var popupWinoldonloadHndlr=window.onload, popupWinpopupHgt, popupWinactualHgt, popupWintmrId=-1, popupWinresetTimer;
var popupWintitHgt, popupWincntDelta, popupWintmrHide=-1, popupWinhideAfter=-1, popupWinhideAlpha, popupWinhasFilters=true;
var popupWinnWin, popupWinshowBy=null, popupWindxTimer=-1, popupWinpopupBottom, popupWinoldLeft;
var popupWinnText,popupWinnMsg,popupWinnTitle,popupWinbChangeTexts=false;

//var popupWinoldonscrollHndr=window.onscroll;
//window.onscroll=popupWinespopup_winScroll;

//function popupWinespopup_winScroll()
//{
//  if (popupWinoldonscrollHndr!=null) popupWinoldonscrollHndr();
//  if (popupWintmrHide!=-1)
//  {
//    el=document.getElementById('popupWin');
//    el.style.display='none'; el.style.display='block';
//  }
//}

function popupWinespopup_ShowPopup(show)
{
  if (popupWindxTimer!=-1) { el.filters.blendTrans.stop(); }

  if ((popupWintmrHide!=-1) && ((show!=null) && (show==popupWinshowBy)))
  {
    clearInterval(popupWintmrHide);
    popupWintmrHide=setInterval(popupWinespopup_tmrHideTimer,popupWinhideAfter);
    return;
  }
  if (popupWintmrId!=-1) return;
  popupWinshowBy=show;

  elCnt=document.getElementById('popupWin_content')
  elTit=document.getElementById('popupWin_header');
  el=document.getElementById('popupWin');
  el.style.left=popupWinoldLeft;
  el.style.top='';
  el.style.filter='';

  if (popupWintmrHide!=-1) clearInterval(popupWintmrHide); popupWintmrHide=-1;

  document.getElementById('popupWin_header').style.display='none';
  document.getElementById('popupWin_content').style.display='none';

  if (navigator.userAgent.indexOf('Opera')!=-1)
    el.style.bottom=(document.body.scrollHeight*1-document.body.scrollTop*1
                    -document.body.offsetHeight*1+1*popupWinpopupBottom)+'px';
  
  if (popupWinbChangeTexts)
  {
    popupWinbChangeTexts=false;
    document.getElementById('popupWinaCnt').innerHTML=popupWinnMsg;
    document.getElementById('popupWintitleEl').innerHTML=popupWinnTitle;
  }

  popupWinactualHgt=0; el.style.height=popupWinactualHgt+'px';
  el.style.visibility='';
  if (!popupWinresetTimer) el.style.display='';
  popupWintmrId=setInterval(popupWinespopup_tmrTimer,(popupWinresetTimer?1000:20));
}

function popupWinespopup_winLoad()
{
	//edit by kevin
	//return;
	/*
    if (getCookie("popup") == "false")
    {
        return;
    }
	*/
    
  if (popupWinoldonloadHndlr!=null) popupWinoldonloadHndlr();

  elCnt=document.getElementById('popupWin_content')
  elTit=document.getElementById('popupWin_header');
  el=document.getElementById('popupWin');
			popupWinoldLeft=el.style.left;
  popupWinpopupBottom=el.style.bottom.substr(0,el.style.bottom.length-2);
  
  popupWintitHgt=elTit.style.height.substr(0,elTit.style.height.length-2);
  popupWinpopupHgt=el.style.height;
  popupWinpopupHgt=popupWinpopupHgt.substr(0,popupWinpopupHgt.length-2); popupWinactualHgt=0;
  popupWincntDelta=popupWinpopupHgt-(elCnt.style.height.substr(0,elCnt.style.height.length-2));

  if (true)
  {
    popupWinresetTimer=true;
    popupWinespopup_ShowPopup(null);
  }  
}

