var currentPhoto = 1;
var totalPhotos = 10;
var imagePath;
var prevButton;
var nextButton;

var init = function() {
	imagePath = '/events/whh_street_team/';
	prevButton = $('#Slideshow_Prev_Button');
	nextButton = $('#Slideshow_Next_Button');
	
	$('#Total_Photos').html(totalPhotos);
	
	$('#Slideshow_Prev_Button').bind('click',function(){ changePhoto(-1); });
	$('#Slideshow_Next_Button').bind('click',function(){ changePhoto(1); });
}

var changePhoto = function(dir) {
	if ((currentPhoto+dir)>0&&(currentPhoto+dir)<=totalPhotos) {
		
		$('#Slideshow_Photo').attr('src',imagePath+'sf/gallery/'+(currentPhoto+dir)+'.jpg');
		
		$('#Current_Photo').html(currentPhoto+dir);
		
		prevButton.attr('src',imagePath+'arrow_prev.gif');
		nextButton.attr('src',imagePath+'arrow_next.gif');
			
		if ((currentPhoto+dir)==1) {
			prevButton.attr('src',imagePath+'arrow_prev_off.gif');
		} else if ((currentPhoto+dir)==totalPhotos) {	
			nextButton.attr('src',imagePath+'arrow_next_off.gif');
		}
		
		currentPhoto += dir;
	}
}

$(init);