// Jquery slider-gallery code.
$(document).ready(function () {
  $('#carousel_1').jCarouselLite({
      btnNext: "#carousel_1_next",
      btnPrev: "#carousel_1_prev",
      visible: 6,
      circular: false
  });

  // Show manufacturer logo on mouseover event
    $(".spotlightProductImg").mouseover(function() {
        setSpotlightProductLogo(this);
    });

    // Show previous product image on mouseout event
    $(".spotlightProductImg").mouseout(function() {
        setSpotlightProductLogo(this);
    });
});

//Function to set the spotlight product logo
function setSpotlightProductLogo(element) {
    // Set the link id
    var linkId = element.id.replace("spotlightProductLink_", "");

    // Set bg image object
    var bgImage = $("#spotlightProductImage_"+linkId);

    // Store the previous link url
    var prevLink = $(bgImage).css('background-image');

    // Replace the previous link url with the new
    if (spotlightProductPreview[linkId]) {
        $(bgImage).css('background-image', spotlightProductPreview[linkId])
        // Save the previous link url
        spotlightProductPreview[linkId] = prevLink;
    }
}