﻿


var currRotatorImage = null;
var bigImageID = "#bigImageWrapper_1";
$(document).ready(function()
{
    $("#bigImageWrapper_1").css("display", "block");
    $(".rotatorTabs:first").addClass("rotatorTabsHover");

    $(".tabWrapper").mouseover(function()
    {
        $(".rotatorTabs").removeClass("rotatorTabsHover");
        bigImageID = "#bigImageWrapper_" + $(this).attr("id").replace("tab_", "");

        if (currRotatorImage != null && currRotatorImage != bigImageID)
        {
            $(currRotatorImage).fadeOut();
            $(currRotatorImage).css("z-index", "1");
        }

        if (bigImageID != currRotatorImage)
        {
            $(bigImageID).fadeIn();
            $(bigImageID).css("z-index", "2");
            if (bigImageID.replace("#bigImageWrapper_", "") == "1")
            {
                $("#serviceTypeButtons").fadeIn();
            }
            else
            {
                $("#serviceTypeButtons").fadeOut();
            }
        }

        $(this).find(".rotatorTabs").addClass("rotatorTabsHover");
        currRotatorImage = bigImageID;
    });



    $(".homeRotatorBkg").click(function()
    {
        document.location = $(bigImageID).find("a").attr("href");
    });


    $(".serviceTypeButtons").click(function()
    {
        bigImageID = "#bigImageWrapper_" + $(this).attr("id").replace("serviceType_", "");

        if (currRotatorImage != null && currRotatorImage != bigImageID)
        {
            $(currRotatorImage).fadeOut();
            $(currRotatorImage).css("z-index", "1");
        }

        if (bigImageID != currRotatorImage)
        {
            $(bigImageID).fadeIn();
            $(bigImageID).css("z-index", "2");
        }

        currRotatorImage = bigImageID;

    });


    // initialize tooltip
    $("#serviceTypeButtons img[title]").tooltip({
        // effect: "fade",
        position: "top left",
        offset: [-2, 17]
    });

    $(".mediaPodImageWrapper").click(function()
    {
        openPlayer("crossroads");
    });

    $(".mediaPodImageWrapper").mouseenter(function()
    {
        doRo(this);
    });

});
