/********************************************************************Contains Functions to Write out the HTML for Media Players:	Flv, Mp3, WMA	NOTE: This file exists on all Radio One Sites, WO# 52175	-scott 5/10/07********************************************************************//********************************************************************	Embedded FLV Player w/ Image		Uses: FlowPlayer 		Docs: http://flowplayer.sourceforge.net/howto.html********************************************************************/var gnNumFlvPlayers = 1;function showFlvPlayer(FlvURL, ImageURL, Width, Height) {	// If Safari, then we have to have a splashImageFile	if ((ImageURL == null || ImageURL == "") && navigator.userAgent.indexOf("Safari") > 0) {		ImageURL = "/images/white.jpg";	}		// Write out the HTML for the Flash Object	document.write('<object width="' + Width + '" height="' + Height + '"');	// Only Include This Attribute for Non-IE browsers	if (document.getElementById && document.all == null) {		document.write(' data="/Flash/FlowPlayer.swf"');	}	document.write(' type="application/x-shockwave-flash" id="FlowPlayer' + gnNumFlvPlayers + '">\r\n');	document.write('		<param name="movie" value="/Flash/FlowPlayer.swf" />');	document.write('		<param name="allowScriptAccess" value="never" />');	document.write('		<param name="quality" value="high" />');	document.write('		<param name="menu" value="false" />');	document.write('		<param name="wmode" value="transparent" />');	document.write('		<param name="FlashVars" value="config={videoFile: \'' + FlvURL + '\', ')	if (ImageURL != null && ImageURL.length > 0) {		document.write('splashImageFile: \'' + ImageURL + '\', ');	}	document.write('loop:false, showMenu:false, autoPlay:false}" />');	document.write('	<embed src="/Flash/FlowPlayer.swf" type="application/x-shockwave-flash" width="' + Width + '" height="' + Height + '" flashvars="config={videoFile: \'' + FlvURL + '\', splashImageFile: \'' + ImageURL + '\', loop:false, showMenu:false, autoPlay:false}" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" wmode="transparent" allowScriptAccess="never"></embed>');	document.write('</object>');	gnNumFlvPlayers++;}/********************************************************************	Embedded MP3 File w/ Image		From: http://www.1pixelout.net/code/audio-player-wordpress-plugin		Docs: http://www.macloo.com/examples/audio_player/		Customization: http://www.macloo.com/examples/audio_player/options.html********************************************************************/var gnNumMp3Players = 1;function showEmbededMp3(Mp3URL, ImageURL, ImageWidth, ImageHeight, ImageLink) {	document.write('<div class="alignCenter">');	// Display the Image above the Mp3	funShowMediaImage(ImageURL, ImageWidth, ImageHeight, ImageLink);	// Check the Image Width for the Width of the Player	if (ImageWidth == null || isNaN(ImageWidth)) ImageWidth = 300;	else if (parseInt(ImageWidth) < 200) ImageWidth = 200;		// Write out the HTML to embed the MP3 Player	document.write('<object height="24" width="290" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" id="Mp3Player' + gnNumMp3Players + '">');	document.write('	<param name="salign" value="lt" />');	document.write('	<param name="quality" value="high" />');	document.write('	<param name="scale" value="noscale" />');	document.write('	<param name="wmode" value="transparent" />');	document.write('	<param name="movie" value="/flash/mp3Player.swf" />');	document.write('	<param name="FlashVars" value="playerID=' + gnNumMp3Players + '&soundFile=' + Mp3URL + '" />');	document.write('	<embed height="24" width="' + ImageWidth + '" flashvars="playerID=' + gnNumMp3Players + '&soundFile=' + Mp3URL + '" quality="high" scale="noscale" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="/flash/mp3Player.swf" wmode="transparent"></embed>');	document.write('</object>');	document.write('</div>');		gnNumMp3Players++;}/********************************************************************	Embedded WMA File w/ Image********************************************************************/var gnNumWmaPlayers = 1;function showEmbededWma(WmaURL, ImageURL, ImageWidth, ImageHeight, ImageLink) {	document.write('<div class="alignCenter">');	// Display the Image above the Mp3	funShowMediaImage(ImageURL, ImageWidth, ImageHeight, ImageLink);	// Check the Image Width for the Width of the Player	if (ImageWidth == null || isNaN(ImageWidth)) ImageWidth = 300;	else if (parseInt(ImageWidth) < 200) ImageWidth = 200;		// Write out the HTML to embed the MP3 Player	document.write('<object id="WmaPlayer' + gnNumWmaPlayers + '" width="' + ImageWidth + '" height="46" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">');	document.write('	<param name="filename" value="' + WmaURL + '" />');	document.write('	<param name="Showcontrols" value="true" />');	document.write('	<param name="autoStart" value="false" />');	document.write('	<param name="loop" value="false">');	document.write('<embed type="application/x-mplayer" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"');	document.write('	id="WmaPlayer' + gnNumWmaPlayers + '" name="WmaPlayer' + gnNumWmaPlayers + '" displaysize="4" autosize="-1" ');	document.write('    bgcolor="darkblue" showcontrols="true" showtracker="-1" ');	document.write('    showdisplay="0" showstatusbar="-1" videoborder3d="-1" width="' + ImageWidth + '" height="46"');	document.write('    src="' + WmaURL + '" autostart="false" designtimesp="5311" loop="false"></embed>');	document.write('</object>');	document.write('</div>');		gnNumWmaPlayers++;}/********************************************************************	Embedded WMV File w/ Image********************************************************************/var gnNumWmvPlayers = 1;function showEmbededWmv(WmvURL, Width, Height) {	// Write out the HTML to embed the MP3 Player	document.write('<object id="WmvPlayer' + gnNumWmvPlayers + '" width="' + Width + '" height="' + Height + '" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">');	document.write('	<param name="filename" value="' + WmvURL + '" />');	document.write('	<param name="Showcontrols" value="true" />');	document.write('	<param name="autoStart" value="false" />');	document.write('	<param name="loop" value="false">');	document.write('<embed type="application/x-mplayer" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"');	document.write('	id="WmvPlayer' + gnNumWmvPlayers + '" name="WmvPlayer' + gnNumWmvPlayers + '" displaysize="4" autosize="-1" ');	document.write('    bgcolor="darkblue" showcontrols="true" showtracker="-1" ');	document.write('    showdisplay="0" showstatusbar="-1" videoborder3d="-1" width="' + Width + '" height="46"');	document.write('    src="' + WmvURL + '" autostart="false" designtimesp="5311" loop="false"></embed>');	document.write('</object>');	gnNumWmvPlayers++;}/********************************************************************	Embedded YouTube Player********************************************************************/var gnNumYouTubePlayers = 1;function showYouTubePlayer(sVideoURL, Width, Height) {	// Fix the URL if its the HTML link	if (sVideoURL.indexOf("watch?v=") > 0) sVideoURL = sVideoURL.replace(/watch\?v\=/i,"/v/");	// Set Default Width and height if not set	if (Width == null || Height == null || isNaN(Width) || isNaN(Height)) {		Width = 255;		Height = 210;	}	// Write out the HTML for the Flash Object	document.write('<object width="' + Width + '" height="' + Height + '" id="YouTubePlayer' + gnNumYouTubePlayers + '">');	document.write('<param name="movie" value="' + sVideoURL + '"></param>');	document.write('<param name="wmode" value="transparent"></param>');	document.write('<embed src="' + sVideoURL + '" type="application/x-shockwave-flash" wmode="transparent" width="' + Width + '" height="' + Height + '"></embed>');	document.write('</object>');	gnNumYouTubePlayers++;}/********************************************************************	Helper Function to Display the Image above the Media********************************************************************/function funShowMediaImage(ImageURL, ImageWidth, ImageHeight, ImageLink) {	if (ImageURL != null && ImageURL.length > 0) {			document.write('<div class="MediaPlayerImage">');				// Build the Image Tag		var sImageTag = '<img src="' + ImageURL + '" border="0"';		if (ImageWidth != null && !isNaN(ImageWidth)) sImageTag += ' width="' + ImageWidth + '"';		if (ImageHeight != null && !isNaN(ImageHeight)) sImageTag += ' height="' + ImageHeight + '"';		sImageTag += ' />';				// Check to see if it needs to link anywhere		if (ImageLink != null && ImageLink.length > 0) {			document.write('<a href="' + ImageLink + '">' + sImageTag + '</a>');		}		else {			document.write(sImageTag);		}		document.write('</div>');	}}/********************************************************************	Functions for Managing the embeded Flash mp3 Player		From: http://www.1pixelout.net/code/audio-player-wordpress-plugin		Docs: http://www.macloo.com/examples/audio_player/		Customization: http://www.macloo.com/examples/audio_player/options.html********************************************************************/var ap_instances = new Array();function ap_stopAll(playerID) {	for(var i = 0;i<ap_instances.length;i++) {		try {			if(ap_instances[i] != playerID) document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 1);			else document.getElementById("audioplayer" + ap_instances[i].toString()).SetVariable("closePlayer", 0);		} catch( errorObject ) {			// stop any errors		}	}}function ap_registerPlayers() {	var objectID;	var objectTags = document.getElementsByTagName("object");	for(var i=0;i<objectTags.length;i++) {		objectID = objectTags[i].id;		if(objectID.indexOf("audioplayer") == 0) {			ap_instances[i] = objectID.substring(11, objectID.length);		}	}}var ap_clearID = setInterval( ap_registerPlayers, 100 );
