Ext.onReady(function(){
		var step = window.step || 0;
		var image_dir = "images/steps/lining_cake_pans/";
		
		var images = new Array("step1.jpg", "step2.jpg", "step3.jpg", "step4.jpg", "step5.jpg");

		var alts = new Array(	"Step One", "Step Two", "Step Three", "Step Four", "Step Five");


		var descriptions = new Array(	"<p>Step One</p><p>Place cake pan on a piece of parchment paper. Trace around pan with a pencil. Cut along traced line.</p>",
										"<p>Step Two</p><p>Using a ruler, measure depth of cake pan. Cut a strip of parchment paper as wide as the depth of the pan and as long as its circumference.</p>",
										"<p>Step Three</p><p>Using vegetable shortening, grease bottom and side of cake pan. Place parchment circle in bottom of cake pan and parchment strip around side of cake pan.</p>",
										"<p>Step Four</p><p>Spray well with nonstick cooking spray with flour, or grease parchment with more vegetable shortening and coat with flour. Pour batter into cake pan and bake according to recipe.</p>",
										"<p>Step Five</p><p>When cake is done and has cooled for 10 minutes in pan on a wire rack, invert cake onto rack. Peel off parchment paper. Let cake cool completely. Spread cooled layers with frosting according to recipe.</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();
});	