// JavaScript Document
var xmlHttpPropertyType, xmlHttpLocationId, xmlHttpBedroomSqftLabel, xmlHttpBedroomSqft, xmlHttpBudget;

var listing_type_x, property_type_id_x, location_id_x, bedroom_sqft_x, budget_x;

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;
}

function updateVariable(obj, new_value){
	window[obj] = new_value;
}

///PropertyType
function showPropertyType(){ 
	xmlHttpPropertyType=GetXmlHttpObject();
	if (xmlHttpPropertyType==null){
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="ajax/process/property_type.get.php";
	url=url+"?listing_type="+listing_type_x;
	url=url+"&property_type_id="+property_type_id_x;
	url=url+"&sid="+Math.random();
	document.getElementById("PropertyType").innerHTML="Processing...";
	xmlHttpPropertyType.onreadystatechange=stateChangedPropertyType;
	xmlHttpPropertyType.open("GET",url,true);
	xmlHttpPropertyType.send(null);
}

function stateChangedPropertyType(){
	if (xmlHttpPropertyType.readyState==4 || xmlHttpPropertyType.readyState=="complete"){
		document.getElementById("PropertyType").innerHTML=xmlHttpPropertyType.responseText;
	}
}

///LocationId
function showLocationId(){ 
	xmlHttpLocationId=GetXmlHttpObject();
	if (xmlHttpLocationId==null){
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="ajax/process/location.get.php";
	url=url+"?listing_type="+listing_type_x;
	url=url+"&property_type_id="+property_type_id_x;
	url=url+"&location_id="+location_id_x;
	url=url+"&sid="+Math.random();
	document.getElementById("LocationId").innerHTML="Processing...";
	xmlHttpLocationId.onreadystatechange=stateChangedLocationId;
	xmlHttpLocationId.open("GET",url,true);
	xmlHttpLocationId.send(null);
}

function stateChangedLocationId(){
	if (xmlHttpLocationId.readyState==4 || xmlHttpLocationId.readyState=="complete"){
		document.getElementById("LocationId").innerHTML=xmlHttpLocationId.responseText;
	}
}

///BedroomSqftLabel
function showBedroomSqftLabel(){ 
	xmlHttpBedroomSqftLabel=GetXmlHttpObject();
	if (xmlHttpBedroomSqftLabel==null){
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="ajax/process/bedroom_sqft_label.get.php";
	url=url+"?property_type_id="+property_type_id_x;
	url=url+"&sid="+Math.random();
	document.getElementById("BedroomSqftLabel").innerHTML="Processing...";
	xmlHttpBedroomSqftLabel.onreadystatechange=stateChangedBedroomSqftLabel;
	xmlHttpBedroomSqftLabel.open("GET",url,true);
	xmlHttpBedroomSqftLabel.send(null);
}

function stateChangedBedroomSqftLabel(){
	if (xmlHttpBedroomSqftLabel.readyState==4 || xmlHttpBedroomSqftLabel.readyState=="complete"){
		document.getElementById("BedroomSqftLabel").innerHTML=xmlHttpBedroomSqftLabel.responseText;
	}
}

///BedroomSqft
function showBedroomSqft(){ 
	xmlHttpBedroomSqft=GetXmlHttpObject();
	if (xmlHttpBedroomSqft==null){
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="ajax/process/bedroom_sqft.get.php";
	url=url+"?property_type_id="+property_type_id_x;
	url=url+"&bedroom_sqft="+bedroom_sqft_x;
	url=url+"&sid="+Math.random();
	document.getElementById("BedroomSqft").innerHTML="Processing...";
	xmlHttpBedroomSqft.onreadystatechange=stateChangedBedroomSqft;
	xmlHttpBedroomSqft.open("GET",url,true);
	xmlHttpBedroomSqft.send(null);
}

function stateChangedBedroomSqft(){
	if (xmlHttpBedroomSqft.readyState==4 || xmlHttpBedroomSqft.readyState=="complete"){
		document.getElementById("BedroomSqft").innerHTML=xmlHttpBedroomSqft.responseText;
	}
}

///Budget
function showBudget(){ 
	xmlHttpBudget=GetXmlHttpObject();
	if (xmlHttpBudget==null){
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="ajax/process/budget.get.php";
	url=url+"?listing_type="+listing_type_x;
	url=url+"&property_type_id="+property_type_id_x;
	url=url+"&budget="+budget_x;
	url=url+"&sid="+Math.random();
	document.getElementById("Budget").innerHTML="Processing...";
	xmlHttpBudget.onreadystatechange=stateChangedBudget;
	xmlHttpBudget.open("GET",url,true);
	xmlHttpBudget.send(null);
}

function stateChangedBudget(){
	if (xmlHttpBudget.readyState==4 || xmlHttpBudget.readyState=="complete"){
		document.getElementById("Budget").innerHTML=xmlHttpBudget.responseText;
	}
}