function popupWinespopup_tmrTimer()
{
  el=document.getElementById('popupWin');
  if (popupWinresetTimer)
  {
    el.style.display='';
    clearInterval(popupWintmrId); popupWinresetTimer=false;
    popupWintmrId=setInterval(popupWinespopup_tmrTimer,20);
  }
  popupWinactualHgt+=5;
  if (popupWinactualHgt>=popupWinpopupHgt)
  {
    popupWinactualHgt=popupWinpopupHgt; clearInterval(popupWintmrId); popupWintmrId=-1;
    document.getElementById('popupWin_content').style.display='';
    if (popupWinhideAfter!=-1) popupWintmrHide=setInterval(popupWinespopup_tmrHideTimer,popupWinhideAfter);
  }
  if (popupWintitHgt<popupWinactualHgt-6)
    document.getElementById('popupWin_header').style.display='';
  if ((popupWinactualHgt-popupWincntDelta)>0)
  {
    elCnt=document.getElementById('popupWin_content')
    elCnt.style.display='';
    elCnt.style.height=(popupWinactualHgt-popupWincntDelta)+'px';
  }
  el.style.height=popupWinactualHgt+'px';
}

function popupWinespopup_tmrHideTimer()
{
  clearInterval(popupWintmrHide); popupWintmrHide=-1;
  el=document.getElementById('popupWin');
  if (popupWinhasFilters)
  {
    backCnt=document.getElementById('popupWin_content').innerHTML;
    backTit=document.getElementById('popupWin_header').innerHTML;
    document.getElementById('popupWin_content').innerHTML='';
    document.getElementById('popupWin_header').innerHTML='';
    el.style.filter='blendTrans(duration=1)';
    el.filters.blendTrans.apply();
    el.style.visibility='hidden';
    el.filters.blendTrans.play();
    document.getElementById('popupWin_content').innerHTML=backCnt;
    document.getElementById('popupWin_header').innerHTML=backTit;
    
    popupWindxTimer=setInterval(popupWinespopup_dxTimer,1000);
  }
  else el.style.visibility='hidden';
}

function popupWinespopup_dxTimer()
{
  clearInterval(popupWindxTimer); popupWindxTimer=-1;
}

function popupWinespopup_Close()
{
 // if(confirm('确认关闭吗?')==false)
 // {
 //          return ;
 //  }
  if (popupWintmrId==-1)
  {
    el=document.getElementById('popupWin');
    el.style.filter='';
    el.style.display='none';
    if (popupWintmrHide!=-1) clearInterval(popupWintmrHide); popupWintmrHide=-1;
    
    //setCookie("popup", "false", 1);
  }
  
//    var xmlhttp = GetXMLHttp();
//        
//    xmlhttp.open("GET", "/Ajax_ClosePopupWin.aspx");
//    xmlhttp.onreadystatechange=function() 
//    {
//        if (xmlhttp.readyState==4)
//        {
//            // DEBUG: alert(xmlhttp.responseText);
//            div.innerHTML = xmlhttp.responseText;
//        }
//        else
//        {
//            div.innerHTML = "<li>可能由于网络原因，加载失败，如果您多次看到本信息，请与网站管理员联系！</li>";
//        }
//    }
//    xmlhttp.send(null)
}

var popupWinmousemoveBack,popupWinmouseupBack;
var popupWinofsX,popupWinofsY;
function popupWinespopup_DragDrop(e)
{
  popupWinmousemoveBack=document.body.onmousemove;
  popupWinmouseupBack=document.body.onmouseup;
  ox=(e.offsetX==null)?e.layerX:e.offsetX;
  oy=(e.offsetY==null)?e.layerY:e.offsetY;
  popupWinofsX=ox; popupWinofsY=oy;

  document.body.onmousemove=popupWinespopup_DragDropMove;
  document.body.onmouseup=popupWinespopup_DragDropStop;
  if (popupWintmrHide!=-1) clearInterval(popupWintmrHide);
}

function popupWinespopup_DragDropMove(e)
{
  el=document.getElementById('popupWin');          
  if (e==null&&event!=null)
  {
    el.style.left=(event.clientX*1+document.body.scrollLeft-popupWinofsX)+'px';
    el.style.top=(event.clientY*1+document.body.scrollTop-popupWinofsY)+'px';
    event.cancelBubble=true;
  }
  else
  {
    el.style.left=(e.pageX*1-popupWinofsX)+'px';
    el.style.top=(e.pageY*1-popupWinofsY)+'px';
    e.cancelBubble=true;
  }
  if ((event.button&1)==0) popupWinespopup_DragDropStop();
}

