// Initialize sIFR
if (typeof sIFR == "function") {
    sIFR.replaceElement("#header .info h1", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-medium.swf", sColor: "#333333", sWmode: "transparent"}))
    sIFR.replaceElement("#header .info .tel", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-medium.swf", sColor: "#0095AB", sWmode: "transparent"}))
    sIFR.replaceElement("#top-nav li.current", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-demi.swf", sColor: "#666666", sWmode: "transparent", sLinkColor: "#666666", sHoverColor: "#666666", nPaddingTop: 7, nPaddingRight: 4, nPaddingBottom: 6, nPaddingLeft: 7}))
    sIFR.replaceElement("#top-nav li", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-demi.swf", sColor: "#0095AB", sWmode: "transparent", sLinkColor: "#0095AB", sHoverColor: "#666666", nPaddingTop: 6, nPaddingRight: 2, nPaddingBottom: 6, nPaddingLeft: 8}))
    sIFR.replaceElement(".get-in-touch h3", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-demi.swf", sColor: "#394F41", sWmode: "transparent"}))
    sIFR.replaceElement(".home-box h3", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-demi.swf", sColor: "#394F41", sWmode: "transparent"}))
    sIFR.replaceElement(".panel-dark-font h2", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-medium.swf", sColor: "#333333", sWmode: "transparent"}))
    sIFR.replaceElement(".panel-dark-font p.intro", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-medium.swf", sColor: "#333333", sWmode: "transparent"}))
    sIFR.replaceElement(".panel h2", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-medium.swf", sColor: "#ffffff", sWmode: "transparent"}))
    sIFR.replaceElement(".panel p.intro", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-medium.swf", sColor: "#ffffff", sWmode: "transparent"}))
    sIFR.replaceElement("#content .left-col .category", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-medium.swf", sColor: "#999999", sWmode: "transparent"}))
    sIFR.replaceElement("#content .left-col h2", named({sFlashSrc: sIFRPath +"images/fonts/foundry-sans-medium.swf", sColor: "#333333", sWmode: "transparent"}))
}

// Network Webcams User interface
var NW = {

    /**
     * Init functions
     */         
    init: function () {
        NW.sectionSwitch();
        NW.sectorsNav();
        NW.emulateHover($('.third-level-nav li'));
        if($.browser.msie){
            NW.fixIE6flicker(true);
        }                                      
    },

    /**
     * Switch between Sectors and Services navigation
     */
    sectionSwitch: function () {

        $('.section-switch .sectors').hover(
            function () {
                $(this).addClass('current');
                $('.section-switch .services').removeClass('current');
                $('#sectors').show();
                $('#services').hide();
            },
            function () {
            }
        )         

       $('.section-switch .services').hover(
            function () {
                $(this).addClass('current');
                $('.section-switch .sectors').removeClass('current');
                $('#services').show();
                $('#sectors').hide();
            },
            function () {
            }
        )         
    },

    /**
     * Navigation for sector panels
     */
    sectorsNav: function () {
        $(".default-panel").addClass("panel-show"); 
        $('.home #sectors li').hover(
            function () {
                $('#sectors li').removeClass('hover');
                $('#sectors li').removeClass('next');
                $(this).addClass('hover');
                $(this).next().addClass('next');
                var panel = $(this).attr('id').replace(/-nav/, '-panel');
                $('.panel').removeClass("panel-show");
                $('.' + panel).addClass("panel-show");
            },
            function () {
            }
        )
        
        $('.home .section-switch .services').hover(
            function () {
                $('#sectors li').removeClass('hover');
                $('#sectors li').removeClass('next');
                $('.panel').removeClass("panel-show");
                $('.services-panel').addClass("panel-show");
            },
            function () {
            }
        )
        
        $('.home .section-switch .sectors').hover(
            function () {
                $('#sectors li').removeClass('hover');
                $('#sectors li').removeClass('next');
                $('.panel').removeClass("panel-show");
                $('.default-panel').addClass("panel-show");
            },
            function () {
            }
        )                 
    },

    /**
     * Emulate hover
     */
    emulateHover: function (items) {
        items.hover(
            function () {
                $(this).addClass('hover');
            },
            function () {
                $(this).removeClass('hover');
            }
        )
    },

    /**
     * Fix background image flicker in IE6
     */         
    fixIE6flicker: function (fix) {
        try {
            document.execCommand("BackgroundImageCache", false, fix);
        } catch(err) { }
    }   
}

$(document).ready(function () {
    NW.init();
});
