﻿    Cufon.replace('.home h1')
    
    Cufon.replace('.headernavigation > ul > li > a', {
        hover: true
    });

    Cufon.replace('#subnavigation > ul > li > a');

    $(document).ready(function () {

        // Dynamically insert a hook for our Top Nav styles  
        var topNavListItem = "TopNavListItem";
        var TopLevelFontSection = 1;

        $('.headernavigation > ul > li > a').each(function () {
            navItemHeight = $(this).parent().height();
            if (navItemHeight > 40) {
                $(this).addClass('twoline');
            }
            $(this).parent().addClass(topNavListItem + TopLevelFontSection);
            TopLevelFontSection = TopLevelFontSection + 1;
        });

        // get the colours of the current nav state before rollover

        var TopNavListItem1Bg = $('.headernavigation > .RadMenu_Default > ul > li.TopNavListItem1 a').css('color');
        var TopNavListItem2Bg = $('.headernavigation > .RadMenu_Default > ul > li.TopNavListItem2 a').css('color');
        var TopNavListItem3Bg = $('.headernavigation > .RadMenu_Default > ul > li.TopNavListItem3 a').css('color');
        var TopNavListItem4Bg = $('.headernavigation > .RadMenu_Default > ul > li.TopNavListItem4 a').css('color');
        var TopNavListItem5Bg = $('.headernavigation > .RadMenu_Default > ul > li.TopNavListItem5 a').css('color');
        var TopNavListItem6Bg = $('.headernavigation > .RadMenu_Default > ul > li.TopNavListItem6 a').css('color');


        $("#ctl00_MenuPlugin1_menu ul").hover(
                function () {
                    // Store if this is the active parent to mark the section
                    tempTopLevelFont = $(this).parent().find('> a').attr('class');

                    // Add the class to highlight the background
                    $(this).parent().find('> a').addClass('expanded');
                },

                function () {
                    // Revert back to the original a class for 1 or 2 lines
                    $(this).parent().find('> a').attr('class', tempTopLevelFont);

                    var currentItemClass = $.trim($(this).parent().attr("class").replace('active ', '').replace('sfHover', '').replace('last', '').replace('active_ancestor_1', ''));

                    var currentItemColor = eval(currentItemClass + 'Bg');

                    Cufon.replace($(this).parent().find('> a'), {
                        color: currentItemColor
                    });

                }




        );

    });  
