/// <reference path="../../Scripts/jquery-1.5.1-vsdoc.js" />


$(window).load(function() {
	$("#Preloader").fadeOut("fast", function() {
		$("#LoadComplete").fadeIn("fast");
	});

	// Hide Images
	var imgArray = [ "img01", "img02", "img03", "img04", "img05", "img06" ];
	jQuery.each(imgArray, function() {
		$("#" + this).hide();
	});

	// Show First Image
	$("#img01").show();

	var TotalImages = 6;
	var CurrentImage = 2;
	var PreviousImage;
	var TransitionSpeed = "fast";

	// Change the Image and Msg on Interval
	setInterval(function() {
		// Check to see if Current Image is more than Total Images
		// and calculate Previous Image Index
		if (CurrentImage > TotalImages) {
			CurrentImage = 1;
			PreviousImage = TotalImages;
		} else {
			PreviousImage = CurrentImage - 1;
		}

		var msg;
		switch (CurrentImage) {
			case 1:
				msg = "Simple is always better";
				break;
			case 2:
				msg = "Simple is always refreshing";
				break;

			case 3:
				msg = "Simple is always cool";
				break;

			case 4:
				msg = "Simple is always unbeatable";
				break;

			case 5:
				msg = "Simple is always colourful";
				break;

			case 6:
				msg = "...and we make simple things!";
				break;					
		}

		$("#img0" + PreviousImage).fadeOut(TransitionSpeed, function() {
			$("#img0" + CurrentImage).fadeIn(TransitionSpeed);
			$("#WelcomeMsg h1").empty();
			$("#WelcomeMsg h1").append(msg);
			CurrentImage += 1;
		});
	}, 2500);
});

$(document).ready(function() {
	
});
