// JavaScript Document - all globally used functions
var isMac = (navigator.platform.indexOf("Mac") != -1) ? true : false;
var isIE = (navigator.appName.indexOf("Microsoft") == -1) ? false : true;
var isNetscape = (navigator.appName.indexOf("Netscape") == -1) ? false : true;
var mainStyle = "";

function setCSSs(){

		if (isNetscape && isMac){
			mainStyle = "mainFireFoxApple";
		}else	if(isNetscape){
			mainStyle = "mainFireFoxPC";
		}else{
			mainStyle = "main";
		}
		document.write('<link href="'+toRootPath+'css/'+ mainStyle+'.css" rel="stylesheet" type="text/css" />');
		//alert('<link href="'+toRootPath+'css/'+ mainStyle+'.css" rel="stylesheet" type="text/css" />');
}
function checkApple(){
	if(isMac){
		MM_showHideLayers('linkDiv', '', 'hide');
	}
}
//
var MM_FlashCanPlay = false;
//
var m_flash6Installed = false;
var m_flash7Installed = false;
var m_flash8Installed = false;
var m_flash9Installed = false;
var m_maxVersion = 9;             // highest version we can actually detect
var m_actualVersion = 0;          // version the user really has
var m_hasRightVersion = false;    // boolean. true if it's safe to embed the flash movie in the page
var m_requiredVersion = 6;   // Version the user needs to view site (max 9, min 2)

if(isIE && !isMac)
{
	document.write('<scr' + 'ipt type="text/vbscript"\> \n');
	document.write('on error resume next \n');
	document.write('m_flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
	document.write('m_flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
	document.write('m_flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
	document.write('m_flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
	document.write('<\/scr' + 'ipt\> \n'); // break up end tag so it doesn't end our script
}

 
if (navigator.plugins) 
{
		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;
			var flashVersion = parseInt(flashDescription.substring(16));
			m_flash6Installed = flashVersion == 6;
			m_flash7Installed = flashVersion == 7;
			m_flash8Installed = flashVersion == 8;
			m_flash9Installed = flashVersion >= 9;
		}
}
  
for (var i = 6; i <= m_maxVersion; i++) 
	if (eval("m_flash" + i + "Installed") == true) m_actualVersion = i;
  
if(navigator.userAgent.indexOf("WebTV") != -1) m_actualVersion = 4;  
  
if (m_actualVersion >= m_requiredVersion) 
{
	m_hasRightVersion = true;
	MM_FlashCanPlay = true;
} 
//

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() {
	//v6.0
	var i, p, v, obj, args = MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i += 3) {
		if ((obj=MM_findObj(args[i])) != null) {
			v = args[i+2];
			if (obj.style) {
				obj = obj.style;
				v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v;
			}
			obj.visibility = v;
		}
	}
}

function writeFlashMovie(vers, w, h, src, fvars, bg, wm){
	if(MM_FlashCanPlay){
		var textFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
		textFlash += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=';
		textFlash += vers+',0,0,0" width="'+w+'" height="'+h+'">';
		textFlash += '<param name="movie" value="'+src+'" />';
		textFlash += '<param name="FlashVars" value="'+fvars+'" />';
		textFlash += '<param name="menu" value="false" />';
		textFlash += '<param name="quality" value="high" />';
		textFlash += '<param name="scale" value="noscale" />';
		textFlash += '<param name="wmode" value="'+wm+'" />';
		if(bg!=''){
			textFlash += '<param name="bgcolor" value="'+bg+'" />';
		}
		textFlash += '<embed src="'+src+'" type="application/x-shockwave-flash" ';
		textFlash += 'pluginspage="http://www.macromedia.com/go/getflashplayer" ';
		textFlash += 'flashvars="'+fvars+'" menu="false" quality="high" ';
		textFlash += 'wmode="'+wm+'" scale="noscale"';
		if(bg!=''){
			textFlash += ' bgcolor="'+bg+'"';
		}
		textFlash += ' width="'+w+'" height="'+h+'"></embed>';
		textFlash += '</object>';
		document.write(textFlash);
	}else{
		document.write('Sie brauchen den Flash Player für eine richtige Darstellung der Seite.<br/><br/><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash&P2_Platform=Win32&P3_Browser_Version=MSIE&P5_Language=German&Lang=German" target="_blank">Bitte hier herunterladen >>></a>');
	}
}

//Print version:
function printVersion(urll) {
	var druck=window.open(urll,"Print","toolbar=0,location=0,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,width=690,height=550,left=50,top=50");
	druck.focus;
}
function writeText(txt, div) {
	var Tekst = txt;
	var thisDiv = MM_findObj(div, '');
	if(thisDiv != "undefined" && thisDiv != null){
			thisDiv.innerHTML = '';
			thisDiv.innerHTML = Tekst;
	}
}
function returnFlashText(vers, w, h, src, fvars, bg, wm){
		var textFlash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
		textFlash += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=';
		textFlash += vers+',0,0,0" width="'+w+'" height="'+h+'">';
		textFlash += '<param name="movie" value="'+src+'" />';
		textFlash += '<param name="FlashVars" value="'+fvars+'" />';
		textFlash += '<param name="menu" value="false" />';
		textFlash += '<param name="quality" value="high" />';
		textFlash += '<param name="scale" value="noscale" />';
		textFlash += '<param name="wmode" value="'+wm+'" />';
		if(bg!=''){
			textFlash += '<param name="bgcolor" value="'+bg+'" />';
		}
		textFlash += '<embed src="'+src+'" type="application/x-shockwave-flash" ';
		textFlash += 'pluginspage="http://www.macromedia.com/go/getflashplayer" ';
		textFlash += 'flashvars="'+fvars+'" menu="false" quality="high" ';
		textFlash += 'wmode="'+wm+'" scale="noscale"';
		if(bg!=''){
			textFlash += ' bgcolor="'+bg+'"';
		}
		textFlash += ' width="'+w+'" height="'+h+'"></embed>';
		textFlash += '</object>';
		return textFlash ;
}
