var detectableWithVB = false;
var pluginFound = false;
var toggled = false;

function canDetectPlugins(){
if(detectableWithVB || (navigator.plugins && navigator.plugins.length > 0)){
	return true;
	}
else{
	return false;
	}
}

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

function detectDirector(redirectURL,redirectIfFound){
pluginFound = detectPlugin('Shockwave','Director');
if(!pluginFound && detectableWithVB){
	pluginFound = detectActiveXControl('SWCtl.SWCtl.1');
	}
return pluginFound;
}

function detectQuickTime(redirectURL,redirectIfFound){
pluginFound = detectPlugin('QuickTime');
if(!pluginFound && detectableWithVB){
	pluginFound = detectQuickTimeActiveXControl();
	}
return pluginFound;
}

function detectReal(redirectURL,redirectIfFound){
pluginFound = detectPlugin('RealPlayer');
if(!pluginFound && detectableWithVB){
	pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') || detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') || detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
	}
return pluginFound;
}

function detectWindowsMedia(redirectURL,redirectIfFound){
pluginFound = detectPlugin('Windows Media');
if(!pluginFound && detectableWithVB){
	pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.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;
}

if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
document.writeln('<script language="VBscript">');
document.writeln('detectableWithVB = False');
document.writeln('If ScriptEngineMajorVersion >= 2 then');
document.writeln('  detectableWithVB = True');
document.writeln('End If');
document.writeln('Function detectActiveXControl(activeXControlName)');
document.writeln('  on error resume next');
document.writeln('  detectActiveXControl = False');
document.writeln('  If detectableWithVB Then');
document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
document.writeln('  End If');
document.writeln('End Function');
document.writeln('Function detectQuickTimeActiveXControl()');
document.writeln('  on error resume next');
document.writeln('  detectQuickTimeActiveXControl = False');
document.writeln('  If detectableWithVB Then');
document.writeln('    detectQuickTimeActiveXControl = False');
document.writeln('    hasQuickTimeChecker = false');
document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
document.writeln('    If IsObject(hasQuickTimeChecker) Then');
document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
document.writeln('        detectQuickTimeActiveXControl = True');
document.writeln('      End If');
document.writeln('    End If');
document.writeln('  End If');
document.writeln('End Function');
document.writeln('</scr' + 'ipt>');
}

function startMe(arg){
myMenu = '';
myStart = new Array();
if(detectReal()){
	myMenu += '<DIV onMouseOut="toggle(\'subout\',this)" onMouseOver="toggle(\'subovr\',this)" onClick="make(\'real\')"><IMG SRC="../layout/realplayer.gif" ALT="" BORDER="0" HEIGHT="16" WIDTH="16">Real: 6,32 MB</DIV>';
	myStart.push('ram');
	}
if(detectFlash()){
	myMenu += '<DIV onMouseOut="toggle(\'subout\',this)" onMouseOver="toggle(\'subovr\',this)" onClick="make(\'flash\')"><IMG SRC="../layout/flash.gif" ALT="" BORDER="0" HEIGHT="16" WIDTH="16">Flash: 14,9 MB</DIV>';
	myStart.push('swf');
	}
if(detectWindowsMedia()){
	myMenu += '<DIV onMouseOut="toggle(\'subout\',this)" onMouseOver="toggle(\'subovr\',this)" onClick="make(\'mpg\')"><IMG SRC="../layout/mpg.gif" ALT="" BORDER="0" HEIGHT="16" WIDTH="16">MPEG 1: 14,9 MB</DIV>';
	myStart.push('mpg');
	}
if(detectQuickTime()){
	myMenu += '<DIV onMouseOut="toggle(\'subout\',this)" onMouseOver="toggle(\'subovr\',this)" onClick="make(\'quicktime\')"><IMG SRC="../layout/quicktime.gif" ALT="" BORDER="0" HEIGHT="16" WIDTH="16">Quicktime: 27,6 MB</DIV>';
	myStart.push('mov');
	}
if(myStart.length > 0){
	document.getElementById("play").innerHTML += '<DIV ID="vMenu">' + myMenu + '</DIV><DIV ID="vMenuStart"><IMG SRC="../layout/video.gif" ALT="" BORDER="0" HEIGHT="20" WIDTH="184" onClick="toggle(\'main\')"></DIV>';
	}
}

function toggle(arg1,arg2){
if(arg1 == 'main'){
	if(toggled == false){
		document.getElementById("vMenuStart").style.width = document.getElementById("vMenu").offsetWidth;
		if(top.is.ns)document.getElementById("vMenuStart").style.width = document.getElementById("vMenu").offsetWidth - 1;
		document.getElementById("vMenu").style.top = 217 - document.getElementById("vMenu").offsetHeight;
		document.getElementById("vMenu").style.visibility = 'visible';
		toggled = true;
		}
	else{
		document.getElementById("vMenuStart").style.width = 66;
		document.getElementById("vMenu").style.visibility = 'hidden';
		toggled = false;
		}
	}
else{
	if(arg1== 'subovr'){
		arg2.style.color = "#B81629";
		}
	else{
		arg2.style.color = "#3366CC";
		}
	}
}

function make(arg){
top.parent.showcase.location.replace('video_flossfahrt_1_' + arg + '.html');
}

window.onload = startMe;
