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

		var alts = new Array(	"Step One", "Step Two", "Step Three", "Step Four");


		var descriptions = new Array("<p>Shape dough into 1 1/2-inch balls. Roll one red ball into a 1/4-inch-wide rope about 6 inches long.<p>",
										"<p>Roll one white ball into a rope of the same length and width as the red rope. </p>",
										"<p>Carefully twist together the red rope and the white rope.</p>",
										"<p>Shape into a candy cane and place on prepared cookie sheets.</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();
});	