(function($) {
     $.fn.tableColorize = function(evenColor, oddColor, not){
        var notSelector = ((not === undefined || not === false)? '':not);
        var container = this;
        container.find('tr:even'+notSelector).css('background-color',evenColor);
        container.find('tr:odd'+notSelector).css('background-color',oddColor);
    }
    
    
    
})(jQuery);

(function($) {
    function whiteBlockShadow(){
        var wbsHeight = $('#shadow .middle').height()-266;
        $('#shadow .middle .side').css({
            'height': wbsHeight+'px'
        });    
    }
    
    function topMenuLastItemWidth(){
        var eachItemWidth = 0;
        $('#menu ul li').each(function(){
            eachItemWidth += $(this).width();
        });
        var lastItemWidth = Math.abs(eachItemWidth - $('#menu ul').width()) + $('#menu ul li:last a').width();
        $('#menu ul li:last a').width(lastItemWidth);    
    }
    
    function submenu(){
        
        function highlight(link){
            var li = link.closest('li');
            var hg = $('#submenu .highlight');
            var offset = li.position();
            hg.css({
                'height': link.height()+10+'px',
                'top': offset.top+'px'
            });
            
        }
        
        var currentLink = $('#submenu a').filter(function(){
            return $(this).attr('href') == mpath;
        }).addClass('current');
        if(currentLink.length > 0){
            if(currentLink.closest('li').is('.gray')){
                highlight(currentLink);
            }
            
            if(currentLink.closest('li').is('.blue')){
                currentLink.closest('li').css('background-color', '#ebf0f4');
            }
        }
        
        $('#submenu ul.items').each(function(){
            $(this).find('li:last').css('border-bottom', 'none');
        });
            
        
        
    }
    
    $(document).ready(function() {
        whiteBlockShadow();    
        setInterval(function(){
            whiteBlockShadow();    
        }, 100);
        topMenuLastItemWidth();
        
        submenu();
        
        
    });


})(jQuery);

