/**************************************************/
/*START: browser detection*/
function BrowserDetection()
{
	var sUserAgent = navigator.userAgent.toLowerCase();

	// browser name
	this.isIE = (sUserAgent.indexOf('msie') != -1);
	this.isOpera = (sUserAgent.indexOf('opera') != -1 || window.opera);
	this.isFirefoxEinsNull =(sUserAgent.indexOf('firefox\/1.0') != -1);
}

var oBrowser = new BrowserDetection();
/*END: browser detection*/
/**************************************************/

/**************************************************/
/*START: flash functions */
function writeFlash()
{
	var ret = getArgs(arguments);
	generateObj(ret.src, ret.params, ret.styles);
}

function generateObj(src, params, styles)
{
	var str = '<object type="application/x-shockwave-flash"' ;
	str += getStyles(styles);
	if (oBrowser.isIE && !oBrowser.isOpera) {
		str += '>';
		str += '<param name="movie" value="'+ src +'" \/>';
	} else {
		str += ' data="'+ src +'">';
	}

	//schreibe param tags
	for (var i in params) {
		str += '<param name="' + i + '" value="' + params[i] + '" />';
	}

	//schreibe embed tag, brauchts für transparenz im safari
	str += '<embed src="'+ src +'"';
	for (var j in params) {
		str += ' ' + j + '="' + params[j] + '"';
	}
	str += '></embed>';
	str += '</object>';
	document.write(str);
}

function getStyles(styles)
{
	str = ' style="';
	for (var i in styles)
		str += i + ': ' + styles[i] + 'px;';
	str += '"';
	return str;
}

function getArgs(args)
{
	var ret = new Array();
	ret.src = new Object();
	ret.params = new Object();
	ret.styles = new Object();
	
	for (var i=0; i < args.length; i=i+2)
	{
		var currArg = args[i].toLowerCase();
		switch (currArg)
		{
			case "src":
			ret.src = args[i+1];
			break;
			case "width":
			case "height":
			ret.styles[args[i]] = args[i+1];
			break;
			case "allowScriptAccess":
			case "wmode":
			ret.params[args[i]] = args[i+1];
			break;
			default:
			ret.params[args[i]] = args[i+1];
		}
	}
	return ret;
}
/*END: flash functions */
/**************************************************/

/*----------- Flash ------------*/
var flash2Installed = false;	// wahr wenn flash 2 installiert ist
var flash3Installed = false;	// wahr wenn flash 3 installiert ist
var flash4Installed = false;	// wahr wenn flash 4 installiert ist
var flash5Installed = false;	// wahr wenn flash 5 installiert ist
var flash6Installed = false;	// wahr wenn flash 6 installiert ist
var flash7Installed = false;	// wahr wenn flash 7 installiert ist
var flash8Installed = false;	// wahr wenn flash 7 installiert ist
var flash9Installed = false;	// wahr wenn flash 7 installiert ist
var flash10Installed = false;	// wahr wenn flash 7 installiert ist
var maxVersion 		= 10;		// die Version die momentan maximal gecheckt wird
var actualVersion 	= 0;		// die version die der User hat
var hasRightVersion = false;	// wahr wenn der User die richtige Version hat

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    	// TRUE wenn IE
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // TRUE wenn auf Windows


/* VB-Script Detection beim MsIe auf Windows, da MsIe bei Windows
-- regular JavaScript Plugins nicht unterstützt
-------------------------------------------------------------------*/
if(isIE && isWin){
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
	document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');  
	document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');  
	document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');  
	document.write('flash10Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10"))) \n');  
	document.write('</SCR' + 'IPT\> \n');
}


/* Detect Flash
---------------*/
function detectFlash(flV) {  
	// existiert navigator.plugins
	if (navigator.plugins) {
		// check für flash 2 oder flash 3+
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var isVersion2 			= navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription 	= navigator.plugins["Shockwave Flash" + isVersion2].description;

			//alert("Flash plugin: " + flashDescription);
			
			var flashVersionArr		= flashDescription.split(".");
			var flashVersionString	= flashVersionArr[0];
			var flashVersion		= flashVersionString.replace("Shockwave Flash ","");
			
//			alert("Flash-Version: " + flashVersion);
//			var flashVersion 		= parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

     		flash2Installed 		= flashVersion == 2;    
			flash3Installed 		= flashVersion == 3;
			flash4Installed 		= flashVersion == 4;
			flash5Installed 		= flashVersion == 5;
			flash6Installed 		= flashVersion == 6;
			flash7Installed 		= flashVersion == 7;
			flash8Installed 		= flashVersion == 8;
			flash9Installed 		= flashVersion == 9;
			flash10Installed 		= flashVersion >= 10;
		}
	}

	for (var i = 2; i <= maxVersion; i++) {  
		if (eval("flash" + i + "Installed") == true) actualVersion = i;
	}

	if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;  

	//alert("version: " + actualVersion);

	if (actualVersion >= flV) {
		hasRightVersion = true;                
	} else {  
		hasRightVersion = false;
	}
}


