var removeFlash = function(){
	setTimeout(Element.setStyle.bind(Element,"openingContainer",{ display:"none"}),750);
	setTimeout(Element.setStyle.bind(Element,"container",{ visibility:"visible"}),750);
	setTimeout(Effect.Appear.bind(Effect,'container'),750);
	new Effect.Opacity("background",{from:0.99,to:0.75});
}

var flashObj;

var onLoadFunc = function(){
	flashObj = AC_FL_RunContent( "codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0", "width","951", "height","556", "scale","noscale", "salign","LT", "id","index", "movie","index", "quality","high", "bgcolor","#000000", "src","index", "name","index", "pluginspage","http://www.macromedia.com/go/getflashplayer","allowScriptAccess","always" );
	flashObj = '<div id="divFlash">' + flashObj + '</div>';
	var ajaxReq =
		new Ajax.Request(
			'./session.php',
			{
				method: 'post',
				parameters: '',
				onComplete: onComplete_checksession
			}
		);
}

var onComplete_checksession = function(objResponse){
	try {
		var resData = objResponse.responseText;
		if(resData == 0){
			new Insertion.Top("body",'<div id="openingContainer"></div>');
			new Insertion.Top("openingContainer",'<div id="flashContainer"></div>');
			new Insertion.Top("flashContainer",flashObj);
			Element.hide("container");
		}else{
			Element.setStyle("container",{ visibility:"visible"});
			new Effect.Opacity("background",{from:0.99,to:0.75});
			new Effect.Opacity("titleImg",{from:0.99,to:0.8});
		}
	} catch (e) {
		alert(e.message);
	}
}

Event.observe(window, 'load', onLoadFunc);
