var req;var container='';function loadXMLDoc(url,method){req=false;if(window.XMLHttpRequest){try{req=new XMLHttpRequest();}catch(e){req=false;}}else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){req=false;}}}if(req){if(method==''){req.onreadystatechange=processReqChange;req.open("GET",url,true);req.send("");}else if(method=='post'){req.onreadystatechange=processReqChange;req.open("POST",url,true);req.send("");}}}function checkMake(pId,cNam){var obj=document.getElementById('year');var yr=obj.options[obj.selectedIndex].value;container=cNam;url='class/xml/valuation_xml.php?option=make&id='+yr;loadXMLDoc(url,'');}function checkModel(pId,cNam){var id2=document.getElementById('year');var yr=id2.options[id2.options.selectedIndex].value;container=cNam;url='class/xml/valuation_xml.php?option=model&year='+yr+'&id='+pId;loadXMLDoc(url,'');}function checkAll(cNam){var obj1=document.getElementById('year');var obj2=document.getElementById('make');var obj3=document.getElementById('model');container=cNam;url='class/xml/valuation_xml.php?option=all&year='+obj1.options[obj1.selectedIndex].value+'&make='+obj2.options[obj2.selectedIndex].value+'&model='+obj3.options[obj3.selectedIndex].value;loadXMLDoc(url,'');}function processReqChange(){
						var con=document.getElementById(container);
						if(req.readyState==1){
							con.innerHTML='<img src="images/spinner.gif">';
						}else if (req.readyState==4){
							if(req.status==200){
								var content=req.responseXML.documentElement;
								var result=content.childNodes;
								if(container=='display_valuation'){
									var txt='<table width="100%" border="0" cellspacing="0" cellpadding="0" align="left">';
									txt+='<tr style="background-image:url(../images/vmic_igd_footer.jpg);"><td style="border:solid 1px #999999; border-right:none; border-left:none;"><b style="font-size:12px;">Year</b></td><td style="border:solid 1px #999999; border-right:none; border-left:none;"><b style="font-size:12px;">Make</b></td><td style="border:solid 1px #999999; border-right:none; border-left:none;"><b style="font-size:12px;">Model</b></td><td style="border:solid 1px #999999; border-right:none; border-left:none;"><b style="font-size:12px;">Average Price</b></td></tr>';
									txt+='<tr><td style="font-size:12px;">'+result[0].childNodes[0].firstChild.data+'</td><td style="font-size:12px;">'+result[0].childNodes[1].firstChild.data+'</td><td style="font-size:12px;">'+result[0].childNodes[2].firstChild.data+'</td><td style="font-size:12px;">$'+result[0].childNodes[3].firstChild.data+'</td></tr></table>';
									con.innerHTML=txt;
								}else{
									if(document.all){
										con.options[0]=new Option("Select an Option","no");
										con.options[1]=new Option("--------------------------","no");
										var incr=2;
										for(var i=0; i < (result.length); i++){
											con.options[incr]=new Option(result[i].firstChild.data,result[i].firstChild.data);
											incr++;
										}
									}else{
										con.innerHTML='<option value="no">Select an Option</option>';
										con.innerHTML+='<option value="no">--------------------------</option>';
										for(var i=0; i < result.length; i++){
											con.innerHTML+='<option value="'+result[i].firstChild.data+'">'+result[i].firstChild.data+'</option>';
										}
									}
								}
							}else{
								alert("There was a problem retrieving the XML data:" + req.statusText);
							}
						}
					}