(function($){
	$(document).ready(function() {
		
		// Home animation
		///-------------------------------------------------------------
		
		// set the elements
		//$("#splash img").remove();
		$("#splash").removeClass();
		animImg = $("#splash div");
		animText = $("#splash em");
		
		// define text for slides
		var text1 = 'time to transform';
		var text2 = 'making sense of your world';
		var text3 = 'developing the whole';
		var text4 = 'what’s your question?';
		var text5 = 'shaping the future';
		
		// set animation parameters
		var slideCount = 1;
		var faster = 1000;
		var slower = 1200;
		var readDelay = 2000;
			
		function animateSlides() {
		
			// hide again for security
			if(slideCount != 1) {
				animImg.css("opacity",0);
				animText.css("opacity",0);
			}
			
			// set slide for animation
			animImg.removeClass();	
			animText.removeClass();	
			animImg.addClass("image-"+ slideCount +"");
			animText.addClass("text-"+ slideCount +"");
			animText.html("<span>" + eval("text"+slideCount) + "</span>");
			
			// set animation item
			animItem = animImg;
			
			// fade in the image
			animItem.animate({
				opacity: 1
			}, slower, function() {
				// callback
				
				// set animation item
				animItem = animText;
				// fade in the text			
				animItem.animate({
					opacity: 1
				}, slower, function() {
					// callback
					
					// set animation item
					animItem = animText;
					// fade out the text
					animItem.delay(readDelay).animate({
						opacity: 0
					}, slower, function() {
						// callback
						
						// set animation item
						animItem = animImg;
						// fade out the image
						animItem.animate({
							opacity: 0
						}, slower, function() {
							// callback
							
							if(slideCount == 5) {
								slideCount = 1;
							}
							else {
								slideCount++;
							}
							// loop over
							animateSlides();	
						});
						
					});
					
				});
				
			});
				
		};
		animateSlides();
	});
})(this.jQuery);
