// JavaScript Document

$(document).ready(function(){

	//This keeps track of the slideshow's current location
	var current_panel = 1;
	//Controlling the duration of animation by variable will simplify changes
	var animation_duration = 2500;

	$.timer(6000, function (timer) {
		//Determine the current location, and transition to next panel
		switch(current_panel){
			case 1:
				$("#slideshow").stop().animate({left: "-890px", top: "0px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 2;
			break;
			case 2:
				$("#slideshow").stop().animate({left: "0px", top: "-350px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 3;
			break;
			case 3:
				$("#slideshow").stop().animate({left: "-890px", top: "-350px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 4;
			break;
			case 4:
				$("#slideshow").stop().animate({left: "0px", top: "-700px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 5;
			break;
			case 5:
				$("#slideshow").stop().animate({left: "-890px", top: "-700px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 6;
			break;
			case 6:
				$("#slideshow").stop().animate({left: "0px", top: "-1050px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 7;
			break;
			case 7:
				$("#slideshow").stop().animate({left: "-890px", top: "-1050px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 8;
			break;
			case 8:
				$("#slideshow").stop().animate({left: "0px", top: "-1400px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 9;
			break;	
			case 9:
				$("#slideshow").stop().animate({left: "-890px", top: "-1400px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 10;
			break;
			case 10:
				$("#slideshow").stop().animate({left: "0px", top: "-1750px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 11;
			break;
			case 11:
				$("#slideshow").stop().animate({left: "-890px", top: "-1750px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 12;
			break;
			case 12:
				$("#slideshow").stop().animate({left: "0px", top: "-2100px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 13;
			break;
			case 13:
				$("#slideshow").stop().animate({left: "-890px", top: "-2100px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 14;
			break;
			case 14:
				$("#slideshow").stop().animate({left: "0px", top: "-2450px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 15;
			break;
			case 15:
				$("#slideshow").stop().animate({left: "-890px", top: "-2450px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 16;
			break;
			case 16:
				$("#slideshow").stop().animate({left: "0px", top: "-2800px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 17;
			break;
			case 17:
				$("#slideshow").stop().animate({left: "-890px", top: "-2800px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 18;
			break;
			case 18:
				$("#slideshow").stop().animate({left: "0px", top: "-3150px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 19;
			break;
			case 19:
				$("#slideshow").stop().animate({left: "-890px", top: "-3150px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 20;
			break;
			case 20:
				$("#slideshow").stop().animate({left: "0px", top: "0px"}, {easing: 'easeOutBack', duration: animation_duration});
				current_panel = 1;
			break;
	  		timer.reset(12000);
		}
	});

});
