﻿// this code is run on every page load once all elements have been loaded to the DOM
jQuery(document).ready(function () {
    //alert('onReady: top_nav.js');
    var MENU_HIDE_DELAY = 75;
    var MENU_FADEOUT = 75;

    // generic hover
    $(".TopNav_Item").hover(
	    function () {
	        $(this).addClass('on');
	    },
	    function () {
	        $(this).removeClass('on');
	    }
    );


    $("#Assurance").hover(
	    function () {
	        $("#Assurance > .Label table tr td").addClass('on');
	        $("#Assurance > .Items").show();
	    },
	    function () {
	        setTimeout(function () {
	            $("#Assurance > .Label table tr td").removeClass('on');
	            $("#Assurance > .Items").fadeOut(MENU_FADEOUT);
	        }, MENU_HIDE_DELAY);
	    }
    );

    $("#Advisory").hover(
	    function () {
	        $("#Advisory > .Label table tr td").addClass('on');
	        $("#Advisory > .Items").show();
	    },
	    function () {
	        setTimeout(function () {
	            $("#Advisory > .Label table tr td").removeClass('on');
	            $("#Advisory > .Items").fadeOut(MENU_FADEOUT);
	        }, MENU_HIDE_DELAY);
	    }
    );

    $("#CorporateFinance").hover(
	    function () {
	        $("#CorporateFinance > .Label table tr td").addClass('on');
	        $("#CorporateFinance > .Items").show();
	    },
	    function () {
	        setTimeout(function () {
	            $("#CorporateFinance > .Label table tr td").removeClass('on');
	            $("#CorporateFinance > .Items").fadeOut(MENU_FADEOUT);
	        }, MENU_HIDE_DELAY);
	    }
    );

    $("#Tax").hover(
	    function () {
	        $("#Tax > .Label table tr td").addClass('on');
	        $("#Tax > .Items").show();
	    },
	    function () {
	        setTimeout(function () {
	            $("#Tax > .Label table tr td").removeClass('on');
	            $("#Tax > .Items").fadeOut(MENU_FADEOUT);
	        }, MENU_HIDE_DELAY);
	    }
    );

	$("#BnC").hover(
	    function () {
	        $("#BnC > .Label table tr td").addClass('on');
	        $("#BnC > .Items").show();
	    },
	    function () {
	        setTimeout(function () {
	            $("#BnC > .Label table tr td").removeClass('on');
	            $("#BnC > .Items").fadeOut(MENU_FADEOUT);
	        }, MENU_HIDE_DELAY);
	    }
    );

	$("#Wealth").hover(
	    function () {
	        $("#Wealth > .Label table tr td").addClass('on');
	        $("#Wealth > .Items").show();
	    },
	    function () {
	        setTimeout(function () {
	            $("#Wealth > .Label table tr td").removeClass('on');
	            $("#Wealth > .Items").fadeOut(MENU_FADEOUT);
	        }, MENU_HIDE_DELAY);
	    }
    );


    $("#Industries").hover(
	    function () {
	        $("#Industries > .Label table tr td").addClass('on');
	        $("#Industries > .Items").show();
	    },
	    function () {
	        setTimeout(function () {
	            $("#Industries > .Label table tr td").removeClass('on');
	            $("#Industries > .Items").fadeOut(MENU_FADEOUT);
	        }, MENU_HIDE_DELAY);
	    }
    );

    $("#PersonalApproach").hover(
	    function () {
	        $("#PersonalApproach > .Label table tr td").addClass('on');
	        $("#PersonalApproach > .Items").show();
	    },
	    function () {
	        setTimeout(function () {
	            $("#PersonalApproach > .Label table tr td").removeClass('on');
	            $("#PersonalApproach > .Items").fadeOut(MENU_FADEOUT);
	        }, MENU_HIDE_DELAY);
	    }
    );

    $("#Resources").hover(
	    function () {
	        $("#Resources > .Label table tr td").addClass('on');
	        //$("#Resources > .Items").show();
	    },
	    function () {
	        setTimeout(function () {
	            $("#Resources > .Label table tr td").removeClass('on');
	            //$("#Resources > .Items").fadeOut(MENU_FADEOUT);
	        }, MENU_HIDE_DELAY);
	    }
    );


});
