function createAjax() {			//该函数将返回XMLHTTP对象实例
	var _xmlhttp;
	try {	
		_xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");	//IE的创建方式
	}
	catch (e) {
		try {
			_xmlhttp=new XMLHttpRequest();	//FF等浏览器的创建方式
		}
		catch (e) {
			_xmlhttp=false;		//如果创建失败，将返回false
		}
	}
	return _xmlhttp;	//返回xmlhttp对象实例
}



function searchCont(str) {	//该函数用来获取分页数据


	var xmlhttp=createAjax();	//创建变量xmlhttp，并将createAjax()函数创建的对象实例赋于它
	if (xmlhttp) {		//如果xmlhttp对象创建成功，则执行条件语句中的程序
	
			//获取页面中id为content的对象
		xmlhttp.open('get','search.asp?ty='+str+'&n='+Math.random(),true);
		
     //alert('search.asp?ty='+str+'&n='+Math.random())
		
		//打开与服务器的连接，其中get为连接方式，server.asp为要连接的页面，有两个参数，其中第一个参数page为需要返回数据的页数,第二个参数n为一个随机数，这样每次发送的URL都会不一样，相当于都向服务器发出一个新的请求，避免浏览器缓存数据。
		xmlhttp.onreadystatechange=function() {		//为xmlhttp对象的readyState属性指定事件，改属性值改变时，则会执行其中的程序
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	//如果xmlhttp.readyState==4并且xmlhttp.status==200时，执行条件中的程序，其中readyState有五个值，4为请求完成，是客户端向服务器提交的数据成功到达，status有N多值-_-!!，其中200为OK，是指服务器向客户端完成发送数据。
				var response=xmlhttp.responseText;	//将服务器返回的数据解码并写入指定的ID中。
				if(response==""){

				}
				else
				{
				
				document.getElementById("searchCont").innerHTML=unescape(response);
				}

			
			}
			else {
					//如果服务器没有完成传送，则向用户提示正在传输。
			}
		}
		xmlhttp.send(null);	//向服务器发送请求，因为是get请求，会直接附在URL后面，所以这里括号中的数据为null，IE中也可以不写，但FF就必须加上null，否则会发送失败。
	}
}


//function SearchLink()
//{	
//	var SearLink;
//	SearLink="products.asp?act=search"
//	
//	var classid=document.getElementsByName("classid");
//	for(i=0;i<classid.length;i++)
//	{
//		if(classid[i].checked)
//		{
//		classid=classid[i].value;
//		SearLink=SearLink+'&classid='+classid;
//		}
//	}
//	
//	if(document.Search.CP1.value!="")
//	{
//		if(document.Search.CP1.value!=0)
//		{
//	 	SearLink=SearLink+'&cp1='+document.Search.CP1.value;
//		}
//	}
//	if(document.Search.CP2.value!="")
//	{
//		if(document.Search.CP2.value!=0)
//		{
//		SearLink=SearLink+'&cp2='+document.Search.CP2.value;
//		}
//	}
//	if(document.Search.CP3.value!="" )
//	{
//		if(document.Search.CP3.value!=0)
//		{
//		SearLink=SearLink+'&cp3='+document.Search.CP3.value;
//		}
//	}
//	if(document.Search.jiage.value!="" )
//	{
//		SearLink=SearLink+'&jiage='+document.Search.jiage.value;
//	}
//	if(document.Search.Keyword.value=="请输入关键词或产品编号"||document.Search.Keyword.value=="")
//	{
//		SearLink=SearLink
//	}
//	else
//	{
//		SearLink=SearLink+'&keyword='+escape(document.Search.Keyword.value);
//	}
//	document.Search.action=SearLink;
//	return true;
//}

function JsQh(str,Cid)
{
	
	var xmlhttp=createAjax();	//创建变量xmlhttp，并将createAjax()函数创建的对象实例赋于它
	if (xmlhttp) {		//如果xmlhttp对象创建成功，则执行条件语句中的程序
	
			//获取页面中id为content的对象
		xmlhttp.open('get','Switch.asp?Acess='+str+'&Cid='+Cid+'&n='+Math.random(),true);
		
     //alert('Switch.asp?Acess='+str+'Cid='+Cid+'&n='+Math.random())
		
		//打开与服务器的连接，其中get为连接方式，server.asp为要连接的页面，有两个参数，其中第一个参数page为需要返回数据的页数,第二个参数n为一个随机数，这样每次发送的URL都会不一样，相当于都向服务器发出一个新的请求，避免浏览器缓存数据。
		xmlhttp.onreadystatechange=function() {		//为xmlhttp对象的readyState属性指定事件，改属性值改变时，则会执行其中的程序
			if (xmlhttp.readyState==4 && xmlhttp.status==200) {	//如果xmlhttp.readyState==4并且xmlhttp.status==200时，执行条件中的程序，其中readyState有五个值，4为请求完成，是客户端向服务器提交的数据成功到达，status有N多值-_-!!，其中200为OK，是指服务器向客户端完成发送数据。
				var response=xmlhttp.responseText;	//将服务器返回的数据解码并写入指定的ID中。
				if(response==""){

				}
				else
				{
				
				document.getElementById("FCont").innerHTML=unescape(response);
				}

			
			}
			else {
					//如果服务器没有完成传送，则向用户提示正在传输。
			}
		}
		xmlhttp.send(null);	//向服务器发送请求，因为是get请求，会直接附在URL后面，所以这里括号中的数据为null，IE中也可以不写，但FF就必须加上null，否则会发送失败。
	}
}

