﻿
//************************************************************************************************************************************************************
 //判断浏览器类型
 function detectBrower()
 { 
    var sUserAgent = navigator.userAgent; 
    var isOpera = sUserAgent.indexOf("Opera") > -1;
    if(isOpera) return "Opera";
    var isKHTML = sUserAgent.indexOf("KHTML") > -1 || sUserAgent.indexOf("Konqueror") > -1 || sUserAgent.indexOf("AppleWebKit") > -1;
    var isSafari = sUserAgent.indexOf("AppleWebKit") > -1 && isKHTML;
    var isKonq = sUserAgent.indexOf("Konqueror") > -1 && isKHTML;
    if(isSafari) return "Safari";
    if(isKonq) return "Konqueror";
    var isIE = sUserAgent.indexOf("compatible") > -1 && sUserAgent.indexOf("MSIE") > -1 && !isOpera;
    if(isIE) return "IE";
    var isMoz = sUserAgent.indexOf("Gecko") > -1 && !isKHTML;
    if(isMoz) return "Mozilla";
    return "None";
}
//上下弹出
function TToF(MsgHtml,state,DivName,FrameName)
{
    var h1 = document.documentElement.clientWidth;
    var h2 = document.documentElement.clientHeight;
    
	
	var backdiv=document.getElementById(DivName);
    var cwidth=h1;//document.body.clientWidth;
	var cheight=h2//document.body.clientHeight;
	

	
	backdiv.style.visibility="visible";
	backdiv.style.top=0;
	backdiv.style.left=0;
	backdiv.style.width=h1//document.body.scrollWidth;
	backdiv.style.height=h2;//document.body.scrollHeight;

}
function TTot(MsgHtml,state,DivName,FrameName,left)
{
    var h1 = document.documentElement.clientWidth;
    var h2 = document.documentElement.clientHeight;
    
	
	var backdiv=document.getElementById(DivName);
    var cwidth=h1;//document.body.clientWidth;
	var cheight=h2//document.body.clientHeight;
	
	
	
	backdiv.style.visibility="visible";
	
	
	
	backdiv.style.top=(screen.availHeight-330)/2;
	backdiv.style.left=(screen.availWidth-eval(left))/2;
	
	var obj1=document.frames(FrameName);
	
	obj1.cwidth=h1;
	obj1.cheight=h2;
	//obj1.TopToFoot(MsgHtml,state);
	obj1.focus();
	document.body.style.overflow='hidden';
	
}
//关闭遮挡层
function DivHiddlen(DivName)
{
	var backdiv=document.getElementById(DivName);
	backdiv.style.visibility="hidden";
}
//返回指定ID的对象
function GetObject(strName)
{
	return document.getElementById(strName);
}



///
///
///
///
///
//弹出层最新修改 2008/5/5
//********************************************************************************************************************************************************
  var docEle = function() {
  return document.getElementById(arguments[0]) || false;
 }
 
 //描述 新的弹出层方法，适应与狐狸和IE
 //作者 田建
 //参数 
 //_id 新建层的id 现在无用 以防日后扩展
 //frameWidth 打开窗体的宽度 需开发自行调整 也就是Iframe的大小
 //frmaeHeight ....
 //top 窗体的上下间距 判断窗口是否居中有用，具体大小开发者自行调整
 //left窗体的左右宽度.....
 //iurl 要打开的iframe地址 可以穿参数 形如"aa.aspx?id=1234&name=裸哥"
