//JavaScript Document
function getHTTPObject() {
  if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
  else if (window.XMLHttpRequest) return new XMLHttpRequest();
  else {
	  alert("Your browser does not support AJAX.");
	  return null;
  }
}

//this for sorting of property locations
function propSetOutput() {
	if(httpObject.readyState == 4) {
	document.getElementById("pickLoc").innerHTML = httpObject.responseText;
	}
}

//this will sort the cities
function propLoc(province) { 	
	httpObject = getHTTPObject();
	//alert("index.php?/setoutput/" + classification + "/" + pageAction + '/' + categoryid.value);
	
	//alert("index.php?/setoutput/" + province.value); 
	if (httpObject != null) {
		httpObject.open("POST", "setoutput/" + province.value, true);
		httpObject.send(null);
		httpObject.onreadystatechange = propSetOutput;
	}		
}

//this will sort the cities under rent section
function propLoc(rprovince) {	 
	  httpObject = getHTTPObject();
	  //alert("index.php?/setoutput/" + classification + "/" + pageAction + '/' + categoryid.value);
	  //alert("index.php?/setoutput/" + province.value); 
	  if (httpObject != null) {
		httpObject.open("POST", "setoutput/" + rprovince.value, true);
		httpObject.send(null);
		httpObject.onreadystatechange = propSetOutput;
	  }	
}

function closeCity(box) {
	if(box.id="province" && box.selectedID>0) {
		document.getElementById('cities').disabled=true
	} else if(box.id==0) {
		document.getElementById('cities').disabled=false
	} else if(box.id="cities" && box.selectedID>0) {
		document.getElementById('province').disabled=true
	} else {
		document.getElementById('province').disabled=false
	}
}
