$(document).ready(function() {
	// Autostart
	$("#imgLogo").animate({opacity:0}, 200).animate({opacity:1}, 500);
	
	$(".person1").animate({opacity:0}, 400).animate({opacity:1}, 500, "easeInOutQuart")
	$(".person2").animate({opacity:0}, 600).animate({opacity:1}, 500, "easeInOutQuart")
	$(".person3").animate({opacity:0}, 800).animate({opacity:1}, 500, "easeInOutQuart")
	$(".person4").animate({opacity:0}, 1000).animate({opacity:1}, 500, "easeInOutQuart")
	
	$("#linestart").animate({opacity:0}, 300).animate({opacity:1}, 500, "easeInOutQuart")
	
	$("#nav_start0").animate({opacity:0}, 1000).animate({opacity:1}, 400, "easeInOutQuart");
	$("#nav_start1").animate({opacity:0}, 1100).animate({opacity:1}, 400, "easeInOutQuart");
	$("#nav_start2").animate({opacity:0}, 1200).animate({opacity:1}, 400, "easeInOutQuart");
	$("#nav_start3").animate({opacity:0}, 1300).animate({opacity:1}, 400, "easeInOutQuart");
	$("#nav_start4").animate({opacity:0}, 1400).animate({opacity:1}, 400, "easeInOutQuart");
	$("#nav_start5").animate({opacity:0}, 1500).animate({opacity:1}, 400, "easeInOutQuart");
	$("#nav_start6").animate({opacity:0}, 1600).animate({opacity:1}, 400, "easeInOutQuart");
	
	
	// Warum VC klick
	$(".nav0").click(function(e) {
		e.preventDefault();
		var to = $("#videri").offset().top;
		var time = Math.abs(to - $('html, body').scrollTop());
		var flo = Math.pow(0.85, time/1000)*time;
		$('html, body').animate({scrollTop: to}, flo, "easeOutQuart");
	});

	// Webdesign klick
	$(".nav1").click(function(e) {
		e.preventDefault();
		var to = $("#web").offset().top;
		var time = Math.abs(to - $('html, body').scrollTop());
		var flo = Math.pow(0.85, time/1000)*time;
		$('html, body').animate({scrollTop: to}, flo, "easeOutQuart");
	});

	// Printdesign klick
	$(".nav2").click(function(e) {
		e.preventDefault();
		var to = $("#print").offset().top;
		var time = Math.abs(to - $('html, body').scrollTop());
		var flo = Math.pow(0.85, time/1000)*time;
		$('html, body').animate({scrollTop: to}, flo, "easeOutQuart");
	});
	
	// Ecommerce klick
	$(".nav3").click(function(e) {
		e.preventDefault();
		var to = $("#ecommerce").offset().top;
		var time = Math.abs(to - $('html, body').scrollTop());
		var flo = Math.pow(0.85, time/1000)*time;
		$('html, body').animate({scrollTop: to}, flo, "easeOutQuart");
	});
	
	// Fotografie klick
	$(".nav4").click(function(e) {
		e.preventDefault();
		var to = $("#foto").offset().top;
		var time = Math.abs(to - $('html, body').scrollTop());
		var flo = Math.pow(0.85, time/1000)*time;
		$('html, body').animate({scrollTop: to}, flo, "easeOutQuart");
	});
	
	// Team klick
	$(".nav5").click(function(e) {
		e.preventDefault();
		var to = $("#team").offset().top;
		var time = Math.abs(to - $('html, body').scrollTop());
		var flo = Math.pow(0.85, time/1000)*time;
		$('html, body').animate({scrollTop: to}, flo, "easeOutQuart");
	});
	
	// Kontakt klick
	$(".nav6").click(function(e) {
		e.preventDefault();
		var to = $("#kontakt").offset().top;
		var time = Math.abs(to - $('html, body').scrollTop());
		var flo = Math.pow(0.85, time/1000)*time;
		$('html, body').animate({scrollTop: to}, flo, "easeOutQuart");
	});

	
	// Videri More-Close Buttons
		$("#btn_videri_more").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#videriMore").animate({height: 866}, 1200, "easeOutBounce");
			// Buttons umschalten
			$("#btn_videri_more").css("display","none");
			$("#videri_desc").css("display","none");
			$("#btn_videri_close").css("display", "inline");
			// HTML scrollen
			var to = $("#videri_teaser").offset().top - 40;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});
		
		$("#btn_videri_close").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#videriMore").animate({height: 0}, 400, "easeInExpo");
			// Buttons umschalten
			$("#btn_videri_more").css("display","block");
			$("#videri_desc").css("display","none");

			$("#btn_videri_close").css("display", "none");
			// HTML scrollen
			var to = $("#videri").offset().top;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});

	// Webdesign More-Close Buttons
		$("#btn_web_more").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#webMore").animate({height: 775}, 1200, "easeOutBounce");
			// Buttons umschalten
			$("#btn_web_more").css("display","none");
			$("#btn_web_close").css("display", "inline");
			// HTML scrollen
			var to = $("#web_teaser").offset().top - 40;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});
		
		$("#btn_web_close").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#webMore").animate({height: 0}, 400, "easeInExpo");
			// Buttons umschalten
			$("#btn_web_more").css("display","inline");
			$("#btn_web_close").css("display", "none");
			// HTML scrollen
			var to = $("#web").offset().top;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});
		
	// Printdesign More-Close Buttons
		$("#btn_print_more").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#printMore").animate({height: 825}, 1200, "easeOutBounce");
			// Buttons umschalten
			$("#btn_print_more").css("display","none");
			$("#btn_print_close").css("display", "inline");
			// HTML scrollen
			var to = $("#print_teaser").offset().top - 40;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});
		
		$("#btn_print_close").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#printMore").animate({height: 0}, 400, "easeInExpo");
			// Buttons umschalten
			$("#btn_print_more").css("display","inline");
			$("#btn_print_close").css("display", "none");
			// HTML scrollen
			var to = $("#print").offset().top;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});
			
	// Ecommerce More-Close Buttons
		$("#btn_ecommerce_more").click(function(e){
			e.preventDefault();
			// Inhalt zurücksetzen
			$("#ecommerceToggle").html("<span>Referenzen</span>");
			$("#ecommerce_2").css("right",-2000).removeClass("ecommerceSliderCurr");
			$("#ecommerce_1").css("right", 0).addClass("ecommerceSliderCurr");
			// Content vergrößern
			$("#ecommerceMore").animate({height: 866}, 1200, "easeOutBounce");
			// Buttons umschalten
			$("#btn_ecommerce_more").css("display","none");
			$("#btn_ecommerce_close").css("display", "inline");
			// HTML scrollen
			var to = $("#ecommerce_teaser").offset().top - 40;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});
		
		$("#btn_ecommerce_close").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#ecommerceMore").animate({height: 0}, 400, "easeInExpo");
			// Buttons umschalten
			$("#btn_ecommerce_more").css("display","inline");
			$("#btn_ecommerce_close").css("display", "none");
			// HTML scrollen
			var to = $("#ecommerce").offset().top;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});	
				
	// Fotografie More-Close Buttons
		$("#btn_foto_more").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#fotoMore").animate({height: 630}, 1200, "easeOutBounce");
			// Buttons umschalten
			$("#btn_foto_more").css("display","none");
			$("#btn_foto_close").css("display", "inline");
			// HTML scrollen
			var to = $("#foto_teaser").offset().top - 40;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});
		
		$("#btn_foto_close").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#fotoMore").animate({height: 0}, 400, "easeInExpo");
			// Buttons umschalten
			$("#btn_foto_more").css("display","inline");
			$("#btn_foto_close").css("display", "none");
			// HTML scrollen
			var to = $("#foto").offset().top;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});		
				
	// Team More-Close Buttons
		$("#btn_team_more").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#teamMore").animate({height: 3100}, 1200, "easeOutBounce");
			// Buttons umschalten
			$("#btn_team_more").css("display","none");
			$("#btn_team_close").css("display", "inline");
			// Grafik ändern
			$("#team_teaser").attr("src", "images/team_teaser2.jpg");
			// HTML scrollen
			var to = $("#team_teaser").offset().top + 20;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});
		
		$("#btn_team_close").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#teamMore").animate({height: 0}, 400, "easeInExpo");
			// Buttons umschalten
			$("#btn_team_more").css("display","inline");
			$("#btn_team_close").css("display", "none");
			$("#team_teaser").attr("src", "images/team_teaser.jpg");
			// HTML scrollen
			var to = $("#team").offset().top;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});	
					
	// Kontakt More-Close Buttons
		$("#btn_kontakt_more").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#kontaktMore").animate({height: 900}, 1200, "easeOutBounce");
			// Buttons umschalten
			$("#btn_kontakt_more").css("display","none");
			$("#btn_kontakt_close").css("display", "inline");
			// HTML scrollen
			var to = $("#kontakt_teaser").offset().top - 40;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});
		
		$("#btn_kontakt_close").click(function(e){
			e.preventDefault();
			// Content vergrößern
			$("#kontaktMore").animate({height: 0}, 400, "easeInExpo");
			// Buttons umschalten
			$("#btn_kontakt_more").css("display","inline");
			$("#btn_kontakt_close").css("display", "none");
			// HTML scrollen
			var to = $("#kontakt").offset().top;
			var time = Math.abs(to - $('html, body').scrollTop());
			$('html, body').animate({scrollTop: to}, time, "easeOutQuart");
		});


	// WebSlider
	$(".webSliderBullet").click(function(e) {
		e.preventDefault();
		if(!$(this).hasClass("webSliderCurrentBullet")) {
			$(".webSliderCurrentBullet").removeClass("webSliderCurrentBullet");
			$(this).addClass("webSliderCurrentBullet");
			$(".webSliderCurrent").filter(':not(:animated)').animate({right: 2000}, 400, "easeInExpo", function(){$(this).css("right",-2000).removeClass("webSliderCurrent");});
			$("."+$(this).attr("data")).filter(':not(:animated)').animate({right: 0}, 400, "easeInExpo").addClass("webSliderCurrent");
		}
		
	});
	
	// PrintSlider
	$(".printSliderBullet").click(function(e) {
		e.preventDefault();
		if(!$(this).hasClass("printSliderCurrentBullet")) {
			$(".printSliderCurrentBullet").removeClass("printSliderCurrentBullet");
			$(this).addClass("printSliderCurrentBullet");
			$(".printSliderCurrent").filter(':not(:animated)').animate({right: 2000}, 400, "easeInExpo", function(){$(this).css("right",-2000).removeClass("printSliderCurrent");});
			$("."+$(this).attr("data")).filter(':not(:animated)').animate({right: 0}, 400, "easeInExpo").addClass("printSliderCurrent");
		}
	});
	
	// EcommerceSlider #1
	$("#ecommerceToggle").click(function(e) {
		e.preventDefault();
		if($("#ecommerce_1").hasClass("ecommerceSliderCurr")) {
			$(this).html("<span>Ecommerce by Videri</span>");
			$(".ecommerceSliderCurr").animate({right: 2000}, 400, "easeInExpo", function(){$(this).css("right",-2000).removeClass("ecommerceSliderCurr");});
			$("#ecommerce_2").animate({right: 0}, 400, "easeInExpo").addClass("ecommerceSliderCurr");
			$("#ecommerceMore").animate({height: 578}, 1200, "easeOutBounce");
		} else {
			$(this).html("<span>Referenzen</span>");
			$(".ecommerceSliderCurr").animate({right: 2000}, 400, "easeInExpo", function(){$(this).css("right",-2000).removeClass("ecommerceSliderCurr");});
			$("#ecommerce_1").animate({right: 0}, 400, "easeInExpo").addClass("ecommerceSliderCurr");
			$("#ecommerceMore").animate({height: 866}, 1200, "easeOutBounce");
		}
	});
	
	// EcommerceSlider #2
	$(".ecommerceSliderBullet").click(function(e) {
		e.preventDefault();
		if(!$(this).hasClass("ecommerceSliderCurrentBullet")) {
			$(".ecommerceSliderCurrentBullet").removeClass("ecommerceSliderCurrentBullet");
			$(this).addClass("ecommerceSliderCurrentBullet");
			$(".ecommerceSliderCurrent").filter(':not(:animated)').animate({right: 2000}, 400, "easeInExpo", function(){$(this).css("right",-2000).removeClass("ecommerceSliderCurrent");});
			$("."+$(this).attr("data")).filter(':not(:animated)').animate({right: 0}, 400, "easeInExpo").addClass("ecommerceSliderCurrent");
		}
	});
	
	// FotoSlider #1
	$(".fotoSliderSmall").click(function(e) {
		e.preventDefault();
		$(".fotoSliderCurrent .bigImage").attr("src", $(this).attr("href"));
	});	
		$(".fotoSliderSmall").mouseover(function(e) {
		e.preventDefault();
		$(".fotoSliderCurrent .bigImage").attr("src", $(this).attr("href"));
	});	
	
	// FotoSlider #2
	$(".fotoSliderBullet").click(function(e) {
		e.preventDefault();
		if(!$(this).hasClass("fotoSliderCurrentBullet")) {
			$(".fotoSliderCurrentBullet").removeClass("fotoSliderCurrentBullet");
			$(this).addClass("fotoSliderCurrentBullet");
			$(".fotoSliderCurrent").filter(':not(:animated)').animate({right: 2000}, 400, "easeInExpo", function(){$(this).css("right",-2000).removeClass("fotoSliderCurrent");});
			$("."+$(this).attr("data")).filter(':not(:animated)').animate({right: 0}, 400, "easeInExpo").addClass("fotoSliderCurrent");
		}
	});	
});
