<!--//

function selectedValue(selBox) {
  return selBox.options[selBox.selectedIndex].value;
}

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+"&dated="+document.quickbook.dated.value+"&villeresa="+document.quickbook.villeresa.value+"&nbNuit="+document.quickbook.nbNuit.value+"&btnreserver="+rechar 
	//var pars="datea="+document.quickbook.datea.value+"&dated="+document.quickbook.dated.value+"&villeresa="+selectedValue(document.quickbook.villeresa)+"&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";
	closeLoaded();
	//if($('attente')){
	//alert("fin");
		Effect.toggle('listehotel');
	//}
}
function registerLoaded(){
	 Dialog.info($('attente').innerHTML, {windowParameters: {className:"chargement", showEffect:Element.show,hideEffect:Element.hide}});
}
function closeLoaded(){
	Dialog.closeInfo() ;
	//return true;
}
function pop_hotel(id){
	
	var pars="id="+id;
	
	Windows.closeAll();

	win = new Window('window_hotel', {className:"dialog", width:700, height:450, 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_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="actions="+actions+"&contenu="+contenu;
		
	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="nomDiv="+nomDiv+"&nomsession="+nomsession+"&nom="+nom+"&url="+url;
	
	ajax =  new Ajax.Updater(nomDiv,    // DIV id must be declared before the method was called
                           '/afficheLast.php',     // URL
                           {                // options
                           	method:'post',
                           	parameters: pars,
                           	evalScripts:true
                         });
}
//-->
