﻿$m.core.register('.main-nav', function (hub) {
    var self = {};

    self.construct = function () {
        var link = hub.find('#mn-company-brochure a');
        var liList = hub.find('#mainnav > li');
        var menuContentContainer = hub.find('#mn-customized-tug-quote');

        $m.jQuery(link).attr('target', 'blank');

        $m.jQuery(liList).each(function () {
            if ($m.jQuery('> a', this).hasClass('current')) {
                $m.jQuery('> ul', this).css('display', 'block');
            }
        });

        var menuContent = $m.jQuery('#menu-content .template-content');

        $m.jQuery(menuContent).clone().prependTo(menuContentContainer);
    };

    self.destruct = function () {

    };

    return self;
});
//Calls the construct function of the above module.  We will be able to chain
//this to the end after the next train deploy.
//ex: $m.core.register('#Bottom-Nav', function (hub) {}).construct();
if ($m.core.modules['.main-nav']) {
    $m.core.modules['.main-nav'].construct();
}

$m.core.register('body', function (hub) {
    var $window,
        self = {};

    self.construct = function () {
        $m.jQuery(hub.container).append("<div id='IE6'><a href='#' class='ie6close'></a><span class='warning'></span> <span>Wow, you're using IE6!</span><br /><p>The browser you're using is very out of date. We beg you to consider upgrading. This website will work for you, but some things may not work as intended because, well, your browser is really old. Upgrade now and be a happier web surfer.</p><a href='http://www.microsoft.com/nz/windows/internet-explorer/default.aspx' class='ie6'></a><a href='http://www.google.com/chrome' class='chrome'></a><a href='http://www.mozilla.com/en-US/firefox/upgrade.html' class='firefox'></a></div>");

        //IE 6 browser detection
        if ($m.jQuery.browser.msie) {
            var version = $m.jQuery.browser.version;

            if (version == '6.0') {
                var cookie = $m.jQuery.cookie('IE6');

                if (cookie != 'set') {
                    $m.jQuery.cookie('IE6', 'set');
                    $m.jQuery('#IE6').show().stop().animate({
                        top: 0
                    }, 1000);
                }

                $m.jQuery('.ie6close').click(function () {
                    $m.jQuery('#IE6').fadeOut(500);
                });
            }
        }
    };

    self.destruct = function () {

    };

    return self;
});
//Calls the construct function of the above module.  We will be able to chain
//this to the end after the next train deploy.
//ex: $m.core.register('#Store', function (hub) {}).construct();
if ($m.core.modules['body']) {
    $m.core.modules['body'].construct();
}
