$(document).ready(
	function(){
		$(".slideshowGallery").append('<div class="handlerLeft"></div><div class="handlerRight"></div>');
		$(".slideshowGallery").append('<div class="information"></div>');
		$(".slideshowGallery").hover(
			function(){
				$(".overlayText",this).stop().animate({"top":"0px"}, 500);
				if($("#slogans",this).children().length > 1){
					if( $("ul#slogans li:first",this).hasClass("selected") ){
						$(".handlerRight",this).fadeIn(500);
					}
					else if( $("ul#slogans li:last",this).hasClass("selected") ){
						$(".handlerLeft",this).fadeIn(500);
					}
					else {
						$(".handlerLeft, .handlerRight",this).fadeIn(500);
					}
				}
			},
			function(){
				$(".overlayText",this).stop().animate({"top":"-65px"},500);
				$(".handlerLeft, .handlerRight",this).fadeOut(500);
			}
		)
		$(".slideshowGallery .handlerLeft").click(
			function(){
				$(this).parent().find("ul li.selected").removeClass("selected").prev().addClass("selected");
				$(this).parent().find("ul").animate({"left":"+=399px"}, 1000);
				$(this).parent().find(".handlerRight").fadeIn(500);
				if( $(this).parent().find("ul li:first").hasClass("selected") ){
					$(this).fadeOut(500);
				}
			}
		)
		$(".slideshowGallery .handlerRight").click(
			function(){
				$(this).parent().find("ul li.selected").removeClass("selected").next().addClass("selected");
				$(this).parent().find("ul").animate({"left":"-=399px"}, 1000);
				if( $(this).parent().find("ul li:last").hasClass("selected") ){
					$(this).fadeOut(500);
				}
				$(this).parent().find(".handlerLeft").fadeIn(500);
			}
		)
	}
);
