function menu_item_hover(cat_id) {
    setTimeout(function() {
        if( typeof t != 'undefined' ) {
            clearTimeout(t);
        }
        
        // Reset the other buttons
        for (i=0; i < 7; i++) {
            if (i != cat_id) {
                menu_item_hout(i);
            }
        }
        
        // Left Menu;
        jQuery('a.left_menu_link_'+cat_id).stop();
        jQuery('a.left_menu_link_'+cat_id).animate({color:'#000000',backgroundColor:'#ed1f24'}, {queue:false,duration:1000})
        jQuery('a.right_menu_link_'+cat_id+' div.inner').css({display:'block'})
        jQuery('a.right_menu_link_'+cat_id+' div.inner').stop();
        jQuery('a.right_menu_link_'+cat_id+' div.inner').animate({opacity:1}, {queue:false,duration:1000})
        t = setTimeout(function() {
            if (typeof backgrounds != 'undefined' && typeof change_background != 'undefined') {
                change_background(backgrounds[cat_id]);
            }
        }, 500)
    }, 10);
}
function menu_item_hout(cat_id) {
    jQuery('a.left_menu_link_'+cat_id).stop();
    jQuery('a.left_menu_link_'+cat_id).animate({color:'#999999',backgroundColor:'#000000'}, {queue:false,duration:1000})
    jQuery('a.right_menu_link_'+cat_id+' div.inner').stop();
    jQuery('a.right_menu_link_'+cat_id+' div.inner').animate({opacity:0}, {queue:false,duration:1000})
}

jQuery.noConflict();

jQuery(document).ready(function(){
    // Compenser Box
    if(jQuery.browser.msie) {
        jQuery('td.boxCompenser').height(jQuery('table.buildlogueTable').height()-jQuery('div#left').height()-15);
    }
    
    
    // Main menu hover
    jQuery('a.menu_link').hover(function() {
        jQuery(this).animate({backgroundColor:'#ed1f24'}, {queue:false,duration:500})
    }, function() {
        jQuery(this).animate({backgroundColor:'#d1d2d4'}, {queue:false,duration:500})
    })
    
    // Menu
    jQuery('div#menu_left').hover(
        function() {
            jQuery('ul#left_menu').show('slow');
            jQuery('ul#right_menu').show('slow');
            if( typeof t != 'undefined' ) {
                clearTimeout(t);
            }
        },
        function()
        {
            t = setTimeout(function(){
                jQuery('ul#left_menu').hide('slow');
                jQuery('ul#right_menu').hide('slow');
            }, 2000)
        }
    );
    
    jQuery('div#menu_right').hover(
        function() {
            jQuery('ul#left_menu').show('slow');
            jQuery('ul#right_menu').show('slow');
            if( typeof t != 'undefined' ) {
                clearTimeout(t);
            }
        },
        function()
        {
            t = setTimeout(function() {
                jQuery('ul#left_menu').hide('slow');
                jQuery('ul#right_menu').hide('slow');
            }, 2000)
        }
    );
});

