//参数设置：
var MoveSpeed = 5;	//移动速度，1－10，越大越快
var isPoPupWin = 0;	//新消息是否弹出窗口阅读(1是,0否)，否则使用动画浮动提示
var MsgLoadPT = 20;	//XML刷新时间10－60（建议20秒）
var MsgDisplayT = 15;	//提示窗弹出后,??秒后消失
var MsgLoadPT2= 3;	//用户手动关闭后,过??分钟再提醒
var MsgVersion = '7.1sp1';	//论坛版本(6或7)
var MsgActiveT=60;	//发呆??分钟为有效提醒
var MsgBodyStyle = "class=tablebody1"	//消息体样式
//－－－END－－
var stdmsg_body='　您有 <span style="color:red;font-weight:800">msg_num</span> 封新短消息<br><br>';
stdmsg_body+='<div align=center><a title=点击查看 href=javascript:{openScript("messanger.asp?action=read&id=msg_id&sender=msg_sender",500,400);stdmsg_Close()} style="color:red">';
stdmsg_body+='查看<span style="color:blue">msg_sender</span>给您的短信</a></div>';
with(document){
	write('<form id="std_msgspan"><table style="display:none" cellpadding=0 cellspacing=1 class=tableborder5 border=0 style="width:180"><tr height=22><th nowrap align=left>');
	write('短消息提示<img src=null.gif width=65 height=0><span title="关闭!'+MsgLoadPT2+' 分钟后再次提醒您!" style="cursor:hand" onclick=stdmsg_Close(1) style="font-family:Wingdings" style="font-size:14px">x</span>');
	write('</th></tr><tr><td '+MsgBodyStyle+' height=90 id=std_msgbody>消息体</td></tr></table></form><bgsound id="stdmsg_bgsound" loop=0>');
}
var std_msgCount=0,std_msgspanT,std_msgspanL,std_msgspanH,std_msgspanW,std_msgdocH,std_msgdocW;
var std_msgTimer,std_msgspanTop,std_msg_xml,std_msgurl=(""+document.location).toLowerCase();
var std_msg_ST=new Date();std_msg_tt=MsgDisplayT,std_msg_obj=document.getElementById("std_msgspan");
with(std_msg_obj){
	style.display="none";
	style.height="120px";
	style.position="absolute";
	onmouseover=new Function("std_msgCount=0;");
	style.filter="DropShadow(Color=#999999,OffX=1,OffY=2,Positive=1) alpha(opacity=85)"
}
function stdmsg_Start(){
	try{
	std_msg_tt=MsgLoadPT;
	std_msg_obj.style.display="block";
	std_msg_obj.childNodes(0).style.display="block";
	std_msgspanT = parseInt(std_msg_obj.style.top);
	std_msgspanL = parseInt(std_msg_obj.style.left);
	std_msgspanH = parseInt(std_msg_obj.offsetHeight);
	std_msgspanW = parseInt(std_msg_obj.offsetWidth);
	std_msgdocH = WebForm_GetClentY();
	std_msgdocW = WebForm_GetClentX();
	dhtscrollLeft=WebForm_GetScrollX();
	dhtscrollTop=WebForm_GetScrollY();
	std_msg_obj.style.top = parseInt(dhtscrollTop) + std_msgdocH;
	std_msg_obj.style.left = parseInt(dhtscrollLeft) + std_msgdocW - std_msgspanW-6
	stdmsg_Move();
	}
	catch(e){}
}
function stdmsg_Resize(p1){
	std_msgCount+=1;
	if(std_msgCount>MsgDisplayT*10){stdmsg_Close();return;}
	if(std_msg_obj.style.display=="none")return;
	try{
	std_msgspanH = parseInt(std_msg_obj.offsetHeight);
	std_msgspanW = parseInt(std_msg_obj.offsetWidth);
	std_msgdocH = WebForm_GetClentY();
	std_msgdocW = WebForm_GetClentX();
	dhtscrollLeft=WebForm_GetScrollX();
	dhtscrollTop=WebForm_GetScrollY();
	std_msg_obj.style.top =  std_msgdocH - std_msgspanH + parseInt(dhtscrollTop);
	std_msg_obj.style.left = std_msgdocW - std_msgspanW + parseInt(dhtscrollLeft) - 6;
	window.clearTimeout(std_msgTimer);
	std_msgTimer=setTimeout("stdmsg_Resize()",100);}
	catch(e){}
}
function stdmsg_Move(){
	try{
	std_msgspanH = parseInt(std_msg_obj.offsetHeight);
	std_msgspanW = parseInt(std_msg_obj.offsetWidth);
	std_msgdocH = WebForm_GetClentY();
	std_msgdocW = WebForm_GetClentX();
	dhtscrollLeft=WebForm_GetScrollX();
	dhtscrollTop=WebForm_GetScrollY();
	if(parseInt(std_msg_obj.style.top) <=( std_msgdocH - std_msgspanH + parseInt(dhtscrollTop)))
	{	stdmsg_Resize();
		std_msg_obj.style.top = std_msgspanTop;
		}
	else std_msgTimer=setTimeout("stdmsg_Move()",10);
	std_msgspanTop = parseInt(std_msg_obj.style.top);
	std_msg_obj.style.top = std_msgspanTop - MoveSpeed;
	}
	catch(e){}
}
function stdmsg_Close(p1){
	std_msgCount=0;
	std_msg_obj.style.display='none';
	if(p1==1)std_msg_tt=MsgLoadPT2*60;
    	setTimeout("stdmsg_loadXML()",std_msg_tt*1000);
}
function stdmsg_loadXML(){
	if(std_msg_obj.style.display!="none")return;
	if(((new Date())-std_msg_ST)>MsgActiveT*60*1000)return;
	std_msg_xml = new ActiveXObject("Microsoft.XMLDOM");
    	std_msg_xml.async=true;
    	std_msg_xml.onreadystatechange = msgGetReady;
   	std_msg_xml.load("Std_MSG_LOAD.asp?"+MsgVersion)
}
function WebForm_GetScrollX() 
{
    if (typeof window.pageYOffset != 'undefined') 
    {
        return window.pageXOffset;
    }
    else 
    {
        if (document.documentElement && document.documentElement.scrollLeft) 
        {
            return document.documentElement.scrollLeft;
        }
        else if (document.body) 
        {
            return document.body.scrollLeft;
        }
    }
    return 0;
}
function WebForm_GetScrollY() 
{
    if (typeof window.pageYOffset != 'undefined') 
    {
        return window.pageYOffset;
    }
    else 
    {
        if (document.documentElement && document.documentElement.scrollTop) 
        {
            return document.documentElement.scrollTop;
        }
        else if (document.body) 
        {
            return document.body.scrollTop;
        }
    }
    return 0;
}
function WebForm_GetClentX() 
{
    if (typeof window.pageYOffset != 'undefined') 
    {
        return window.pageXOffset;
    }
    else 
    {
        if (document.documentElement && document.documentElement.clientWidth) 
        {
            return document.documentElement.clientWidth;
        }
        else if (document.body) 
        {
            return document.body.clientWidth;
        }
    }
    return 0;
}
function WebForm_GetClentY() 
{
    if (typeof window.pageYOffset != 'undefined') 
    {
        return window.pageYOffset;
    }
    else 
    {
        if (document.documentElement && document.documentElement.clientHeight) 
        {
            return document.documentElement.clientHeight;
        }
        else if (document.body) 
        {
            return document.body.clientHeight;
        }
    }
    return 0;
}
function msgGetReady(){
	if(std_msg_xml.readyState==4){
    		if(std_msg_xml.parseError.errorCode==0)
    		{	var txt=std_msg_xml.documentElement.selectNodes("sts");
    			var tmpsts=txt(0).text;
    			if(tmpsts=="-1")return;
    			if(tmpsts=="ok"){
				document.getElementById("stdmsg_bgsound").src="skins/default/mail.wav";
				setTimeout(function(){document.getElementById("stdmsg_bgsound").src="";},10000);
    				var tmpnum=std_msg_xml.documentElement.selectNodes("num")(0).text;
    				var tmpid=std_msg_xml.documentElement.selectNodes("id")(0).text;
    				var tmpsender=std_msg_xml.documentElement.selectNodes("sender")(0).text;
    				if(isPoPupWin){
    					openScript("messanger.asp?action=read&id="+tmpid+"&sender="+tmpsender,500,400);
    				}
    				else
    				{
    				var tmpstr=stdmsg_body.replace(/msg_num/i,tmpnum);
    				tmpstr=tmpstr.replace(/msg_id/i,tmpid);
    				tmpstr=tmpstr.replace(/msg_sender/ig,tmpsender);
				document.getElementById("std_msgbody").innerHTML=tmpstr;
				stdmsg_Start();
    				}
    			}
    			else setTimeout("stdmsg_loadXML()",std_msg_tt*1000);
    		}
    		delete(std_msg_xml);
    	}
}
if(std_msgurl.indexOf("login.asp?action=chk")>0||std_msgurl.indexOf("messanger.asp")>0&&(std_msgurl.indexOf("action=send")>0||std_msgurl.indexOf("action=delet")>0||std_msgurl.indexOf("action=new")>0||std_msgurl.indexOf("action=fw")>0||std_msgurl.indexOf("action=read")>0||std_msgurl.indexOf("action=outread")>0)){}
else {setTimeout("stdmsg_loadXML()",1000);}