/**
 * Aus der HTML-Seite zugaenliche Methode
 */
function einfuegeFlash(flashUri, flashName, flashBgColor, breitePx, hoehePx, altBildUri, altBildAltText) {
	var d = document;
	if (flashUri && flashName && breitePx && hoehePx) {
		if (detectFlash()) {
			// Movie einfuegen
			d.write('<table border="0" cellpadding="0" cellspacing="0"><tr><td class="blk"><obj'+'ect ');
			d.write('  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
			d.write('  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,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="wmode" value="transparent"><param name="scale" value="exactfit"><param name="bgcolor" value="'+flashBgColor+'">');
			d.write('  <em'+'bed 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"></em'+'bed></obj'+'ect></td></tr></table>');
		} else if (altBildUri) {
			// Einsetzen des Alternativbildes
			var alt = altBildAltText;
			if (!altBildAltText)
				alt = "";
			d.write('<table border="0" cellpadding="0" cellspacing="0"><tr><td class="blk"><img src="'+altBildUri+'" alt="'+alt+'" width="'+breitePx+'" height="'+hoehePx+'"></td></tr></table>');
		}
	}
}


// AB HIER NICHT DER HTML-SEITE AUFRUFEN

var detectableWithVB = false;

// Here we write out the VBScript block for MSIE Windows
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 desired plugin name is found in either plugin name or description
				if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) ||
					(navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
					numFound++;
				}
			}
			// if the number we found matches the total number provided then we were successful
			if(numFound == daPlugins.length) {
				pluginFound = true;
				break;
			}
		}
    }
    return pluginFound;
}

