//*****************************************************************************************//
//---消息弹出函数--//
function MESSAGE(id,title,message,target,action){  
	this.id = id;  
	this.title = title;  
	this.message = message;  
	this.target = target;  
	this.action = action;  
	this.width = 264;
	this.height = 162;  
	this.timeout = 500;  
	this.speed = 10; 
	this.step = 1; 
	this.right = screen.width - 16;  
	this.bottom = screen.height - 30; 
	this.left = this.right - this.width; 
	this.top = this.bottom - this.height; 
	this.timer = 0; 
	this.pause = false;
	this.close = false;
	this.autoHide = false;
}  
MESSAGE.prototype.hide = function(){  
 if(this.onunload()){
	var offset = this.height>this.bottom-this.top?this.height:this.bottom-this.top;
	var me = this;
	if(this.timer > 0){
		window.clearInterval(me.timer);}
	var fun = function(){
		if(me.pause == false || me.close){
			var x = me.left;
			var y = 0;
			var width = me.width;
			var height = 0;
			if(me.offset > 0){
				height = me.offset;}
			y = me.bottom - height;
			if(y >= me.bottom){
				window.clearInterval(me.timer);
				me.Pop.hide();}
			else{
				me.offset = me.offset - me.step;}
				me.Pop.show(x,y,width,height);}}
	this.timer = window.setInterval(fun,this.speed);
 }  
}  
//*************************************************************************************************//
//*消息卸载事件，可以重写//
MESSAGE.prototype.onunload = function(){
    return true;
}
/**//*  
*消息显示方法  
*/  
MESSAGE.prototype.show = function(){  
 var oPopup = window.createPopup(); //IE5.5+    
 this.Pop = oPopup;
 var w = this.width;
 var h = this.height;
 var str = "<div style='background:url(/Themes/Images/Bg/castbg.jpg);width:264px;height:162px; position:relative;'>"
 str += "<div id=\"btSysClose\" style='position:absolute;top:3px;right:8px;background:url(/Themes/Images/Bg/exitbtn.gif);cursor:pointer;width:15px;height:19px;'></div>"
 str += "<div id=\"Title\" style='height:24px;line-height:24px;font-size:12px;color:#FFFFFF;font-weight:bold;text-indent:50px;'>您有新的订单消息</div>"
 str += "<embed src=\"/Themes/Images/Bg/dang.mp3\" autostart=\"true\" loop=\"false\" volume=\"100\" hidden=\"true\"></embed>"
 str += "<div id=\"Content\" style='padding:8px 15px;line-height:20px;color:#005E91;font-size:12px;letter-spacing:1.25;'>" + this.title + "</div>"
 str += "</div>"
 oPopup.document.body.innerHTML = str; 
 this.offset = 0;
 var me = this;  
 oPopup.document.body.onmouseover = function(){me.pause = true;}
 oPopup.document.body.onmouseout = function(){me.pause = false;}
 var fun = function(){
	var x = me.left;
	var y = 0;
	var width = me.width;
	var height = me.height;
	if(me.offset > me.height){
		height = me.height;}
	else{
		height = me.offset;}
	y = me.bottom - me.offset;
	if(y <= me.top){
		me.timeout--;
		if(me.timeout == 0){
			window.clearInterval(me.timer);
			if(me.autoHide){
				me.hide();}}}
	else{
		me.offset = me.offset + me.step;}
	me.Pop.show(x,y,width,height);}
 this.timer = window.setInterval(fun,this.speed);
 var btClose = oPopup.document.getElementById("btSysClose");
 btClose.onclick = function(){
	me.close = true;
	me.hide();}
}  
/**//* 
**设置速度方法 
**/ 
MESSAGE.prototype.speed = function(s){ 
 var t = 20;
 try{
	t = praseInt(s);}
 catch(e){}
 this.speed = t;
} 
/**//* 
**设置步长方法 
**/ 
MESSAGE.prototype.step = function(s){ 
 var t = 1;
 try{
	t = praseInt(s);}
 catch(e){}
 this.step = t; 
} 
MESSAGE.prototype.rect = function(left,right,top,bottom){ 
 try{
	this.left = left!=null?left:this.right-this.width; 
	this.right = right!=null?right:this.left+this.width; 
	this.bottom = bottom!=null?(bottom>screen.height?screen.height:bottom):screen.height; 
	this.top = top!=null?top:this.bottom-this.height;}
 catch(e){}
} 
//*****************************************************************************************//
//--短消息确定相关---//
var Speed = 20;
var ShowSpeed = 10;
var ShowStep = 2;
var ShowFlag = false;
function getmsg(){
 if(window.XMLHttpRequest){
	isIE = false;
	xml = new XMLHttpRequest();	}
 else if(window.ActiveXObject) {
	isIE = true;
	xml = new ActiveXObject("Microsoft.XMLHTTP");}
 xml.onreadystatechange = getMailContent;
 try{
	xml.open("GET","jscript/OrderMsg.asp?nocache=" + Math.random(),true);
	xml.send(null);}
 catch(e){
	}
}
function getMailContent(){
 if(xml.readyState == 4){
	if(xml.status == 200){
		if(xml.responseText != "")
			showMsg();}
	}
}
function showMsg(){
 var MSG2 = new MESSAGE("aa",xml.responseText);
 MSG2.speed = ShowSpeed; 
 MSG2.step = ShowStep; 
 MSG2.show();  
}
setInterval("getmsg()",Speed*1000);