//Function to set up the Features Showcase
$(document).ready(
    function initiateFeaturesShowcase(){
        var currentShowcase = 1;                    //Start the Showcase at the first feature  
        showFeaturesShowcase(currentShowcase);      //Show the first feature
        //Add a click event to the previous button
        $("#featuresSpotlightNavPrev").click(
            function showPreviousFeaturesShowcase(){
                var nextShowcase = currentShowcase - 1;     //Set the next showcase number to the next lowest showcase number
                if (nextShowcase == 0) {nextShowcase = 4;}  //If the next showcase would be 0 make the next showcase, showcase 4
                hideFeaturesShowcase(currentShowcase);      //Hide the current showcase
                showFeaturesShowcase(nextShowcase);         //Show the next showcase
                currentShowcase = nextShowcase;             //Set the current showcase to the showcase we've just shown
                return false;
            }
        );
        //Add a click event to the next button
        $("#featuresSpotlightNavNext").click(
            function showNextFeaturesShowcase(){
                var nextShowcase = currentShowcase + 1;     //Set the next showcase number to the next highest showcase number
                if (nextShowcase == 5) {nextShowcase = 1;}  //If the next showcase would be 5 make the next showcase, showcase 1
                hideFeaturesShowcase(currentShowcase);      //Hide the current showcase
                showFeaturesShowcase(nextShowcase);         //Show the next showcase
                currentShowcase = nextShowcase;             //Set the current showcase to the showcase we've just shown
                return false;
            }
        );              
    }
);

function hideFeaturesShowcase(intFeature)
{
    $("#featuresSpotlight" + intFeature.toString()).hide();
}

function showFeaturesShowcase(intFeature)
{
    var pathString = $("#featuresSpotlight" + intFeature.toString()).find(".featureSpotlightPaths").attr("rel");
    var pathArray = pathString.split("|");
    var linkPath = pathArray[0];
    var imagePath = pathArray[1];
    $("#imgFeaturesSpotlight").attr("src",imagePath);
    $("#linkFeaturesSpotlightLearnMore1").attr("href",linkPath);
    $("#linkFeaturesSpotlightLearnMore2").attr("href",linkPath);
    $("#featuresSpotlight" + intFeature.toString()).show();
}