var agent = navigator.userAgent.toLowerCase();

/* Usage:
** Place the following JavaScript block in the page where the ASF object should appear.
** 
** <script language="JavaScript" type="text/javascript">
** // <![CDATA[
** 	ASFObject("filename","id",width,height,AutoStart,Volume,PlayCount);
** // ]]>
** </script>
** 
** filename - full path/filename or URL of ASF/ASX file (Required)
** id - id name assigned to object (Required)
** width - width in pixels (Required)
** height - height in pixels (Required - 26 pixels are added to accomodate player StatusBar)
** AutoStart - true | false (Optional)
** Volume - on a scale of 0 to 100 (Optional - IE only)
** PlayCount - Number of times the file is played. A value of 0 repeats forever. Default is one. (Optional)
** 
** The optional parameters may be omitted, but must appear in the above order when used.
** To 'skip' an optional parameter, use two double quotes ("") to specify a null value.
*/
function ASFObject(mov,id,w,h,astart,vol,loop) {
	h = eval(h+26);
	if (agent.indexOf("msie") != -1) {
		var moVie = '<object classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" id="' + id + '" width="' + w + '" height="' + h + '" standby="Loading Microsoft Windows Media Player components...">';
	} else {
		var moVie = '<object type="video/x-ms-asf" data="' + mov + '" id="' + id + '" width="' + w + '" height="' + h + '">';
			moVie += '<param name="pluginspage" value="http://www.microsoft.com/windows/windowsmedia/" />';
	}
	moVie += '<param name="src" value="' + mov + '" />';
	moVie += '<param name="url" value="' + mov + '" />';
	moVie += '<param name="ShowStatusBar" value="1" />';
	if (astart) {moVie += '<param name="AutoStart" value="' + astart + '" />';}
	if (vol) {moVie += '<param name="Volume" value="' + vol + '" />';}
	if (loop) {moVie += '<param name="PlayCount" value="' + loop + '" />';}
	moVie += '</object>';
	document.write(moVie);
}

/* Usage:
** Place the following JavaScript block in the page where the AVI object should appear.
** 
** <script language="JavaScript" type="text/javascript">
** // <![CDATA[
** 	AVIObject("filename","id",width,height,AutoStart,Volume,PlayCount);
** // ]]>
** </script>
** 
** filename - full path/filename or URL of WMV file (Required)
** id - id name assigned to object (Required)
** width - width in pixels (Required)
** height - height in pixels (Required - 26 pixels are added to accomodate player StatusBar)
** AutoStart - true | false (Optional)
** Volume - on a scale of 0 to 100 (Optional - IE only)
** PlayCount - Number of times the file is played. A value of 0 repeats forever. Default is one. (Optional)
** 
** The optional parameters may be omitted, but must appear in the above order when used.
** To 'skip' an optional parameter, use two double quotes ("") to specify a null value.
*/
function AVIObject(mov,id,w,h,astart,vol,loop) {
	h = eval(h+26);
	if (agent.indexOf("msie") != -1) {
		var moVie = '<object classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" id="' + id + '" width="' + w + '" height="' + h + '" standby="Loading Microsoft Windows Media Player components...">';
	} else if (agent.indexOf("opera") != -1) {
		var moVie = '<object classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" id="' + id + '" width="' + w + '" height="' + h + '" standby="Loading Microsoft Windows Media Player components...">';
			moVie += '<embed src="' + mov + '" id="' + id + '" width="' + w + '" height="' + h +'" type="application/x-mplayer2" showstatusbar="1" pluginspage="http://www.microsoft.com/windows/windowsmedia/" />';
	} else {
		var moVie = '<object type="application/x-mplayer2" data="' + mov + '" id="' + id + '" width="' + w + '" height="' + h + '">';
			moVie += '<param name="pluginspage" value="http://www.microsoft.com/windows/windowsmedia/" />';
	}
	moVie += '<param name="src" value="' + mov + '" />';
	moVie += '<param name="url" value="' + mov + '" />';
	moVie += '<param name="ShowStatusBar" value="1" />';
	if (astart) {moVie += '<param name="AutoStart" value="' + astart + '" />';}
	if (vol) {moVie += '<param name="Volume" value="' + vol + '" />';}
	if (loop) {moVie += '<param name="PlayCount" value="' + loop + '" />';}
	moVie += '</object>';
	document.write(moVie);
}