/* Schreibe Flash für Content-Bild
-----------------*/
function writeFlashForContent(textstring1, textstring2, textstring3, textstring4, loadimage) {
	// detect flash version
	detectFlash(7);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/content.swf?text1='+textstring1+'&text2='+textstring2+'&text3='+textstring3+'&text4='+textstring4+'&image='+loadimage+'','width','760','height','130','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = "<div class='image-alt-container'><h1>"+textstring1.replace("%26","&").replace("%2B","+")+"</h1>"+textstring2.replace("%26","&").replace("%2B","+")+"</div><div class='image-alt-quicklinkcontainer'><h4>"+textstring3.replace("%26","&").replace("%2B","+")+"</h4>"+textstring4.replace("%26","&").replace("%2B","+")+"</div>";
		document.write(imageobject);
	}
}

/* Schreibe Flash für Startseiten-Bild
-----------------*/
function writeFlashForStart(textstring1, textstring2, textstring3, textstring4, loadimage) {
	// detect flash version
	detectFlash(7);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/start.swf?text1='+textstring1+'&text2='+textstring2+'&text3='+textstring3+'&text4='+textstring4+'&image='+loadimage+'','width','760','height','245','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = "<div class='startimage-alt-container'><h1>"+textstring1.replace("%26","&").replace("%2B","+")+"</h1>"+textstring2.replace("%26","&").replace("%2B","+")+"</div><div class='startimage-alt-quicklinkcontainer'><h4>"+textstring3.replace("%26","&").replace("%2B","+")+"</h4>"+textstring4.replace("%26","&").replace("%2B","+")+"</div>";
		document.write(imageobject);
	}
}

/* Schreibe Flash für Newsletter-Header
-----------------*/
function writeFlashForNewsletter(textstring1, textstring2) {
	// detect flash version
	detectFlash(7);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/newsletter.swf?text1='+textstring1+'&text2='+textstring2+'','width','280','height','70','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = "<div class='newsletter-alt'><h4>"+textstring1.replace("%26","&").replace("%2B","+")+"</h4>"+textstring2.replace("%26","&").replace("%2B","+")+"</div>";
		document.write(imageobject);
	}
}

/* Schreibe Flash für Startnews-Header
-----------------*/
function writeFlashForStartNews(textstring1, textstring2) {
	// detect flash version
	detectFlash(7);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/startnews.swf?text1='+textstring1+'&text2='+textstring2+'','width','200','height','30','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = "<div class='startnews-alt'><div class='startnews-alt-title'>"+textstring1.replace("%26","&").replace("%2B","+")+"</div><div class='startnews-alt-date'>"+textstring2.replace("%26","&").replace("%2B","+")+"</div></div>";
		document.write(imageobject);
	}
}

/* Schreibe Flash für Startinfo-Header
-----------------*/
function writeFlashForStartInfo(textstring1) {
	// detect flash version
	detectFlash(7);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/startinfo.swf?text1='+textstring1+'','width','200','height','30','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = "<div class='startinfo-alt'>"+textstring1.replace("%26","&").replace("%2B","+")+"</div>";
		document.write(imageobject);
	}
	
}
/* Schreibe Flash für Content-Header
-----------------*/
function writeFlashForContentTitle(textstring1) {
	// detect flash version
	detectFlash(7);

	if(hasRightVersion) {
		// schreibe flash-string
		writeFlash('src','/swf/contenttitle.swf?text1='+textstring1+'','width','480','height','65','allowScriptAccess','sameDomain','wmode','transparent');
	} else {
		// schreibe kein-Flash-String
		var imageobject = "<div class='contenttitle-alt'><h2>"+textstring1.replace("%26","&").replace("%2B","+")+"</h2></div>";
		document.write(imageobject);
	}
}