function defil_news_flash() {
    var news_total  = $('#news_flash .news_element').length;
    if(news_total>1) {
        var num_news = $('#news_flash .news_element:visible').attr('id').split('_');
        var news_id = num_news[2] == news_total ? 1 : eval(num_news[2]) + 1;
        $('#news_flash .news_element').fadeOut('slow');
        $('#news_flash_'+news_id).fadeIn('slow');
        window.setTimeout('defil_news_flash()',5000);
    }
}
function defil_news_nova() {
    var news_total  = $('#news_nova .news_element').length;
    if(news_total>1) {
        var num_news = $('#news_flash .news_element:visible').attr('id').split('_');
        var news_id = num_news[2] == news_total ? 1 : eval(num_news[2]) + 1;
        $('#news_flash .news_element').fadeOut('slow');
        $('#news_flash_'+news_id).fadeIn('slow');
        window.setTimeout('defil_news_nova()',5000);
    }
}

$(document).ready(function(){

window.setTimeout('defil_news_nova()',5000);    
window.setTimeout('defil_news_flash()',5000);   

var width = $('.movable').css('width');
var new_width = 920;
var new_top = 35
Done = true;
    $('.news_element').click(function() {
        window.location.href = $(this).find('a').attr('href');
    });
    $('#particuliers').hover(
            
        function(){
            if(Done) {
                Done = false;
                $('.movable').css('z-index','10');
                $(this).children('.movable').css('z-index','20');
                $(this).children('.movable').animate({top:new_top}).animate({width:new_width+1,left:0},'normal',
                    function() {Done = true;});
            }
        },
        function(){ 
            $(this).children('.movable').animate({width:width,left:0}).animate({top:0});
        }
    );
    $('#entreprises').hover(
        function(){
            if(Done) {
            Done = false;
            $('.movable').css('z-index','10');
            $(this).children('.movable').css('z-index','20');
            $(this).children('.movable').animate({top:new_top}).animate({width:new_width+1,left:0},'normal',
                    function() {Done = true;});
            }
        },
        function(){
            $(this).children('.movable').animate({width:width,left:188}).animate({top:0});
        }
    );
    $('#grands-comptes').hover(
        function(){
            if(Done) {
            Done = false;
            $('.movable').css('z-index','10');
            $(this).children('.movable').css('z-index','20');
            $(this).children('.movable').animate({top:new_top}).animate({width:new_width+1,left:0},'normal',
            function() {Done = true;});
            }
            
        },
        function(){
            $(this).children('.movable').animate({width:width,left:376}).animate({top:0});
        }
    );
    $('#secteur-public').hover(
        function(){
            if(Done) {
            Done = false;
            $('.movable').css('z-index','10');
            $(this).children('.movable').css('z-index','20');
            $(this).children('.movable').animate({top:new_top}).animate({width:new_width+1,left:0},'normal',
                function() {Done = true;});
            }
        },
        function(){
            $(this).children('.movable').animate({width:width,left:564}).animate({top:0});
        }
    );
    $('#votre-metier').hover(
        function(){
            if(Done) {
            Done = false;
            $('.movable').css('z-index','10');
            $(this).children('.movable').css('z-index','20');
            $(this).children('.movable').animate({top:new_top}).animate({width:new_width,left:0},'normal',
                    function() {Done = true;});
            }
        },
        function(){
            $(this).children('.movable').animate({width:width,left:752}).animate({top:0});
        }
    );
});
