/*  Le Phare JavaScript library - (c) 2007
/*--------------------------------------------------------------------------*/
Event.handler = {
   register: function(element) {
      if($(element)) {
         switch (element) {
            case 'pagePreInscription':
                  if($('visitor_connu'))
                  {
                     Event.observe('visitor_connu', 'change', function() {
                        if($('visitor_connu').value==2 || $('visitor_connu').value==5)   
                        $('divInfo').show();
                        else  $('divInfo').hide();
                     });
                  }
                  initForm();
            break;
            case 'pageContacts':
                initForm();
            break;
            case 'pagePreInscriptionAncien':
               initForm();
            break;
            case 'pagePhototheque':
               initPhototheque();
               lightBox_init();
            break;
            case 'pageVideotheque':
               initVideotheque();
               //lightBoxVideo_init();
         }
      }
   } // register
}

// load
Event.observe(window, 'load', function() {
      Event.handler.register(document.body.id);
      navManager();
});

function image_transition(image,tab,tmp)
   {
      oTransition = new Transition( 'holder', image,tab ,tmp);
   }  

function initVideotheque(){
   myLightWindow = new lightwindow({dont_close_on_overlay:false}); 
   Event.observe($('jsSelectCateg'), 'change', function(){
      
      $('jsFormVideotheque').submit();
   });
};

function initPhototheque(){

   Event.observe($('jsSelectCateg'), 'change', function(){
      
      $('jsFormPhototheque').submit();
   });
};

function lightBox_init()
{
   myLightbox = new Lightbox('../../ml/s11_phototheque/_get_infos_photos.php');
}

function navManager() {

   $$('.jsNav').each(function(obj){
           
      Event.observe(obj, 'mouseover', function() {
            $$('#'+obj.id+' ul.sousNav').each(function(sousobj){ 
                sousobj.show();
            });
        });   
   });  
};
function initForm()
{
         var zeForm = new Validation('zeForm', {
            useTitles:true,immediate:true, stopOnFirst:true, onFormValidate: function() {$('todo').value = "submit_quest";}
         });
   
         if($('searchSubmitter')) {
            Event.observe('searchSubmitter', 'click', function() {$('searchTodo').value = "email-subscribe"; $('searchEmailForm').submit();});
         }
   
         if($('errMsg')) {
            if($('errMsg').innerHTML  != '') {
               Element.show('errMsg'); Effect.BlindUp('errMsg', {delay:3});
            }
         }
}