<!--//
function pageVide(){
	//$('attente').style.visibility="hidden";
	Element.hide('attente');
	$('listehotel').innerHTML="";
	$('recap').innerHTML="";
	Element.hide('listehotel');
}
function dispo(tr,tri,prixminiSel,prixmaxSel,rechar,nbpage){
	//new Draggable('listehotel',{snap:true,revert:true});
	var tri;
	var tr;
	var prixminiSel;
	var prixmaxSel;
	var rechar;
	var nbpage;
	if(!prixminiSel)prixminiSel="";
	if(!prixmaxSel)prixmaxSel="";
	if(!rechar)rechar="";
	if(!nbpage)nbpage="";
	if(!tri)tri="";
	
	if(rechar){
		if(document.formEtoile){
			decoche("all");
			nbetoile="";
		}
		listamenities="";
	}
	
	var pars="datea="+document.quickbook.datea.value+"&villeresa="+document.quickbook.villeresa.value+"&nbNuit="+document.quickbook.nbNuit.value+"&btnreserver="+rechar ;
	if(document.formNear){
		if(document.formNear.near.length > 0 ){
			pars+= "&near=" + document.formNear.near.options[document.formNear.near.selectedIndex].value;
		}
	}
	pars+="&rech_trie="+tri+"&tr="+tr+"&prixminiSel="+prixminiSel+"&prixmaxSel="+prixmaxSel+"&nbpage="+nbpage;
	
	if(document.formEtoile){
	nbetoile = joinChamps("formEtoile","etoile");
	if(nbetoile)
		pars+="&nbetoile="+nbetoile;
	}
	/*listamenities = joinChamps("formAmenities","amenities");
	if(listamenities)
	pars+="&listamenities="+listamenities;
	*/
	pageVide();
	
	//,dated=document.quickbook.dated.value
	ajax =  new Ajax.Updater('listehotel',    // DIV id must be declared before the method was called
                           '/dispo.php',     // URL
                           {                // options
                           	method:'post',
                           	parameters: pars,
                           	evalScripts:true,
                           	'onLoading':registerLoaded,
                           	'onSuccess':showResponse 
												    });
}
function showResponse(originalRequest){
	//$('attente').style.visibility="hidden";
	usleep();
	closeLoaded();
	//if($('attente')){
	//alert("fin");
//	$('listehotel').style.visibility="visible";
		Effect.toggle('listehotel');
	//}
}
function registerLoaded(){
	//alert("Ouvrir");
	 Dialog.info($('attente').innerHTML, {windowParameters: {className:"chargement", showEffect:Element.show,hideEffect:Element.hide}});
}
function closeLoaded(){
	//alert("Fermer");
	Dialog.closeInfo() ;
	//return true;
}
function pop_hotel(id){
	
	var pars="idH="+id;
	
	Windows.closeAll();

	win = new Window('window_hotel', {className:"dialog", width:520, height:300, showEffect:Effect.BlindDown,hideEffect:Effect.BlindUp}); 
	
	win.setAjaxContent('/pop-fiche-hotel.php',
												{
													method:'post', 
													parameters: pars,
                          evalScripts:true,
                          'onLoading':registerLoaded,
                          'onSuccess':closeLoaded 
                         },
                        true,alert);
	//win.WindowUtilities.enableScreen();
	//win.showCenter(); 	
	win.toFront()
  win.setDestroyOnClose(); 
 }

function pop_picto(id){
	
	var pars="idH="+id;
	
	Windows.closeAll();

	win = new Window('window_hotel', {className:"dialog", width:500, height:510, showEffect:Effect.BlindDown,hideEffect:Effect.BlindUp}); 
	
	win.setAjaxContent('/pop-picto.php',
												{
													method:'post', 
													parameters: pars,
                          evalScripts:true 
                         },
                        true,alert);
	//win.WindowUtilities.enableScreen();
	//win.showCenter(); 	
	win.toFront()
  win.setDestroyOnClose(); 
 }
  
function pop_comparer(pars){
	
	var pars;
  if($("window_comparer")){win.destroy();}
	Windows.closeAll();
		
	win = new Window('window_comparer', {className:"dialog", width:700, height:450, showEffect:Effect.BlindDown,hideEffect:Effect.BlindUp}); 
	win.setAjaxContent('/pop-comparer.htm',
											{
												method:'post', 
												parameters: pars, 
												evalScripts:true
											},
											true,alert);
	
	win.toFront()
  win.setDestroyOnClose(); 
}
function valide_pop_comparer(){
	
	var pars;
	if(document.max3produit){
		nbcomp = joinChamps("max3produit","choixid");
	}
	
	win.destroy();
		
	pars="choixid="+	nbcomp;
	
	pop_comparer(pars);
}
function selectionCaddy(actions,contenu){
	var pars="votreSelection=1&actions="+actions+"&contenu="+contenu;
	//alert("selectionCaddy");	
	ajax =  new Ajax.Updater('afficheSelect',    // DIV id must be declared before the method was called
                           '/afficheSelect.php',     // URL
                           {                // options
                           	method:'post',
                           	parameters: pars,
                           	evalScripts:true,
                           	'onSuccess':showAfficheSelect 
									    			});
}
function showAfficheSelect(originalRequest){
	Element.show('afficheSelect');
}

function lastCaddy(nomDiv,nomsession,nom,url){
	var pars="dernierHotelVu=1&nomDiv="+nomDiv+"&nomsession="+nomsession+"&nom="+nom+"&url="+url;
//	alert("lastCaddy"+nomDiv+"   "+nom);
	ajax =  new Ajax.Updater('afficheLastHotel',    // DIV id must be declared before the method was called
                           '/afficheSelect.php',     // URL
                           {                // options
                           	method:'post',
                         
                           	parameters: pars,
                           	evalScripts:true
                         });
                      //   usleep();
                        
}

function usleep(){
	var	startDate = new Date();
 	var diffDate=0;
	var i=1;
		
	while( diffDate < 700 ){
		var	endDate = new Date();
		diffDate=endDate-startDate;
		i++;
		if(i>5)break; 
	}
}
//-->
