﻿var isProductsSection = (location.pathname.indexOf('/products/') !== -1);
var isProductInspiredXPress = (location.pathname.indexOf('/products/inspiredXpress.aspx') !== -1);
var isProductInspired2Go = (location.pathname.indexOf('/products/inspired2go.aspx') !== -1);
var isProductInspiredSignage = (location.pathname.indexOf('/products/inspiredSignage.aspx') !== -1);

var isApplicationsSection = (location.pathname.indexOf('/applications/') !== -1);
var isCustomerProfileSection = (location.pathname.indexOf('/customer_profiles/') !== -1);
var isO2 = (location.pathname.indexOf('/customer_profiles/default.aspx') !== -1) || ((location.pathname.indexOf('/customer_profiles/') !== -1) && (location.pathname.indexOf('.aspx') === -1));
var isTraderMedia = (location.pathname.indexOf('/customer_profiles/traderMediaGroup') !== -1);
var isGeorgeProctor = (location.pathname.indexOf('/customer_profiles/georgeProctor') !== -1);
var isShopPanasonic = (location.pathname.indexOf('/customer_profiles/shopPanasonic') !== -1);

var isTCOCalculatorSection = (location.pathname.indexOf('/DigitalSignageTCOCalulator/') !== -1);
var isContactUsSection = (location.pathname.indexOf('/where_to_buy/') !== -1);


(function($)
{

    $.fn.TopNav = function()
    {

        if (!isProductsSection)
        {
            //Home
            $("#topNavHome").mouseover(function()
            {
                //$("div[id*=subNav]").hide("slow");
            });

            //Products
            $("#topNavProducts").mouseover(function()
            {
                //$("div[id*=subNav]").not("#subNavProducts").hide("slow");
                //$("div:contains('subNav')").hide("slow");
                //$("#subNavProducts").show("slow");
            });
            
            //Customer Profiles
            $("#topNavProfiles").mouseover(function()
            {

               // $("div[id*=subNav]").not("#subNavProfiles").hide("slow");
                /**/
                //$("div:contains('subNav')").hide("slow");
                //$("#subNavProfiles").show("slow");

            });
            
            //Applications
            $("#topNavApplications").mouseover(function()
            {
                //$("div[id*=subNav]").hide("slow");
            });

            //Contact US
            $("#topNavContactUs").mouseover(function()
            {
                //$("div[id*=subNav]").hide("slow");
            });


        }
        /*
        var isProductsSection = ($(this).context.location.pathname.indexOf('/products/') !== -1);
        var isApplicationsSection = ($(this).context.location.pathname.indexOf('/applications/') !== -1);
        var isCustomerProfileSection = ($(this).context.location.pathname.indexOf('/customer_profiles/') !== -1);
        var isContactUsSection = ($(this).context.location.pathname.indexOf('/where_to_buy/') !== -1);

        */
        switch (true)
        {
            case isProductsSection:
                //alert("this is in the product section");
                //navLinksHighlightCurrentPage
                $("#topNavProducts > a").addClass("navLinksHighlightCurrentPage");
                $("#subNavProducts").show();
                switch (true)
                {
                    case isProductInspiredXPress:
                        $("#hrefInspiredXPress").addClass("navLinksHighlightCurrentPage");
                        break;
                    case isProductInspired2Go:
                        $("#hrefInspired2Go").addClass("navLinksHighlightCurrentPage");
                        break;
                    case isProductInspiredSignage:
                        $("#hrefInspiredSignage").addClass("navLinksHighlightCurrentPage");
                        break;
                }

                break;
            case isApplicationsSection:
                $("#topNavApplications > a").addClass("navLinksHighlightCurrentPage");
                break;
            case isCustomerProfileSection:
                $("#topNavProfiles > a").addClass("navLinksHighlightCurrentPage");
                $("#subNavProfiles").show();
                switch (true)
                {
                    case isO2:
                        $("#hrefO2").addClass("navLinksHighlightCurrentPage");
                        break;
                    case isTraderMedia:
                        $("#hrefTraderMedia").addClass("navLinksHighlightCurrentPage");
                        break;
                    case isGeorgeProctor:
                        $("#hrefGeorgeProctor").addClass("navLinksHighlightCurrentPage");
                        break;
                    case isShopPanasonic:
                        $("#hrefShopPanasonic").addClass("navLinksHighlightCurrentPage");
                        break;                        
                }
                
                break;
            case isContactUsSection:
                $("#topNavContactUs > a").addClass("navLinksHighlightCurrentPage");
                break;
        }

        return;
    }

})(jQuery);
