/* ---------------------------- */
/* XMLHTTPRequest Enable 		*/
/* ---------------------------- */
function createObject() {
	var request_type;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer"){
	request_type = new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		request_type = new XMLHttpRequest();
	}
		return request_type;
}

var http = createObject();

/* -------------------------- */
/* SEARCH	 1				 */
/* -------------------------- */
function autosuggest(txtField, resultArea) {
		nocache = Math.random();
	var q = document.getElementById(txtField).value;
	var cid=document.getElementById('searchCountry').value;
	if(cid=="")
	{
		alert('Please select country');
		document.getElementById('location').value="";		
		return false;
	}
	
	http.open('get', 'http://www.rentpropertyanywhere.com/auto_suggest/search.php?q='+q+'&nocache = '+nocache +'&cid='+cid +'&result_Area='+resultArea );
	http.onreadystatechange = autosuggestReply;
	http.send(null);
}

function autosuggestReply() {
if(http.readyState == 4){
	var response = http.responseText;
	var e = document.getElementById('results_location');
	if(response!=""){
		e.innerHTML=response;
		e.style.display="block";
	} else {
		e.style.display="none";
	}
}
}

function display(word, resultArea){
	document.getElementById('location').value = word;
	document.getElementById(resultArea).style.display = 'none';
	document.getElementById('location').focus();
}



