﻿// Flash Film akitvieren 
function CheckFlash(flash,html) {
	
	if(flash === undefined){
		flash='cmsFlash'
	}
	
	if(html === undefined){
		html='cmsHtml'
	}
	
	if(getCookie('cmsPluginFlash') != "true") {
	
		var cmsFlashAvailable = CheckFlashVersion();
		document.cookie = 'cmsPluginFlash='+cmsFlashAvailable+';';
		
		if (cmsFlashAvailable){
			document.getElementById(html).style.display = "none";
			document.getElementById(flash).style.display = "block";
		}		
	} else {
	
		document.getElementById(html).style.display = "none";
		document.getElementById(flash).style.display = "block";
	
	}
}

function setCookieFlash(c_name,value,exdays)
 {
 var exdate=new Date();
 exdate.setDate(exdate.getDate() + exdays);
 var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
 document.cookie=c_name + "=" + c_value;
 Set_Cookie(c_name,c_vaule,100,"/",'','')
 }
 
function Set_Cookie( name, value, expires, path, domain, secure )
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct
expires time, the current script below will set
it for x number of days, to make it for hours,
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
 


// 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');
	}
}

