//create onDomReady Event
window.onDomReady = initReady;

// Initialize event dpending on browser
function initReady(fn)
{
	//W3C-compliant browser
	if (document.addEventListener)
	{
		document.addEventListener("DOMContentLoaded", fn, false);
	}
	//IE
	else
	{
		document.onreadystatechange = function()
			{
			readyState(fn)
		}
	}
}

//IE execute function
function readyState(func)
{
	// DOM is ready
	if (document.readyState == "interactive" || document.readyState == "complete")
	{
		func();
	}
}

window.onDomReady(init);

function init()
{
	if (!swfobject.hasFlashPlayerVersion('9.0.0'))
	{
		return;
	}
	//hide flash fallback
	document.getElementById('flashcontent').style.display = 'none';

	showFlash();
}

function showFlash()
{
	if (swfobject.hasFlashPlayerVersion("9.0.0"))
	{
		/* Flashvars are set globally in index.html
		var flashvars =
		{
			prm_logger:'1',
			lang:'de_DE'
		};
		*/
		
		var params = {};

		var attributes = {};

		document.getElementById('flashcontent').style.display = 'block';

		swfobject.embedSWF("flash/MewaApplicationLoader.swf", "flashcontent", "100%", "100%", "9.0.0", false, flashvars, params, attributes);
		// Overwrite regular CSS used for alternative content to enable Full Browser Flash
		swfobject.createCSS("#flashcontent", "margin:0; width:100%; height: 100%; display: block; min-width:1010px; min-height:660px;");
	  swfobject.createCSS("body", "overflow:hidden; height:100%;");
	}
}
