var W = screen.width;//取得屏幕分辨率宽度
var H = screen.height;//取得屏幕分辨率高度
var imgurl ="";

function M(id){
return document.getElementById(id);//用M()方法代替document.getElementById(id)
}
function MC(t){
return document.createElement(t);//用MC()方法代替document.createElement(t)
};

//判断浏览器是否为IE
function isIE(){
   return (document.all && window.ActiveXObject && !window.opera) ? true : false;
}
//取得页面的高宽
function getBodySize(){
var bodySize = [];
with(document.documentElement) {
bodySize[0] = (scrollWidth>clientWidth)?scrollWidth:clientWidth;//如果滚动条的宽度大于页面的宽度，取得滚动条的宽度，否则取页面宽度
bodySize[1] = (scrollHeight>clientHeight)?scrollHeight:clientHeight;//如果滚动条的高度大于页面的高度，取得滚动条的高度，否则取高度
}
return bodySize;
}
//创建遮盖层
function popCoverDiv(){
if (M("cover_div")) {
//如果存在遮盖层，则让其显示
M("cover_div").style.display = 'block';
} else {
//否则创建遮盖层
var coverDiv = MC('div');
document.body.appendChild(coverDiv);
coverDiv.id = 'cover_div';
with(coverDiv.style) {
    position = 'absolute';
    background = '#CCCCCC';
    left = '0px';
    top = '0px';
    var bodySize = getBodySize();
    width = bodySize[0] + 'px'
    height = bodySize[1] + 'px';
    zIndex = 0;
    if (isIE()) {
   filter = "Alpha(Opacity=60)";//IE逆境
    } else {
   opacity = 0.6;
    }
}
}
}




//让登陆层显示为块
function showLogin()
{
var login=M("login");
       login.style.display = "block";
}

//设置DIV层的样式
function change(tops,lefts){
   var login = M("login");
   login.style.position = "absolute";
   login.style.border = "1px solid #cccccc";
   login.style.background ="#cccccc";
   var i=0;
   var bodySize = getBodySize();
   login.style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-tops)/2)+"px";
   login.style.left=(document.documentElement.scrollLeft+(document.documentElement.clientWidth-lefts)/2)+"px";
   
//   popChange(i);
}
//让DIV层大小循环增大
//function popChange(i){
//   var login = M("login");
//   var bodySize = getBodySize();
//   login.style.left=100;
//   login.style.top=document.body.scrollTop+100;
//   if(i<=10){
//          i++;
//         setTimeout("popChange("+i+")",10);//设置超时10毫秒
//   }
//}
//打开DIV层
function open(tops,lefts,imgurl)
{
change(tops,lefts);
showLogin();
popCoverDiv();
void(0);//不进行任何操作,如：<a href="#">aaa</a>
document.images.randimg1.src = imgurl;
if(document.getElementById("drlist"))
{
    document.getElementById("drlist").style.display = "none";
}
if(document.getElementById("UpdatePanel1"))
{
    document.getElementById("UpdatePanel1").style.display = "none";
}
}
//关闭DIV层
function close(){
    M('login').style.display = 'none';
    M("cover_div").style.display = 'none';
void(0);
document.images.randimg1.src = "images/loading.jpg";
if(document.getElementById("drlist"))
{
document.getElementById("drlist").style.display = "block";
}
if(document.getElementById("UpdatePanel1"))
{
document.getElementById("UpdatePanel1").style.display = "block";
}
}

function KeepPos() {
 document.getElementById("login").style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("login").offsetHeight)/2)+"px";
 document.getElementById("login").style.left=(document.documentElement.scrollLeft+(document.documentElement.clientWidth-document.getElementById("login").offsetWidth)/2)+"px";
}

//window.onscroll=KeepPos;
//window.onresize=KeepPos;
//window.onload=KeepPos;


function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6. 
{ 
    var arVersion = navigator.appVersion.split("MSIE") 
    var version = parseFloat(arVersion[1]) 
    if ((version >= 5.5) && (document.body.filters)) 
    { 
       for(var j=0; j<document.images.length; j++) 
       { 
          var img = document.images[j] 
          var imgName = img.src.toUpperCase() 
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
          { 
             var imgID = (img.id) ? "id='" + img.id + "' " : "" 
             var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
             var imgStyle = "display:inline-block;" + img.style.cssText 
             if (img.align == "left") imgStyle = "float:left;" + imgStyle 
             if (img.align == "right") imgStyle = "float:right;" + imgStyle 
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
             var strNewHTML = "<span " + imgID + imgClass + imgTitle 
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
             + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
             img.outerHTML = strNewHTML 
             j = j-1 
          } 
       } 
    }     
} 
window.attachEvent("onload", correctPNG); 
