var xmlHttp

function showProducts(str) {
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	var url="checkproduct.php"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() {
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
	var txt = "<table border=1  class='product_table'>";
				txt = txt + "<tr bgcolor='#999999'>";
				txt = txt + "	<th>MODEL</th>";
				txt = txt + "	<th>DESCRIPTION</th>";
				txt = txt + "	<th>LIST PRICE</th>";
				txt = txt +"	</tr>";
		var List = xmlHttp.responseText.split("[");
		recordNum = List.length - 1;
				for ( var i=0, len=recordNum; i<len; ++i ){
					recordInfo = List[i].split("|");
					if(recordInfo[3]==document.getElementById('prod').innerHTML) {
						txt = txt + "<tr bgcolor='#333333'>";
							txt = txt + "<td>"    + recordInfo[0] + "</td>";
							txt = txt + "<td>"    + recordInfo[1] + "</td>";
							txt = txt + "<td> $ " + recordInfo[2] + "</td>";
						txt = txt + "</tr>";
					}
				}
				txt = txt + "</table>";
		Write('products', txt)
	} 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
