	var xmlHttp;				
	function plazexmlHttp()
	{
		if(window.ActiveXObject)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		else if(window.XMLHttpRequest)
		{
			xmlHttp=new XMLHttpRequest();
			xmlHttp.overrideMimeType("text/xml");
		}
		else if(Msxml2.ActiveXObject)
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	}
	
	function Buy(goodId)
	{
		plazexmlHttp();
		BuyServer(goodId);				
	}
	
	function BuyCallback()
	{
		if(xmlHttp.readyState==4)
		{
			if(xmlHttp.status==200)
			{
				var result=new String(xmlHttp.responseText);
				if(result.indexOf("|")<0)
				{
					alert(result);
				}
				else
				{
					BuyReply();
					//document.open('/userManage/plaza/cue.htm','提示','width=205,height=105');
					var array=result.split("|");
					document.getElementById("lblCount").innerHTML=array[0];
					document.getElementById("lblTotal").innerHTML=array[1];
				}
			}
		}
	}

	function StoreCallback()
	{
	    if (xmlHttp.readyState == 4)
	    {
	        if (xmlHttp.status == 200)
	        {
	            var result = new String(xmlHttp.responseText);
	            if (result.indexOf("|") < 0)
	            {
	                alert(result);
	            }
	            else
	            {
	                StoreReply();
	                //document.open('/userManage/plaza/cue.htm','提示','width=205,height=105');
	                var array = result.split("|");
	                document.getElementById("lblCount").innerHTML = array[0];
	                document.getElementById("lblTotal").innerHTML = array[1];
	            }
	        }
	    }
	}
	function BuyReply()
	{
	    //Gradually();
	    alert("购买成功，请点击购物车查看您所有的已购买商品！");
	}
	function StoreReply()
	{
	    //Gradually();
	    alert("收藏成功，请点击收藏夹查看您所有的已收藏商品！");
	}
	function Gradually()
	{
		setTimeout("ChangeColor('#FFF9F2')",200);
		//setTimeout("ChangeColor('#FFE3C8')",200*1);
		//setTimeout("ChangeColor('#FFD9B3')",200*2);
		//setTimeout("ChangeColor('#FFCE9D')",200*3);
		setTimeout("ChangeColor('#FFC488')",200*4);
		//setTimeout("ChangeColor('#FFB973')",200*5);
		//setTimeout("ChangeColor('#FFAE5E')",200*6);
		//setTimeout("ChangeColor('#FFA448')",200*7);

		setTimeout("ChangeColor('#ff9933')",200*8);
		//setTimeout("ChangeColor('#FFA448')",200*9);
		//setTimeout("ChangeColor('#FFAE5E')",200*10);
		//setTimeout("ChangeColor('#FFB973')",200*11);
		setTimeout("ChangeColor('#FFC488')",200*12);
		//setTimeout("ChangeColor('#FFCE9D')",200*13);
		//setTimeout("ChangeColor('#FFD9B3')",200*14);
		//setTimeout("ChangeColor('#FFE3C8')",200*15);
		//setTimeout("ChangeColor('#FFF9F2')",200*16);
		setTimeout("ChangeColor('#FFFFFF')",200*17);
	}
	function ChangeColor(color)
	{
		document.getElementById("selfBody").setAttribute("bgColor",color);	
	}

	
	function BuyServer(goodId)
	{
		var hostName=document.location.hostname;
		var url="/userManage/plaza/cartStore.aspx?hostName="+hostName+"&type=buy&goodId="+goodId+"&timeSpan="+new Date().getTime();
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=BuyCallback;
		xmlHttp.send(null);
	}
	function Store(goodId)
	{
		plazexmlHttp();
		storeServer(goodId);				
	}
	function storeServer(goodId)
	{
		var hostName=document.location.hostname;
		var url="/userManage/plaza/cartStore.aspx?hostName="+hostName+"&type=store&goodId="+goodId+"&timeSpan="+new Date().getTime();
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange = StoreCallback;
		xmlHttp.send(null);
	}
	
	
	function StartInit()
	{
		plazexmlHttp();
		InitServer();				
	}
	
	function InitServer()
	{
		var hostName=document.location.hostname;
		var url="/userManage/plaza/cartStore.aspx?hostName="+hostName+"&type=init&goodId=&timeSpan="+new Date().getTime();
		xmlHttp.open("GET",url,true);
		xmlHttp.onreadystatechange=InitCallback;
		xmlHttp.send(null);
	}
	
	function InitCallback()
	{	
		if(xmlHttp.readyState==4)
		{
			if(xmlHttp.status==200)
			{
				//alert("已经运行！");
				var result=new String(xmlHttp.responseText);
				if(result.indexOf("|")<0)
				{
					document.getElementById("lblCount").innerHTML="0";
					document.getElementById("lblTotal").innerHTML="0";
				}
				else
				{
					var array=result.split("|");
					document.getElementById("lblCount").innerHTML=array[0];
					document.getElementById("lblTotal").innerHTML=array[1];
				}
			}
			//else //奇怪的问题，初始化时没有回应
			//{
				//document.getElementById("lblCount").innerHTML="0";
				//document.getElementById("lblTotal").innerHTML="0";
			//}
		}
	}