// JavaScript Document<script type="text/javascript"> 
listeactive=false;
longueurliste=1;

function noHtml(txt) 
{
a = txt.indexOf('<');
b = txt.indexOf('>');
len = txt.length;
c = txt.substring(0, a);
if(b == -1) 
{
      b = a;
 }
   d = txt.substring((b + 1), len);
   txt = c + d;
   cont = txt.indexOf('<');
   if (cont != -1) {
      txt = noHtml(txt);
    }
   return txt;
 }
function verifPseudo2(pseudo,evenement)
     {
		 
	 if(pseudo.length>2)
	{
file4('http://www.zenvoyages.com/do.php?pseudo='+pseudo,evenement);
    var key = window.event ? evenement.keyCode : evenement.which;
	if (key == 40) 
	paser("1");
if (key == 13)
	{
	  liste=document.getElementById("choix4");
	//var i=liste.selectedIndex;
 
	 texte =noHtml(Tableau[i+1]);
	 red=texte.split("@@");
	window.location.href=red[1];

	document.recherche.motcle.value=red[0];
	
	var sv4=document.getElementById("tdprov2");
		while ( sv4.firstChild != null ) { 
			 sv4.removeChild(sv4.firstChild) ; 
		}document.recherche.motcle.focus();
}
	}else
	 {var sv4=document.getElementById("tdprov2");
		while ( sv4.firstChild != null ) { 
			 sv4.removeChild(sv4.firstChild) ; 
		}
		 }
	 }
	 

function ajout4(){

var sv4=document.getElementById("tdprov2");

//var style=this.currentStyle;

while ( sv4.firstChild != null ) { 
			 sv4.removeChild(sv4.firstChild) ; 
		}


		/*		
new_liste = document.createElement("div");
sv4.appendChild(new_liste);
sv4.style.display="";
new_liste.setAttribute("id", "choix4");
new_liste.setAttribute("name", "choix4");
new_liste.style.background = "#F6F9FC";
new_liste.style.width="450px";
*/
var text="";
for (var i=1; i<Tableau.length; i++) {
Table=noHtml(Tableau[i]).split("@@");
if(i==1)text+="<div id=\"choix4\" name=\"choix4\" style=\"width:450px;background:#F6F9FC;\" ><div align=\"right\" ><a href=\"javascript:vider()\" class=\"fermer\">fermer<img src=\"http://www.zenvoyages.com/images/close.png\" border=\"0\" /></a></div><ul id=\"uli\">";
text+="<li onKeyUp=\"paser2(event,"+i+")\" id=\"list"+i+"\"><a href=\""+Table[1]+"\" class=\"lien\">&nbsp;&nbsp;"+Table[0]+"</a></li>";
if(i==Tableau.length-1)text+="</ul></div>";


}
document.getElementById("tdprov2").innerHTML=text;
//new_liste.style.position="absolute";
}



function paser(i)
{
var lis="list"+i;
var sel = document.getElementById(lis); 
//document.recherche.motcle.value=noHtml(Tableau[1]);
	//document.recherche.ville1.value=villeita(document.recherche.motcle.value);
	document.getElementById("uli").focus();
/*sel.style.background = "#2A71C0";
sel.style.color = "#ffffff";*/
		
}
function paser2(evenement,i)
{

var key = window.event ? evenement.keyCode : evenement.which;
	if (key == 40) 
	paser(i);
		
}



////
xhr_object=null;
function file4(fichier,evenement)
     {if(xhr_object&&xhr_object.readyState==1)
	 xhr_object.abort();
	if(window.XMLHttpRequest) // Firefox et autres
	   xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject){ // Internet Explorer 
	   try {
                xhr_object = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                xhr_object= new ActiveXObject("Microsoft.XMLHTTP");
            }
	}
	else { // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   xhr_object = false; 
	}
	xhr_object.open("GET", fichier,true); 
	  xhr_object.setRequestHeader("Cache-Control","no-cache");
     xhr_object.send(null); 
	xhr_object.onreadystatechange = function(){
		if(xhr_object.readyState == 4)
		{
	retour= xhr_object.responseText;
Tableau=retour.split("**");	
longueurliste=Tableau.length;
if(longueurliste==1)
{var sv4=document.getElementById("tdprov2");
		while ( sv4.firstChild != null ) { 
			 sv4.removeChild(sv4.firstChild) ; 
		}}
if(longueurliste>1)
{
ajout4();


    }
	}

     
    
	}}
	
	
function vider()
{
	var sv4=document.getElementById("tdprov2");
		while ( sv4.firstChild != null ) { 
			 sv4.removeChild(sv4.firstChild) ; 
		}
	}


