﻿    Cufon.replace('.home h1');
    
    Cufon.replace('.headernavigation > div > ul > li > a', {
        // hover: true
    });
    
    Cufon.replace('.innovatorshome h2');

    Cufon.replace('.careershome h3') 
    
    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 > .RadMenu_Default > ul > li').each(function () {
            $(this).addClass(topNavListItem + TopLevelFontSection);
            TopLevelFontSection++;
        });

        // 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');


        $(".rmRootGroup .rmSlide").hover(
                function () {
                    // Do nothing

                    Cufon.replace($(this).parent().find('> a'), {
                        color: '#FFFFFF'
                    });
                    
                },
                function () {

                    var currentItemClass = $(this).parent().attr("class").replace('rmItem ', '').replace('rmFirst ', '').replace('rmLast ', '');
                    var currentItemColor = eval(currentItemClass + 'Bg');

                    Cufon.replace($(this).parent().find('> a'), {
                        color: currentItemColor
                    });

                }
        );
        
        // The cufon hover states seems flakey when used with the Telerik nav so we're creating our own here
        $(".headernavigation > .RadMenu_Default > ul.rmRootGroup > li > a").hover(
                function () {
                    Cufon.replace($(this), {
                        color: '#FFFFFF'
                    });
                },
                function () {
                    var currentItemClass = $(this).parent().attr("class").replace('rmItem ', '').replace('rmFirst ', '').replace('rmLast ', '');
                    var currentItemColor = eval(currentItemClass + 'Bg');

                    Cufon.replace($(this), {
                        color: currentItemColor
                    });
                }
        );


    });
