$(document).ready(function(){
						   
	var count = 0;
	var toShow = new Array();
	var newToShow = new Array();
	var numRand;
	
	$('#logo img').each(function(){
		 count++;
		$(this).css({'z-index' :+count+100 });
		$(this).addClass('tile-'+count);
	});
	
	for (var i = 0; i < count; i++) {
		toShow.push(i+1);
	}
	
	showNextImage();

	function showNextImage() {
		numRand = Math.floor(Math.random()*toShow.length);
		
		var show = toShow[numRand];
		
		if (toShow.length > 1) {
			for (var i = 0; i < toShow.length; i++) {
				if (i != numRand) {
					newToShow.push(toShow[i]);
				}
			}
		} else {
			toShow = new Array(numRand);
		}
		
		toShow = newToShow;
		newToShow = new Array();

		$('.tile-'+show).fadeIn(5, function() {
			if (toShow.length > 0) {
				showNextImage();
			}
		});
	}
});
