var xmlHttp;
function sortby(CatId,sb,p)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
}	 
	var sb = document.getElementById("select14").value;
	if(!sb){
		
		sb="id desc"
		//alert('Please choose options');
		 //document.getElementById("select14").focus();
		//return false;
	}
	
	var url2="showboatbysort.php?CatId="+CatId+"&sb="+sb+"&page="+p;
	url2=url2+"&rand="+Math.random();	
	xmlHttp.onreadystatechange=stateChange
	xmlHttp.open("GET",url2,true);
	xmlHttp.send(null);

}
function sort1by(p,CatId)
{
	var sb = document.getElementById("select14").value;
	if(!sb){
		
		sb="id desc"
		//alert('Please choose options');
		 //document.getElementById("select14").focus();
		//return false;
	}
	//alert(sb); 
	sortby(CatId,sb,p);
	return false;
	
}
function stateChange()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	
	//alert(xmlHttp.responseText)
	document.getElementById("showcont").innerHTML=xmlHttp.responseText;
	
	
	}
}
function sortbyrange(CatId)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}	 
	
	s1 = document.getElementById("select1").value;
	s2 = document.getElementById("select2").value;
	s3 = document.getElementById("select3").value;
	s4 = document.getElementById("select4").value;
	s5 = document.getElementById("select5").value;
	s6 = document.getElementById("select6").value;
	s7 = document.getElementById("select7").value;
	var url2="showboatbyrange.php?s1="+s1+"&s2="+s2+"&s3="+s3+"&s4="+s4+"&s5="+s5+"&s6="+s6+"&s7="+s7+"&CatId="+CatId;
	url2=url2+"&rand="+Math.random();
	//alert(url2); return false;
	xmlHttp.onreadystatechange=stateChange_sortbyrange
	xmlHttp.open("GET",url2,true);
	xmlHttp.send(null);

}
function stateChange_sortbyrange()
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	
	//alert(xmlHttp.responseText)
	document.getElementById("showcont").innerHTML=xmlHttp.responseText;
	
	
	}
}
	function GetXmlHttpObject()
	{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
	objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
	objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
	}
function goToPage(v)
{
	if(v.value=='MA01')
	{
		window.location="aluminium_boat.php?CatId=MA01";
	}
	else if(v.value=='MA02')
	{
		window.location="aluminium_boat.php?CatId=MA02";
	}
	else if(v.value=='MF01')
	{
		window.location="fibreglass_boat.php?CatId=MF01";
	}
	else if(v.value=='MF02')
	{
		window.location="fibreglass_boat.php?CatId=MF02";
	}
	else if(v.value=='MF03')
	{
		window.location="fibreglass_boat.php?CatId=MF03";
	}
	else if(v.value=='MF04')
	{
		window.location="fibreglass_boat.php?CatId=MF04";
	}
	else if(v.value=='MQ01')
	{
		window.location="quicksilver_inflatables_boat.php?CatId=MQ01";
	}
	else
	{
		return false;
	}
}