// JavaScript Document

	$(window).load(function() {
		//alert("test");
		/*$("#bottom1").click(function () {
			alert("test");
		});*/
		var activeSlide = 1;

		$("#third #headline-3b").fadeOut(400);
		$("#third #headline-3c").fadeOut(400);
		
		
		
		//FIRST SLIDE
		function firstIn(event) {
			$("#first .bg").animate({	bottom:'0px'}, 		1200, 'easeInOutQuad');
			$("#first .para1").animate({bottom:'0'}, 		1200, 'easeInOutQuad');
			$("#first .para2").animate({bottom:'-31px'}, 	1200, 'easeInOutQuad');
			$("#first .para3").animate({bottom:'3px'}, 		1200, 'easeInOutQuad');
		}
		function firstOut(event){
			$("#first .bg").animate({	bottom:'-100px'}, 	1200, 'easeInOutQuad');
			$("#first .para1").animate({bottom:'210px'}, 	1200, 'easeInOutQuad');
			$("#first .para2").animate({bottom:'120px'}, 	1200, 'easeInOutQuad');
			$("#first .para3").animate({bottom:'93px'}, 	1200, 'easeInOutQuad');
		}
		//SECOND SLIDE
		function secondIn(event){
			$("#second .bg").animate({	 bottom:'0'}, 		1200, 'easeInOutQuad');
			$("#second .para1").animate({bottom:'-166px'}, 	1200, 'easeInOutQuad');
			$("#second .para2").animate({bottom:'-15px'}, 	1200, 'easeInOutQuad');
			$("#second .para3").animate({bottom:'-15px'}, 	1200, 'easeInOutQuad');
		}
		function secondOut(event){
			$("#second .bg").animate({	 bottom:'-100'}, 	1200, 'easeInOutQuad');
			$("#second .para1").animate({bottom:'100px'}, 	1200, 'easeInOutQuad');
			$("#second .para2").animate({bottom:'-220px'}, 	1200, 'easeInOutQuad');
			$("#second .para3").animate({bottom:'-330px'}, 	1200, 'easeInOutQuad');
		}
		//THIRD SLIDE
		function thirdIn(event){
			$("#third .bg").animate({	bottom:'0'}, 		1200, 'easeInOutQuad');
			$("#third .para1").animate({bottom:'240px'}, 	1200, 'easeInOutQuad');
			$("#third .para2").animate({bottom:'190px'}, 	1200, 'easeInOutQuad');
			$("#third .para3").animate({bottom:'150px'}, 	1200, 'easeInOutQuad');
			$("#third #headline-3b").delay(1000).fadeIn(600);
			$("#third #headline-3c").delay(1300).fadeIn(600);
		}
		function thirdOut(event){
			$("#third .bg").animate({	bottom:'-100px'}, 	1200, 'easeInOutQuad');
			$("#third .para1").animate({bottom:'310px'}, 	1200, 'easeInOutQuad');
			$("#third .para2").animate({bottom:'-120px'}, 	1200, 'easeInOutQuad');
			$("#third .para3").animate({bottom:'130px'}, 	1200, 'easeInOutQuad');
			$("#third #headline-3b").delay(300).fadeOut(600);
			$("#third #headline-3c").fadeOut(600);
		}
		//FOURTH SLIDE
		function fourthIn(event){
			$("#fourth .bg").animate({	 bottom:'-67px'},  	1200, 'easeInOutQuad');
			$("#fourth .para1").animate({bottom:'-130px'},  	1200, 'easeInOutQuad');
			$("#fourth .para2").animate({bottom:'0'}, 	1200, 'easeInOutQuad');
			$("#fourth .para3").animate({bottom:'0'}, 	1200, 'easeInOutQuad');
			//$("#fourth .headline").animate({bottom:'50px'}, 1200, 'easeInOutQuad');
		}
		function fourthOut(event){
			$("#fourth .bg").animate({	 bottom:'-130px'},  1200, 'easeInOutQuad');
			$("#fourth .para1").animate({bottom:'-340px'},  1200, 'easeInOutQuad');
			$("#fourth .para2").animate({bottom:'-50px'}, 1200, 'easeInOutQuad');
			$("#fourth .para3").animate({bottom:'-100px'}, 	1200, 'easeInOutQuad');
			//$("#fourth .headline").animate({bottom:'350px'}, 1200, 'easeInOutQuad');
		}
		//FIFTH SLIDE
		function fifthIn(event){
			$('#logo').fadeIn(800);
		}
		

		$("#bottom1").click(function () {
			firstOut();
			secondIn();
			$('.home-feature').animate({bottom: '+=550'}, 1200, 'easeInOutQuad');
			return false;
		});
		
		$("#bottom2").click(function () {
			secondOut();
			thirdIn();
			$('.home-feature').animate({bottom: '+=550'}, 1200, 'easeInOutQuad');
			return false;
		});
		$("#bottom3").click(function () {
			thirdOut();
			fourthIn();
			$('.home-feature').animate({bottom: '+=550'}, 1200, 'easeInOutQuad');
			return false;
		});
		$("#bottom4").click(function(){
			//alert("test");
			fourthOut();
			thirdIn();
			$('.home-feature').animate({bottom: '+=550'}, 1200, 'easeInOutQuad');
			return false;
		});
		
		
		$("#top2").click(function () {
			secondOut();
			firstIn();
			$('.home-feature').animate({bottom: '-=550'}, 1200, 'easeInOutQuad');
			return false;
		});
		$("#top3").click(function () {
			thirdOut();
			secondIn();
			$('.home-feature').animate({bottom: '-=550'}, 1200, 'easeInOutQuad');
			return false;
		});
		$("#top4").click(function () {
			fourthOut();
			thirdIn();
			$('.home-feature').animate({bottom: '-=550'}, 1200, 'easeInOutQuad');
			return false;
		});
		$("#top5").click(function () {
			//alert("test");
			//fifthOut();
			fourthIn();
			$('.home-feature').animate({bottom: '-=550'}, 1200, 'easeInOutQuad');
			return false;
		});
		
		
		// FADING ARROW FOR FIRST SLIDE
		var fadeIn = true;
		var target = $('#bottom1');
		function loopFade(){
			if(fadeIn)
				target.fadeTo(1000, .01, 'easeInOutQuad');
			else
				target.fadeTo(600, 1, 'easeInOutQuad');
			
			fadeIn = !fadeIn;
			setTimeout(loopFade, 1100);
		}
		loopFade();
		
	});
