// JavaScript Document
var xmlHttp;
function createXmlHttp()
{
	if (window.ActiveXObject)
	{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");		
	}
	else if (window.XMLHttpRequest)
	{
		xmlHttp=new XMLHttpRequest();		
	}	
}
///////////////////////////////////////////////////////////////////////////////////////////////////////品牌和产品类别
function getXq(id)
{
  var objid =id;
 // alert(objid);
  if(objid.value!="")
   {
	 shows.innerHTML='<div align=center><img src=/images/loading.gif></div>';
     createXmlHttp();
	 var url="Plist.asp?pid="+objid;
	 //alert(url);
	 xmlHttp.open("Get",url,true);
	 xmlHttp.onreadystatechange=getXqOk;
	 //xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	 xmlHttp.send(null);
   }			
}

function getXqOk()
{
	if(xmlHttp.readystate==4)
	{				
		if (xmlHttp.status==200)
		{
			 var response = xmlHttp.responseText;
			//alert(response);
			try{
				var classObj = document.getElementById("shows");
			//	alert(classObj.innerHTML);
				classObj.innerHTML=response;
			  }
			catch(exception){}
		}
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////品牌
function getPP(id)
{
  var objid =id;
 // alert(objid);
  if(objid.value!="")
   {
	 shows.innerHTML='<div align=center><img src=/images/loading.gif></div>';
     createXmlHttp();
	 var url="PP.asp?pid="+objid;
	 //alert(url);
	 xmlHttp.open("Get",url,true);
	 xmlHttp.onreadystatechange=getppOk;
	 //xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	 xmlHttp.send(null);
   }			
}

function getppOk()
{
	if(xmlHttp.readystate==4)
	{				
		if (xmlHttp.status==200)
		{
			 var response = xmlHttp.responseText;
			//alert(response);
			try{
				var classObj = document.getElementById("pp");
			//	alert(classObj.innerHTML);
				classObj.innerHTML=response;
			  }
			catch(exception){}
		}
	}
}
//////////////////////////////////////////////////////////////////////////////////订单提交
function Orders()
{
  var txtid=document.getElementById("txtid").value;
  var txtuserid=document.getElementById("txtuserid").value;
  var txtcpmc=document.getElementById("txtcpmc").value;//产品名称
  var txtpp=document.getElementById("txtpp").value;//品牌
  var txtscjg=document.getElementById("txtscjg").value;//市场价格
  var txthyjg=document.getElementById("txthyjg").value;//会员价格
  var txtnum=document.getElementById("txtnum").value;//购买数量
  var txtname=document.getElementById("txtname").value;//联系人姓名
  var txtphone=document.getElementById("txtphone").value;//联系人电话
  if(txtnum=="")
  {alert('请填写购买数量！');return false;}
  if(txtname=="")
  {alert('请填写姓名！');document.all.txtname.focus();return false;}
  if(txtphone=="")
  {alert('请输入您的联系方式！');document.all.txtphone.focus();return false;}
  
  if(txtnum.value!="" || txtname.value!="" || txtphone!="")
   {
	 loding.innerHTML='<div align=center><img src=../images/loading.gif></div>';
     createXmlHttp();
	 var url="Orders.asp?txtid="+txtid+"&txtuserid="+txtuserid+"&txtcpmc="+txtcpmc+"&txtpp="+txtpp+"&txtscjg="+txtscjg+"&txthyjg="+txthyjg+"&txtnum="+txtnum+"&txtname="+txtname+"&txtphone="+txtphone+"";
	 xmlHttp.open("Get",url,true);
	 xmlHttp.onreadystatechange=getXqOk2;
	 //xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");
	 xmlHttp.send(null);
   }			
}
function getXqOk2()
{
	if(xmlHttp.readystate==4)
	{				
		if (xmlHttp.status==200)
		{
			 var response = xmlHttp.responseText;
			//alert(response);
			try{
			    startObjVisible('objDiv');
				 alert('订单提交成功！');
				 loding.innerHTML='';
				 document.all.txtnum.value='1';
				 document.all.txtname.value='';
				 document.all.txtphone.value='';
			  }
			catch(exception){}
		}
	}
}













