SWFAddress.addEventListener(SWFAddressEvent.INIT, initFlash);

$(document).ready(function()
{
	/*$("img#loader").css("display", "block");
	$("img#loader").css("position", "absolute");
	$("img#loader").css("top", $(window).height()/2 - $("img#loader").height()/2);
	$("img#loader").css("left", $(window).width()/2- $("img#loader").width()/2);
	$("img#loader").css("z-index", "0");*/
	
	if(document.URL.indexOf("#") == -1)
	{
		var base = window.location.href.substr(0,window.location.href.length -1);
		window.location.href = "./reload.php?b="+base+"&d="+presetLang+"/home";
	}
});

function initFlash() 
{
	var swfPath = 'swf/lpj_application.swf?'+Math.round(Math.random() * 35000);	
	
	/*
	switch(SWFAddress.getPathNames()[0])
	{
		case 'de':
		case 'en':
		case 'it':
			swfPath = 'swf/lpj_application_new.swf?'+Math.round(Math.random() * 35000);	
			break;
		default:
			window.location.href = "http://www.lufthansa-private-jet.com/reload.php";
			break;
	}*/
	
	var flashvars = {};
	flashvars.gmap_key = "ABQIAAAAChb9ptKaxJ0jbMOjnRlLRRTWJAoDWhp3s2uvgSLDKhpvDNfPaRRVW04iIjrj5hWXxnqiTGfKAR2-7Q";

	var params = {};
	params.bgcolor = "#ffffff";
	params.allowScriptAccess = "always";
	params.allowFullScreen = "true";
	//params.menu = "false";
	params.base = ".";
		
	swfobject.embedSWF(swfPath, 'flashContent', '100%', '100%', '10.0.0', false , flashvars, params); 
	
	setAlternativeContent();
}

function setAlternativeContent()
{
	$("#flashContent").append('<p>Um die Seite anzuzeigen, ben&ouml;tigen Sie Flash Player. Klicken Sie <a href="http://get.adobe.com/flashplayer/" title="Adobe Flash Player">hier</a>, um das Plugin herunterzuladen.</p>');

	$("p").css("position", "absolute");
	$("p").css("top", $(window).height()/2 - $("p").height()/2);
	$("p").css("margin", "auto");
}

function removeLoaderImg()
{
	//$("img#loader").remove();
}


function showSharePopUp()
{
	sw = screen.availWidth;
	sh = screen.availHeight;
	
	x = (sw - 270)/2;
	y = (sh - 155)/2;

	window.open('shareWindow.php?title='+SWFAddress.getTitle()+'&deeplink='+SWFAddress.getPath()+'&lang='+SWFAddress.getPathNames()[0], 'Share', 'top='+y+',left='+x+',width=270,height=155,scrollbars=no');
}
