var http_request=false;
var sSpeedTime="-";
var bUpdateMap=false;
function send_request(url,method)
{
	http_request=false;
	if(window.XMLHttpRequest)
	{
		http_request=new XMLHttpRequest();
		if(http_request.overrideMimeType)
		{
			http_request.overrideMimeType("text/xml");
		}
	}
	else if(window.ActiveXObject)
	{
		try
		{
			http_request=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(e)
		{
			try
			{
				http_request=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e)
			{}
		}
	}
	if(!http_request)
	{
		return false;
	}
	switch(method)
	{
		case 1:http_request.onreadystatechange = processRequest1;break;
		case 2:http_request.onreadystatechange = processRequest2;break;
		case 3:http_request.onreadystatechange = processRequest3;break;
		default:http_request.onreadystatechange = processRequest;
	}
	http_request.open("GET",url,true);
	http_request.send(null);
}

function processRequest()
{
	if(http_request.readyState==4)
		{
			if(http_request.status==200)
			{
				try
				{
					var str=http_request.responseText;
					SetMoveRoadInfo(str);
				}
				catch(e)
				{}
			}
			else
			{
				sSpeedTime="";
			}
		}
}

function processRequest1()
{
	if(http_request.readyState==4)
		{
			if(http_request.status==200)
			{
				try
				{
					var str=http_request.responseText;
					SetAIDLayer(str);
				}
				catch(e)
				{}
			}
		}
}

function getAjaxTime(FormID)
{
	var surl="getServerTime.aspx?sSpeedTime="+sSpeedTime;
	send_request(surl,0);
}

//传入的事件串：Aid,type,x,y;Aid,type,x,y;...滚动内容
function SetMoveRoadInfo(sRoadInfoArray)
{
	var sValue=sRoadInfoArray.split(";");
	if (sValue[0]!=sSpeedTime)
	{
		bUpdateMap=sSpeedTime!="-";
		sSpeedTime=sValue[0];
		strRoadInfo1="<marquee onmouseover='stop()' onmouseout='start()' scrollamount='2' scrolldelay='1' height='18' style='FONT-WEIGHT: bold; VERTICAL-ALIGN: middle; COLOR: #575757; CURSOR: hand'>"
			+sValue[1]+"</marquee>";
		strRoadInfo2="<marquee onmouseover='stop()' onmouseout='start()' scrollamount='2' scrolldelay='1' height='18' style='FONT-WEIGHT: bold; VERTICAL-ALIGN: middle; COLOR: #575757; CURSOR: hand'>"
			+sValue[2]+"</marquee>";
		window.document.getElementById('RoadInfo').contentWindow.document.getElementById("RoadInfo1").innerHTML=strRoadInfo1;
		window.document.getElementById('RoadInfo').contentWindow.document.getElementById("RoadInfo2").innerHTML=strRoadInfo2;
		window.document.getElementById('MainMap').contentWindow.document.getElementById("RealTime").innerHTML="路况时间："+sSpeedTime;
	    var t1=window.document.getElementById('RoadInfo').contentWindow.RouterCount;
	    if (t1==null)
	    {
            window.document.getElementById('MainMap').contentWindow.RouterMapCommand("");
            var box=new Array(3);
            box=document.getElementById('RoadInfo').contentWindow.document.getElementById("SiteMapTextBox").value.split("_");
            document.getElementById('RoadInfo').contentWindow.LocateSite(box[0],box[1],box[2]);
        }
	}
}
