﻿/* test for jQuery */
if (typeof $ != 'undefined') {

    var dynNonSLheroTab2 = {

        settings: {
            /**
            * this.settings.imagePath
            * Path to the image directory used by the non-Silverlight hero.  Used by TAB2 methods.
            */
            imagePath: '/global/dynamics/en/us/RichMedia/HomeHero/nonSLassets/images/tab2/',
            previousSinglePlacard: null

        },

        init: function() {

            /////////////////////////SinglePerson initialization////////////////////////
            //dynHeroNonSL-tab2-sub-SinglePerson
            this.SinglePersonDiv = $('#dynHeroNonSL-tab2-sub-SinglePerson-Inner');
            this.SinglePersonDivPlacard = $('#tab2-sub-SinglePlacard');
            this.settings.previousSinglePlacard = this.SinglePersonDivPlacard;

            //dynHeroNonSL-tab2-sub-SinglePerson Placard
            this.tab2SubSinglePlacard1 = $('#tab2-sub-SinglePlacard1');
            this.tab2SubSinglePlacard2 = $('#tab2-sub-SinglePlacard2');
            this.tab2SubSinglePlacard3 = $('#tab2-sub-SinglePlacard3');
            this.tab2SubSinglePlacard4 = $('#tab2-sub-SinglePlacard4');
            this.tab2SubSinglePlacard5 = $('#tab2-sub-SinglePlacard5');

            /////////////////////////PageContent initialization////////////////////////
            //dynHeroNonSL-tab2-sub-PageContent
            this.PageContentInner1 = $('#dynHeroNonSL-tab2-sub-PageContentInner1');
            this.PageContentInner2 = $('#dynHeroNonSL-tab2-sub-PageContentInner2');
            this.PageContentInner3 = $('#dynHeroNonSL-tab2-sub-PageContentInner3');
            this.PageContentInner4 = $('#dynHeroNonSL-tab2-sub-PageContentInner4');
            this.PageContentInner5 = $('#dynHeroNonSL-tab2-sub-PageContentInner5');

            /////////////////////////Many People initialization////////////////////////
            //dynHeroNonSL-tab2-sub-ManyPeople
            this.ManyPeopleDiv = $('#dynHeroNonSL-tab2-sub-ManyPeople');

            //dynHeroNonSL-tab2-sub-ManyPeople Placards
            this.tab2SubP1 = $('#tab2-sub-p1');
            this.tab2SubP2 = $('#tab2-sub-p2');
            this.tab2SubP3 = $('#tab2-sub-p3');
            this.tab2SubP4 = $('#tab2-sub-p4');
            this.tab2SubP5 = $('#tab2-sub-p5');

        },
        ReplaceSinglePlacard: function(currentPlacard, replacementPlacard) {
            currentPlacard.html(replacementPlacard).show('slow');

        },

        SwapToSubScreen: function() {
            $("#dynHeroNonSL-tab2-MainScreen").css("display", "none").hide("slow");
            $("#dynHeroNonSL-tab2").css("background", "#ffffff url('" + this.settings.imagePath + "sub_bg.jpg') no-repeat scroll 0 0").show("slow");
            $("#dynHeroNonSL-tab2-SubScreen").css("display", "block").show("slow");

            this.tab2SubP1.css("display", "none");
        },

        HidePageContent: function() {
            this.PageContentInner1.css("display", "none");
            this.PageContentInner2.css("display", "none");
            this.PageContentInner3.css("display", "none");
            this.PageContentInner4.css("display", "none");
            this.PageContentInner5.css("display", "none");
        },

        ShowSubScreen: function(itemid) {
            //alert("itemid: " + itemid);
            switch (itemid) {
                case 1:
                    //SinglePerson setup
                    this.SinglePersonDiv.fadeOut("fast", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_prof.jpg') no-repeat scroll 0 0") });
                    this.SinglePersonDiv.fadeIn("slow", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_prof.jpg') no-repeat scroll 0 0") });
                    this.ReplaceSinglePlacard(this.settings.previousSinglePlacard, "<div id='tab2-sub-SinglePlacard1'><h2 style='margin:0;padding: 2px 0 0 2px;  font: normal normal bold 12px/12px arial,sans-serif !important;color:#000000;'>Jane</h2><span style='margin:0;padding: 2px 0 2px 2px;font: normal normal normal 11px/11px arial,sans-serif;color:#FE5A1A;'>Professional Services</span></div>");
                    this.SinglePersonDiv.show("slow");
                    this.tab2SubSinglePlacard1.show("slow");

                    //PageContent setup
                    this.HidePageContent();
                    this.PageContentInner1.slideDown("slow");

                    //ManyPeople setup
                    this.ManyPeopleDiv.fadeOut();
                    this.ManyPeopleDiv.css("background", "url('" + this.settings.imagePath + "sub_prof.jpg') no-repeat scroll 0 0").slideDown("slow");
                    this.ShowSubScreenPlacards(this.tab2SubP2, this.tab2SubP3, this.tab2SubP4, this.tab2SubP5, this.tab2SubP1);
                    break;

                case 2:
                    //SinglePerson setup
                    this.SinglePersonDiv.fadeOut("fast", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_gov.jpg') no-repeat scroll 0 0") });
                    this.SinglePersonDiv.fadeIn("slow", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_gov.jpg') no-repeat scroll 0 0") });
                    this.ReplaceSinglePlacard(this.settings.previousSinglePlacard, "<div id='tab2-sub-SinglePlacard2'><h2 style='margin:0;padding: 2px 0 0 2px;  font: normal normal bold 12px/12px arial,sans-serif !important;color:#000000;'>Bill</h2><span style='margin:0;padding: 2px 0 2px 2px;font: normal normal normal 11px/11px arial,sans-serif;color:#FE5A1A;'>Government</span></div>");
                    this.SinglePersonDiv.show("slow");
                    this.tab2SubSinglePlacard2.show("slow");

                    //PageContent setup
                    this.HidePageContent();
                    this.PageContentInner2.slideDown("slow");

                    //ManyPeople setup
                    this.ManyPeopleDiv.fadeOut();
                    this.ManyPeopleDiv.css("background", "url('" + this.settings.imagePath + "sub_gov.jpg') no-repeat scroll 0 0").slideDown("slow");
                    this.ShowSubScreenPlacards(this.tab2SubP1, this.tab2SubP3, this.tab2SubP4, this.tab2SubP5, this.tab2SubP2);
                    break;
                case 3:
                    //SinglePerson setup
                    this.SinglePersonDiv.fadeOut("fast", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_financ.jpg') no-repeat scroll 0 0") });
                    this.SinglePersonDiv.fadeIn("slow", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_financ.jpg') no-repeat scroll 0 0") });
                    this.ReplaceSinglePlacard(this.settings.previousSinglePlacard, "<div id='tab2-sub-SinglePlacard3'><h2 style='margin:0;padding: 2px 0 0 2px;  font: normal normal bold 12px/12px arial,sans-serif !important;color:#000000;'>Joe</h2><span style='margin:0;padding: 2px 0 2px 2px;font: normal normal normal 11px/11px arial,sans-serif;color:#FE5A1A;'>Financial Services</span></div>");
                    this.SinglePersonDiv.show("slow");
                    this.tab2SubSinglePlacard3.show("slow");

                    //PageContent setup
                    this.HidePageContent();
                    this.PageContentInner3.slideDown("slow");

                    //ManyPeople setup
                    this.ManyPeopleDiv.fadeOut();
                    this.ManyPeopleDiv.css("background", "url('" + this.settings.imagePath + "sub_financ.jpg') no-repeat scroll 0 0").slideDown("slow");
                    this.ShowSubScreenPlacards(this.tab2SubP1, this.tab2SubP2, this.tab2SubP4, this.tab2SubP5, this.tab2SubP3);
                    break;
                case 4:
                    //SinglePerson setup
                    this.SinglePersonDiv.fadeOut("fast", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_manuf.jpg') no-repeat scroll 0 0") });
                    this.SinglePersonDiv.fadeIn("slow", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_manuf.jpg') no-repeat scroll 0 0") });
                    this.ReplaceSinglePlacard(this.settings.previousSinglePlacard, "<div id='tab2-sub-SinglePlacard4'><h2 style='margin:0;padding: 2px 0 0 2px;  font: normal normal bold 12px/12px arial,sans-serif !important;color:#000000;'>Robert</h2><span style='margin:0;padding: 2px 0 2px 2px;font: normal normal normal 11px/11px arial,sans-serif;color:#FE5A1A;'>Manufacturing</span></div>");
                    this.SinglePersonDiv.show("slow");
                    this.tab2SubSinglePlacard4.show("slow");

                    //PageContent setup
                    this.HidePageContent();
                    this.PageContentInner4.slideDown("slow");

                    //ManyPeople setup
                    this.ManyPeopleDiv.fadeOut();
                    this.ManyPeopleDiv.css("background", "url('" + this.settings.imagePath + "sub_manuf.jpg') no-repeat scroll 0 0").slideDown("slow");
                    this.ShowSubScreenPlacards(this.tab2SubP1, this.tab2SubP2, this.tab2SubP3, this.tab2SubP5, this.tab2SubP4);
                    break;
                case 5:
                    //SinglePerson setup
                    this.SinglePersonDiv.fadeOut("fast", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_retail.jpg') no-repeat scroll 0 0") });
                    this.SinglePersonDiv.fadeIn("slow", function() { $(this).css("background", "url('" + dynNonSLheroTab2.settings.imagePath + "person_retail.jpg') no-repeat scroll 0 0") });
                    this.ReplaceSinglePlacard(this.settings.previousSinglePlacard, "<div id='tab2-sub-SinglePlacard5'><h2 style='margin:0;padding: 2px 0 0 2px;  font: normal normal bold 12px/12px arial,sans-serif !important;color:#000000;'>Nicole</h2><span style='margin:0;padding: 2px 0 2px 2px;font: normal normal normal 11px/11px arial,sans-serif;color:#FE5A1A;'>Retail</span></div>");
                    this.SinglePersonDiv.show("slow");
                    this.tab2SubSinglePlacard5.show("slow");

                    //PageContent setup
                    this.HidePageContent();
                    this.PageContentInner5.slideDown("slow");

                    //ManyPeople setup
                    this.ManyPeopleDiv.fadeOut();
                    this.ManyPeopleDiv.css("background", "url('" + this.settings.imagePath + "sub_retail.jpg') no-repeat scroll 0 0").slideDown("slow");
                    this.ShowSubScreenPlacards(this.tab2SubP1, this.tab2SubP2, this.tab2SubP3, this.tab2SubP4, this.tab2SubP5);
                    break;
                default:
                    break;
            }
        },

        ShowSubScreenPlacards: function(plac1, plac2, plac3, plac4, placNoShow) {
            plac1.css("display", "block").show("slow");
            plac2.css("display", "block").show("slow");
            plac3.css("display", "block").show("slow");
            plac4.css("display", "block").show("slow");

            placNoShow.css("display", "block").hide("slow");
        },

        SwapPlacard: function(id, state) {
            var p = document.getElementById("tab2-p" + id);
            var l = document.getElementById("tab2-link" + id);
            var t = document.getElementById("tab2-summary-text-input" + id);
            var f = document.getElementById("dynHeroNonSL-tab2-summary-text");
            var d = document.getElementById("tab2-summary-text-input-start");

            if (p != null && l != null) {
                if (state != null && state == 'over') {
                    p.className = 'placard placard-selected';
                    l.className = 'industry-link-selected';
                    if (f != null && t != null) {
                        f.innerHTML = t.value;
                    }
                }
                else {
                    p.className = 'placard placard-unselected';
                    l.className = 'industry-link-unselected';
                    if (f != null && d != null) {
                        f.innerHTML = d.value;
                    }
                }
            }
        }

} //end of dynNonSLheroTab2

$(document).ready(function() {
    dynNonSLheroTab2.init();

    //Event Handlers
    $("#tab2-link1").click(function(event) {
        dynNonSLheroTab2.SwapToSubScreen();
        dynNonSLheroTab2.ShowSubScreen(1);
    });
    $("#tab2-link1").mouseover(function(event) { dynNonSLheroTab2.SwapPlacard('1', 'over'); }); $("#tab2-link1").mouseout(function(event) { dynNonSLheroTab2.SwapPlacard('1', 'out'); });


    $("#tab2-link2").click(function(event) {
        dynNonSLheroTab2.SwapToSubScreen();
        dynNonSLheroTab2.ShowSubScreen(4);
    });
    $("#tab2-link2").mouseover(function(event) { dynNonSLheroTab2.SwapPlacard('2', 'over'); }); $("#tab2-link2").mouseout(function(event) { dynNonSLheroTab2.SwapPlacard('2', 'out'); });


    $("#tab2-link3").click(function(event) {
        dynNonSLheroTab2.SwapToSubScreen();
        dynNonSLheroTab2.ShowSubScreen(2);
    });
    $("#tab2-link3").mouseover(function(event) { dynNonSLheroTab2.SwapPlacard('3', 'over'); }); $("#tab2-link3").mouseout(function(event) { dynNonSLheroTab2.SwapPlacard('3', 'out'); });


    $("#tab2-link4").click(function(event) {
        dynNonSLheroTab2.SwapToSubScreen();
        dynNonSLheroTab2.ShowSubScreen(5);
    });
    $("#tab2-link4").mouseover(function(event) { dynNonSLheroTab2.SwapPlacard('4', 'over'); }); $("#tab2-link4").mouseout(function(event) { dynNonSLheroTab2.SwapPlacard('4', 'out'); });

    $("#tab2-link5").click(function(event) {
        dynNonSLheroTab2.SwapToSubScreen();
        dynNonSLheroTab2.ShowSubScreen(3);
    });
    $("#tab2-link5").mouseover(function(event) { dynNonSLheroTab2.SwapPlacard('5', 'over'); }); $("#tab2-link5").mouseout(function(event) { dynNonSLheroTab2.SwapPlacard('5', 'out'); });



    $("#tab2-sub-link1").click(function(event) {
        dynNonSLheroTab2.ShowSubScreen(1);
    });
    $("#tab2-sub-link1").mouseover(function() { $('#tab2-sub-p1').css('background', '#e59716'); $('#tab2-sub-p1 > span').css('color', '#ffffff'); });
    $("#tab2-sub-link1").mouseout(function() { $('#tab2-sub-p1').css('background', '#ffffff'); $('#tab2-sub-p1 > span').css('color', '#e59716'); });
    
    $("#tab2-sub-link2").click(function(event) {
        dynNonSLheroTab2.ShowSubScreen(2);
    });
    $("#tab2-sub-link2").mouseover(function() { $('#tab2-sub-p2').css('background', '#e59716'); $('#tab2-sub-p2 > span').css('color', '#ffffff'); });
    $("#tab2-sub-link2").mouseout(function() { $('#tab2-sub-p2').css('background', '#ffffff'); $('#tab2-sub-p2 > span').css('color', '#e59716'); });
    
    $("#tab2-sub-link3").click(function(event) {
        dynNonSLheroTab2.ShowSubScreen(3);
    });
    $("#tab2-sub-link3").mouseover(function() { $('#tab2-sub-p3').css('background', '#e59716'); $('#tab2-sub-p3 > span').css('color', '#ffffff'); });
    $("#tab2-sub-link3").mouseout(function() { $('#tab2-sub-p3').css('background', '#ffffff'); $('#tab2-sub-p3 > span').css('color', '#e59716'); });
    
    $("#tab2-sub-link4").click(function(event) {
        dynNonSLheroTab2.ShowSubScreen(4);
    });
    $("#tab2-sub-link4").mouseover(function() { $('#tab2-sub-p4').css('background', '#e59716'); $('#tab2-sub-p4 > span').css('color', '#ffffff'); });
    $("#tab2-sub-link4").mouseout(function() { $('#tab2-sub-p4').css('background', '#ffffff'); $('#tab2-sub-p4 > span').css('color', '#e59716'); });
    
    $("#tab2-sub-link5").click(function(event) {
        dynNonSLheroTab2.ShowSubScreen(5);
    });
    $("#tab2-sub-link5").mouseover(function() { $('#tab2-sub-p5').css('background', '#e59716'); $('#tab2-sub-p5 > span').css('color', '#ffffff'); });
    $("#tab2-sub-link5").mouseout(function() { $('#tab2-sub-p5').css('background', '#ffffff'); $('#tab2-sub-p5 > span').css('color', '#e59716'); });



});       // end of $(document).ready
  
}
