$(document).ready(function() {
		
	var _Total = 0;
	var _Target = 0;
	
	function GoNext() {
		$(".rotateItem-"+_Target).hide();
		_Target++;
		if (_Target >= _Total) {
			_Target = 0;
		}
		for (x=0; x<_Total;x++) {
			if (x == _Target) {
				$(".rotateItem-"+x).fadeIn('slow');
			}
		}
	}
		
	function DisplayGallery () {
		$("#photoGallery").show()
		$("#nextImage").show()
	}

	$("#rotator").children().each(function(index) {
		_Total++;
		$(this).addClass("rotateItem-"+index);
		if (index == 0) {
			$(this).fadeIn('slow');
		}
	});	
		
	$("#PGbutton").click(function() {
		DisplayGallery();
	});
		
	$("#nextImage").click(function() {
		GoNext();
	});
		
});