/* Usage:
** Place the following JavaScript block in the page where the DCR object should appear.
** 
** <script language="JavaScript" type="text/javascript">
** // <![CDATA[
** 	DCRObject("filename","id",width,height,"bgcolor");
** // ]]>
** </script>
** 
** filename - full path/filename or URL of DCR file (Required)
** id - id name assigned to object (Required)
** width - width in pixels (Required)
** height - height in pixels (Required)
** bgcolor - hexidecimal RGB value in the format: #RRGGBB (Optional)
** 
*/
function DCRObject(mov,id,w,h,bg) {
	var agent = navigator.userAgent.toLowerCase();
	if (agent.indexOf("msie") != -1) {
		var moVie = '<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,0,0,0" id="8100demo" width="' + w + '" height="' + h + '">';
	} else if (agent.indexOf("opera") != -1) {
		var moVie = '<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,0,0,0" id="' + id + '" width="' + w + '" height="' + h + '">';
			moVie += '<embed src="' + mov + '" bgcolor="' + bg + '" name="' + id + '" swliveconnect="true" swstretchhalign="left" swstretchvalign="top" width="' + w + '" height="' + h + '" swremote="swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\' " swstretchstyle="meet" type="application/x-director" pluginspage="http://www.macromedia.com/shockwave/download/"></embed>';
	} else {
		var moVie = '<object type="application/x-director" data="' + mov + '" id="' + id + '" width="' + w + '" height="' + h + '">';
			moVie += '<param name="pluginspage" value="http://www.macromedia.com/shockwave/download/" />';
	}
	moVie += '<param name="src" value="' + mov + '" />';
	moVie += '<param name="bgcolor" value="' + bg + '" />';
	moVie += '<param name="name" value="' + id + '" />';
	moVie += '<param name="swstretchstyle" value="meet" />';
	moVie += '<param name="swremote" value="swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\' " />';
	moVie += '<param name="swstretchhalign" value="left" />';
	moVie += '<param name="swstretchvalign" value="top" />';
	moVie += '</object>';
	document.write(moVie);
}

/* Usage:
** Place the following JavaScript block in the page where the MOV object should appear.
** 
** <script language="JavaScript" type="text/javascript">
** // <![CDATA[
** 	MOVObject("filename","id",width,height,autoplay,controller,"bgcolor",volume,loop,"href","target");
** // add 16 pixels to height for controls ]]>
** </script>
** 
** filename - full path/filename or URL of MOV file (Required)
** id - id name assigned to object (Required)
** width - width in pixels (Required)
** height - height in pixels (Required - add 16 pixels to height for controls)
** autoplay - true | false (Optional)
** controller - true | false (Optional)
** bgcolor - hexidecimal RGB value in the format: #RRGGBB (Optional)
** volume - on a scale of 0 to 100 (Optional)
** loop - true | false | "palindrome" (Optional, palindrome will play forward then reverse)
** href - URL for a link when the movie is clicked on (Optional)
** target - valid frame or window name (Optional, used in conjunction with href parameter)
** 
** The optional parameters may be omitted, but must appear in the above order when used.
** To 'skip' an optional parameter, use two double quotes ("") to specify a null value.
*/
function MOVObject(mov,id,w,h,aplay,ctrl,bg,vol,loop,href,target) {
	if (agent.indexOf("msie") != -1) {
		var moVie = '<object classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="' + id + '" width="' + w + '" height="' + h + '">';
	} else {
		var moVie = '<object type="video/quicktime" data="' + mov + '" id="' + id + '" width="' + w + '" height="' + h + '">';
			moVie += '<param name="pluginspage" value="http://www.apple.com/quicktime/download/" />';
	}
	moVie += '<param name="src" value="' + mov + '" />';
	if (aplay) {moVie += '<param name="autoplay" value="' + aplay + '" />';}
	if (ctrl) {moVie += '<param name="controller" value="' + ctrl + '" />';}
	if (bg) {moVie += '<param name="bgcolor" value="' + bg + '" />';}
	if (vol) {moVie += '<param name="volume" value="' + vol + '" />';}
	if (loop) {moVie += '<param name="loop" value="' + loop + '" />';}
	if (href) {moVie += '<param name="href" value="' + href + '" />';}
	if (target) {moVie += '<param name="target" value="' + target + '" />';}
	moVie += '</object>';
	document.write(moVie);
}

