// JavaScript Document
$(function() {
		$("#accordion").accordion({
			collapsible: true,
			autoHeight: false,
			active: false
			});
			
//***********google map******************/



		
//*********************		reafficher les nombre de resultat a cote de chaque affinition
var unefois=$('#declencheuraffinedefault').val();
if(unefois==0){
affinedefault();
$('#declencheuraffinedefault').val('1');

}

//**********************
$('.bubbleInfopres').each(function () {

    // options
    var distance = 0;
    var time = 0;
    var hideDelay = 0;

    var hideDelayTimer = null;

    // tracker
    var beingShown = false;
    var shown = false;
    
    var trigger = $('.trigger', this);
    var popup = $('.popuppres', this).css('opacity', 0);

    // set the mouseover and mouseout on both element
    $([trigger.get(0), popup.get(0)]).mouseover(function () {
      // stops the hide event if we move from the trigger to the popup element
      if (hideDelayTimer) clearTimeout(hideDelayTimer);

      // don't trigger the animation again if we're being shown, or already visible
      if (beingShown || shown) {
        return;
      } else {
        beingShown = true;

        // reset position of popup box
        popup.css({
          top: 20,
          left: 100,
          display: 'block' // brings the popup back in to view
        })

        // (we're using chaining on the popup) now animate it's opacity and position
        .animate({
          top: '-=' + distance + 'px',
          opacity: 1
        }, time, 'swing', function() {
          // once the animation is complete, set the tracker variables
          beingShown = false;
          shown = true;
        });
      }
    }).mouseout(function () {
      // reset the timer if we get fired again - avoids double animations
      if (hideDelayTimer) clearTimeout(hideDelayTimer);
      
      // store the timer so that it can be cleared in the mouseover if required
      hideDelayTimer = setTimeout(function () {
        hideDelayTimer = null;
        popup.animate({
          top: '-=' + distance + 'px',
          opacity: 0
        }, time, 'swing', function () {
          // once the animate is complete, set the tracker variables
          shown = false;
          // hide the popup entirely after the effect (opacity alone doesn't do the job)
          popup.css('display', 'none');
        });
      }, hideDelay);
    });
  });
//**********************
		
$('.bubbleInfo').each(function () {

    // options
    var distance = 0;
    var time = 0;
    var hideDelay = 0;

    var hideDelayTimer = null;

    // tracker
    var beingShown = false;
    var shown = false;
    
    var trigger = $('.trigger', this);
    var popup = $('.popup', this).css('opacity', 0);

    // set the mouseover and mouseout on both element
    $([trigger.get(0), popup.get(0)]).mouseover(function () {
      // stops the hide event if we move from the trigger to the popup element
      if (hideDelayTimer) clearTimeout(hideDelayTimer);

      // don't trigger the animation again if we're being shown, or already visible
      if (beingShown || shown) {
        return;
      } else {
        beingShown = true;

        // reset position of popup box
        popup.css({
          top: 20,
          left: 158,
          display: 'block' // brings the popup back in to view
        })

        // (we're using chaining on the popup) now animate it's opacity and position
        .animate({
          top: '-=' + distance + 'px',
          opacity: 1
        }, time, 'swing', function() {
          // once the animation is complete, set the tracker variables
          beingShown = false;
          shown = true;
        });
      }
    }).mouseout(function () {
      // reset the timer if we get fired again - avoids double animations
      if (hideDelayTimer) clearTimeout(hideDelayTimer);
      
      // store the timer so that it can be cleared in the mouseover if required
      hideDelayTimer = setTimeout(function () {
        hideDelayTimer = null;
        popup.animate({
          top: '-=' + distance + 'px',
          opacity: 0
        }, time, 'swing', function () {
          // once the animate is complete, set the tracker variables
          shown = false;
          // hide the popup entirely after the effect (opacity alone doesn't do the job)
          popup.css('display', 'none');
        });
      }, hideDelay);
    });
  });	
	
	


//**********************

  });
  
//--------------
function afficherca(ca){
fermertout();
var elt=ca.id;
$('#'+elt).parent().find('.bubbleInfochambre').each(function () {

    // options
    var distance = 0;
    var time = 0;
    var hideDelay = 0;
	 var topy=(100);
    var lefty=(screen.width-500)/2;
    var hideDelayTimer = null;

    // tracker
    var beingShown = false;
    var shown = false;
    
    var trigger = $('.trigger', this);
    var popup = $('.popupchambre', this).css('opacity', 0);
	
    // set the mouseover and mouseout on both element
     
	
        // reset position of popup box
        popup.css({
		position:'fixed',
          top:topy,
          left:lefty,
          display: 'block' // brings the popup back in to view
        })

        // (we're using chaining on the popup) now animate it's opacity and position
        .animate({
          top: '-=' + distance + 'px',
          opacity: 1
        }, time, 'swing', function() {
          // once the animation is complete, set the tracker variables
         
        });
      
   
	
  });
}
//---------------------
function fermerca(ca){

var id=ca.id;
	
          $('#'+id).parent().parent().css('display', 'none');
        
         
      
   
  
}  
function fermertout(){


	
          $('.popupchambre').css('display', 'none');
        
         
      
   
  
}  
//**********************
			

function changerEtat60(check){

	
		var hidden60=$("#hidden60").val();
	
		if((hidden60 % 2)!=0 ){
		$("#img60").replaceWith("<img id='img60' src='images/commun/rech_plein.gif'  width='22' height='20' name='type'  value='60' class='in_text_rech'  onclick='changerEtat60(this);'/> ");
		$("#hidden60").val("0");
		$("#fourchette60").val("60");
		}
		else{
		$("#img60").replaceWith("<img  id='img60' src='images/commun/rech_vide.gif' width='22' height='20' name='type'  value='60' class='in_text_rech'  onclick='changerEtat60(this);'/>");
		$("#hidden60").val("1");
		$("#fourchette60").val("");
			}
		
	}
	
