/**
 * @author 汤恒杰 Added 2008.08.21
 * 用户在 被锁定的情况弹出层的相关 js 功能
 */

function G(id){
       return document.getElementById(id);
     }
     
    function GC(t){
       return document.createElement(t);
    }
    
    String.prototype.trim = function(){
              return this.replace(/(^\s*)|(\s*$)/g, '');
    }
    
    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 (G("cover_div")) 
	   {
			G("cover_div").style.display = '';
	   } 
	   else 
	   {
		    var coverDiv = GC('div');
			var db_ = document.body;
			if(!db_)
			{
				document.write("<body></body>");
				db_ = document.body;
			}
		    db_.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 = 1000;
				 
			     if (isIE()) 
				 {
					filter = "Alpha(Opacity=60)";
			     } 
				 else 
				 {
			        opacity = 0.6;
			     }
		    }
	   }
}

function setContentShow(id)
{
    document.getElementById(id).style.display= "block";
	//document.getElementById("ifmCover").style.display= "block";
}

function applyCoverStyle(id)
{
    //1.创建灰景层
    //2. 显示内容层 
    popCoverDiv();
    
    setContentShow(id);
    
    showDivCenter("divContent",220,460);
    
}

function closeTip()
{
	document.getElementById("cover_div").style.display="none";
	document.getElementById("divContent").style.display="none";
	//document.getElementById("ifmCover").style.display="none";
}

function goto5173()
{
    document.location ="http://www.5173.com";
}
function getScreenInfo()
{
    var top = document.documentElement.scrollTop;
    var left = document.documentElement.scrollLeft;
    var height = document.documentElement.clientHeight;
    var width = document.documentElement.clientWidth;
    return {top:top,left:left,height:height,width:width};
}
function showDivCenter(id,hei,wid)
{
    var height = parseInt(hei);
    var width = parseInt(wid);
    var screenInfo = getScreenInfo();
    var obj = document.getElementById(id);
    var leftAdd = (screenInfo.width-width)/2;
    var topAdd = (screenInfo.height-height)/2;
    
    obj.style.display = "block";
    obj.style.position = "absolute";
    obj.style.width = width + "px";
    obj.style.height = height + "px";
    obj.style.top = (screenInfo.top + topAdd) + "px";
    obj.style.left = (screenInfo.left + leftAdd) + "px";
    window.onscroll = function()
    {
       var screenInfo = getScreenInfo();
       obj.style.top = (screenInfo.top + topAdd) + "px";
       obj.style.left = (screenInfo.left + leftAdd) + "px";
    };
}