/**************************************
*  GUI functions tool kit (non obscruptive js)

*  required jQuery
*      
* author:  erational(http://www.erational.org)
* version: 0.2
* date:    2007.10.10
* licence: GPL 2.0    
***********************************/

//
// function
// 
function build_Menu() {
       // section 1   
        $("#secteur1 div").mouseover(function(){
            $(this).children('div').show(); 
        }).mouseout(function(){
            $(this).children('div').hide();  
        });

}

// popup virtuelle temporaire
function init_popup(state) {
  if (0==state) {             // step 0: hide & wait
      $('#popup').hide();
      setTimeout("init_popup(1)",1000);
  } else if (1==state) {      // step 1: fade in 
      $('#popup').fadeIn("slow");
      setTimeout("init_popup(2)",16000); // 10s
            
      $("#popup_closer_trigger").click(function () {
            $('#popup').fadeOut("slow");
            return false; 
      }); 
  } else if (2==state) {      // step 2: fade out 
      if ('none' != $('#popup').css("display"))      
                        $('#popup').fadeOut("slow");
  } 
  
} // init_popup


//
// event
//
$(document).ready(function(){
    build_Menu();
    if ($('#popup'))
        init_popup(0); // popup (homepage)

    // cycle (http://www.malsup.com/jquery/cycle/)  
    $('#slide').cycle({                  
           fx: 'scrollHorz',
           timeout: 500,
           next: '#fondu',
           pause: 1
    });
});