function changerEtat100(check){
	
	
		
		var hidden100=$("#hidden100").val();
		if((hidden100 % 2)!=0 ){
		$("#img100").replaceWith("<img id='img100' src='images/commun/rech_plein.gif' width='22' height='20' name='type'  value='100' class='in_text_rech'  onclick='changerEtat100(this);'/> ");
		$("#hidden100").val("0");
		$("#fourchette100").val("100");
		}
		else{
		$("#img100").replaceWith("<img id='img100' src='images/commun/rech_vide.gif' width='22' height='20' name='type'  value='100' class='in_text_rech'  onclick='changerEtat100(this);'/>");
		$("#hidden100").val("1");
		$("#fourchette100").val("");
			}
		}
function changerEtat150(check){
	
	
		
		var hidden150=$("#hidden150").val();
		if((hidden150 % 2)!=0 ){
		$("#img150").replaceWith("<img id='img150' src='images/commun/rech_plein.gif' width='22' height='20' name='type'  value='150' class='in_text_rech'  onclick='changerEtat150(this);'/>  ");
		$("#hidden150").val("0");
		$("#fourchette150").val("150");
		}
		else{
		$("#img150").replaceWith("<img id='img150' src='images/commun/rech_vide.gif' width='22' height='20' name='type'  value='150' class='in_text_rech'  onclick='changerEtat150(this);'/> ");
		$("#hidden150").val("1");
		$("#fourchette150").val("");
			}
		}
function changerEtat250(check){
	
	
		
		
		var hidden250=$("#hidden250").val();
		if((hidden250 % 2)!=0 ){
		$("#img250").replaceWith("<img id='img250' src='images/commun/rech_plein.gif' width='22' height='20' name='type'  value='250' class='in_text_rech'  onclick='changerEtat250(this);'/>    ");
		$("#hidden250").val("0");
		$("#fourchette250").val("250");
		}
		else{
		$("#img250").replaceWith("<img id='img250' src='images/commun/rech_vide.gif' width='22' height='20' name='type'  value='250' class='in_text_rech'  onclick='changerEtat250(this);'/>  ");
		$("#hidden250").val("1");
		$("#fourchette250").val("");
			}
		}
		
		
		function changerEtat251(check){
	
	
		
		
		var hidden251=$("#hidden251").val();
		if((hidden251 % 2)!=0 ){
		$("#img251").replaceWith("<img id='img251' src='images/commun/rech_plein.gif' width='22' height='20' name='type'  value='250' class='in_text_rech'  onclick='changerEtat251(this);'/>     ");
		$("#hidden251").val("0");
		$("#fourchette251").val("251");
		}
		else{
		$("#img251").replaceWith("<img id='img251' src='images/commun/rech_vide.gif' width='22' height='20' name='type'  value='250' class='in_text_rech'  onclick='changerEtat251(this);'/>  ");
		$("#hidden251").val("1");
		$("#fourchette251").val("");
			}
		}
				
function reafficher_critere251(){
$("#img251").replaceWith("<img id='img251' src='images/commun/rech_plein.gif' width='22' height='20' name='type'  value='250' class='in_text_rech'  onclick='changerEtat251(this);'/>     ");
		$("#hidden251").val("0");
		$("#fourchette251").val("251");


}
function reafficher_critere60(){
$("#img60").replaceWith("<img id='img60' src='images/commun/rech_plein.gif'  width='22' height='20' name='type'  value='60' class='in_text_rech'  onclick='changerEtat60(this);'/> ");
		$("#hidden60").val("0");
		$("#fourchette60").val("60");

}
function reafficher_critere100(){
$("#img100").replaceWith("<img id='img100' src='images/commun/rech_plein.gif' width='22' height='20' name='type'  value='100' class='in_text_rech'  onclick='changerEtat100(this);'/> ");
		$("#hidden100").val("0");
		$("#fourchette100").val("100");


}
function reafficher_critere150(){
$("#img150").replaceWith("<img id='img150' src='images/commun/rech_plein.gif' width='22' height='20' name='type'  value='150' class='in_text_rech'  onclick='changerEtat150(this);'/>  ");
		$("#hidden150").val("0");
		$("#fourchette150").val("150");


}
function reafficher_critere250(){
$("#img250").replaceWith("<img id='img250' src='images/commun/rech_plein.gif' width='22' height='20' name='type'  value='250' class='in_text_rech'  onclick='changerEtat250(this);'/>     ");
		$("#hidden250").val("0");
		$("#fourchette250").val("250");


}














	
		
		
	//affichher zone de recherche head
function afficherZoneRecherche(){
$("#ville1").removeAttr("checked");
$("#suggestion1").attr("checked","checked");
		$("#listeVille").hide();
		$("#txtSearch").show();
	 $("#form1").attr( "action","AfficherResultats1.php");

 $("#btnseek").replaceWith(" <input type='submit' name='type' class='in_sub' value='Voir l&rsquo;hôtel' id='btnseek1'/>");
		}
		//fin affichher zone de recherche head
//affichher liste ville head		
function afficherVille(){
$("#suggestion1").removeAttr("checked");
$("#ville1").attr("checked","checked");
		$("#listeVille").show();
		$("#txtSearch").hide();
		$("#txtSearch").val("");
		$("#search_suggest").hide();
            $("#form1").attr( "action","seekresult.php");

		
$("#btnseek1").replaceWith(" <input type='submit' name='type' class='in_sub' value='Chercher' id='btnseek'/>");
		}		
//affichher liste ville head		
		