﻿var ie7 = ($.browser.msie && $.browser.version == "7.0") ? true : false;
var ie8 = ($.browser.msie && $.browser.version == "8.0" && document.documentMode) ? true : false;
if (typeof (window.mb) == "undefined") {
    mb = {}
} mb.homePage = new (function (c) {
    var b = this;
    var d = {};
    mb.broadcaster.addListener(mb.events.INITED, function () {
        mb.homePage.init()
    });
    b.init = function () {
        mb.logger.info("homePage.init()");
        mb.broadcaster.addListener(mb.events.MEDIA_CONTAINER_READY, function (g, f) {
            mb.logger.log("MEDIA_CONTAINER_READY")
        });
        mb.broadcaster.addListener(mb.events.VIDEO_COMPLETE, function () {
            mb.homePage.onVideoComplete()
        });
        mb.broadcaster.addListener(mb.events.PAGE_LOADED, function (g, f) {
            mb.homePage.onPageLoaded(g)
        })
    };
    b.onPageLoaded = function (e) {
        mb.logger.info("homePage.onPageLoaded(" + typeof (e) + ")");
        a(e);
        c(".hero-thumbnail-wrapper").carousel(c(".hero-container"), { hitArea: c(".thumbnail-hit-area"), intervalSeconds: 10, siteSection: e.getProperty("section") })
    };
    var a = function (h) {
        mb.logger.info("homePage.initPageStyles()");
        var g = h.getProperty("section"), f = h.getProperty("subsection"), e = h.getProperty("contextPath");
        c(window).resize(function () {
            mb.global.posPage()
        });
        mb.global.posPage();
        c("div.link-sets ul").hoverIntent(function () {
            c(this).addClass("darker-tout")
        }, function () {
            c(this).removeClass("darker-tout")
        });
        c("div.link-sets ul li").hoverIntent(function () {
            var i = c(this);
            c(this).addClass("not");
            c("span.carousel-wrapper", i).addClass("open");
            c(".greyout", i).show().animate({ height: "225px" }, 150, function () {
                c("h2", i).css("bottom", "190px");
                c("p", i).css("bottom", "-17px");
                c("a", i).css("bottom", "85px");
                c(".lower-links").css("z-index", "1001");
                c(this).fadeOut(250)
            })
        }, function () {
            var i = c(this);
            c("span.carousel-wrapper", i).removeClass("open");
            c(".greyout", i).show().animate({ height: "130px" }, 150, function () {
                c("h2", i).css("bottom", "-10px");
                c("p", i).css("bottom", "-100px");
                c("a", i).css("bottom", "25px");
                c(".lower-links").css("z-index", "999");
                c(this).fadeOut(250)
            });
            c("div.link-sets ul li").removeClass("darker-tout").removeClass("not")
        }).find("span.carousel-wrapper").append('<div class="greyout"/>');
        if (ie7) {
            c(".hero-container").css("float", "none")
        } 
    }
})(jQuery);
