function showThema(themaNr, themaMax, position) {
	for(var i = 1; i <= themaMax; i++) {
		var themaClass = "" + position + i;
		var element = document.getElementById(themaClass).style;
		if(themaNr == i) {
			element.display = "block";
		} else {
			element.display = "none";
		}
	}	
}

// Flash-Detection
function einfuegeFlash(flashUri, flashName, flashBgColor, breitePx, hoehePx, altBildUri, altBildAltText) {
	var d = document;
	if (flashUri && flashName && breitePx && hoehePx) {
		if (detectFlash() && !((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) == 4))) {
			d.write('<div class="flashcontainer"><object ');
			d.write('  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
			d.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"');
			d.write('  width="' + breitePx + '" height="' + hoehePx + '">');
			d.write('  <param name="movie" value="' + flashUri + '">');
			d.write('  <param name="quality" value="high"><param name="scale" value="exactfit"><param name="bgcolor" value="'+flashBgColor+'">');
			d.write('  <embed src="' + flashUri + '" quality="high" ');
			d.write('    pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"');
			d.write('    type="application/x-shockwave-flash" width="' + breitePx + '" height="' + hoehePx + '" bgcolor="' + flashBgColor + '" border="0" hspace="0" vspace="0"></embed></object></div>');
		} else if (altBildUri) {
			var alt = altBildAltText;
			if (!altBildAltText)
				alt = "";
			d.write('<div class="flashcontainer"><img src="' + altBildUri + '" alt="' + alt + '" width="' + breitePx + '" height="' + hoehePx + '"></div>');
			window.location.href('/de/meta/no_flash/');
		}
	}
}

var detectableWithVB = false;

if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
	var d = document;
    d.writeln('<script language="VBscript">');

    d.writeln('detectableWithVB = False');
    d.writeln('If ScriptEngineMajorVersion >= 2 then');
    d.writeln('  detectableWithVB = True');
    d.writeln('End If');

    d.writeln('Function detectActiveXControl(activeXControlName)');
    d.writeln('  on error resume next');
    d.writeln('  detectActiveXControl = False');
    d.writeln('  If detectableWithVB Then');
    d.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    d.writeln('  End If');
    d.writeln('End Function');

    d.writeln('</scr' + 'ipt>');
}

function detectFlash() {
	var pluginFound = false;
    pluginFound = detectPlugin('Shockwave', 'Flash');
    if(!pluginFound && detectableWithVB) {
		pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
    }
    return pluginFound;
}

function detectPlugin() {
    var daPlugins = detectPlugin.arguments;
    var pluginFound = false;
    if (navigator.plugins && navigator.plugins.length > 0) {
		var pluginsArrayLength = navigator.plugins.length;
		for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
			var numFound = 0;
			for (namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
				if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) ||
					(navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
					numFound++;
				}
			}
			if(numFound == daPlugins.length) {
				pluginFound = true;
				break;
			}
		}
    }
    return pluginFound;
}

function popUp(file, name, width, height) {
	var fenster = window.open(file, name, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=' + width + 'width,height=' + height);
	fenster.focus();
}

function optimizeView() {
	// Ermitteln der Browser
	var browser1 = "IE";
	if (navigator.userAgent.indexOf('Safari') != -1) {
		var browser1	= "Safari";
	}
	
	// OS Ermitteln
	var os = "Linux";
	if(navigator.platform.indexOf("Win32") != -1) {
		os = "Windows";	
	} else if(navigator.platform.indexOf("Mac") != -1) {
		os = "Macintosh";	
	}
		
	// Anpassungen für Mac Safari
	if (os == "Macintosh" && browser1 == "Safari") {
		// Anpassen der Tabelle auf breiten Übersichtsseiten für Mac Safari	
		if(document.getElementById("marginalExtenden")) {
			el = document.getElementById("marginalExtenden").style;
			el.width = "200px";
		}
	}
	/*
	if(browser.isWin && browser.isIE) {
		var divs = document.getElementsByTagName("div");
		for(var i = 0; i < divs.length; i++) {
			var div = divs[i];
			if(div.className == 'themen') {
				var alteHoehe = div.offsetHeight;
				div.style.height = (alteHoehe + 10) + "px";
			}
		}
	}
	*/
	// Anpassung für den Content Bereich der Homepage^- wird erstmal nicht mehr benötigt
	/*
	if(browser.isMac) {
		var div = document.getElementById("contentHomepage");
		if(div) {
			var alteHoehe = div.offsetHeight;
			div.style.height = (alteHoehe + 30) + "px";
		}
	}
	*/
}