var highlightMenu = true;
var textResizing = true;
var expandingMenu = true;

$(document).ready(function(){
    	// <li> Hover for IE6 and below
	if($.browser.msie && $.browser.version < "8") {
	
	    $("#nav li, .productBox").hover(function() {
	        $(this).addClass("hover");
	    }, function(){
	        $(this).removeClass("hover");
	    });
	    
	    $("#hNav ul li.navdrop").hover(function() {
	        $(this).addClass("navDropHover");
	        }, function(){
	        $(this).removeClass("navDropHover");
	    });
	    
	}
		
	$("#nav a").each(function(){
        // Add active class to current page link in the menu
        if (highlightMenu) {
            if (location.href.indexOf(this.href) != -1) {
                $(this).parent().addClass("selected");
                //$(this).wrapInner($("<span></span>"));
            }
        }
        
        // Expand lists when the user tabs through menu items
        $(this).focus(function() {
            $(this).parents('li').addClass('hover');
        });
        // Collapse lists again when the link loses focus
        $(this).blur(function() {
            $(this).parents('#nav li').removeClass('hover');
        });
    });
    
    // Text resizing
    if(textResizing){
        changeTextSize(readCookie('style'));
        $('#widgets a').click(function(event){
            event.preventDefault();
            changeTextSize(this.id);
        });
    }
    
    if(expandingMenu){
        /*var navid = "" + $.query.get('n');    
        $("#nav-prod > li > ul.subnav").hide();

        if(navid > 0){
            $("#nav-prod > li").eq(navid).css({'background-color' : '#FF1919', 'background-image' : 'url(/cms/outertemplates/images/btn/close.gif)'}).children("ul.subnav").show();
        }
           
        $('#nav-prod li.navdrop a').each(function(){
            var n= $('#nav-prod > li').index($(this).closest('#nav-prod > li'));
            $(this).attr('href', $(this).attr("href") + '&n=' + n);
        });
        
        $("#nav-prod > li.navdrop > a").click(function(e) {
            e.preventDefault();
            if($(this).next("ul.subnav").css('display') == 'none'){
                $(this).closest('li').css({'background-image' : 'url(/cms/outertemplates/images/btn/close.gif)'});
                $(this).closest('li').siblings('li.navdrop').css({'background-image' : 'url(/cms/outertemplates/images/btn/open.gif)'});
                $(this).next("ul.subnav").slideDown();
            } else {
                $(this).closest('li.navdrop').css({'background-image' : 'url(/cms/outertemplates/images/btn/open.gif)'});
                $(this).next("ul.subnav").slideUp();
            }
        });
        
        $("#nav-prod li:not(.navdrop)").addClass('nodrop');
        
        $('#nav-prod li').hover(function(){
            $(this).addClass('hover');
        }, function(){
            $(this).removeClass('hover');
        });
        */
    }
    
    $("#nav-prod li:nth-child(5n+2)").css("background-color","#bc0233");
    $("#nav-prod li:nth-child(5n+3)").css("background-color","#4684bd");
    $("#nav-prod li:nth-child(5n+4)").css("background-color","#388418");
    $("#nav-prod li:nth-child(5n+5)").css("background-color","#004566");
    $("#nav-prod li:nth-child(5n+6)").css("background-color","#388418");
    $("#nav-prod li li").css("background-color","#147DAD");
});