﻿$m.core.register('.sitesearch', function (hub) {
    var searchButton,
        searchField,
        self = {};

    self.construct = function () {
        searchButton = hub.find('.searchButton');
        searchField = hub.find('.searchField');
        $m.jQuery(searchButton).val('');
        $m.jQuery(searchField).val('Search');
    };

    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('.searchPanel', function (hub) {}).construct();
if ($m.core.modules['.sitesearch']) {
    $m.core.modules['.sitesearch'].construct();
} 

$m.core.register('.inforequest', function (hub) {
    var searchButton,
        self = {};

    self.construct = function () {
        searchButton = hub.find('.button');
        $m.jQuery(searchButton).val('');
    };

    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('.searchPanel', function (hub) {}).construct();
if ($m.core.modules['.inforequest']) {
    $m.core.modules['.inforequest'].construct();
}

$m.core.register('#mainnav', function (hub) {
    var childNodes,
        bodyId,
        self = {};

    self.construct = function () {
        bodyId = $m.jQuery('body').attr('id');
        childNodes = hub.find('> li > ul');

        $m.jQuery(childNodes).each(function () {
            $m.jQuery(this).mouseover(function () {
                var a = $m.jQuery(this).prev();
                switch (bodyId) {
                    case 'girls':
                        a.css('background-image', "url('SiteFiles/500008/images/MS_ActiveLinkRight.jpg')");
                        break;
                    case 'boys':
                        a.css('background-image', "url('SiteFiles/500008/images/MS_BoysActiveLinkRight.jpg')");
                        break;
                    case 'outdoor':
                        a.css('background-image', "url('SiteFiles/500008/images/MS_OutdoorActiveLinkRight.jpg')");
                        break;
                    case 'alternative':
                        a.css('background-image', "url('SiteFiles/500008/images/MS_AlternativeActiveLinkRight.jpg')");
                        break;
                    case 'default':
                        a.css('background-image', "url('SiteFiles/500008/images/MS_ActiveLinkRight.jpg')");
                        break;
                }

                a.css('color', "#ffffff");
                a.css('background-repeat', "no-repeat");
                a.css('background-position', "right top");
            });
            $m.jQuery(this).mouseout(function () {
                var a = $m.jQuery(this).prev();
                a.css('background-image', '');
                a.css('color', '');
            });
        });

    };

    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('.searchPanel', function (hub) {}).construct();
if ($m.core.modules['#mainnav']) {
    $m.core.modules['#mainnav'].construct();
}
