function avis(reference)
{
var td="avisss_"+reference;
if(document.getElementById(td).className=="avisss2")
document.getElementById(td).className="avisss";
else document.getElementById(td).className="avisss2";


}

function voir_dest(idDiv,idPage)
{
classTmp="VT_6";		
document.getElementById('div_VT_6').setAttribute("className",classTmp);	
document.getElementById('div_VT_6').setAttribute("class",classTmp);
}
function fermer6()
{	
document.getElementById('div_VT_6').setAttribute("class"," cache");
document.getElementById('div_VT_6').setAttribute("className"," cache");
}

function voir_tout(idDiv,idPage)
{
classTmp="VT_3";		
document.getElementById('div_VT_3').setAttribute("className",classTmp);	
document.getElementById('div_VT_3').setAttribute("class",classTmp);
}

function voir_guide(idDiv,idPage)
{
classTmp="VT_8";		
document.getElementById('div_VT_8').setAttribute("className",classTmp);	
document.getElementById('div_VT_8').setAttribute("class",classTmp);
}

function voir_ville(idDiv,idPage)
{
classTmp="VT_2";		
document.getElementById('div_VT_2').setAttribute("className",classTmp);	
document.getElementById('div_VT_2').setAttribute("class",classTmp);
}
function voir_date(idDiv,idPage)
{
classTmp="VT_4";		
document.getElementById('div_VT_4').setAttribute("className",classTmp);	
document.getElementById('div_VT_4').setAttribute("class",classTmp);
}
function voir_frs(idDiv,idPage)
{
classTmp="VT_5";		
document.getElementById('div_VT_5').setAttribute("className",classTmp);	
document.getElementById('div_VT_5').setAttribute("class",classTmp);
}
function voir_pays(idDiv,idPage)
{
classTmp="VT_1";		
document.getElementById('div_VT_1').setAttribute("className",classTmp);	
document.getElementById('div_VT_1').setAttribute("class",classTmp);
}
function fermerr()
{	
document.getElementById('div_VT_3').setAttribute("class"," cache");
document.getElementById('div_VT_3').setAttribute("className"," cache");
}
function fermer1()
{	
document.getElementById('div_VT_4').setAttribute("class"," cache");
document.getElementById('div_VT_4').setAttribute("className"," cache");
}
function fermer2()
{	
document.getElementById('div_VT_2').setAttribute("class"," cache");
document.getElementById('div_VT_2').setAttribute("className"," cache");
}
function fermer3()
{	
document.getElementById('div_VT_5').setAttribute("class"," cache");
document.getElementById('div_VT_5').setAttribute("className"," cache");
}
function fermer4()
{	
document.getElementById('div_VT_1').setAttribute("class"," cache");
document.getElementById('div_VT_1').setAttribute("className"," cache");
}
function fermer8()
{	
document.getElementById('div_VT_8').setAttribute("class"," cache");
document.getElementById('div_VT_8').setAttribute("className"," cache");
}

Nom = navigator.appName;

ns = (Nom == 'Netscape') ? 1:0
ie = (Nom == 'Microsoft Internet Explorer') ? 1:0

function nompropre(mot) {
var m=mot.charAt(0).toUpperCase() +
mot.substring(1).toLowerCase();
return m;
}
function ouvre_popup(page)
{
window.open(page,"Avis","top=0 , left=0 , resizable=yes, toolbar=no, scrollbars=yes, menubar=no, location=no, statusbar=no ,width=" + screen.width + ",height=" + screen.height);
}
function popup_photo(page) 
{
window.open(page,"Photo","menubar=no, status=no, scrollbars=yes, menubar=no, left=100, width=850, height=480");
}