/* Usage:
** Place the following JavaScript block in the page where the MPG object should appear.
** 
** <script language="JavaScript" type="text/javascript">
** // <![CDATA[
** 	MPGObject("filename","id",width,height,autoplay,controller,"bgcolor",volume,loop,"href","target");
** // add 16 pixels to height for controls ]]>
** </script>
** 
** filename - full path/filename or URL of MPG file (Required)
** id - id name assigned to object (Required)
** width - width in pixels (Required)
** height - height in pixels (Required - add 16 pixels to height for controls)
** autoplay - true | false (Optional)
** controller - true | false (Optional)
** bgcolor - hexidecimal RGB value in the format: #RRGGBB (Optional)
** volume - on a scale of 0 to 100 (Optional)
** loop - true | false | "palindrome" (Optional, palindrome will play forward then reverse)
** href - URL for a link when the movie is clicked on (Optional)
** target - valid frame or window name (Optional, used in conjunction with href parameter)
** 
** The optional parameters may be omitted, but must appear in the above order when used.
** To 'skip' an optional parameter, use two double quotes ("") to specify a null value.
*/
function MPGObject(mov,id,w,h,aplay,ctrl,bg,vol,loop,href,target) {
	if (agent.indexOf("msie") != -1) {
		var moVie = '<object classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="' + id + '" width="' + w + '" height="' + h + '">';
	} else if (agent.indexOf("opera") != -1) {
		var moVie = '<object classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" id="' + id + '" width="' + w + '" height="' + h + '">';
			moVie += '<embed src="' + mov + '" id="' + id + '" width="' + w + '" height="' + h +'" type="video/x-mpeg" pluginspage="http://www.apple.com/quicktime/download/" />';
	} else {
		var moVie = '<object type="video/x-mpeg" data="' + mov + '" id="' + id + '" width="' + w + '" height="' + h + '">';
			moVie += '<param name="pluginspage" value="http://www.apple.com/quicktime/download/" />';
	}
	moVie += '<param name="src" value="' + mov + '" />';
	if (aplay) {moVie += '<param name="autoplay" value="' + aplay + '" />';}
	if (ctrl) {moVie += '<param name="controller" value="' + ctrl + '" />';}
	if (bg) {moVie += '<param name="bgcolor" value="' + bg + '" />';}
	if (vol) {moVie += '<param name="volume" value="' + vol + '" />';}
	if (loop) {moVie += '<param name="loop" value="' + loop + '" />';}
	if (href) {moVie += '<param name="href" value="' + href + '" />';}
	if (target) {moVie += '<param name="target" value="' + target + '" />';}
	moVie += '</object>';
	document.write(moVie);
}

