if ($('#the-slideshow').length > 0) {
	$("#loading").show();

	$(document).ready(function() {

		$.ajax({ 
		cache: false,
		url: "/assets/sections/homepage/data/carousel.html", // Grab external page for carousel content 
		dataType: "html",
	        error: function() {
        	   	//alert('HTML Fragment not found...');
	        },	
		success: function(data) {
		
			$("#loading").hide();
		
			$("#products-slideshow").html("").append(data);
			
			var sN = ""; // Slideshow Navigation
			var tIndex = 1; // Set index for displaying slide numbers

			// Build Navigation List
			sN = "<div id=\"ss-nav\">";			
			sN += "<div id=\"w\">";			
			sN += "<div id=\"i\">";			
			sN += "<div id=\"t\">";			
				$("#products-slideshow .product").each(function(){ 
					sN += "<a href=\"#\">" + tIndex + "</a>";
					tIndex++
				});
			sN += "</div>";
			sN += "<div id=\"c\">";
				sN += "<a href=\"#\" id=\"pause\" class=\"sprite-home\"><img src=\"/assets/core/img/layout/transparent.png\" alt=\"Pause\" width=\"50\" height=\"22\" /></a>";
			sN += "</div>";
			sN += "</div>";
			sN += "</div>";
			sN += "</div>";

			// Add All Slideshow Controls to the DOM
			$("#products-slideshow").after(sN);

			// Initiate Tabs with Slideshow Plugin
			$("#t").tabs("#products-slideshow > .product", { 
				effect: 'fade', 
				fadeOutSpeed: "50", 
				fadeInSpeed: "50", 
				rotate: true 
			}).slideshow({
				autoplay: true,
				interval: 15000
			}); 
  
			$("#play").live("click", function(e){
				$("#t").data("slideshow").play();
				$(this).addClass("current");
				$(this).attr("id", "pause");
				$("img",this).attr("alt","Pause");
				e.preventDefault();
			});
			$("#pause").live("click",function(e){
				var api = $("#t").data("slideshow"); 
				api.stop();
				$(this).addClass("current");
				$(this).attr("id", "play");
				$("img",this).attr("alt","Play");
				e.preventDefault();
			});
			
			// Apply tooltips
			if ($("a.tooltip").length) {
				tescoInterface.tescoTooltips();
			}
			
		} 
		
		}); //ajax
	
	}); //DOM ready
}
