// Declarations var arrAdImage = new Array(); var lNewImage = 0; var lNewStart = 0; var lFade = 500 // Start the feature var tid = setInterval('RotateFeature(true);', 7500); // Set up the list of images and supporting text arrAdImage.push('Advert-1.jpg'); arrAdImage.push('Advert-2.jpg'); arrAdImage.push('Advert-3.jpg'); arrAdImage.push('Advert-4.jpg'); // Preload the next image PreLoadNewImage(); // ===================================================================================== function PreLoadNewImage() { // Calculate the next image SetNewImage() // Preload it var objImage = new Image(424, 507); objImage.src = '/Images/Content/' + arrAdImage[lNewImage]; } // ===================================================================================== function SetNewImage() { // Calculate the next image lNewImage = lNewImage + 1; // If it's past the end reset to 1 if (lNewImage == arrAdImage.length) lNewImage = 0; } // ===================================================================================== function RotateFeature(vbPreLoad) { // Fade it out $("#Advert").fadeOut(lFade, function () { // Change the image $("#Advert").attr("src", "/Images/Content/" + arrAdImage[lNewImage]); // And fade it in $("#Advert").fadeIn(lFade); // Preload the next image if (vbPreLoad) PreLoadNewImage(); }); } // ===================================================================================== function ShowMoreRecipes(vsLinkID, vsRecipeIDPrefix, vlRecipes) { $('#' + vsLinkID).attr('class', 'Hidden'); for (lIndex = 1; lIndex <= vlRecipes; lIndex++) { $('#' + vsRecipeIDPrefix + lIndex).attr('class', 'Visible'); } }