<!--//--><![CDATA[//><!--

var highlightMenu = true;
var textResizing = false;
var expandingMenu = false;

$(document).ready(function(){
    // <li> Hover for IE6 and below
	if($.browser.msie && $.browser.version < "7") {
	    $("#nav li").hover(function() {
	        $(this).addClass("hover");
	    }, function(){
	        $(this).removeClass("hover");
	    });
	}
		
	$("#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/downarrow.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').animate({backgroundColor : '#FF1919'})
                                     .css({'background-image' : 'url(/cms/outertemplates/images/downarrow.gif)'});
                $(this).closest('li').siblings('li.navdrop').animate({backgroundColor : '#acacac'})
                                                    .css({'background-image' : 'url(/cms/outertemplates/images/rightarrow.gif)'})
                                                    .find('ul').slideUp();
                $(this).next("ul.subnav").slideDown();
            } else {
                $(this).closest('li.navdrop').animate({backgroundColor : '#acacac'})
                                     .css({'background-image' : 'url(/cms/outertemplates/images/rightarrow.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');
        });
        
    }    
});
