﻿// On Dom Ready
jQuery(document).ready(function ()
{
    // Set cached elements
    var LifeCycleBackgroundStates = jQuery("#LifeCycleGroups img[id!='BackgroundImageGroupsStandard']");
    var LifeCycleBackgroundStandard = jQuery("#BackgroundImageGroupsStandard");
    var LifeCycleDefinitionList = jQuery("#LifeCycle dl");
    // Reset states
    jQuery("#TransparentMap, #LifeCycle dt").bind("mouseover", function ()
    {
        // Hide all states
        LifeCycleBackgroundStates.hide();
        // Remove class for link color
        LifeCycleDefinitionList.removeClass("Current");
    });
    // For each area
    jQuery("#LifeCycleMap area").each(function ()
    {
        // Bind mouseover
        jQuery(this).mouseover(function (event)
        {
            // Stop propagation to accommodate IE7/8
            event.stopPropagation();
            // Set context id
            var ContextIdString = this.id.split("_");
            var ContextId = ContextIdString[1];
            // Hide all states
            LifeCycleBackgroundStates.hide();
            // Show hover image
            jQuery("#Image_" + ContextId).show();
            // Add class for link color
            jQuery("#List_" + ContextId).addClass("Current");
        });
    });
    // For each link
    jQuery("#LifeCycle dl dd a").each(function ()
    {
        // Bind mouseover
        jQuery(this).mouseover(function ()
        {
            // Set context id
            var ContextIdString = jQuery(this).parents("dl").attr("id").split("_");
            var ContextId = ContextIdString[1];
            // Hide all states
            LifeCycleBackgroundStates.hide();
            // Show hover image
            jQuery("#Image_" + ContextId).show();
            // Add class for link color
            jQuery("#List_" + ContextId).addClass("Current");
        });
    });
});
