/* ---------------------------- */
/* 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 autosuggest3(id,typ) {
q = id;
// Set te random number to add to URL request
nocache = Math.random();
		
		http.open('get', '../lib/search_sav.php?q='+q+'&typ='+typ+'&nocache = '+nocache);
		http.onreadystatechange = autosuggestReply3;
		http.send(null);
		 
}
function autosuggestReply3() {
e = document.getElementById('2009');
	var mid = document.createElement("mid" );
    document.getElementById("mid").appendChild(mid);
  if(http.readyState == 1){
  mid = document.getElementById('mid');
  	mid.style.display="block";
      mid.innerHTML = "<img src='/resultat/IMG/load.gif' width=16 height=16>&nbsp;Loading...";
   }
     else if(http.readyState == 2){
	 mid = document.getElementById('mid');
	 	mid.style.display="block";
      mid.innerHTML = "<img src='/resultat/IMG/load.gif' width=16 height=16>&nbsp;Loading...";
   }
    else if(http.readyState == 3){
	mid = document.getElementById('mid');
	 	mid.style.display="block";
      mid.innerHTML = "<img src='/resultat/IMG/load.gif' width=16 height=16>&nbsp;Loading...";
   }
else  if(http.readyState == 4){
	var response = http.responseText;
	document.getElementById('mid').style.visibility="hidden";
	if(response!=""){
		e.innerHTML=response;
		e.style.display="block";
		
	} else {
		e.style.display="none";
	}
}
}
function fnum(fel)
{
	f = document.getElementById(fel);
  	f.style.display="block";
	f.innerHTML = "<img src='/resultat/IMG/saved.png' width=16 height=16>&nbsp;<b>Sauvegard&eacute;e</b>"; 
	
}
function fdel(fe)
{
	fz = document.getElementById("f"+fe);
  	fz.style.display="block";
	fz.innerHTML = "	<a href=\"#\" ONCLICK=\"autosuggest3('"+fe+"','1');fnum('f"+fe+"');Modalbox.show(this.ref,{title: this.title, overlayOpacity: 0.1}); return false;\" style=\"color:blue;\"><img src=\"/resultat/save.png\"  > Sauvegarder</a>";
	 
}
  