function set_interface() {
	// Get page sizes
	var arrPageSizes = getPageSize();
	// Style overlay and show it
	$('#back').css({
		backgroundColor:	"#000",
		opacity:			0.9,
		width:				arrPageSizes[0],
		height:				arrPageSizes[1]
	});
	
	// If window was resized, calculate the new overlay dimensions
	$(window).resize(function() {
		// Get page sizes
		var arrPageSizes = getPageSize();
		// Style overlay and show it
		$('#back').css({
			width:		arrPageSizes[0],
			height:		arrPageSizes[1]
		});
	});
}


function getPageSize() {
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
}




var onloadflg = false;
			
function startfla(){
	$("#back").remove();
	$("#swf").remove();
	
	onloadflg = true;
}

var theCookie;


$(function(){
	theCookie = document.cookie.match("name=coachandfour");
	
	if(theCookie != "name=coachandfour"){
		setDay = new Date();
		setDay.setTime(setDay.getTime() + 1800*1000);
		expTime = setDay.toGMTString();
		document.cookie = "name=coachandfour;expires=" + expTime;
		
		var h = $("html").height();
		var w = $("html").width();
		set_interface();
		$("#swf").css("top","55px").css("left",w/2-410 + "px").css("display","block");
		
	}
	else {
		startfla();
	}
});

$(function(){
	$("#back").click(function(){
		startfla();
	});
	$("#swf").click(function(){
		startfla();
	});
});

function checkonload(){
	if(onloadflg){
		return true;
	} else {
		return false;
	}
}

/*
function FlashPlayerVer(){
var flashplayer_ver = 0;
if(navigator.plugins && navigator.mimeTypes['application/x-shockwave-flash']){
var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
if(plugin){flashplayer_ver = parseInt(plugin.description.match(/\d+\.\d+/));}
}
else{
try{
var flashOCX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").match(/([0-9]+)/);
if(flashOCX){flashplayer_ver = parseInt(flashOCX[0]);}
}catch(e){}
}
alert(flashplayer_ver);
if(flashplayer_ver <= 6){flashplayer_ver = 0;}
	
	return flashplayer_ver;
}


*/
