﻿$(document).ready(function()
{

slidecount1 = 0;
slidecount2 = 0;
slidecount3 = 0;

	$("#webdesign .slideright").click(function(){
		$(this).parent().find('.scroller').filter(':not(:animated)').animate({"left": "-=340px"}, "normal");
		slidecount1 = ++slidecount1;
		maxslides = $(this).parent().find('.scroller').children().size(); 
		if (slidecount1 == "0") {
		$(this).parent().find('.slideleft').fadeOut("fast");
		} else {
			$(this).parent().find('.slideleft').fadeIn("slow");
		}

		if (slidecount1 == maxslides - 3) {
			$(this).parent().find('.slideright').fadeOut("fast");
			$(this).parent().find('.reset').fadeIn("slow");
		} else {
			$(this).parent().find('.slideright').fadeIn("slow");
		}
	})

	$("#webdesign .slideleft").click(function(){
		$(this).parent().find('.scroller').filter(':not(:animated)').animate({"left": "+=340px"}, "normal");
		slidecount1 = slidecount1 - 1;
		$(this).parent().find('.slideright').fadeIn("slow");
		$(this).parent().find('.reset').fadeOut("fast");
	
		if (slidecount1 == "0") {
			$(this).parent().find('.slideleft').fadeOut("fast");
		} else {
			$(this).parent().find('.slideleft').fadeIn("slow");
		}	  
	});

	$("#webdesign .reset").click(function(){
		$(this).parent().filter(':not(:animated)').animate({"left": "0px"}, "slow");
		slidecount1 = 0;
		$('#webdesign .slideleft').fadeOut("slow");
		$('#webdesign .slideright').fadeIn("slow");
		$(this).fadeOut("slow");
	});
	
	
	
	
		$("#medien .slideright").click(function(){
		$(this).parent().find('.scroller').filter(':not(:animated)').animate({"left": "-=340px"}, "normal");
		slidecount2 = ++slidecount2;
		maxslides = $(this).parent().find('.scroller').children().size(); 
		if (slidecount2 == "0") {
		$(this).parent().find('.slideleft').fadeOut("fast");
		} else {
			$(this).parent().find('.slideleft').fadeIn("slow");
		}

		if (slidecount2 == maxslides - 3) {
			$(this).parent().find('.slideright').fadeOut("fast");
			$(this).parent().find('.reset').fadeIn("slow");
		} else {
			$(this).parent().find('.slideright').fadeIn("slow");
		}
	})

	$("#medien .slideleft").click(function(){
		$(this).parent().find('.scroller').filter(':not(:animated)').animate({"left": "+=340px"}, "normal");
		slidecount2 = slidecount2 - 1;
		$(this).parent().find('.slideright').fadeIn("slow");
		$(this).parent().find('.reset').fadeOut("fast");
	
		if (slidecount2 == "0") {
			$(this).parent().find('.slideleft').fadeOut("fast");
		} else {
			$(this).parent().find('.slideleft').fadeIn("slow");
		}	  
	});

	$("#medien .reset").click(function(){
		$(this).parent().filter(':not(:animated)').animate({"left": "0px"}, "slow");
		slidecount2 = 0;
		$('#medien .slideleft').fadeOut("slow");
		$('#medien .slideright').fadeIn("slow");
		$(this).fadeOut("slow");
	});
	
	
			$("#text .slideright").click(function(){
		$(this).parent().find('.scroller').filter(':not(:animated)').animate({"left": "-=340px"}, "normal");
		slidecount3 = ++slidecount3;
		maxslides = $(this).parent().find('.scroller').children().size(); 
		if (slidecount3 == "0") {
		$(this).parent().find('.slideleft').fadeOut("fast");
		} else {
			$(this).parent().find('.slideleft').fadeIn("slow");
		}

		if (slidecount3 == maxslides - 1) {
			$(this).parent().find('.slideright').fadeOut("fast");
			$(this).parent().find('.reset').fadeIn("slow");
		} else {
			$(this).parent().find('.slideright').fadeIn("slow");
		}
	})

	$("#text .slideleft").click(function(){
		$(this).parent().find('.scroller').filter(':not(:animated)').animate({"left": "+=340px"}, "normal");
		slidecount3 = slidecount3 - 1;
		$(this).parent().find('.slideright').fadeIn("slow");
		$(this).parent().find('.reset').fadeOut("fast");
	
		if (slidecount3 == "0") {
			$(this).parent().find('.slideleft').fadeOut("fast");
		} else {
			$(this).parent().find('.slideleft').fadeIn("slow");
		}	  
	});

	$("#text .reset").click(function(){
		$(this).parent().filter(':not(:animated)').animate({"left": "0px"}, "slow");
		slidecount3 = 0;

		$('#text .slideleft').fadeOut("slow");
		$('#text .slideright').fadeIn("slow");
		$(this).fadeOut("slow");
	});
	
});