var currentAnnounce = 0;
var nbAnnounce = 0;

$(function(){
    
        nbAnnounce = $('.announceForSlider').length;
       var announceContainerHeight = nbAnnounce*$('.announceForSlider:first').height();
       $('#announceForSliders').css('height',announceContainerHeight);  
    
       //$(this).stopTime();
       $(this).everyTime(5000, function() {
               if(currentAnnounce<(nbAnnounce-1))
                  currentAnnounce++;
              else
                  currentAnnounce = 0;
              slideAnnounce(currentAnnounce);
       });    
});

function slideAnnounce(numAnnounce)
{
    //je place la nouvelle annonce sous l annonce affichée
    $('.announceForSlider[id='+numAnnounce+']').css('top','72px');
    var visibleAnnounce = $('.announceForSlider:visible');
    $('.announceForSlider[id='+numAnnounce+']').show();
    
    //je fait monter l annonce visible
    visibleAnnounce.animate({
        'top':'-62px'
    },600,function(){
        $(this).hide();
    });
    
    $('.announceForSlider[id='+numAnnounce+']').animate({
        'top':'5px'
    },600);
    
    
}

function showRegion(regionNumber){
    $('#franceMapImage').find('img').attr('src','/images/maps/france/carte-region'+regionNumber+'.png');
}

function hideRegion(){
    $('#franceMapImage').find('img').attr('src','/images/maps/france/carte-region.png');
}

function switchHomeBanButton(){
    $(document).stopTime();
    switchHomeBan();
}

function switchHomeBan(){
    

    if($('#homeBanBlue').css('display') == "none"){
        $('#homeBanBlue').fadeIn();
    }
    else{
        
        $('#homeBanBlue').fadeOut();
    }
}

function launchTweazVideo()
{
    $('.TweazVideo').html('<iframe width="365" height="231" src="http://www.youtube.com/embed/v6yMyhOWLC0?wmode=transparent&autoplay=1" frameborder="0" allowfullscreen></iframe>');
}
