function oninit1(){
  if($("div_moteurAccueil")) initOngletMoteurAcc();
  if($("div_blocsAcc")) initAffBloc();  
  if($("div_moteurRechercheAcc")) initMoteurAcc();
  if($("div_contentActus")) genereNavigZoomSur();
}

function initAffBloc(){
  $$(".li_btBlocs").each(function(obj){
    obj.onclick = function(evt){
      $$(".div_contentBloc").each(function(obj2){
        obj2.style.display="none";
      });      
      var div = obj.getAttribute("div");
      $(div).style.display="block";
    };
  });
}

function initMoteurAcc(){
  $("img_calendAcc").onclick=function(evt){setCalendrierGeneral("gites45","1","","H","div_calendrierMoteurAccContent",clicCalendJsAcc,"inpt_dateDebAcc","","","inpt_dureeSejourAcc","1","");afficheEfface("div_calendrierMoteurAcc");};
  $("inpt_submitFormAcc").onclick=function(evt){lanceRechercheAcc();};
  checkTypeMoteur();  
}

function lanceRechercheAcc(){
  if(($("inpt_dateDebAcc").value && !$("inpt_dureeSejourAcc").value) || (!$("inpt_dateDebAcc").value && $("inpt_dureeSejourAcc").value)) alertAMalibu("Vous devez définir la date et la durée de votre séjour");
  else $("frm_moteurAcc").submit();
}

function checkTypeMoteur(){
  $$(".check_moteurAcc").each(function(obj){
    obj.onclick=function(evt){          
      switch(obj.value){
        case "HOTEL":
          $$(".div_elemAvecDispo").each(function(obj2){             
            obj2.style.display = "none";                                          
          });
          $$(".inputPasDispo").each(function(obj3){             
            obj3.value="";                                          
          });
          $$(".div_messageLancerRecherche").each(function(obj2){             
            obj2.style.display = "none";                                          
          });
          $("div_messageAttenteHotels").style.display="block";
          $("frm_moteurAcc").action="/hebergements/hotels.html";
          break;
        case "LOCAT":
          $$(".div_elemAvecDispo").each(function(obj2){             
            obj2.style.display = "block";                                          
          });           
          $$(".div_messageLancerRecherche").each(function(obj2){             
            obj2.style.display = "none";                                          
          });  
          $("inpt_dureeSejourAcc").setAttribute("name","DUREE");
          $("frm_moteurAcc").action="/lst_prod.php";
          if(obj.getAttribute("id")=="inpt_campings") $("inpt_classe").value="FAMIL";
          else if(obj.getAttribute("id")=="inpt_bateaux") $("inpt_classe").value="BAT";      
          break;
        default:
          $("inpt_dureeSejourAcc").setAttribute("name","NBJ");
          $("inpt_classe").value="";
          $$(".div_elemAvecDispo").each(function(obj2){             
            obj2.style.display = "block";                                          
          });           
          $$(".div_messageLancerRecherche").each(function(obj2){             
            obj2.style.display = "none";                                          
          });  
          $("frm_moteurAcc").action="/liste-hebergement.html"; 
      }
    };  
  });
}

function clicCalendJsAcc(evt,jour,mois,annee,etat){
  $("inpt_dateDebAcc").value=jour+"/"+mois+"/"+annee;
  afficheEfface("div_calendrierMoteurAcc");
}

function genereNavigZoomSur(){
  $("ul_contentActus").setAttribute("style","");
  if($("div_contentActus")) setScrollHorizontalOnLstGenerePage("div_contentActus","ul_contentActus",{idDivPastePage:"div_contentActus",position:"top"});
}

function initOngletsMoteurAcc(){
  $("p_titreReserverEnLigne").onclick=function(evt){
    afficheEffaceOngletAcc("div_contentMoteurRechercheAcc","a_ongletReserver")
  };
}

function initOngletMoteurAcc(){
  $$(".p_titreBlocMoteurClic").each(function(obj){
    obj.onclick=function(evt){
      var div = obj.getAttribute("div");
      $$(".div_contentRechercheAcc").each(function(obj2){
        obj2.style.display="none";      
      });
      $(div).style.display="block";  
      $$(".p_titreBlocMoteurClic").each(function(obj3){
        if(obj3.hasClassName("p_titreBlocMoteurClicOn")) obj3.removeClassName("p_titreBlocMoteurClicOn");               
      });
      obj.addClassName("p_titreBlocMoteurClicOn");          
    };
  });
}
