$(function(){
	function playsplash(){
		var origh = $('body').height();
		
		var overlay = $('<div>').css({
			position: 'absolute',
			backgroundColor: '#000',
			left: 0,
			top: 0
		}).appendTo($('body'));
		
		function coverAll(){
			overlay.css({
				width:  Math.max($(window).width(), 980),
				height: Math.max($(window).height(), origh)
			});
		}
		coverAll();
		$(window).resize(coverAll);
		
		window.splashSkipped = function(){
			overlay.remove();
			$.cookie('takii_recruit_splash_skip', "1");
		};
		window.splashCompleted = function(){
		    swf.remove();
		    overlay.css('backgroundColor', "#FFF").fadeOut('slow', function(){
                overlay.remove();
                $.cookie('takii_recruit_splash_skip', "1");
            });
		};
		
		var swf = overlay.flash({
            swf: 'splash.swf',
            width:  '100%',
            height: '100%'
		});
		
		return false;
	};
	
	if($.flash.available) {
		playsplash();
	}
	
	/*
	if($.flash.available && !$.cookie('takii_recruit_splash_skip')) {
		playsplash();
	}
	
	if($.flash.available) {
		$('<a>').attr('href', "#").css({
			float:'right',
			clear:'right',
			margin:'20px 20px 0px 0px'
		}).text(
			"Play splash movie again."
		).click(playsplash).appendTo($('#header .w980'));
	}
	*/
});

