/*************************
*     spaSearch.js
*  
* evenement jquery de la recherche spa
*************************/
 

 $(function(){
 
        
     $('#slideHomePage').cycle({ 
        fx:       'fade', 
        speed:    1000,
        pager:  '#nav'    
     });    
     
     if($.fn.lightBox)
     { 
         $('#gallerie_photos a').lightBox({
                imageLoading: 'http://www.lpgsystems.net/img/lightbox-ico-loading.gif',
                imageBtnClose: 'http://www.lpgsystems.net/img/lightbox-btn-close.gif',
                imageBtnPrev: 'http://www.lpgsystems.net/img/lightbox-btn-prev.gif',    
                imageBtnNext: 'http://www.lpgsystems.net/img/lightbox-btn-next.gif'
         }); 
     }
                    
     
         

      /* ANIMATE sur la puce des li */
      $("div#container_spa_searcher ul li").hover(function()
      {
             
             $("div#container_spa_searcher .liste ul li").css( "backgroundPosition" , '90% 50%');
             $(this).animate({ backgroundPosition: '85% 50%'}, 200 );
      },function()
      {               
            $(this).animate({ backgroundPosition: '90% 50%'}, 100 );  
      }) ; 
      
      
      /* clic sur un li */
      $("div#liste01 ul li").click(function()
      {
            var id = $(this).attr("id");   
            $("#liste02 ul").hide();
            
            if(id=='enspa_center') {
                $("#liste02 #listCenter").show();
                $("#currentTypeEnspa").val("centre");
                oScrollbar.update(); 
            } 
            else if(id=='enspa_corner'){
                $("#liste02 #listCorner").show();
                $("#currentTypeEnspa").val("corner");
                oScrollbar.update();  
            } 
                        
            scrollMenu("#liste01","#liste02","right");  
            $("#spanSearchBack").show();          
      });
      
      $("#spanSearchBack").click(function()
      {
           scrollMenu("#liste02","#liste01","left");  
           $(this).hide();
            $("#liste03").hide();  
           $("#bg_liste_enspa").fadeIn();
      });
      
      
      $("div#liste02 li").click(function()
      {
              $("#linesENSPA .lineSpa").hide();
              $("#bg_liste_enspa").hide();
              $("#liste03").show();
              
              var iso = $(this).attr("rel");
              var type = $("#currentTypeEnspa").val();   
              
              $("#linesENSPA div."+iso).show(); 
              if(type=='corner'){
                $("#linesENSPA .centre").hide();
              }
              if(type=='centre'){
                 $("#linesENSPA .corner").hide();  
              }
              
       
              var oScrollbar2 =  $('#liste03'); 
              oScrollbar2.tinyscrollbar({ size: 428 });
                                                                       
              
             /* $("#liste03 div.linespa").each(){
                if($(this).attr("rel")=='FR' && $(this).hasClass("center"))
                {
                    $(this).show();
                }       
                
               
              }      */   
      
      });  
      
      var oScrollbar = $('#liste02');           
      oScrollbar.tinyscrollbar({ size: 428 });  
      
      
 });
 
 
 
 function scrollMenu(origin,target,direction)
 {        
      if(direction=="right")
      {
        $(origin).animate({ left: -375}, 500 );
        $(target).animate({ left: 0}, 500 );
      }
      else if(direction=="left")
      {
        $(origin).animate({ left: 375}, 500 );
        $(target).animate({ left: 0}, 500 );
      }
 }
