 var $ = jQuery.noConflict();
 
 $(document).ready(function() {
 	//People functions
	 function personOne(){
	 	setTimeout(
		  function() {
	    	$('.person1').animate({left: '+=50px', opacity: 0}, 1000);
	    	$('.person2').fadeIn(1000);
	    	personTwo();
		  }, 5000);
		  
	 }
	 function personTwo(){
	 	setTimeout(
		  function() {
	    	$('.person2').animate({left: '+=50px', opacity: 0}, 1000);
	    	$('.person3').fadeIn(1000);
	    	 personThree();
		  }, 5000);
		 
	 }
	 function personThree(){
	 	setTimeout(
		  function() {
	    	$('.person3').animate({left: '+=50px', opacity: 0}, 1000);
	    	$('.person4').fadeIn(1000);
		  }, 5000);
	 }
	 
	 //Text functions
	 function textOne(){
 		$('#person1 .one').fadeIn(500);
 		textTwo();
	 }
	 function textTwo(){
	 	setTimeout(function(){
	 		$('#person1 .one').animate({opacity: .50});
	 		$('#person1 .two').fadeIn(500);
	 		textThree();
	 	}, 1000);
	 }
	 function textThree(){
	 	setTimeout(function(){
		 	$('#person1 .three').fadeIn(500);
	 	}, 1000);		
	 }
	 function textFour(){
	 //Removed setTimeout on starting text function
		 	$('#person2 .one').fadeIn(500);
		 	textFive();
	 }
	 function textFive(){
	 	setTimeout(function(){
		 	$('#person2 .one').animate({opacity: .50});
		 	$('#person2 .two').fadeIn(500);
	 	}, 1000);
	 }
	 function textSix(){
	 	setTimeout(function(){
		 	$('#person3 .one').fadeIn(500);
		 	textSeven();
	 	}, 1000);
	 }
	 function textSeven(){
	 	setTimeout(function(){
		 	$('#person3 .one').animate({opacity: .50});
		 	$('#person3 .two').fadeIn(500);
		 	textEight();
	 	}, 1000);
	 }
	 function textEight(){
	 	setTimeout(function(){
		 	$('#person3 .two').animate({opacity: .50});
		 	$('#person3 .three').fadeIn(500);
		 	textNine();
	 	}, 1000);
	 }
	 function textNine(){
	 	setTimeout(function(){
		 	$('#person3 .three').animate({opacity: .50});
		 	$('#person3 .four').fadeIn(500);
	 	}, 1000);
	 }
	 function textTen(){
	 	setTimeout(function(){
		 	$('#person4 .one').fadeIn(500);
		 	textEleven();
	 	}, 1000);
	 }
	 function textEleven(){
	 	setTimeout(function(){
		 	$('#person4 .two').fadeIn(500);
		 	$('.click').fadeOut(500);
	 	}, 1000);
	 }
	 
	 //Text container functions
	 function personOneTextOut() {
	 	setTimeout(function(){
		 	$('#person1').animate({left: '-=50px', opacity: 0}, 1000);
		 	textFour();
	 	}, 5000);
	 }
	 function personTwoTextOut() {
	 	setTimeout(function(){
		 	$('#person2').animate({left: '-=50px', opacity: 0}, 1000);
		 	textSix();
	 	}, 5000);
	 }
	 function personThreeTextOut() {
	 	setTimeout(function(){
		 	$('#person3').animate({left: '-=50px', opacity: 0}, 1000);
		 	textTen();
	 	}, 10000);
	 }
	 
	 //Bars
		 //Default widths
			 // Fat green - 75px
			 // Med green - 50px
			 // Sm green - 25px
			 // Fat blue - 65px
			 // Med green - 40px
			 // Sm green - 15px
		 //Change timeout duration to alter display length time
	 function BarOutOne() {
	 	setTimeout(function(){
	 		$('.fat-green').animate({right: '960px'}, 1000, 'easeInBack');
	 		$('.medium-green').animate({right: '11060px'}, 1000, 'easeInBack');
	 		$('.small-green').animate({right: '3160px'},1000, 'easeInBack');
	 		$('.fat-blue').animate({right: '1560px'}, 1000, 'easeInBack');
	 		$('.medium-blue').animate({right: '1760px'}, 1000, 'easeInBack');
	 		$('.small-blue').animate({right: '1960px'}, 1000, 'easeInBack');
	 		BarInTwo();
	 	}, 5000);
	 }
	 function BarInTwo() {
 		$('.fat-green').animate({right: '0'}, 1000, 'easeInOutQuint');
 		$('.medium-green').animate({right: '100px', width: '20px'}, 1000, 'easeInOutQuint');
 		$('.small-green').animate({right: '350px'}, 1000, 'easeInOutQuint');
 		$('.fat-blue').animate({right: '-100px'}, 1000, 'easeInOutQuint');
 		$('.medium-blue').animate({right: '20px'}, 1000, 'easeInOutQuint');
 		$('.small-blue').animate({right: '85px', width: '5px'}, 1000, 'easeInOutQuint');
 		BarOutTwo();
	 }
	 function BarOutTwo() {
	 	setTimeout(function(){
	 		$('.fat-green').animate({right: '960px'}, 1000, 'easeInBack');
	 		$('.medium-green').animate({right: '11060px'}, 1000, 'easeInBack');
	 		$('.small-green').animate({right: '1360px'},1000, 'easeInBack');
	 		$('.fat-blue').animate({right: '1560px'}, 1000, 'easeInBack');
	 		$('.medium-blue').animate({right: '1760px'}, 1000, 'easeInBack');
	 		$('.small-blue').animate({right: '1960px'}, 1000, 'easeInBack');
	 		BarInThree();
	 	}, 5000);
	 }
	 function BarInThree() {
	 	$('.fat-green').animate({right: '0px'}, 1000, 'easeInOutQuint');
 		$('.medium-green').animate({right: '350px'}, 1000, 'easeInOutQuint');
 		$('.small-green').animate({right: '500px'}, 1000, 'easeInOutQuint');
 		$('.fat-blue').animate({right: '50px'}, 1000, 'easeInOutQuint');
 		$('.medium-blue').animate({right: '300px'}, 1000, 'easeInOutQuint');
 		$('.small-blue').animate({right: '425px'}, 1000, 'easeInOutQuint');
 		BarOutThree();
	 }
	 function BarOutThree() {
	 	setTimeout(function(){
	 		$('.fat-green').animate({right: '960px'}, 1000, 'easeInBack');
	 		$('.medium-green').animate({right: '11060px'}, 1000, 'easeInBack');
	 		$('.small-green').animate({right: '1360px'},1000, 'easeInBack');
	 		$('.fat-blue').animate({right: '1560px'}, 1000, 'easeInBack');
	 		$('.medium-blue').animate({right: '1760px'}, 1000, 'easeInBack');
	 		$('.small-blue').animate({right: '1960px'}, 1000, 'easeInBack');
	 		BarInFour();
	 	}, 5000);
	 }
	  function BarInFour() {
	 	$('.fat-green').animate({right: '30px'}, 1000, 'easeInOutQuint');
 		$('.medium-green').animate({right: '120px', width: '20px'}, 1000, 'easeInOutQuint');
 		$('.small-green').animate({right: '150px', width: '5px'}, 1000, 'easeInOutQuint');
 		$('.fat-blue').animate({right: '-20px'}, 1000, 'easeInOutQuint');
 		$('.medium-blue').animate({right: '110px', width: '20px'}, 1000, 'easeInOutQuint');
 		$('.small-blue').animate({right: '190px', width: '5px'}, 1000, 'easeInOutQuint');
	 }
	 
	 // load initial video
    if ($.browser.msie) {
        attachEvent("onload", function () {
			personTwo();//Change this to vary starting person
			textFour();//Change this to vary starting text
			personTwoTextOut();
			personThreeTextOut();
			BarOutTwo();
        }, false);
    }
    else {
        window.addEventListener("load", function () {
			personTwo();//Change this to vary starting person
			textFour();//Change this to vary starting text
			personTwoTextOut();
			personThreeTextOut();
			BarOutTwo();

        }, false);
    }
 });
