Ext.onReady(function(){
		var step = window.step || 0;
		var image_dir = "images/steps/caramel_icing/";
		
		var images = new Array("img00.jpg", "img01.jpg", "img02.jpg","img03.jpg","img04.jpg","img05.jpg","img06.jpg","img07.jpg","img08.jpg","img09.jpg","img10.jpg","img11.jpg","img12.jpg");

		var alts = new Array(	"Introduction","Step One", "Step Two", "Step Three", "Step Four", "Step Five", "Step Six", "Step Seven", "Step Eight", "Step Nine", "Step Ten", "Step Eleven", "Step Twelve");


		var descriptions = new Array(	"<p><em>Taste of the South</em> editor Lorna Reeves says that her mother's recipe for cooked caramel icing [August/September 2009, page 74] is the easiest caramel icing she has ever made. That proved true for some of our readers, who wrote to tell us of the delicious results they had the first time they made the icing. But other readers reported problems&mdash;with everything from caramelizing the sugar to getting the icing thick enough to spread.<br/><br/>Loren Wood, the pastry chef in our test kitchen who tested this recipe, admits that making caramel icing can be challenging until you get the timing down. Here, in pictures, Loren walks you through making Linda's Cooked Caramel Icing, sharing her tips and giving you specific signs to look for.</p>",
									 "<p>In making this recipe, you will have two pans on the heat at the same time. Loren Wood recommends using an 8-inch skillet to caramelize the sugar (a nonstick skillet will make cleanup easier) and a 5- to 6-quart Dutch oven to heat the milk mixture.<br/><br/>&nbsp;&nbsp; &bull; Place 1/2 cup sugar in the skillet. Set on stove over medium-high heat.<br/><br/>&nbsp;&nbsp; &bull; Place 4 cups sugar, 2 (5-ounce) cans evaporated milk, and 1 cup butter in the Dutch oven. Set on stove over high heat.</p>",
										"<p>All you need to caramelize the sugar is a heat source. Be patient. A gas range will likely cook faster than an electric range with coil burners, which, in turn, will cook faster than a smooth-top electric range.</p>",
										"<p>Whisk constantly to make sure the caramelized sugar is smooth with no lumps. If you don't whisk constantly, the sugar can easily burn.<br/><br/>&nbsp;&nbsp; &bull; Cook sugar in skillet, whisking constantly until caramelized or amber colored, approximately 4 minutes.<br/><br/>&nbsp;&nbsp; &bull; At the same time, bring the ingredients in the Dutch oven to a boil over high heat, whisking constantly. (The objective is for these ingredients to come to a boil at the same time that the sugar in the other pan turns amber in color.)</p>",
										"<p>When the sugar is smooth and amber colored and the milk mixture has come to a full rolling boil, carefully add the sugar to the milk, whisking constantly.<br/><br/>&nbsp;&nbsp; &bull; Be careful; the mixture may foam up when the caramelized sugar is added.</p>",
										"<p>Don't reduce the heat; keep it on high. The mixture needs to boil vigorously for 3 minutes or more, depending on your type of range. The caramel should reach softball stage (234&deg; on a candy thermometer). If you don't have a candy thermometer, drop a little icing into a cup of cold water. If you can shape the icing into a soft ball, it's ready.<br/><br/>&nbsp;&nbsp; &bull; Let cool for 1 minute.<br/><br/>&nbsp;&nbsp; &bull; The caramel mixture will cool faster if you transfer it to a glass or ceramic bowl, one that won't retain heat the way the hot pot will.</p>",
										"<p>Beat at medium speed with an electric mixer until the caramel thickens and reaches a pourable consistency&mdash;approximately 1 minute, but perhaps longer.</p>",
										"<p>When the icing is ready, Loren says, it should pile up on itself when dripped from a spatula.</p>",
										"<p>Ice the cake with layers of caramel icing. &quot;Icing the cake is going to get messy,&quot; Loren says, so she recommends using a cake plate with a lip or an upturned edge. Place the first cake layer on the plate and pour the icing over it.</p>",
										"<p>Smooth the icing to the layer's edge using an offset spatula.</p>",
										"<p>Pour a second layer of icing and smooth it to the edge.</p>",
										"<p>Repeat for remaining cake layers and icing.</p>",
										"<p>The icing will get thicker as you work. Pick up the excess icing with the spatula and spread it on the sides. If the icing gets too thick, you can warm it gently on the stove until it reaches the desired consistency.</p>"
																	);	
			

	var vimg = Ext.getDom('viewer_img');
	var vtext = Ext.getDom('viewer_text');
	
	Ext.get('next').on('click', function(){
		Ext.get('ss_left').show();
		step = step + 1;
		if(step>images.length-1){
			step=0;
		}
		vimg.alt = alts[step];
		vimg.src = image_dir + images[step];
		vtext.innerHTML = descriptions[step];
		if(step==images.length-1){
			Ext.get('ss_right').hide();
		}
	});
	
	Ext.get('prev').on('click', function(){
		Ext.get('ss_right').show();
		step = step - 1;
		if(step<0){
			step=images.length-1;
		}
		vimg.alt = alts[step];
		vimg.src = image_dir + images[step];
		vtext.innerHTML = descriptions[step];
		if(step==0){
			Ext.get('ss_left').hide();
		}
																			 
	});
	
	//load intial photo and text
	vimg.alt = alts[step];
	vimg.src = image_dir + images[step];
	vtext.innerHTML = descriptions[step];
	
	//hide previous button initially
	Ext.get('ss_left').hide();
});	