<!--

	$(document).ready(function(){
	
		// Preload Images
		var wp_theme_root = '/wp-content/themes/Firetail2010';
		var image1 = $('<img />').attr('src', wp_theme_root+'/images/1.jpg');
		var image2 = $('<img />').attr('src', wp_theme_root+'/images/2.jpg');
		var image3 = $('<img />').attr('src', wp_theme_root+'/images/3.jpg');
		var image4 = $('<img />').attr('src', wp_theme_root+'/images/4.jpg');
		var image5 = $('<img />').attr('src', wp_theme_root+'/images/5.jpg');
		
		// Alt Text
		var text = new Array();
		text[0] = 'hello world';
		text[1] = 'We work with civil society and business to help them meet the challenge of climate change.';
		text[2] = 'Firetail\'s clients are working around the world to improve health and education opportunities for all.';
		text[3] = 'We work with some of the largest fundraisers in the country.';
		text[4] = 'We\'re helping organisations who work with the hardest to reach members of our community.';
		text[5] = 'Our clients are using the latest tools to engage and mobilise new audiences.';
	 
		// Vars
		var Index = 1;
		var Image = 0;
		var Interval = "";
		var TimeOut = "";
		var Seconds = 0;
		var Underlay = document.getElementById('underlay');
		var Carpet = document.getElementById('carpet');
		var AltText = document.getElementById('alt-text');
		
		$('#step'+Index).css("background-color","red");
		AltText.innerHTML = text[Index];
		
		function Iterate(Index){
			if(Index==5){return 1;}else{return Index+1;}
		}
		function Rewind(Index){
			if(Index==1){return 5;}else{return Index-1;}
		}
		function Rotate(){
			Image = Iterate(Index);
			Underlay.style.backgroundImage = "url('"+wp_theme_root+"/images/"+(Image)+".jpg')";
			$('#step'+Index).css("background-color","transparent");
			$('#step'+Image).css("background-color","red");
			$('#carpet').animate({opacity:0.0},1000, function(){
				$('#carpet').css("background-image","url('"+wp_theme_root+"/images/"+(Image)+".jpg')");
				$('#carpet').animate({opacity:1.0},1000);
			});
			$('#alt-text').animate({opacity:0.0},1000, function(){
				AltText.innerHTML = text[Image];
				$('#alt-text').animate({opacity:1.0},1000);
			});
			Index = Iterate(Index);
		}
		
		$('#step1').click(function(){Feature(1);});
		$('#step2').click(function(){Feature(2);});
		$('#step3').click(function(){Feature(3);});
		$('#step4').click(function(){Feature(4);});
		$('#step5').click(function(){Feature(5);});
		
		function Feature(Target){
			window.clearInterval(Interval);
			Interval="";
			window.clearInterval(TimeOut);
			TimeOut="";
			Image = Target;
			Underlay.style.backgroundImage = "url('"+wp_theme_root+"/images/"+(Target)+".jpg')";
			$('#step'+Index).css("background-color","transparent");
			$('#step'+Target).css("background-color","red");
			$('#carpet').animate({opacity:0.0},500, function(){
				$('#carpet').css("background-image","url('"+wp_theme_root+"/images/"+(Target)+".jpg')");
				$('#carpet').animate({opacity:1.0},500);
			});
			$('#alt-text').animate({opacity:0.0},500, function(){
				AltText.innerHTML = text[Target];
				$('#alt-text').animate({opacity:1.0},500);
			});
			Index = Target;
			TimeOut = setTimeout(function(){Interval = window.setInterval(Rotate,4000);},8000);
		}
		
		Interval = window.setInterval(Rotate,4000);
		
	});
	
-->
