<!--//--><![CDATA[//><!--

var highlightMenu = true;
var textResizing = true;
var expandingMenu = true;

$(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) {
        var bodyTextSize = readCookie('textSize');
        if (bodyTextSize > 0) {
            $('body').css({ 'font-size': bodyTextSize + "px" });
        }

        $('a#smallerText').click(function(e) {
            e.preventDefault();
            var bodyTextSize = parseInt($('body').css('font-size'));
            if (bodyTextSize > 8) {
                bodyTextSize -= 1;
                $('body').css({ 'font-size': bodyTextSize + "px" });
            }
            createCookie('textSize', bodyTextSize);
        });

        $('a#largerText').click(function(e) {
            e.preventDefault();
            var bodyTextSize = parseInt($('body').css('font-size'));
            if (bodyTextSize < 18) {
                bodyTextSize += 1;
                $('body').css({ 'font-size': bodyTextSize + "px" });
            }
            createCookie('textSize', bodyTextSize);
        });
    }
    
    if(expandingMenu){
        var navid = "" + $.query.get('n');    
        $("#nav-prod > li > ul.subnav").hide();

        if(navid > 0){
            $("#nav-prod > li").eq(navid).css({
                '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').css({'background-image' : 'url(/cms/outertemplates/images/downarrow.gif)'});
                $(this).closest('li').siblings('li.navdrop').css({'background-image' : 'url(/cms/outertemplates/images/rightarrow.gif)'})
                                                    .find('ul').slideUp();
                $(this).next("ul.subnav").slideDown();
                $(this).addClass("open");
            } else {
                $(this).closest('li.navdrop').css({'background-image' : 'url(/cms/outertemplates/images/rightarrow.gif)'});
                $(this).next("ul.subnav").slideUp();
                $(this).removeClass("open");
            }
        });*/
        
        $("#nav-prod > li.navdrop > a").click(function(e) {
            e.preventDefault();
            if($(this).next("ul.subnav").css('display') == 'none'){
                $(".open").parent().children("ul").slideUp().parent().children(".open").removeClass("open");
                $(this).next("ul.subnav").slideDown();
                $(this).addClass("open");
            } else {
                $(this).next("ul.subnav").slideUp();
                $(this).removeClass("open");
            }
        });
        
        $("#nav-prod li:not(.navdrop)").addClass('nodrop');
        
        $('#nav-prod li').hover(function(){
            $(this).addClass('hover');
        }, function(){
            $(this).removeClass('hover');
        });
        
    }
    
    $("#hNav li").each(function(){
        if($(this).hasClass("first") && $(this).hasClass("selected")){
            $(this).addClass("firstSelected");
        }
    });
       
});