BLUE = {};
BLUE.app = function()
{
    function setupNavigationDropdown()
    {
        //site dropdown menu
        jQuery('ul#HMMainMenu li').hover(function()
        {
            jQuery(this).addClass("sfHover");
        }, 
        function()
        {
            jQuery(this).removeClass("sfHover");
        });
    }
    
    return {
        init: function()
        {
            setupNavigationDropdown();
            
            if (jQuery('#secondary').length > 0) {
                var offset = jQuery('#body_ba div.container').height() - jQuery('div.content-header').height();
                jQuery('div.content-inner').height(offset - 5);
            }

            jQuery('ul#HMMainMenu li:first, #footer ul li:first').addClass('first');
            jQuery('ul#HMMainMenu li:last, #footer ul li:last').addClass('last');
            
            /* Venkat-- to address thickbox issue for images to add a class "thickbox" */
            jQuery('div.nDetailsPane span.nDetailsImages span a').addClass('thickbox');
            
            /* venkat-- jquery for thickbox implementation in production */
            jQuery('div.nDetailsPane span.nDetailsImages span div.nDetailsImages_ISImage a').addClass('thickbox'); 
            
            /**
             * Setting up the display of headers for secondary pages
             * Also, write the name of the section above the sidebar
             */
            if (jQuery('#secondary').length > 0) { //we're in a secondary page
                var bc = jQuery.trim(jQuery('a.Breadcrumb:first').text());
                var firstBreadCrumb = bc.toLowerCase();
                var imageClassMap = {
                    'company': 2,
                    'services': 3,
                    'portfolio': 4,
                    'news': 5,
                    'resources': 6,
                    'careers': 7,
                    'contact': 8,
                    'search': 9
                };
                if (imageClassMap.hasOwnProperty(firstBreadCrumb)) {
                    var _class = 'header-' + imageClassMap[firstBreadCrumb];
                    jQuery('div.content-header').addClass(_class).removeClass('header-default');
                }
                else {
                    jQuery('div.content-header').addClass('header-default');
                }
                
                // name of section
                jQuery('h2 span.sidebar-highlight-light').show().children('span:first').text(bc);
                
                /**
                 * Setup appropriate display of secondary navigation menu items
                 */
                var $parent = jQuery('li#HMSidebarMenuCurrentItem').parents('#secondary ul#HMSidebarMenu > li');
                $parent.addClass('subulParent');
                try {
                    var id = $parent.attr('id');
                    id = id.replace("Sidebar", "Main");
                    jQuery('#HMMainMenu #' + id).addClass('active');
                } catch(err) {}
            }
            
            /**
             * Add some markup for images in table cells
             */
            jQuery('div.c_content img').parent('a').parent('td').addClass('img-td-container');
            
            /**
             * Testing UI breakup in IE7.  Remove reference to skin.css
             */
            if(jQuery('div.temp').length > 0) {
                jQuery('link[href*="skin.css"]').remove();
            }
        }
    };
    
}();

//commented out by Jason to address broken thickbox issue.
//explained here: http://websmurf.org/blogs/javascript/jquery-and-thickbox-noconflict-mode.html
jQuery.noConflict();

jQuery(document).ready(function() {
    BLUE.app.init();
});
