/* ---------------------------- */
/* 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					 */
/* -------------------------- */
function autosuggest(section, idx, field) {
var q = document.getElementById(idx).value;

// Set te random number to add to URL request
nocache = Math.random();
http.open('get', 'http://www.ioncinema.com/search.php?q='+q+'&nocache = '+nocache+'&s='+section+'&idx='+idx+'&field='+field);
http.onreadystatechange = function() {//Call a function when the state changes.
	if(http.readyState == 4){
		var response = http.responseText;
		var resultdiv = "results" + idx;
		var e = document.getElementById(resultdiv);
		e.style.display='block';
		if(response!=""){
			e.innerHTML=response;
			e.style.display="block";
		} else {
			e.style.display="none";
		}
	}
}
http.send(null);
}
