var FlashVersion = 0;
var IsIE = 0;

function init() {	
	if (navigator.plugins &&
	    navigator.plugins.length > 0 &&
	    navigator.plugins["Shockwave Flash"]) {
	
	    var WordList = navigator.plugins["Shockwave Flash"].description.split(" ");
	
	    for (var index = 0; index < WordList.length; ++index) {
	        if (isNaN(parseInt(WordList[index])))  continue;
	        FlashVersion = WordList[index];
	    }
	}	

	if ((FlashVersion < 7) || (!bShowSite)) showFallback();
	
	logFlashVersion(FlashVersion);	
} 


function logFlashVersion(ver) {
        var xmlhttp = false;
	
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}

	if (xmlhttp) {
		xmlhttp.open("GET", "/all/statistic/flash/?version=" + ver + "&statistic=v2", true);
		xmlhttp.send(null);
	}
}

function showSite(sSiteURL, bandWidth) {
	var sProps = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=0,top=0,width=" + (screen.width - 10) + ",height=" + (screen.height - 55);
	sSiteURL = sSiteURL + "?language=" + escape(sLanguage);
	sSiteURL = sSiteURL + "&market=" + escape(sMarket);
	sSiteURL = sSiteURL + "&pool=" + escape(sSiteId);
	sSiteURL = sSiteURL + "&browser=" + escape((IsIE == 1) ? "ie" : "other");	
	sSiteURL = sSiteURL + "&instance=" + escape(sInstance);
	sSiteURL = sSiteURL + "&variant=" + escape(sVariant);
	sSiteURL = sSiteURL + "&section=" + escape(sSection);
	sSiteURL = sSiteURL + "&showintro=" + escape(sShowIntro);
	sSiteURL = sSiteURL + "&bandwidth=" + escape(bandWidth);
	sSiteURL = sSiteURL + "&width=" + escape(iWidth);
	sSiteURL = sSiteURL + "&height=" + escape(iHeight);
	 var site = window.open(sSiteURL,"porschemicrosite", sProps);
	site.focus();		
	//window.location.href = sSiteURL;
}

function showFallback() {
	window.document.getElementById("buttons").style.display = "none";
	window.document.getElementById("introText1").style.display = "none";
	window.document.getElementById("introText2").style.display = "none";
	window.document.getElementById("fallback").style.display = "block";
}