/* Usage:
** Place the following JavaScript block in the page where the Flash object should appear.
** 
** <script language="JavaScript" type="text/javascript">
** // <![CDATA[
** 	SWFObject("filename","id",width,height,"quality","bgcolor","wmode",version);
** // ]]>
** </script>
** 
** filename - full path/filename of swf (Required)
** id - id name assigned to object (Required)
** width - width in pixels (Required)
** height - height in pixels (Required)
** quality - low | medium | high | autolow | autohigh | best (Optional)
** bgcolor - hexidecimal RGB value in the format: #RRGGBB, to override the background color specified in the Flash file. (Optional)
** wmode - window | opaque | transparent (Optional)
** version - minimum player version required to view the Flash file. (Optional)
** 
** The optional parameters may be omitted, but must appear in the above order when used.
** To 'skip' an optional parameter, use two double quotes ("") to specify a null value.
*/
function SWFObject(mov,id,w,h,qual,bg,wmode,ver) {
	if (ver && isNaN(ver) == false) {
		var MM_contentVersion = ver;
		var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
		if ( plugin ) {
				var words = navigator.plugins["Shockwave Flash"].description.split(" ");
			    for (var i = 0; i < words.length; ++i)
			    {
				if (isNaN(parseInt(words[i])))
				continue;
				var MM_PluginVersion = words[i]; 
			    }
			var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
		}
		else if (agent.indexOf("msie") != -1 && navigator.appVersion.indexOf("Win") != -1) {
			document.write('<scr' + 'ipt language=VBScript\> \n');
			document.write('set MM_Installed = ( CreateObject("ShockwaveFlash.ShockwaveFlash"))\n');
			document.write('MM_FullVersion = MM_Installed.GetVariable("$version")\n');
			document.write('MM_FullVersion = Replace(MM_FullVersion,"WIN ","")\n');
			document.write('MM_VersionNum = Replace(MM_FullVersion,",",".")\n');
			document.write('</scr' + 'ipt\> \n');
			var MM_PluginVersion = MM_VersionNum.substr(0,3);
			var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
		}
	} else {
		MM_FlashCanPlay = true;
	}
	if (MM_FlashCanPlay == true) {
		if (agent.indexOf("msie") != -1) {
			var moVie = '<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="' + id + '" width="' + w + '" height="' + h + '">';
		} else if (agent.indexOf("opera") != -1) {
			var moVie = '<object classid="CLSID:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="' + id + '" width="' + w + '" height="' + h + '">';
				moVie += '<embed src="' + mov + '" id="' + id + '" width="' + w + '" height="' + h +'" type="application/x-shockwave-flash"';
				if (qual) moVie += ' quality="' + qual + '"';
				if (bg) moVie += ' bgcolor="' + bg + '"';
				if (wmode) moVie += ' wmode="' + wmode + '"';
				moVie += ' pluginspage="http://www.adobe.com/go/getflashplayer" />';
		} else {
			var moVie = '<object type="application/x-shockwave-flash" data="' + mov + '" id="' + id + '" width="' + w + '" height="' + h + '">';
				moVie += '<param name="pluginspage" value="http://www.adobe.com/go/getflashplayer" />';
		}
		moVie += '<param name="movie" value="' + mov + '" />';
		if (qual) {moVie += '<param name="quality" value="' + qual + '" />';}
		if (bg) {moVie += '<param name="bgcolor" value="' + bg + '" />';}
		if (wmode) {moVie += '<param name="wmode" value="' + wmode + '" />';}
		moVie += '</object>';
	} else {
		var moVie = '<div id="' + id + '" style="border: 2px solid #808080; width:' + w + 'px; height:' + h + 'px; text-align: center;">';
			moVie += '<p style="padding:15px;">This page makes use of <a href="http://www.adobe.com/go/getflashplayer" target="_blank">Adobe&reg; Flash&reg;</a> software. You have an older version of Adobe Flash Player that cannot play the content we&rsquo;ve created.<br /><br />';
			moVie += 'Why not download and install the latest version now? It will only take a moment.<br /><br /></p>';
			moVie += '</div>';
	}
	document.write(moVie);
}

/* Usage:
** Place the following JavaScript block in the page where the WMV object should appear.
** 
** <script language="JavaScript" type="text/javascript">
** // <![CDATA[
** 	WMVObject("filename","id",width,height,AutoStart,Volume,PlayCount);
** // ]]>
** </script>
** 
** filename - full path/filename or URL of WMV file (Required)
** id - id name assigned to object (Required)
** width - width in pixels (Required)
** height - height in pixels (Required - 26 pixels are added to accomodate player StatusBar)
** AutoStart - true | false (Optional)
** Volume - on a scale of 0 to 100 (Optional - IE only)
** PlayCount - Number of times the file is played. A value of 0 repeats forever. Default is one. (Optional)
** 
** The optional parameters may be omitted, but must appear in the above order when used.
** To 'skip' an optional parameter, use two double quotes ("") to specify a null value.
*/
function WMVObject(mov,id,w,h,astart,vol,loop) {
	h = eval(h+26);
	if (agent.indexOf("msie") != -1) {
		var moVie = '<object classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" id="' + id + '" width="' + w + '" height="' + h + '" standby="Loading Microsoft Windows Media Player components...">';
	} else {
		var moVie = '<object type="video/x-ms-wmv" data="' + mov + '" id="' + id + '" width="' + w + '" height="' + h + '">';
			moVie += '<param name="pluginspage" value="http://www.microsoft.com/windows/windowsmedia/" />';
	}
	moVie += '<param name="src" value="' + mov + '" />';
	moVie += '<param name="url" value="' + mov + '" />';
	moVie += '<param name="ShowStatusBar" value="1" />';
	if (astart) {moVie += '<param name="AutoStart" value="' + astart + '" />';}
	if (vol) {moVie += '<param name="Volume" value="' + vol + '" />';}
	if (loop) {moVie += '<param name="PlayCount" value="' + loop + '" />';}
	moVie += '</object>';
	document.write(moVie);
}


