function selector (target) {
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="670" height="467" id="selector" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="opaque" /><param name="movie" value="http://www.pbs.org/wgbh/pages/frontline/player/swf/selector.swf?stationid='+target+'" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" /><embed src="http://www.pbs.org/wgbh/pages/frontline/player/swf/selector.swf?stationid='+target+'" quality="high" bgcolor="#ffffff" width="670" wmode="opaque" height="467" name="selector" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	document.selector.focus();
	reporter(target,0);
}

function genmovie (movfile,targetxml,targetch,idhash){
	if(detectqt){
		document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="670" height="467" codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="qt1"><param name="src" value="'+movfile+'" /><param name="AUTOPLAY" value="true" /><param name="CONTROLLER" value="false" /><param name="cache" value="true" /><param name="bgcolor" value="#252c3c" /><param name="MOVIENAME" value="'+idhash+targetch+targetxml+'" /><embed src="'+movfile+'" moviename="'+idhash+targetch+targetxml+'" width="670" height="467" alt="" cache="true" autoplay="true" controller="false" bgcolor="#252c3c" pluginspage="http://www.apple.com/quicktime/download/" name="qt1" type="video/quicktime" EnableJavaScript="true"></embed></object>');
		document.qt1.focus();
	}
}

function stationmsg (station,selvis){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="670" height="40" id="stationthing" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="opaque" /><param name="movie" value="http://www.pbs.org/wgbh/pages/frontline/player/swf/stationmessages3.swf?stationid='+station+'&selvis='+selvis+'" /><param name="quality" value="high" /><param name="bgcolor" value="#444444" /><embed src="http://www.pbs.org/wgbh/pages/frontline/player/swf/stationmessages3.swf?stationid='+station+'&selvis='+selvis+'" wmode="opaque" quality="high" bgcolor="#444444" width="670" height="40" name="stationthing" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
}

function warnflash (){
	document.write('<div style="text-align: center;"><div align="center"><div class="warn"><p>We have detected that you have disabled Macromedia Flash and/or do not have it installed.  Flash 7 is required to view FRONTLINE on demand.<br /><a href="http://www.macromedia.com/go/getflashplayer/" target="links"><img src="/wgbh/pages/frontline/player/art/get_flashplayer.gif" width="88" height="31" alt="get macromedia flash" /></a></p></div></div></div>');
}

function warnqt (){
	document.write('<div style="text-align: center;"><div align="center"><div class="warn"><p>We have detected that you have disabled QuickTime and/or do not have it installed.  QuickTime 6 or later is required to view FRONTLINE on demand.<br /><a href="http://www.apple.com/quicktime/download/" target="links"><img src="/wgbh/pages/frontline/player/art/quicktime_download.gif" width="88" height="31" alt="get quicktime" /></a></p></div></div></div>');
}

function detectqt (){
	var fnd = false;
	if (navigator.plugins && (navigator.plugins.length > 0)) {
		for (var pluginsCounter = 0; pluginsCounter < navigator.plugins.length ; pluginsCounter++) {
			if ((navigator.plugins[pluginsCounter].name.indexOf(plugin) >= 0) || (navigator.plugins[pluginsCounter].description.indexOf(plugin) >= 0)) {
			fnd = true;
			break;
			}
		}
	} else {
		
		if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
			document.writeln('<script language="VBscript">');

			document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
			document.writeln('detectableWithVB = False');
			document.writeln('If ScriptEngineMajorVersion >= 2 then');
			document.writeln('  detectableWithVB = True');
			document.writeln('End If');

			document.writeln('\'this next function will detect most plugins');
			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('\'and the following function handles QuickTime');
			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>');
		}
		
		if(detectableWithVB){
			fnd = detectQuickTimeActiveXControl();
		}
	}
	return fnd;
}

function reporter (station,program) {
	snitch = new Image;
	snitch.src = "http://videocheck.entropymedia.com/playertrack/" + station + "/" + program + "/";
}
