Ext.onReady(function(){
		var step = window.step || 0;
		var image_dir = "images/steps/santa_cookies/";
		
		var images = new Array("step1.jpg", "step2.jpg", "step3.jpg", "step4.jpg", "step5.jpg", "step6.jpg", "step7.jpg", "step8.jpg");

		var alts = new Array(	"Step One", "Step Two", "Step Three", "Step Four", "Step Five", "Step Six", "Step Seven", "Step Eight");


		var descriptions = new Array(	"<p>Shape dough into 1 1/4-inch balls and place on prepared baking sheets. Using the greased bottom of a glass, dipped in sugar, flatten each ball to approximately 2 1/2 inches in diameter.</p>",
										"<p>After cookies are baked and cooled, it's time to decorate! Place a scoop or a cup over two-thirds of the cookie to serve as a decorating guide.</p>",
										"<p>Spread frosting in a crescent shape on outer third of each cookie (the part not covered by the scoop or cup). While frosting is still wet, sprinkle with red sugar.</p>",
										"<p>Using frosting as adhesive, press miniature marshmallows on cookies for tassel on caps.</p>",
										"<p>Spread frosting in a crescent shape on lower third of each cookie.</p>",
										"<p>While frosting is still wet, sprinkle with coconut.</p>",
										"<p>Using frosting as adhesive, press 2 chocolate chips for eyes and 1 red cinnamon candy for nose of each cookie. </p>",
										"<p>Allow cookies to dry completely before handling.</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();
});	