var autotime,Timeout;
var color = new Array("red","Black");
var x=0;
var b=0;
var xmlHttp;
function CreateAjax()
{
	if (window.ActiveXObject)
	{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		xmlHttp = new XMLHttpRequest();
	}	
}
function DoAjax(Url,InnerId)
{
	if (!xmlHttp)
	{
		CreateAjax();
	}	
	if(xmlHttp)
	{
	xmlHttp.open('GET',Url,true);
	xmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	//var SendData = '';
	xmlHttp.send(null);	
	window.setTimeout("DoAjax('"+(Url+"&rad1="+Math.random())+"','"+InnerId+"')",60000);	
	xmlHttp.onreadystatechange=function()
	{		
		if(xmlHttp.readyState==4)
		{			
			if(xmlHttp.status==200)
			{				
				ReturnAarray=(xmlHttp.responseText).split("$");
				if (ReturnAarray[0] != "0")
				{
					document.getElementById(InnerId).innerHTML ="<a href='/message/SystemMessage.asp?NT="+ReturnAarray[1]+"'   class='lhei12'><span id='lxx'>消息("+ReturnAarray[0]+")</span></a>" ;
					if (b==0)
					{
						document.getElementById("musiciframe").src="/UserMessageMusic.asp";
						changecolor();					
					}
					b=1;					
				}
				else
				{
					document.getElementById("musiciframe").src="";
					window.clearTimeout(Timeout);
				}
			}
			else
			{
				//document.getElementById(InnerId).innerHTML="<font class='red'>出错："+xmlHttp.statusText+"</font>";
				alert(xmlHttp.statusText);
			}
		}
		else
		{
			//document.getElementById(InnerId).innerHTML="<font class='red'>正在提交数据...</font>";			
		}
	}
	}
	else
	{
	//document.getElementById(InnerId).innerHTML="<font class='red'>抱歉，您的浏览器不支持XMLHttpRequest，请使用IE6以上版本！</font>";
	alert("抱歉，您的浏览器不支持XMLHttpRequest，请使用IE6以上版本！");
	}
}
function changecolor()
{
	document.getElementById("lxx").style.color=color[x];
	(x < color.length-1) ? x++ : x = 0;
	if (x==0)
	{
		window.document.title="◤您有新短消息,请注意查收!◥"
	}
	else
	{
		window.document.title="◤　　　　　　　　　　　　◥";	
	}
	Timeout=window.setTimeout("changecolor()",1000);
}