﻿function openScript(url,width,height){var Win=window.open(url,'openScript','width='+width+',height='+height+',resizable=1,scrollbars=yes,menubar=no,status=no');}
function isk(ids){return typeof ids=='undefined'?true:false;}
function $(d){return document.getElementById(d);}
function ietruebody(){return(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;}
function jst_close(){$("dialogBox").style.display='none';}
function openWindow(_sUrl,sTitle,width,height,lx){if(!_sUrl)return;if(isk(sTitle))sTitle="即时通，即时交流沟通！";if(isk(width))width=530;if(isk(height))height=400;if(isk(lx))lx=0;var oEdit=new dialog(sTitle,width,height);oEdit.init();oEdit.open(_sUrl,lx);}
function dialog(sTitle,width,height){var sBox='<div onMouseDown="new dialog().moveStart(event)" style="position:relative;height:28px;line-height:28px;padding:0 10px;color:#fff;cursor:move;font-size:12px;font-weight:bold;background:#333 url(/jst/image/skins.gif) repeat-x;" ><span style="left:0; top:0; width:10px; height:28px; position:absolute; background:url(/jst/image/skins.gif) 0px 56px;"></span><img src="/jst/image/jst_close.gif" alt="关闭" onclick="new dialog().reset();"/ style="float:right;margin-top:5px;cursor:pointer;">'+sTitle+'<span style="right:0;top:0; width:10px;height:28px; position:absolute; background:url(/jst/image/skins.gif) 0px 28px;"></span></div><div id="dialogBody" style="height:'+height+'px;border:2px solid #333;border-top:0;">loading...</div>';this.reset=function(){$('dialogBox').style.display='none';}
this.init=function(){$('dialogBox')?$('dialogBox').parentNode.removeChild($('dialogBox')):function(){};var oDiv=document.createElement("div");oDiv.id="dialogBox";oDiv.style.position="absolute";oDiv.style.width=width+"px";oDiv.style.background="#fff";oDiv.style.zIndex=999;oDiv.innerHTML=sBox;document.body.appendChild(oDiv);this.middle('dialogBox');}
this.open=function(_sUrl,lx){switch(lx)
{case 3:$("dialogBody").innerHTML="<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width=100% height=100%><PARAM NAME=SRC VALUE=\""+_sUrl+"\"><PARAM NAME=CONSOLE VALUE=\""+_sUrl+"\"><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=1></OBJECT>";break;case 2:case 1:$("dialogBody").innerHTML="<embed src=\""+_sUrl+"\" width='100%' height='100%' border='0'></embed>";break;case 0:$("dialogBody").innerHTML="<iframe width='100%' id='Jst_Iframe' height='100%' src='"+_sUrl+"'    frameborder='0' scrolling='no'></iframe>";break;}}
this.moveStart=function(event){var oObj=$("dialogBox");oObj.onmousemove=mousemove;oObj.onmouseup=mouseup;oObj.setCapture?oObj.setCapture():function(){};var oEvent=window.event?window.event:event;var dragData={x:oEvent.clientX,y:oEvent.clientY};function mousemove(){oObj.style.left=oEvent.clientX-dragData["x"]+parseInt(oObj.style.left)+"px";oObj.style.top=oEvent.clientY-dragData["y"]+parseInt(oObj.style.top)+"px";dragData={x:oEvent.clientX,y:oEvent.clientY};}
function mouseup(){oObj.onmousemove=null;oObj.onmouseup=null;oObj.releaseCapture?oObj.releaseCapture():function(){};}}
this.middle=function(_sId){$(_sId).style.left=parseInt((ietruebody().clientWidth/2)-($(_sId).offsetWidth/2))+"px";var sClientHeight=ietruebody().clientHeight;var sScrollTop=ietruebody().scrollTop;var sTop=(sClientHeight/2+sScrollTop)-($(_sId).offsetHeight/2);$(_sId).style.top=parseInt(sTop>0?sTop:(sClientHeight/2+sScrollTop)-($(_sId).offsetHeight/2))+"px";}}
function XmlHttp(){var xml=false;if(window.XMLHttpRequest){xml=new XMLHttpRequest();}
else if(window.ActiveXObject){xml=new ActiveXObject("Microsoft.XMLHTTP");}
return xml;}
function getjst(dxs,t,sy){var xml=XmlHttp();xml.open("GET","/jst/count.aspx",true);xml.onreadystatechange=function(){if(xml.readyState==4&&xml.status==200){var res=parseInt(xml.responseText);if($('Jst_Count')!=null)
$('Jst_Count').innerHTML=res;if(t>0){if(res!=0&&res>dxs){getMsg(res,sy);setTimeout("getjst("+res+","+t+","+sy+")",5000);}
else if(res>0){setTimeout("getjst("+res+","+t+","+sy+")",5000);}
else{if($('ShuzirenCms_Jst')!=null)
$('ShuzirenCms_Jst').style.visibility='hidden';setTimeout("getjst(0,"+t+","+sy+")",5000);}}
else{if(res!=0)
getMsg(res,sy);}}}
xml.send(null);}
function xsjst(dxs,sy){$('ShuzirenCms_Jst')?$('ShuzirenCms_Jst').parentNode.removeChild($('ShuzirenCms_Jst')):function(){};var o=document.createElement("div");o.id="ShuzirenCms_Jst";o.style.position="absolute";o.style.width="165px";o.style.height="106px";o.style.background="#c9d3f3";o.style.zIndex=998;o.innerHTML="<div style='border: 1px solid #a6b4cf;background-image: url(/jst/image/jst_001.gif);height:24px;color:#1f336b;font-size:9pt;'><img src='/jst/image/jst_000.gif' height='16'>即时通提示精灵&nbsp;&nbsp;&nbsp;&nbsp;<img src='/jst/image/jst_Close.jpg' width='13' height='13' hspace='3' style='cursor:pointer' title='关闭' onclick='closeDiv()'/></div><div style='height:80px;BACKGROUND-IMAGE:url(/jst/image/jst_002.jpg);border: 1px solid #a6b4cf;border-top:0;font-size:9pt;text-align: center;'><br />您有 <b>"+dxs+"</b> 条未读短信<br/><u style='FONT-WEIGHT:bold;COLOR:red;cursor:pointer' onclick=openWindow('/jst/duanxin.aspx');closeDiv()>&gt;&gt;查看即时通&lt;&lt;</u></div>";if(sy==1){o.innerHTML+="<bgsound src='/jst/image/sy.wav'>";}
document.body.appendChild(o);}
var objTimer;function getMsg(dxs,sy){xsjst(dxs,sy);$('ShuzirenCms_Jst').style.top=parseInt(ietruebody().scrollTop,10)+ietruebody().clientHeight+10+'px';$('ShuzirenCms_Jst').style.left=parseInt(ietruebody().scrollLeft,10)+ietruebody().clientWidth-parseInt($('ShuzirenCms_Jst').offsetWidth,10)+'px';objTimer=window.setInterval('moveDiv()',10);}
function moveDiv(){if(parseInt($('ShuzirenCms_Jst').style.top,10)<=(ietruebody().clientHeight-parseInt($('ShuzirenCms_Jst').offsetHeight,10)+parseInt(ietruebody().scrollTop,10))){window.clearInterval(objTimer)}
$('ShuzirenCms_Jst').style.top=(parseInt($('ShuzirenCms_Jst').style.top,10)-1)+'px'}
function closeDiv(){$('ShuzirenCms_Jst').style.visibility='hidden';if(objTimer)window.clearInterval(objTimer)}