$(document).ready(function(){	
	$('.logo_moptip').mopTip({'w':95,'style':"overOut",'get':"#moptip_logo"});
  $('#dropdown2').nmcDropDown({
    submenu_selector: 'ul',
    show: {opacity: 'show', top: '-=10px'},
    show_speed: 100,
    hide: {opacity: 'hide', top: '+=10px'},
    hide_speed: 300
  });
  var max = Math.max($('#home_content1').height(), Math.max($('#home_content3').height(), $('#home_content2_tile').height()));
  $('#home_content1').height(max);
  $('#home_content2_tile').height(max+25);
  $('#home_content3').height(max);
  jQuery('.mappoint').click(function() {
    jQuery('#info_campinouest_' + this.id.toString().substr(3)).fadeIn(1000);
    return false;
  });
  jQuery('.campinouest_info .close').click(function() {
    jQuery('#info_campinouest_' + this.id.toString().substr(9)).hide(); //fadeOut(500); je ne sais pas pourquoi le fadeOut ne marche pas en publié ??? Tant pis
    return false;
  });


  //Envoyer à un ami
  jQuery('#partage_page .box_labelgreen_link_txt').click(function()
  {
    var exp = jQuery(this).closest('#boxbleu_contentinput').find('input[name=nomexp]').val();
    if(exp == 'votre nom' || exp == '')
    {
      alert("Vous devez spécifer votre nom");
      return false;
    }

    var email = jQuery(this).closest('#boxbleu_contentinput').find('input[name=emailreception]').val();
    if(!email.match(/[a-z0-9\-\.]+@[a-z0-9\-\.]+\.[a-z\.]{2,}/i))
    {
      alert("Format de l'adresse email incorrect");
      return false;
    }

    var zone_message = jQuery(this).closest('#boxbleu_contentinput').find('.partager_message:first');
    jQuery.post('/index.php', { module: 'emails', action: 'partager', exp: exp, email: email }, function(data)
    {
      if(data == 'ok')
        zone_message.css('color', 'green').html("Email envoyé, merci");
      else
        zone_message.css('color', 'red').html("Erreur lors de l'envoi");
    });
    
    return false;
  });
});	