function produit(reference,formule,theme,libelle_fournisseur,red_fournisseur,libelle_hotel,img_hotel,taxe,libelle_region,libelle_ville,prix,nuit,date_dep,villedep,ville,autre,id_hv,avi,villedest,depart,m,budget,voyagiste,x,popularite,vip,valeur,unite,photo1,photo2,photo3,photo4,photo5,photo6,destination,logo_fournisseur,id_tarif)
{
var chaine="";

plus=avi.split("***");
			
row=plus[2];		   
avis_plus=plus[0];

/////////////////////////////////////
chaine+="<div id=\"proddet\">";
chaine+="<div id=\"titre_prod\">";
chaine+="Voyage "+nompropre(destination);
		dep=m;
		 while(dep.match(/_/))
		{
		dep=dep.replace(/_/," ");
		}
		datdep=dep;

					 if(villedest!='')  chaine+=" "+villedest;
                     if(budget!='')  chaine+=" "+budget;
                     if(m!='')  chaine+=" "+datdep;
                     if(depart!='')  chaine+=" au départ de "+depart;
                     if(voyagiste!='')  chaine+=" avec "+voyagiste;
chaine+="</div>";
chaine+="<div id=\"divimgres\"><a href=\""+red_fournisseur+"?reference="+reference;
 chaine+="&id_tarif="+id_tarif;
chaine+="\"  rel=\"nofollow\" target=\"_blank\"><img src=\""+img_hotel+"\"/></a></div>";
chaine+="<div id=\"detaprods\">";
chaine+="<div id=\"destprod\"><a href=\""+red_fournisseur+"?reference="+reference;
 chaine+="&id_tarif="+id_tarif;
chaine+="\"  rel=\"nofollow\" target=\"_blank\"><span class=\"titre_bleu\">Sejour "+libelle_region+" "+libelle_ville+"</span></a><br />";
label=libelle_hotel.replace("hotel ","");
		 while(label.match(/ /))
		{
		label=label.replace(" 1*","");
		label=label.replace(" 2*","");
		label=label.replace(" 3*","");
		label=label.replace(" 4*","");
		label=label.replace(" 5*","");
		label=label.replace(/ /,"_");
		}
		libelle="hotel-"+label;
				liendest=destination;
		 while(liendest.match(/ /))
		{
		liendest=liendest.replace(/ /,"_");
		}
		lien_destination=liendest;
		
		lienavis=libelle_hotel;
		 while(lienavis.match(/ /))
		{
		lienavis=lienavis.replace(/ /,"-");
		}
		lien_avis="critique-"+lienavis;


		lienville=libelle_ville;
		 while(lienville.match(/ /))
		{
		lienville=lienville.replace(/ /,"_");
		}
		lien_ville=lienville;
		
chaine+="<a href=\"http://www.zenvoyages.com/reservation-"+libelle+"-"+lien_destination.toLowerCase()+"-"+lien_ville.toLowerCase()+".html\" >"+libelle_hotel+"</a><br />Voyage ";

if (nuit!=0) designation=nuit+" nuits "+formule+" départ "+villedep; 
chaine+=designation+"<br />";
chaine+="<strong>Autre d&eacute;part </strong>";

if(depart!="")
{
chaine+=depart;
}
else
{
Tabl=ville.split("::");	
longueur=Tabl.length;

for(ii=0;ii<(longueur-1);ii++)
{
if(ii!=0)
chaine+=" ";
chaine+=Tabl[ii];
}
}
chaine+="</div>",
chaine+="<div id=\"voirdet\">";
chaine+="<a href=\"http://www.zenvoyages.com/reservation-"+libelle+"-"+lien_destination.toLowerCase()+"-"+lien_ville.toLowerCase()+".html\">";
chaine+="<div id=\"voirplusdet\"></div>";
chaine+="</a>";
chaine+="<div style=\"float:right; margin-right:20px; cursor:pointer;\" onclick=\"avis('"+reference+"_"+villedep+"')\">"; 
if(row!=0){
chaine+="<u>"+row+" Avis</u>";
}
chaine+="</div></div></div><div id=\"prodprix\">";
chaine+="<div id=\"logfour_prix\"><img src=\""+logo_fournisseur+"\" border=\"0\" /><br />"+prix+"€</div>";
chaine+="<a href=\""+red_fournisseur+"?reference="+reference;
 chaine+="&id_tarif="+id_tarif;
chaine+="\"  rel=\"nofollow\" target=\"_blank\"><div id=\"voiroff\">Voir Offre</div></a></div></div>";
chaine+="<div id=\"avisss_"+reference+"_"+villedep+"\" class=\"avisss\">";
chaine+="<div id=\"divavis\">";

carap=" ";
nb_plus = avis_plus.length; 
ip=170;
if(nb_plus >= 170)
{
					
carap=avis_plus.charAt(170);
				
while(carap!=" ")
{
ip=ip-1;
carap=avis_plus.charAt(ip);
}
}
avis_plus=avis_plus.slice(0, ip);
chaine+= avis_plus;
if(nb_plus>170) chaine+= "...";
chaine+="<a href=\"http://www.zenvoyages.com/reservation-"+libelle+"-"+lien_destination.toLowerCase()+"-"+lien_ville.toLowerCase()+".html\" style=\"cursor:pointer\" rel=\"nofollow\">";
chaine+=" Lire la suite";
chaine+="</a>";
chaine+="</div></div>";


	  return chaine;
}
function file(deb,pas,destination,total,ville,depart,m,budget,voyagiste,trie)
     {
	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; 
	}
	fichier="http://www.zenvoyages.com/voyages/requette.php?deb="+deb+"&pas="+pas+"&destination="+destination+"&ville="+ville+"&depart="+depart+"&m="+m+"&budget="+budget+"&voyagiste="+voyagiste+"&trie="+trie;

	xhr_object.open("GET", fichier,false); 
	  //xhr_object.setRequestHeader("Cache-Control","no-cache");
     xhr_object.send(null); 
 Tableau =new Array();
		if(xhr_object.readyState == 4)
		{
						retour= xhr_object.responseText;
						
					Tableau=retour.split("##");	
					longueurliste=Tableau.length;
					var chaine="";
					//alert(longueurliste);
					x=(deb*8)+1;
					for(i=0;i<(longueurliste-1);i++)
					{
					detail=Tableau[i].split("@@");
					
					chaine+=produit(detail[0],detail[1],detail[2],detail[3],detail[4],detail[5],detail[6],detail[7],detail[8],detail[9],detail[10],detail[11],detail[12],detail[13],detail[14],detail[15],detail[16],detail[17],ville,depart,m,budget,voyagiste,x,detail[18],detail[19],detail[20],detail[21],detail[22],detail[23],detail[24],detail[25],detail[26],detail[27],destination,detail[28],detail[29]);
					x++;
					}
               document.getElementById("res").innerHTML=chaine;
			 
			  
			   tot=(deb+1)*pas;
			   if(tot>total) tot=total;
			   
			   document.getElementById("pos").innerHTML=tot;
			  
			   pagination="";
			   if(deb!=0)
			   pagination+="<a href=\"javascript:file("+(deb-1)+","+pas+",'"+destination+"',"+total+",'"+ville+"','"+depart+"','"+m+"','"+budget+"','"+voyagiste+"','"+trie+"');\"> < Précédent "+" "+"</a> ";

			   pagination+="<span > | </span>"; 
			   

			   
			   ///////////////////////
			   var prem=0;
			   fin=total/pas;
			   if(fin>10)
			   {
			   prem=deb;
			   if(fin-deb>10)
			   fin=prem+10;
			   else
			   fin=prem+(fin-deb);
			   
			   }
					  for(i=prem;i<fin;i++)
						{
						num=i+1;
						
						if(i==deb)
						{
						pagination+="<span class=\"offerprice\">"+num+"</span> ";
						}
						else
						pagination+="<a href=\"javascript:file("+i+","+pas+",'"+destination+"',"+total+",'"+ville+"','"+depart+"','"+m+"','"+budget+"','"+voyagiste+"','"+trie+"');\"  style=\" text-align:center;\">"+num+"</a> ";
						 }
						 
	   			pagination+="<span class=\"offerprice\"> | </span>";
				
				if((deb+1)<(total/pas))
				pagination+="<a href=\"javascript:file("+(deb+1)+","+pas+",'"+destination+"',"+total+",'"+ville+"','"+depart+"','"+m+"','"+budget+"','"+voyagiste+"','"+trie+"');\"> Suivant >"+" "+"</a> ";
			   //document.getElementById("page").innerHTML=pagination;
			   document.getElementById("page_bas").innerHTML=pagination;
			   }
	
}
function trier(deb,pas,destination,total,ville,depart,m,budget,voyagiste)
     {
	 trie=document.Hotel_Search.trie.value;
	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; 
	}
	fichier="http://www.zenvoyages.com/voyages/requette.php?deb="+deb+"&pas="+pas+"&destination="+destination+"&ville="+ville+"&depart="+depart+"&m="+m+"&budget="+budget+"&voyagiste="+voyagiste+"&trie="+trie;
 
	xhr_object.open("GET", fichier,false); 
	  //xhr_object.setRequestHeader("Cache-Control","no-cache");
     xhr_object.send(null); 
 Tableau =new Array();
		if(xhr_object.readyState == 4)
		{
						retour= xhr_object.responseText;
						
					Tableau=retour.split("##");
					longueurliste=Tableau.length;
					var chaine="";
					//alert(longueurliste);
					x=(deb*8)+1;
					for(i=0;i<(longueurliste-1);i++)
					{
					detail=Tableau[i].split("@@");
					
					chaine+=produit(detail[0],detail[1],detail[2],detail[3],detail[4],detail[5],detail[6],detail[7],detail[8],detail[9],detail[10],detail[11],detail[12],detail[13],detail[14],detail[15],detail[16],detail[17],ville,depart,m,budget,voyagiste,x,detail[18],detail[19],detail[20],detail[21],detail[22],detail[23],detail[24],detail[25],detail[26],detail[27],destination,detail[28],detail[29]);
					x++;
					}
					
               document.getElementById("res").innerHTML=chaine;
			 
			  
			   tot=(deb+1)*pas;
			   if(tot>total) tot=total;
			   
			   document.getElementById("pos").innerHTML=tot;
			  
			   pagination="";
			   if(deb!=0)
			   pagination+="<a href=\"javascript:file("+(deb-1)+","+pas+",'"+destination+"',"+total+",'"+ville+"','"+depart+"','"+m+"','"+budget+"','"+voyagiste+"','"+trie+"');\" class=\"bleudetails2\"> <img src=\"http://www.zenvoyages.com/sejours/images/flech2.gif\" align=\"absmiddle\" border=\"0\"> "+" "+"</a> ";

			   pagination+="<span class=\"offerprice\"> | </span>"; 
			   

			   
			   ///////////////////////
			   var prem=0;
			   fin=total/pas;
			   if(fin>10)
			   {
			   prem=deb;
			   if(fin-deb>10)
			   fin=prem+10;
			   else
			   fin=prem+(fin-deb);
			   
			   }
					  for(i=prem;i<fin;i++)
						{
						num=i+1;
						
						if(i==deb)
						{
						pagination+="<span class=\"offerprice\">"+num+"</span> ";
						}
						else
						pagination+="<a href=\"javascript:file("+i+","+pas+",'"+destination+"',"+total+",'"+ville+"','"+depart+"','"+m+"','"+budget+"','"+voyagiste+"','"+trie+"');\" class=\"bleudetails2\" style=\"border:1px solid #AFCCDE; text-align:center;\">"+num+"</a> ";
						 }
						 
	   			pagination+="<span class=\"offerprice\"> | </span>";
				
				if((deb+1)<(total/pas))
				pagination+="<a href=\"javascript:file("+(deb+1)+","+pas+",'"+destination+"',"+total+",'"+ville+"','"+depart+"','"+m+"','"+budget+"','"+voyagiste+"','"+trie+"');\" class=\"bleudetails2\"> <img src=\"http://www.zenvoyages.com/sejours/images/flech1.gif\" align=\"absmiddle\" border=\"0\"> "+" "+"</a> ";
			   document.getElementById("page").innerHTML=pagination;
			   document.getElementById("page_bas").innerHTML=pagination;
			   			   			   
		}
	
}

