/**
 * @author : Flo :: Mali Aqua Viva
 * @date : 03/04/2011
 * 
 * Scripts communs 
 */

jQuery(document).ready(function(){ 
  
  // Prechargement des images
  if (document.images) {
    preload_image = new Image(25,25); 
    preload_image.src="squelettes/tpl/img/okon.png";  
    preload_image.src="squelettes/tpl/img/fd/navon.jpg";
  }
  
  // Rollover imgage form
  $('#search input[type="image"]').hover(function(){
    $(this).attr("src","squelettes/tpl/img/okon.png");
  }, function(){
    $(this).attr("src","squelettes/tpl/img/ok.png");
  });
   
  // Plugin Moodular : Slide home
  $('#homeCarrousel ul').moodulite({
    auto        : true,
    controls    : 'index',
	effects		: 'left',
	easing: 'easeInOutCubic',
    speed       : 700,
	dispTimeout : 4500
  });
  
  // Plugin Moodular : Slide tourisme
  var tourismeCarrousel = $('#tourismeCarrousel ul').moodular({
    auto        : false,
    api         : true,
    speed       : 200,
    dispTimeout : 0
  });   
  $('#tourismeCarrousel a#next').bind('click', function () { 
    tourismeCarrousel.next(); 
    return false; 
  }); 
  $('#tourismeCarrousel a#prev').bind('click', function () { 
    tourismeCarrousel.prev(); 
    return false; 
  });
  
  // Plugin Moodular : Slide Offres
  var offresCarrousel = $('#offresCarrousel > ul').moodular({
    auto        : false,
    api         : true,
    speed       : 200,
    dispTimeout : 0
  });   
  $('#offresCarrousel a#next').bind('click', function () { 
    offresCarrousel.next(); 
    return false; 
  }); 
  $('#offresCarrousel a#prev').bind('click', function () { 
    offresCarrousel.prev(); 
    return false; 
  });  
  
  // Effet hover span
 	 $('.over').hover(function(){
    if ($.browser.msie) 
      $('span', this).stop(true,true).show();
    else
      $('span', this).stop(true,true).fadeIn(400);
	}, function() {
    if ($.browser.msie) 
      $('span', this).stop(true,true).hide();      
    else
      $('span', this).stop(true,true).fadeOut(400);
  });
  
  // fade : Effet fondu
	if (navigator.appName != 'Microsoft Internet Explorer') {
    $('.fade').mouseover(function() { 
  		$(this).stop().fadeTo(200, 0.8);
  	}).mouseout(function(){ 
  		$(this).stop().fadeTo(200, 1); 
  	});
  } 
  
  // Plugin Colorbox : zoom photos
  $("a.zoom").colorbox({transition:"fade"});
  
  // Champs de recherche
  var search = $("header #search input[type='text']");
	search.focus(function() {
		if ($(this).val() == "votre e-mail")
			$(this).val("")
	});   
	search.blur(function() {
		if ($(this).val() == '')
			$(this).val("votre e-mail");
  }); 
                                               
});       

