/*
 * FONCTIONS APPELEES SUR TOUTES LES PAGES DU SITE
 */
$(function(){

    // TABS DE LA ZONE AGENDA
    $('#tabs').tabs();


/* --- EFFET SUR LE MENU PRINCIPAL ---*/ 

 $('#menu>ul>li>a').each(function() {
  if (!$(this).parent().hasClass("on")) {
   $(this).css( {backgroundPosition: "0 0"} ) 
       .mouseover(menuOver)
       .focus(menuOver)
       .mouseout(menuOut)
       .blur(menuOut)
  }
 });

/*------------------------------------------------------*/
  $('.deplie').toggle(function(){
      $(this).next('.sOuvreAnnu').slideDown('duration:1500');
      $(this).addClass("open");},
  function(){
      $(this).next('.sOuvreAnnu').slideUp('duration:1500');
      $(this).removeClass("open");
  });

/*------------------------------------------------------*/
  $('#aggloAVotreService h3 a').click(function(){
    if($('body.accueil').length == 0){
       $('#aggloAVotreService ul').slideToggle('duration:1500');
      }
      return false;
  });

  $('#pratiqueRight h3 a').click(function(){
    if($('body.accueil').length == 0){
       $('#pratiqueRight ul').slideToggle('duration:1500');
      }
      return false;
  });

  $('#aggloAVotreService h3 a, #pratiqueRight h3 a').toggle(function(){
    $(this).addClass('open');
  },
  function(){
    $(this).removeClass('open');  
  });

  $('body.accueil #aggloAVotreService ul li a').hover(function(){
     $(this).stop().animate({backgroundPositionY:-85}, 150);
  },
  function(){
     $(this).stop().animate({backgroundPositionY:0}, 500);
  });


  $('body.accueil .carteInteractiveRight').hover(function(){
     $(this).stop().animate({backgroundPositionY:-39}, 150);
  },
  function(){
     $(this).stop().animate({backgroundPositionY:0}, 500);
  });


});

function menuOver()
{
 $(this).stop().animate({backgroundPositionY:-43}, {duration:150});
}


function menuOut()
{
 $(this).stop().animate({backgroundPositionY:0}, {duration:500});
}
