function showOptions(vehicletype)
{
var url="http://www.magnaflow.com/qpulldown/getmakes.asp";
if (window.document.allsearch.vehicletype.value == "CAR")
{
	//document.getElementById("searchform").innerHTML = "<FORM name='allsearch' action='shopdisplayproducts.asp' method='post'>"
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById("allmakes").innerHTML=xmlhttp.responseText;
		document.getElementById("allmodels").innerHTML="<select name='model' size='1' onChange='showYears(allsearch.make.value, this.value)' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Model</option></select>";
		//document.getElementById("allmodels").innerHTML="<font size='1' FACE='Verdana, Arial, Helvetica, sans-serif' color='#767778'><b></b></font><select name='model' size='1' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Model</option></select>";
		document.getElementById("allyears").innerHTML="<select name='year' size='1' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Year</option></select>";
		document.getElementById("allsearchbutton").innerHTML = "&nbsp;"

		}
	  }
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}else if (window.document.allsearch.vehicletype.value == "DIESEL"){
	url=url+"?type=DIESEL";
	//document.getElementById("searchform").innerHTML = "<FORM name='allsearch' action='shopdisplayproducts.asp' method='post'>"
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById("allmakes").innerHTML=xmlhttp.responseText;

		document.getElementById("allmodels").innerHTML="<select name='model' size='1' onChange='showYears(allsearch.make.value, this.value)' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Model</option></select>";
		//document.getElementById("allmodels").innerHTML="<font size='1' FACE='Verdana, Arial, Helvetica, sans-serif' color='#767778'><b></b></font><select name='model' size='1' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Model</option></select>";
		document.getElementById("allyears").innerHTML="<select name='year' size='1' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Year</option></select>";
		document.getElementById("allsearchbutton").innerHTML = "&nbsp;"

		}
	  }
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);

}else if (window.document.allsearch.vehicletype.value == "TRUCK"){

		document.getElementById("allmakes").innerHTML="<select name='catalog' size='1' onChange='showTruckMakes(this.value)' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Catalog</option><option value='PERFORMANCE'>PERFORMANCE</option><option value='CONVERTERS'>CONVERTERS</option></select>";
		document.getElementById("allmodels").innerHTML="&nbsp;";
		document.getElementById("allyears").innerHTML="&nbsp;";
		document.getElementById("allsearchbutton").innerHTML = "&nbsp;";

}else{

		document.getElementById("allmakes").innerHTML="&nbsp;";
		document.getElementById("allmodels").innerHTML="&nbsp;";
		document.getElementById("allyears").innerHTML="&nbsp;";
		document.getElementById("allsearchbutton").innerHTML = "&nbsp;";
}


}




function showModels(make)
{


var url="http://www.magnaflow.com/qpulldown/getmodels.asp";
url=url+"?make="+make;
//url=url+"&sid="+Math.random();

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("allmodels").innerHTML=xmlhttp.responseText;

	document.getElementById("allyears").innerHTML="<select name='model' size='1' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Year</option></select>";
	document.getElementById("allsearchbutton").innerHTML = "&nbsp;"

    }
  }
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function showYears(make, model)
{
var url="http://www.magnaflow.com/qpulldown/getyears.asp";
url=url+"?make="+make+"&model="+model;
//url=url+"&sid="+Math.random();

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("allyears").innerHTML=xmlhttp.responseText;

	document.getElementById("allsearchbutton").innerHTML = "&nbsp;"

    }
  }
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function showSearch(make,model,xyear)
{
	vtype = window.document.allsearch.vehicletype.value;
	if (xyear != "")
	{
		//document.getElementById("allsearchbutton").innerHTML = "<input type='image' src='http://www.magnaflow.com/images/submit.jpg' alt='Submit' width='58' height='22' border='0' style='margin-top:5px;'>";
		//document.getElementById("allsearchbutton").innerHTML = "<a href='javascript:document.allsearch.submit();'><img src='http://www.magnaflow.com/images/submit.jpg' border='0'></a>"
		//window.location = "http://www.magnaflow.com/02product/shopdisplayproducts_cars.asp?make=" + make + "&model=" + model + "&year=" + xyear;
		window.location = "http://www.magnaflow.com/allsearch.asp?vehicletype=" + vtype + "&make=" + make + "&model=" + model + "&year=" + xyear;
	}else{
		document.getElementById("allsearchbutton").innerHTML = "&nbsp;";
	}
}


