   	var counter = 0;
   	var responseArray = new Array();
   	function getRequestObject(){
		try{
			return(new XMLHttpRequest());
		}catch(e){}
		
		try{
			return(new ActiveXObject("Msxml2.XMLHTTP"));
		}catch(e){}
		
		try{
			return(new ActiveXObject("Microsoft.XMLHTTP"));
		}catch(e){}
	
	    alert("Your browser doesn't support AJAX");
	    return(null);
}
   
   /******************************
   *     Begin page functions    *
   *				 			 *
   *  printXXXX functions print	 *
   *  the options for the select *
   *  boxes			 			 *
   ******************************/

	function openPage(url){						
       xmlhttp = getRequestObject();			
       xmlhttp.open("GET", url, true);
       if(arguments[1]!=null && arguments[1]!='undefined'){
       		xmlhttp.onreadystatechange = arguments[1];
       	}else{
	       xmlhttp.onreadystatechange=function() {
	           if (xmlhttp.readyState==4) {
	               parseData(xmlhttp.responseText);
	           }
	       }
	     }
       xmlhttp.send(null);
   	}
	function printMake(){				
	 	var theSelect = document.getElementById("sel_make");
	 	theSelect.innerHTML = "";
	 	
	 	option = document.createElement("option");
	 	option.value = "-1";
	 	option.innerHTML = "All Makes";
	 	theSelect.appendChild(option);
	 	
		for(var x = 0; x < responseArray["makes"].length; x++){
			option = document.createElement("option");
			option.value = responseArray["makes"][x];
			option.innerHTML = responseArray["makes"][x];
			
			theSelect.appendChild(option);
		}
	}

	function printModel(){						
	 	var theSelect = document.getElementById("sel_model");
	 	theSelect.innerHTML = "";
	 	
	 	option = document.createElement("option");
	 	option.value = "-1";
	 	option.innerHTML = "All Models";
	 	theSelect.appendChild(option);
	 	
		for(var x = 0; x < responseArray["models"].length; x++){
			option = document.createElement("option");
			option.value = responseArray["models"][x];
			option.innerHTML = responseArray["models"][x];
			
			theSelect.appendChild(option);
		}
	}

	function printYear(){								
	 	var theSelect = document.getElementById("year");
	 	theSelect.innerHTML = "";
	 	
		option = document.createElement("option");
		option.value = 1;
		option.innerHTML = "All Years";
		
		theSelect.appendChild(option);
		
		for(var x = 0; x < responseArray["years"].length; x++){
			option = document.createElement("option");
			option.value = responseArray["years"][x];
			option.innerHTML = responseArray["years"][x];
			
			theSelect.appendChild(option);
		}
	}

	function printPrice(){								
	 	var theSelect = document.getElementById("prices");
	 	theSelect.innerHTML = "";
	 	
		option = document.createElement("option");
		option.value = -1;
		option.innerHTML = "All Prices";
		theSelect.appendChild(option);
		
		var priceLow = 0;
		var priceHigh = 5000;
		for(var x = 0; x < 21; x++){
			option = document.createElement("option");
			option.value = x;
			if(x == 0){
			    option.innerHTML = "$" + priceLow/1000 + " - " + "$" + priceHigh/1000 + ",000";
			}else{
			    option.innerHTML = "$" + priceLow/1000 + ",000 - " + "$" + priceHigh/1000 + ",000";
			}
			theSelect.appendChild(option);
			priceLow = priceLow + 5000;
			priceHigh = priceHigh + 5000;
		}
		
		option = document.createElement("option");
		option.value = x + 1;
		option.innerHTML = "$100,000+"
		theSelect.appendChild(option);
	}

	function printAll(){
		counter++;
		url = 'ajax_respond_main.php?WebSiteID=' + WebSiteID + '&counter=' + counter;
		xmlhttp = getRequestObject();
		xmlhttp.open("GET", url, true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				parseData(xmlhttp.responseText);
				printMake();
				printModel();
				printPrice();
				printYear();
			}
		}
		xmlhttp.send(null);
	}

	function selectChange(type, value){
		counter++;
		url = 'ajax_respond_main.php?WebSiteID=' + WebSiteID + '&counter=' + counter + "&" + type + "=" + value;
		xmlhttp = getRequestObject();
		xmlhttp.open("GET", url, true);
		xmlhttp.onreadystatechange=function() {
			if (xmlhttp.readyState==4) {
				parseData(xmlhttp.responseText);
				switch(type){
					case "make":
						printModel();
						break;
				}
			}
		}
		xmlhttp.send(null);
	}
// Grabs returned data, explodes it, stores into arrays,
// and passes to print functions

	function parseData(responseData){
	    eval("responseArray = " + responseData);
	} 