 function selectPriceRange(theform) {
	var item_span=document.getElementById("propertyprice");
	var item3_span=document.getElementById("propertylist");
	item3_span.innerHTML='';
	item_span.innerHTML='<select name=property_price><option></option></select>';
	var p = theform.property_type.options[theform.property_type.selectedIndex].value;
	var c = theform.property_location.options[theform.property_location.selectedIndex].value;
	if (p != '' && c != '') {
		item_span.innerHTML = "Loading...";
		if (window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		} else if (window.ActiveXObject) { 
		http_request = new ActiveXObject("Microsoft.XMLHTTP");
		}
		http_request.onreadystatechange = function(){
		if (http_request.readyState == 4) {
			if(http_request.status == 200) {
				item_span.innerHTML = http_request.responseText;
			}else{
				item_span.innerHTML = "There was an error getting price data, please try again!";	
			}
			    // everything is good, the response is received
			} else {
			    // still not ready
			}
		};
		
		http_request.open('GET', './results.cfm?p='+p+'&c='+c, true);

		http_request.send(null);
	} else {
		item_span.innerHTML = "<select name=property_price><option></option></select>";
	}
}
function selectLocation(theform) {
	var item_span=document.getElementById("propertylocation");
	var item2_span=document.getElementById("propertyprice");
	var item3_span=document.getElementById("propertylist");
	item2_span.innerHTML='';
	item3_span.innerHTML='';
	var p = theform.property_type.options[theform.property_type.selectedIndex].value;
	if (p != '') {
		item_span.innerHTML = "Loading...";
		if (window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		} else if (window.ActiveXObject) { 
		http_request = new ActiveXObject("Microsoft.XMLHTTP");
		}
		http_request.onreadystatechange = function(){
		if (http_request.readyState == 4) {
			if(http_request.status == 200) {
				item_span.innerHTML = http_request.responseText;
			}else{
				item_span.innerHTML = "There was an error getting location data, please try again!";	
			}
			    // everything is good, the response is received
			} else {
			    // still not ready
			}
		};

		http_request.open('GET', './results.cfm?p='+p, true);

		http_request.send(null);
	} else {
		item_span.innerHTML = "<select name=property_location><option></option></select>";
	}
}

function searchProperties(theform) {
	var item_span=document.getElementById("propertylist");
	var p = theform.property_type.options[theform.property_type.selectedIndex].value;
	var l = theform.property_price.options[theform.property_price.selectedIndex].value;
	var c = theform.property_location.options[theform.property_location.selectedIndex].value;
	if (p != '' && l != ''  && c != '') {
		item_span.innerHTML = "Loading...";
		if (window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		} else if (window.ActiveXObject) { 
		http_request = new ActiveXObject("Microsoft.XMLHTTP");
		}
		http_request.onreadystatechange = function(){
		if (http_request.readyState == 4) {
			if(http_request.status == 200) {
				item_span.innerHTML = http_request.responseText;
			}else{
				item_span.innerHTML = "There was an error getting location data, please try again!";	
			}
			    // everything is good, the response is received
			} else {
			    // still not ready
			}
		};

		http_request.open('GET', './results.cfm?p='+p+'&l='+l+'&c='+c, true);

		http_request.send(null);
	} else {
		item_span.innerHTML = "No Data";
	}
}