function showTruckMakes(xcatalog)
{

var url="http://www.magnaflow.com/qpulldown/getmakes.asp";
if (xcatalog == "PERFORMANCE")
{
	url = url + "?type=TRUCK";

	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
		document.getElementById("allmodels").innerHTML=xmlhttp.responseText;
		document.getElementById("allyears").innerHTML="<select name='model' size='1' onChange='showTruckYears(allsearch.make.value, this.value)' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Model</option></select>";
		document.getElementById("allsearchbutton").innerHTML = "<select name='year' size='1' onChange='showTruckPerformanceSearch()' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Year</option></select>"
		document.getElementById("allsearchbutton_truck").innerHTML = "&nbsp;"
		}
	  }
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);

}else if (xcatalog == "CONVERTERS"){
		document.getElementById("allmodels").innerHTML="<select name='clocation' size='1' onChange='showTruckConverterSearch(this.value)' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Location</option><option value='49 STATE'>49 STATE</option><option value='CALIFORNIA'>CALIFORNIA</option></select>"
		document.getElementById("allyears").innerHTML="&nbsp;";
		document.getElementById("allsearchbutton").innerHTML = "&nbsp;"
		document.getElementById("allsearchbutton_truck").innerHTML = "&nbsp;"
}else{
		document.getElementById("allmodels").innerHTML="&nbsp;"
		document.getElementById("allyears").innerHTML="&nbsp;";
		document.getElementById("allsearchbutton").innerHTML = "&nbsp;"
}
}

function showTruckModels(make)
{
var url="http://www.magnaflow.com/qpulldown/getmodels.asp";
url = url + "?type=TRUCK&make="+make;


if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("allyears").innerHTML=xmlhttp.responseText;
	document.getElementById("allsearchbutton").innerHTML = "<select name='year' size='1' onChange='showTruckPerformanceSearch()' class='formStyle' style='font-size: 8pt; font-family: verdana,arial; background: #FFFFFF; color: #000000; border: 1px solid rgb(180,180,180);'><option value=''>Select a Year</option></select>"
	document.getElementById("allsearchbutton_truck").innerHTML = "&nbsp;"

    }
  }
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function showTruckYears(make, model)
{
var url="http://www.magnaflow.com/qpulldown/getyears.asp";
url=url+"?type=TRUCK&make="+make+"&model="+escape(model);
//url=url+"&sid="+Math.random();

if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("allsearchbutton").innerHTML=xmlhttp.responseText;
	//window.document.pagesearch.trim.value = '';
	//window.document.pagesearch.engine.value = '';
	document.getElementById("allsearchbutton_truck").innerHTML = "&nbsp;"
	//document.getElementById("trim").value='';
	//document.getElementById("engine").value='';
    }
  }
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function showTruckConverterSearch(xlocation)
{
	vtype="TRUCK";
	if (xlocation != "")
	{
		//document.getElementById("allyears").innerHTML = "<input type='image' src='http://www.magnaflow.com/images/submit.jpg' alt='Submit' width='58' height='22' border='0' style='margin-top:5px;'>";
		//window.location = "http://www.magnaflow.com/allsearch.asp?catalog=CONVERTERS&vehicletype=" + vtype & "&clocation=" + xlocation;
		window.location = "http://www.magnaflow.com/allsearch.asp?catalog=CONVERTERS&vehicletype=" + vtype + "&clocation=" + xlocation;
	}else{
		document.getElementById("allyears").innerHTML = "&nbsp;";
	}
}

function showTruckPerformanceSearch(make,model,xyear)
{
	vtype="TRUCK";
	if (xyear != "")
	{
		window.location = "http://www.magnaflow.com/allsearch.asp?catalog=PERFORMANCE&vehicletype=" + vtype + "&make=" + make + "&model=" + model + "&year=" + xyear;
	//	document.getElementById("allsearchbutton_truck").innerHTML = "<input type='image' src='http://www.magnaflow.com/images/submit.jpg' alt='Submit' width='58' height='22' border='0' style='margin-top:5px;'>";
	//window.location = "http://www.magnaflow.com/allsearch.asp?catalog=PERFORMANCE&vehicletype=" + vtype & "&make=" + make + "&model=" + model + "&year=" + xyear;
	}else{
		document.getElementById("allsearchbutton_truck").innerHTML = "&nbsp;";
	}
}

