// Flash Film akitvieren 
function CheckFlash() {
	
	if(getCookie('cmsPluginFlash') != "true") {
	
		var cmsFlashAvailable = CheckFlashVersion();
		document.cookie = 'cmsPluginFlash='+cmsFlashAvailable+';';
		
		if (cmsFlashAvailable){
			document.getElementById("cmsHtml").style.display = "none";
			document.getElementById("cmsFlash").style.display = "block";
		}		
	} else {
	
		document.getElementById("cmsHtml").style.display = "none";
		document.getElementById("cmsFlash").style.display = "block";
	
	}
}


// Cookie abfragen
function getCookie(name) {

	var cookies = document.cookie;
	cookies = cookies.split('; ');
	
	for(var i=0; i<=(cookies.length-1); i++) {
		
		if(cookies[i].substr(0, cookies[i].indexOf('=')) == name) {
			return cookies[i].substr(cookies[i].indexOf('=')+1);
			break;
		}

	}
	
}

// Flash Version prüfen
function CheckFlashVersion() {

	if (FlashCanPlay) {
		return true;
	} 
	else{
		return false;
	}

}

// Plugin Pruefen	

if(getCookie('cmsPluginFlash') != "true") {
	
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	
	if ( plugin ) {
			var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		    for (var i = 0; i < words.length; ++i)
		    {
			if (isNaN(parseInt(words[i])))
			continue;
			var PluginVersion = words[i]; 
		    }
		var FlashCanPlay = PluginVersion >= cmsFlashVersion ;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
	   && (navigator.appVersion.indexOf("Win") != -1)) {
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
		document.write('on error resume next \n');
		document.write('FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & cmsFlashVersion)))\n');
		document.write('</SCR' + 'IPT\> \n');
	}
}
