// Withinsight Core

$(document).ready(function(){
	$('button').click(function(){
		$('h1').css({top: '80px', left: '-10px', opacity: '0', fontSize: '240px'});
		$('#redFade').css('opacity', '1.0');
		$('#background').css('opacity','0');
		$('img').css({top: '0', opacity: '1.0'});
		marvel();
		document.getElementsByTagName('audio')[0].play();
	});
	
	function marvel(){
		$('h1').animate({
			opacity: '1.0',
			fontSize: '100px',
			top: '140',
			left: '200px'
		}, 7500);
		$('#redFade').animate({
			opacity: '0'
		}, 1150, function(){
			$('#background').animate({
				opacity: '1.0'
			}, 7500);
		});
		var i = 23;
		var j = 0;
		function imgs(){
			$('img:eq(' + i + ')').animate({
				top: '-412px',
				opacity: '0'
			}, 150, function(){
				i--;
				if (i === 1) {
					i = 23;
					j++;
					if (j == 3) {
						return false;
					}
					$('img').css('top', '0');
					$('img').css('opacity', '1.0');
					imgs();
				}
				if (j != 3) {
					imgs();
				} else if (j == 3) {
					return false;
				}
			});
		}
		if (j != 3) {
			imgs();
		} else if (j == 3) {
			return false;
		}
	}
});