function openNewDiv(_id,frameWidth,frameHeight,top,left,iurl) 
{
  var m = "mask";
  if (docEle(_id)) document.removeChild(docEle(_id));
  if (docEle(m)) document.removeChild(docEle(m));
  // 新激活图层
  var newDiv = document.createElement("div");
  newDiv.id = _id;
  newDiv.style.position = "absolute";
  newDiv.style.zIndex = "9999";
  newDiv.style.width = "0px";
  newDiv.style.height = "0px";
  newDiv.style.top = (screen.availHeight-parseInt(top))/2+"px";//300
  newDiv.style.left =(screen.availWidth-parseInt(left))/2+"px"; //屏幕居中
  newDiv.style.background = "#ffffff";
  
  newDiv.style.padding = "0px";
  newDiv.innerHTML = "<iframe src="+iurl+" width="+frameWidth+" height="+frameHeight+" scrolling='no' frameborder='0'>";
  document.body.appendChild(newDiv);
  
  
  // mask图层
  var newMask = document.createElement("div");
  newMask.id = m;
  newMask.style.position = "absolute";
  newMask.style.zIndex = "9998";
//  if(document.documentElement.clientWidth == document.documentElement.scrollWidth)
//  {
//    newMask.style.width = document.documentElement.clientWidth+"px";  
//  }
//  else
//  {
//    newMask.style.width=(document.documentElement.clientWidth+(document.documentElement.scrollWidth -document.documentElement.clientWidth))+ "px" 
//  }
  if(document.documentElement.scrollHeight>document.documentElement.clientHeight)
  {
    newMask.style.height=(document.documentElement.clientHeight+(document.documentElement.scrollHeight -document.documentElement.clientHeight))+ "px"
  }
  else
  {
    newMask.style.height = document.documentElement.clientHeight+"px";
  }

  if(document.all)
  {
   //IE代码
    newMask.style.width = (screen.width - 20 ) + "px";
  }
  else
  {
   //其他
    newMask.style.width = (screen.width - 16 ) + "px";
  }
  

  newMask.style.top = "0px";
  newMask.style.left = "0px";
  newMask.style.background = "#000";
  
  if(navigator.appName=="Netscape")
  {
    newMask.style.filter = "alpha(opacity=40)";
    newMask.style.opacity = "0.40";
  }
  else
  {
    newMask.style.filter = "alpha(opacity=40)";
    newMask.style.opacity = "0.40";
  }
  document.body.appendChild(newMask);
 }
 //关闭层
  function closeDiv()
  {
    document.body.removeChild(docEle("newDiv"));
    document.body.removeChild(docEle("mask"));
  }
 function getInfo()
 {
    
    var s = "";
    s += " 网页可见区域宽："+ document.body.clientWidth;
    s += " 网页可见区域高："+ document.body.clientHeight;
    s += " 网页可见区域宽："+ document.body.offsetWidth + " (包括边线和滚动条的宽)";
    s += " 网页可见区域高："+ document.body.offsetHeight + " (包括边线的宽)";
    s += " 网页正文全文宽："+ document.body.scrollWidth;
    s += " 网页正文全文高："+ document.body.scrollHeight;
    s += " 网页被卷去的高(ff)："+ document.body.scrollTop;
    s += " 网页被卷去的高(ie)："+ document.documentElement.scrollTop;
    s += " 网页被卷去的左："+ document.body.scrollLeft;
    s += " 网页正文部分上："+ window.screenTop;
    s += " 网页正文部分左："+ window.screenLeft;
    s += " 屏幕分辨率的高："+ window.screen.height;
    s += " 屏幕分辨率的宽："+ window.screen.width;
    s += " 屏幕可用工作区高度："+ window.screen.availHeight;
    s += " 屏幕可用工作区宽度："+ window.screen.availWidth;
    s += " 你的屏幕设置是 "+ window.screen.colorDepth +" 位彩色";
    s += " 你的屏幕设置 "+ window.screen.deviceXDPI +" 像素/英寸";
    alert (s);
 }
 
    function OpenComment(obj)
    {   
        var pid=obj.id;
       if(navigator.appName=="Netscape")
        {
            openNewDiv('newDiv',"500px","315px","200","260",'newcomment.aspx?playid='+pid); 
        }
        else
        {
            openNewDiv('newDiv',"500px","328px","200","260",'newcomment.aspx?playid='+pid) ;
        }
    }


    function Openregister()
    {   
       if(navigator.appName=="Netscape")
        {
            openNewDiv('newDiv',"468px","300px","200","260",'register.aspx'); 
        }
        else
        {
            openNewDiv('newDiv',"468px","300px","200","260",'register.aspx') ;
        }
    }
    
        function Openregister2()
    {   
       if(navigator.appName=="Netscape")
        {
            openNewDiv('newDiv',"400px","300px","200","260",'login.aspx'); 
        }
        else
        {
            openNewDiv('newDiv',"400px","300px","200","260",'login.aspx') ;
        }
    }