function produit(reference,libelle_hotel,prix,prix_promo,pourcent,formule,img_p,categorie,acroche,date,date_fin,ville,depart,retour)
{
var chaine="";
lienhotel=libelle_hotel;

var esp=lienhotel.length;
if(lienhotel.charAt(esp-1)==' ') esp=esp-1;
var lienhot="";
for(s=0;s<esp;s++) lienhot+=lienhotel.charAt(s);
lienhotel=lienhot;

while(lienhotel.match(/ /))
{
lienhotel=lienhotel.replace(/ /,"-");
}
lien_hotel=lienhotel.toLowerCase();

vill=ville
while(vill.match(/ /))
{
vill=vill.replace(/ /,"-");
}
ville=vill.toLowerCase();

avis_hotel=libelle_hotel;
while(avis_hotel.match(/ /))
{
avis_hotel=avis_hotel.replace(/ /,"_");
}
avis_hotel=avis_hotel;
		
chaine+='<div class="top_resultat2">';
chaine+='<div>';
chaine+='<div style="float:left;"><img src="http://www.tunisiebooking.com/images/icone_hotel.gif" border="0" align="absmiddle" /></div>';
chaine+='<div class="libellehotel"><a href="http://www.tunisiebooking.com/hotel-tunisie/'+ville+'/hotels/hotel-'+lien_hotel+'-'+ville+'.html" class="libellehotel">'+libelle_hotel+'</a>';
chaine+='&nbsp;&nbsp;';
for(i=0;i<categorie;i++){
chaine+='<img src="http://www.tunisiebooking.com/images/etoile_orange.gif">';
}
for(j=0;j<(5-i);j++){
chaine+='<img src="http://www.tunisiebooking.com/images/etoile_blanc.gif">'; 
}
chaine+='</div>';
chaine+='</div>';
chaine+='</div>';
chaine+='<div class="top_resultat3">';
chaine+='<div>';
chaine+='<form action="http://www.tunisiebooking.com/hotel-tunisie/'+ville+'/hotels/hotel-'+lien_hotel+'-'+ville+'.html" method="post">';
chaine+='<div class="img_hotel" style="float:left">';
chaine+='<input type="hidden" value="'+reference+'" name="id_hotel" />';
chaine+='<input type="hidden" value="';
if(!depart) chaine+=date; else chaine+=depart;
chaine+='" name="depart" />';
chaine+='<input type="hidden" value="';
if(!retour) chaine+=date_fin; else chaine+=retour;
chaine+='" name="retour" />';
chemin=img_p;
//chemin=chemin.replace("http://www.tunisiebooking.com/","");
chaine+='<input name="image" type="image" src="http://www.tunisiebooking.com/resize.php?img='+chemin+'&width=61&height=60" align="absmiddle" />'; 
chaine+='</div>';
chaine+='</form>';
chaine+='<div style="float:left;margin:10px;width:300px;text-align:justify;">';
 
carap=" ";
nombre = acroche.length; 
ip=100;
if(nombre >= 100)
{
carap=acroche.charAt(100);
while(carap!=" ")
{
ip=ip-1;
carap=acroche.charAt(ip);
}
}
acroche=acroche.slice(0, ip);
chaine+= acroche;
if(nombre>100) chaine+= "...";

chaine+='<br /><br />Offres valables pour un séjour entre le ';
if(!depart) chaine+=date; else chaine+=depart;
chaine+=' et le ';
if(!retour) chaine+=date_fin; else chaine+=retour;
chaine+='<br /><br />';
chaine+='<a href="http://www.tunisiebooking.com/hotel-tunisie/'+ville+'/hotels/hotel-'+lien_hotel+'-'+ville+'.html" class="link_orange">Plus de détails</a> <font color="#F38709">|</font> ';
chaine+='<form action="http://www.tunisiebooking.com/hotel-tunisie/'+ville+'/hotels/hotel-'+lien_hotel+'-'+ville+'.html" method="post" name="favis_'+avis_hotel+'" id="favis_'+avis_hotel+'">';
chaine+='<input type="hidden" name="avis" value="avis" />';
chaine+='<a onclick="document.favis_'+avis_hotel+'.submit()" class="link_orange" style="cursor:pointer;"> Avis </a>';
chaine+='</form>';                   
chaine+='</div>';
chaine+='<div style="float:left;margin-left:5px;padding-top:33px;background:url(http://www.tunisiebooking.com/images/et_1.gif);width:59px;height:39px;text-align:center;color:#FFFFFF;font-weight:bold;font-family:Arial narrow"><span class="pourcent">-</span><span class="pourcent">'+pourcent+'</span><span style="font-size:13px"><sup>%</sup></span></div>';
chaine+='<div style="float:left; margin-left:10px; margin-top:20px;text-align:center;">';
chaine+='<span style="color:#E06B25;font-size:16px;font-weight:bold;">'+prix_promo+'</span> au lieu de <span style="font-size:12px;color:#E06B25;"><S>'+prix+'</S></span><br /><br />';
chaine+='<form action="http://www.tunisiebooking.com/hotel-tunisie/'+ville+'/hotels/hotel-'+lien_hotel+'-'+ville+'.html" method="post">';
chaine+='<input type="hidden" value="'+reference+'" name="id_hotel" />';
chaine+='<input type="hidden" value="';
if(!depart) chaine+=date; else chaine+=depart;
chaine+='" name="depart" />';
chaine+='<input type="hidden" value="';
if(!retour) chaine+=date_fin; else chaine+=retour;
chaine+='" name="retour" />';
chaine+='<input type="image" src="http://www.tunisiebooking.com/images/tarif_dispo.gif" border="0" />';
chaine+='</form></div>';
chaine+='</div>';
chaine+='</div>';

 return chaine;
}
function file(deb,pas,total,ville,categorie,depart,retour,devises)
     {
	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.tunisiebooking.com/requette_promo_pg.php?deb="+deb+"&pas="+pas+"&ville="+ville+"&categorie="+categorie+"&depart="+depart+"&retour="+retour+"&devises="+devises;
	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)
		{
						prod= xhr_object.responseText;
					Tableau=prod.split("##");	
					longueurliste=Tableau.length;
					var chaine="";
					x=(deb*5)+1;
					for(a=0;a<(longueurliste-1);a++)
					{
					detail=Tableau[a].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],depart,retour);
					x++;
					}
					
               document.getElementById("res").innerHTML=chaine;
			 
			  
		  
			   pagination="";
			   pagination+="Pages : ";
			   if(deb!=0)
			   pagination+="<a href=\"javascript:file("+(deb-1)+","+pas+","+total+",'"+ville+"','"+categorie+"','"+depart+"','"+retour+"','"+devises+"'"+");\" class=\"offerprice\"> &laquo; </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(s=prem;s<fin;s++)
						{
						num=s+1;
						
						if(s==deb)
						{
						if(s!=prem) pagination+="<span> | </span>";
						pagination+="<span class=\"offerprice\">"+num+"</span> ";
						}
						else
						{
						if(s!=prem) pagination+="<span> | </span>";
						pagination+="<a href=\"javascript:file("+(num-1)+","+pas+","+total+",'"+ville+"','"+categorie+"','"+depart+"','"+retour+"','"+devises+"');\">"+num+"</a> "; 
						 }
						 }
						 
	   			pagination+="<span class=\"offerprice\"> | </span>";
				
				if((deb+1)<(total/pas))
				pagination+="<a href=\"javascript:file("+(deb+1)+","+pas+","+total+",'"+ville+"','"+categorie+"','"+depart+"','"+retour+"','"+devises+"');\" class=\"offerprice\" > &raquo; "+" "+"</a> ";
			   document.getElementById("page").innerHTML=pagination;
			   document.getElementById("page_haut").innerHTML=pagination;
			   }
	
}