﻿var sCurrentProductCategory;
var nCurrentProductSubCategoryID = 0;

sCurrentPage = "products";

function InitializeNav() {
    // Turn current tab on
    ToggleTab('tabProducts' + sCurrentProductCategory, 'on');
    
    // If the page needs a visible subtab, turn it on
    if (nCurrentProductSubCategoryID > 0) {
        // Show the current subtab
        $('ul', '#' + sCurrentProductCategory).show();
        
        // Turn selected subcategory on
        $('#' + nCurrentProductSubCategoryID).attr('class','on');
    }
    
    // Initialize the hover events for the tabs
    $('li.navigationTab').hover(
        function() { 
            ToggleTab($('img', this).attr('id'), 'on');
            
            // Hide all subtabs
            $('.navigationSubTabs').hide();
            
            // Show the current subtab
            $('ul', this).show(); 
        }, function() {
            if ($(this).attr('id') != sCurrentProductCategory) {
                ToggleTab($('img', this).attr('id'), 'off');
                
                // Hide this tab is if is not current
                $('ul', this).hide();
                
                // Show the subtabs for the current tab
                $('#navigationSubTabs' + sCurrentProductCategory).show();
            }
        }
    );
                            
    // Add right border to last subtabs
    $('#navigationSubTabsBreads a:last').addClass('last');
    $('#navigationSubTabsMisc a:last').addClass('last');
}

function InitNutritionHide() {
    $('#productNutrition').click(
        function() {
            $(this).hide();
        }
    );
}
