//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;
  }
}

function isNumberKey(evt) {
	/* Allow only numbers/digits in TextBox */
	var charCode = (evt.which) ? evt.which : event.keyCode

	if (charCode > 31 && (charCode < 48 || charCode > 57)) { return false; }
	
	return true;
}

//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", "index.php?/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", "index.php?/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
	}
}