var whichActiveStep = 1;

(function($) {
    $(document).ready(function() {	
		$('.customFit-slideshow img').hover(
			function() {
				$(this).attr("src", $(this).attr("src").replace("off.png","overWhite.gif"));
			}, function() {
				$(this).attr("src", $(this).attr("src").replace("overWhite.gif","off.png"));
            }
		);
		$('.customFit-slideshow img.previousStep').click(
			function() {
				$('.lodgerExperience-customfitStep').not($('#lodgerExperience-customfit-' + whichActiveStep)).css('display','none');
				if (whichActiveStep == 1) {
					whichActiveStep = 8;
				} else {
					whichActiveStep = whichActiveStep-1;
				}
				$('.lodgerExperience-customfitStep').css("z-index",30);
				$('#lodgerExperience-customfit-' + whichActiveStep).css("z-index",31);
				$('#lodgerExperience-customfit-' + whichActiveStep).fadeIn(500);
			}
		);
		$('.customFit-slideshow img.nextStep').click(
			function() {
				$('.lodgerExperience-customfitStep').not($('#lodgerExperience-customfit-' + whichActiveStep)).css('display','none');
				if (whichActiveStep == 8) {
					whichActiveStep = 1;
				} else {
					whichActiveStep = whichActiveStep+1;
				}
				$('.lodgerExperience-customfitStep').css("z-index",30);
				$('#lodgerExperience-customfit-' + whichActiveStep).css("z-index",31);
				$('#lodgerExperience-customfit-' + whichActiveStep).fadeIn(500);
			}
		);
		for(i=3;i<8;i++) {
			$("#lodgerExperience-customfit-1").after(
			'<div id="lodgerExperience-customfit-' + i + '" class="lodgerExperience-customfitStep">' +
				'<img src="http://www.lodgerfootwear.com/skin/frontend/default/lodger/images/thestore-' + i + '.jpg" width="602" height="472" alt="" border="0" />' +
			'</div>'
			);
		}
    });
})(jQuery);