/* ---------------------------- */
/* 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();
var isIE = (document.all ? true : false);
/* -------------------------- */
/* SEARCH					 */
/* -------------------------- */
function autosuggest() {
	q = document.getElementById('search-q').value;
	// Set te random number to add to URL request	
	nocache = Math.random();
	http.open('get', 'lib/aramak.php?q='+q);
	http.onreadystatechange = autosuggestReply;
	http.send(null);
}
function autosuggestReply() {
	
		var response = http.responseText;
		obj= document.getElementById('results');
		
		if(response!=""){
			obj.innerHTML=response;
			if(isIE){
				obj.style.left = '0px';
			}
			obj.style.display="block";
		} else {
			obj.style.display="none";
		}
	
}
function oct(){
	e = document.getElementById('results');		
	document.getElementById('search-q').value = "";
	e.style.display="none";
	
}