function popupWinespopup_DragDropStop()
{
  document.body.onmousemove=popupWinmousemoveBack;
  document.body.onmouseup=popupWinmouseupBack;
}


document.write('<div id="popupWin"');
document.write('    style="display:none; background:#E0E9F8; border-right:1px solid #455690; border-bottom:1px solid #455690; border-left:1px solid #B9C9EF; border-top:1px solid #B9C9EF; position:absolute; z-index:9999;  width:310px; height:210px; right:3px; bottom:3px;" ');
document.write('    onselectstart="return false;" ');
document.write('    onmousedown="return popupWinespopup_DragDrop(event);" >');
    
document.write('        <div id="popupWin_header" ');
document.write('            style="cursor:default; display:none; position:absolute; left:2px; width:306px; top:2px; height:14px; filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,');
document.write('            StartColorStr=\'#FFE0E9F8\', EndColorStr=\'#FFFFFFFF\');font:12px arial,sans-serif; color:#1F336B; text-decoration:none;">');

document.write('            <span id="popupWintitleEl"></span>');

document.write('            <span ');
document.write('            style="position:absolute; right:0px; top:0px; cursor:pointer; color:#728EB8; font:bold 12px arial,sans-serif; position:absolute; right:3px;"');
document.write('            onclick="popupWinespopup_Close()"');
document.write('            onmousedown="event.cancelBubble=true;"');
document.write('            onmouseover="style.color=\'#455690\';"');
document.write('            onmouseout="style.color=\'#728EB8\';">X</span>');
document.write('        </div>');
 
document.write('        <div id="popupWin_content" onmousedown="event.cancelBubble=true;" style="display:none; border-left:1px solid #728EB8; border-top:1px solid #728EB8;');
document.write('        border-bottom:1px solid #B9C9EF; border-right:1px solid #B9C9EF;');
document.write('        background:#E0E9F8; padding:2px; overflow:hidden; text-align:center;');
document.write('        filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,');
document.write('        StartColorStr=\'#FFE0E9F8\', EndColorStr=\'#FFFFFFFF\');position:absolute; left:2px; width:300px; top:20px; height:182px;">');

document.write('<iframe src="/notice.htm"  frameborder="no" width="300" height="182" border="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>');
//document.write('            <a style="font:12px arial,sans-serif; color:#1F336B; text-decoration:none;" onmouseover="style.textDecoration=\'underline\';"');
//document.write('            onmouseout="style.textDecoration=\'none\';"');
//document.write('            href="javascript:popupWinespopup_ShowWindow();" id="popupWinaCnt">装机软1件大全</a>');

document.write('       </div>');
document.write('</div>');

function Scrolls() 
{    
    var posX,posY;
    if (window.innerHeight) {  
        posX = window.pageXOffset;  
        posY = window.pageYOffset;  
    }  
    else if (document.documentElement && document.documentElement.scrollTop) {  
        posX = document.documentElement.scrollLeft;  
        posY = document.documentElement.scrollTop;  
    }  
    else if (document.body) {  
        posX = document.body.scrollLeft;  
        posY = document.body.scrollTop;  
    }  

    document.getElementById("popupWin").style.top= posY+document.documentElement.clientHeight-214; 
}

window.onscroll=Scrolls; 
window.onresize=Scrolls;

function GetXMLHttp()
{
    var xmlhttp=false;
    
    try 
    {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } 
    catch (e) 
    {
        try 
        {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (E)
        {
            xmlhttp = false;
        }
    }

    // Mozilla then?
    if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
       xmlhttp = new XMLHttpRequest();
    }
    
    return xmlhttp;
}

function getCookie(c_name)
{
    if (document.cookie.length > 0)
    {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1)
        {
            c_start = c_start + c_name.length + 1;
            c_end   = document.cookie.indexOf(";",c_start);
            if (c_end == -1)
            {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start,c_end));
        }
    }
    return null;
}

function setCookie(c_name,value,expiredays)
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    // 使设置的有效时间正确。增加toGMTString()
    document.cookie = c_name + "=" +escape(value) + ((expiredays == null) ? "" : (";expires=" + exdate.toGMTString()));
}