//将输入文本框定义成input变量
//系统使用的XMLHttpRequest对象
var XMLHttpReq; 

	//创建XMLHttpRequest对象
function createXMLHttpRequest()
{
//对于Mozilla浏览器
	if(window.XMLHttpRequest)
	{
		//直接使用XMLHttpRequest函数来创建XMLHttpRequest对象
		XMLHttpReq = new XMLHttpRequest();
	}
		//对于IE浏览器
	else if (window.ActiveXObject)
	{
		try
		{
			//使用AcitveXObject函数创建浏览器
			XMLHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			//如果出现异常，再次尝试以如下方式创建XMLHttpRequest对象
		
			try
			{
				XMLHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
			}
		}
	}
}

function sendRequest(sId,sName,productName,productId,thisPrice)
{
	//input是个全局变量，对应于聊天信息的输入文本框
	//调用聊天信息输入文本框的value属性，获取文本框的内容
	var orderNumber = document.getElementById("orderNum"+productId).value;
	var onlinePrice = thisPrice;
	//完成XMLHttpRequest对象的初始化
	createXMLHttpRequest();
	//定义请求的URL变量
	var url = "miniCart.action";
	//通过open方法取得与服务器的连接
	//本系统发送POST请求
	XMLHttpReq.open("POST", url, true);
	//发送POST请求时，应该增加该文件头
	XMLHttpReq.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	//指定XMLHttpRequest状态改变时的处理函数
	XMLHttpReq.onreadystatechange = processResponse;
	//发送请求，send的参数包含许多key-value对
	//即以“请求参数名=请求参数值”的形式发送请求参数
	//var list = {"orderNumber":orderNumber,"storeName":storeName,"productName":productName,"id":id};
	var list = productId+","+sId+","+sName+","+productName+","+orderNumber+","+onlinePrice;
		XMLHttpReq.send("list="+list); // 发送请求
}

	//用于处理服务器响应的程序
function processResponse()
{
	//如果服务器响应已经完成
	if (XMLHttpReq.readyState == 4)
	{
		// 判断对象状态，如果服务器生成了正常响应
		if (XMLHttpReq.status == 200)
		{
			if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0))
			{
				parent.rl.location.reload(); 
			}
			else if (navigator.userAgent.indexOf('Firefox') >= 0){
					parent.document.getElementById('rl').contentWindow.location.reload();  
							
				}

		}
							/*else
							{
								//页面不正常
								window.alert("您所请求的页面有异常。");
							}*/
	}
}


//storeShooping.jsp
function setChooseColor(e){
	var list = document.getElementsByTagName("a");
	var size = list.length;
	if (size>1){
		var eName= e.name;
		for(var i=0;i<size;i++)
		{
			if (list[i].name==eName){
				list[i].style.color='black';
			}
		}
	}
	e.style.color='red';
}

//function setChooseColorA(e){
//	var list = document.getElementsByTagName("a");
//	var size = list.length;
//	if (size>1){
//	var eName= e.name;
//		for(var i=0;i<size;i++)
//		{
//			if (list[i].name==eName){
//			list[i].style.color='#1465B7';
//			}
//		}
//	}
//	e.style.color='#E86A22';
//	e.style.fontSize='16px';
//	e.style.fontWeight='bold';
//}


			function reinitIframe(){
				var iframe = document.getElementById("storeNav");
				try{
					var bHeight = iframe.contentWindow.document.body.scrollHeight;
					var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
					var height = Math.max(bHeight, dHeight);
					iframe.height =  height;
				}catch (ex){}
			}
			window.setInterval("reinitIframe()", 200);

			function reinstallIframeA(){
				  var iframe = document.getElementById("areaflooriFrame");
				  try{
				   iframe.height =  iframe.contentWindow.document.documentElement.scrollHeight;
				  }catch (ex){}
				  } 
				  window.setInterval("reinstallIframeA()", 200);
				  
				  


			  
