
	function GetWebcastPlayer(Instance, strMediaFile, numWidth, numHeight, strAutoStart, strPreviewImg) {
		if (typeof numWidth == 'undefined' || numWidth == '') {
			numWidth = 320;
		}
		if (typeof numHeight == 'undefined' || numHeight == '') {
			numHeight = 240;
		}

		if (typeof strAutoStart == 'undefined') {
			strAutoStart = 'false';
		}
		if(strAutoStart == 'nopreview') {
			return '';
		}
		var lenOfMedia = strMediaFile.length;
		if(strMediaFile.substring(lenOfMedia-8, lenOfMedia) == '.youtube') {
			var strExt = 'youtube';
			strMediaFile = strMediaFile.substring(0, lenOfMedia-8)
		} else if(strMediaFile.substring(lenOfMedia-8, lenOfMedia) == '.torrent') {
			var strExt = 'torrent';
		} else if(strMediaFile.substring(lenOfMedia-3, lenOfMedia-2) == '.') {
			var strExt = strMediaFile.substring(lenOfMedia-2, lenOfMedia);
		} else if(strMediaFile.substring(lenOfMedia-4, lenOfMedia-3) == '.') {
			var strExt = strMediaFile.substring(lenOfMedia-3, lenOfMedia);
		} else {
			var strExt = '';
		}
		strExt = strExt.toLowerCase();

		switch (strExt) {
			case 'm4v':
			case 'm4a':
			case 'avi':
			case 'mpeg':
			case 'mpg':
			case 'mp4':
			case 'qt':
			case 'mov':
				switch (strExt) {
					case 'm4v':
						var strMimeType = 'video/x-m4v';
						break;
					case 'm4a':
						var strMimeType = 'audio/x-m4a';
						break;
					case 'avi':
						var strMimeType = 'video/avi';
						break;
					case 'mpeg':
					case 'mpg':
						var strMimeType = 'video/mpeg';
						break;
					case 'mp4':
						var strMimeType = 'audio/mpeg';
						break;
					case 'qt':
					case 'mov':
						var strMimeType = 'video/quicktime';
						break;
				}
				strResult = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'+numWidth+'" height="'+numHeight+'" codebase="http://www.apple.com/qtactivex/qtplugin.cab">';
				strResult += '	<param name="src" value="'+strMediaFile+'" />';
				strResult += '	<param name="href" value="'+strMediaFile+'" />';
				strResult += '	<param name="scale" value="aspect" />';
				strResult += '	<param name="controller" value="true" />';
				strResult += '	<param name="autoplay" value="'+strAutoStart+'" />';
				strResult += '	<param name="bgcolor" value="000000" />';
				strResult += '	<param name="pluginspage" value="http://www.apple.com/quicktime/download/" />';
				strResult += '	<embed src="'+strMediaFile+'" width="'+numWidth+'" height="'+numHeight+'" scale="aspect" cache="true" bgcolor="000000" autoplay="'+strAutoStart+'" controller="true" src="'+strMediaFile+'" type="'+strMimeType+'" pluginspage="http://www.apple.com/quicktime/download/"></embed>';
				strResult += '</object><br/><br/>';
				break;
			case 'wma':
			case 'wmv':
			case 'asf':
				strResult = '<object id="winplayer" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'+numWidth+'" height="'+numHeight+'" standby="Media is loading..." type="application/x-oleobject">';
				strResult += '	<param name="url" value="'+strMediaFile+'" />';
				strResult += '	<param name="AutoStart" value="'+strAutoStart+'" />';
				strResult += '	<param name="AutoSize" value="true" />';
				strResult += '	<param name="AllowChangeDisplaySize" value="true" />';
				strResult += '	<param name="standby" value="Media is loading..." />';
				strResult += '	<param name="AnimationAtStart" value="true" />';
				strResult += '	<param name="scale" value="aspect" />';
				strResult += '	<param name="ShowControls" value="true" />';
				strResult += '	<param name="ShowCaptioning" value="false" />';
				strResult += '	<param name="ShowDisplay" value="false" />';
				strResult += '	<param name="ShowStatusBar" value="false" />';
				strResult += '	<embed type="application/x-mplayer2" src="'+strMediaFile+'" width="'+numWidth+'" height="'+numHeight+'" scale="aspect" AutoStart="'+strAutoStart+'" ShowDisplay="0" ShowStatusBar="0" AutoSize="1" AnimationAtStart="1" AllowChangeDisplaySize="1" ShowControls="1"></embed>';
				strResult += '</object><br/><br/>';
				break;
			case 'swf':
				if(strAutoStart == 'true') {
					strAutoStart = '';
				} else {
					strAutoStart = ' play="false"';
				}
			
				strResult = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"'+strAutoStart+' width="'+numWidth+'" height="'+numHeight+'" menu="true">';
				strResult += '	<param name="movie" value="'+strMediaFile+'" />';
				strResult += '	<param name="quality" value="high" />';
				strResult += '	<param name="menu" value="true" />';
				strResult += '	<param name="scale" value="noorder" />';
				strResult += '	<param name="quality" value="high" />';
				strResult += '	<embed src="'+strMediaFile+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"'+strAutoStart+' width="'+numWidth+'" height="'+numHeight+'" menu="true"></embed>';
				strResult += '</object>';
				break;
			case 'flv':
				strResult = '\n<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0 class=" height="'+numHeight+'" width="'+numWidth+'" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>';
				strResult += '\n\t<PARAM NAME="_cx" VALUE="13229">';
				strResult += '\n\t<PARAM NAME="_cy" VALUE="9260">';
				strResult += '\n\t<PARAM NAME="FlashVars" VALUE="">';
				strResult += '\n\t<PARAM NAME="Movie" VALUE="/cclib/players/avplayer.swf?url='+strMediaFile+'">';
				strResult += '\n\t<PARAM NAME="Src" VALUE="/cclib/players/avplayer.swf?url='+strMediaFile+'">';
				strResult += '\n\t<PARAM NAME="WMode" VALUE="Opaque">';
				strResult += '\n\t<PARAM NAME="Play" VALUE="-1">';
				strResult += '\n\t<PARAM NAME="Loop" VALUE="-1">';
				strResult += '\n\t<PARAM NAME="Quality" VALUE="High">';
				strResult += '\n\t<PARAM NAME="SAlign" VALUE="LT">';
				strResult += '\n\t<PARAM NAME="Menu" VALUE="-1">';
				strResult += '\n\t<PARAM NAME="Base" VALUE="">';
				strResult += '\n\t<PARAM NAME="AllowScriptAccess" VALUE="">';
				strResult += '\n\t<PARAM NAME="Scale" VALUE="NoScale">';
				strResult += '\n\t<PARAM NAME="DeviceFont" VALUE="0">';
				strResult += '\n\t<PARAM NAME="EmbedMovie" VALUE="0">';
				strResult += '\n\t<PARAM NAME="BGColor" VALUE="FFFFFF">';
				strResult += '\n\t<PARAM NAME="SWRemote" VALUE="">';
				strResult += '\n\t<PARAM NAME="MovieData" VALUE="">';
				strResult += '\n\t<PARAM NAME="SeamlessTabbing" VALUE="1">';
				strResult += '\n\t<PARAM NAME="Profile" VALUE="0">';
				strResult += '\n\t<PARAM NAME="ProfileAddress" VALUE="">';
				strResult += '\n\t<PARAM NAME="ProfilePort" VALUE="0">';
				strResult += '\n\t<PARAM NAME="AllowNetworking" VALUE="all">';
				strResult += '\n\t<PARAM NAME="AllowFullScreen" VALUE="false">';
				strResult += '\n\t<embed src="/cclib/players/avplayer.swf?url='+strMediaFile+'" height="'+numHeight+'" width="'+numWidth+'" play="true" loop="true" wmode="Opaque" quality="high" bgcolor="#ffffff" align="" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
				strResult += '\n</OBJECT><br/><br/>';
				break;
			case '.rm':
				strResult = '<object id="realplayer" classid="clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa" width="'+numWidth+'" height="'+numHeight+'">';
				strResult += '	<param name="src" value="'+strMediaFile+'" />';
				strResult += '	<param name="autostart" value="'+strAutoStart+'" />';
				strResult += '	<param name="controls" value="imagewindow,controlpanel" />';
				strResult += '	<embed src="'+strMediaFile+'" width="'+numWidth+'" height="'+numHeight+'" autostart="'+strAutoStart+'" controls="imagewindow,controlpanel" type="audio/x-pn-realaudio-plugin"></embed>';
				strResult += '</object><br/><br/>';
				break;
			case 'ogg':
				if(strAutoStart == 'true') {
					strAutoStart = 'yes';
				} else {
					strAutoStart = 'no';
				}
				strResult = '<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="'+numWidth+'" height="'+numHeight+'" align="center" codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0">';
				strResult += '	<param name="java_codebase" VALUE="'+podPressBackendURL+'players/" />';
				strResult += '	<param name="java_code" VALUE="JOrbisPlayer.class" />';
				strResult += '	<param name="archive" VALUE="JOrbisPlayer.jar,jogg.jar,jorbis.jar" />';
				strResult += '	<param name="jorbis.player.play.0" VALUE="'+strMediaFile+'" />';
				strResult += '	<param name="jorbis.player.icestats" VALUE="no" />';
				strResult += '	<param name="jorbis.player.playonstartup" VALUE="'+strAutoStart+'" />';
				strResult += '	<param name="type" VALUE="application/x-java-applet;version=1.3" />';
				strResult += '	<comment><embed type="application/x-java-applet;version=1.3" width="'+numWidth+'" height="'+numHeight+'" java_codebase="'+podPressBackendURL+'players/" java_code="JOrbisPlayer.class" archive="JOrbisPlayer.jar,jogg.jar,jorbis.jar" jorbis.player.play.0="'+strMediaFile+'" jorbis.player.icestats="no" jorbis.player.playonstartup="'+strAutoStart+'" pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html"></embed></comment>';
				strResult += '</object><br/><br/>';
				break;
			case 'youtube':
				if(strAutoStart == 'true') {
					strAutoStart = 'yes';
				} else {
					strAutoStart = 'no';
				}
				strResult = '<object width="'+numWidth+'" height="'+numHeight+'">';
				strResult += '	<param name="movie" value="http://www.youtube.com/v/'+strMediaFile+'&rel=1&autoplay=1" />';
				strResult += '	<param name="wmode" value="transparent" />';
				strResult += '	<embed src="http://www.youtube.com/v/'+strMediaFile+'&rel=1&autoplay=1" type="application/x-shockwave-flash" wmode="transparent" width="'+numWidth+'" height="'+numHeight+'"></embed>';
				strResult += '</object><br/><br/>';
				break;
			case 'mp3':
			default:
				strResult = '\n<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0 class=" height="'+numHeight+'" width="'+numWidth+'" classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000>';
				strResult += '\n\t<PARAM NAME="_cx" VALUE="13229">';
				strResult += '\n\t<PARAM NAME="_cy" VALUE="9260">';
				strResult += '\n\t<PARAM NAME="FlashVars" VALUE="">';
				strResult += '\n\t<PARAM NAME="Movie" VALUE="/cclib/players/avplayer.swf?url='+strMediaFile+'">';
				strResult += '\n\t<PARAM NAME="Src" VALUE="/cclib/players/avplayer.swf?url='+strMediaFile+'">';
				strResult += '\n\t<PARAM NAME="WMode" VALUE="Opaque">';
				strResult += '\n\t<PARAM NAME="Play" VALUE="-1">';
				strResult += '\n\t<PARAM NAME="Loop" VALUE="-1">';
				strResult += '\n\t<PARAM NAME="Quality" VALUE="High">';
				strResult += '\n\t<PARAM NAME="SAlign" VALUE="LT">';
				strResult += '\n\t<PARAM NAME="Menu" VALUE="-1">';
				strResult += '\n\t<PARAM NAME="Base" VALUE="">';
				strResult += '\n\t<PARAM NAME="AllowScriptAccess" VALUE="">';
				strResult += '\n\t<PARAM NAME="Scale" VALUE="NoScale">';
				strResult += '\n\t<PARAM NAME="DeviceFont" VALUE="0">';
				strResult += '\n\t<PARAM NAME="EmbedMovie" VALUE="0">';
				strResult += '\n\t<PARAM NAME="BGColor" VALUE="FFFFFF">';
				strResult += '\n\t<PARAM NAME="SWRemote" VALUE="">';
				strResult += '\n\t<PARAM NAME="MovieData" VALUE="">';
				strResult += '\n\t<PARAM NAME="SeamlessTabbing" VALUE="1">';
				strResult += '\n\t<PARAM NAME="Profile" VALUE="0">';
				strResult += '\n\t<PARAM NAME="ProfileAddress" VALUE="">';
				strResult += '\n\t<PARAM NAME="ProfilePort" VALUE="0">';
				strResult += '\n\t<PARAM NAME="AllowNetworking" VALUE="all">';
				strResult += '\n\t<PARAM NAME="AllowFullScreen" VALUE="false">';
				strResult += '\n\t<embed src="/cclib/players/avplayer.swf?url='+strMediaFile+'" height="'+numHeight+'" width="'+numWidth+'" play="true" loop="true" wmode="Opaque" quality="high" bgcolor="#ffffff" align="" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>';
				strResult += '\n</OBJECT><br/><br/>';
				break;
		}
		return strResult;
	}
	function ShowWebcastPlayer( Instance, strMediaFile, numWidth, numHeight, strAutoStart, strPreviewImg) {
		var refPlayerDiv = document.getElementById( 'Player'+Instance );
		var refPlayLink = document.getElementById( 'Show'+Instance );
		var refHideLink = document.getElementById( 'Hide'+Instance );

		if(refPlayerDiv == undefined) {
			return false;
		}
		refHideLink.style.display='inline';
		refPlayLink.style.display='none';
		refPlayerDiv.style.display='block';
		var Player=GetWebcastPlayer( Instance, strMediaFile, numWidth, numHeight, strAutoStart, strPreviewImg);
		refPlayerDiv.innerHTML=Player;
	}
	function HideWebcastPlayer( Instance, strMediaFile, numWidth, numHeight, strAutoStart, strPreviewImg) {
		var refPlayerDiv = document.getElementById( 'Player'+Instance );
		var refPlayLink = document.getElementById( 'Show'+Instance );
		var refHideLink = document.getElementById( 'Hide'+Instance);

		if(refPlayerDiv == undefined) {
			return false;
		}

		refHideLink.style.display='none';
		refPlayLink.style.display='inline';
		refPlayerDiv.style.display='none';

		var pos = strMediaFile.lastIndexOf('\.');
		pos = pos+1;
		var strExt = strMediaFile.substring(pos);
		strExt = strExt.toLowerCase();
		//if(strExt == 'mp3') {
		//	ap_stopAll();
		//}

		refPlayerDiv.innerHTML='';
	}

	function ShowWebcastPopupPlayer( Instance, strMediaFile, numWidth, numHeight) {
		var refPlayerDiv = document.getElementById( 'Player'+Instance );
		var refPlayLink = document.getElementById( 'Show'+Instance );
		var refHideLink = document.getElementById( 'Hide'+Instance );

		if(refPlayerDiv != undefined) {
			refHideLink.style.display='none';
			refPlayLink.style.display='inline';
			refPlayerDiv.style.display='none';

			if(document.getElementById('winplayer') != undefined) {
				if(document.getElementById('winplayer').controls) {
					document.getElementById('winplayer').controls.stop();
				}
			} else {
				refPlayerDiv.innerHTML='';
			}
		}

		var strResult = '<HTML>\n';
		strResult += '<HEAD>\n';
		strResult += '<TITLE>Webcast Popup Player</TITLE>\n';
		strResult += '</HEAD>\n';
		strResult += '<BODY style="margin:0px;padding:0px;text-align:center;">\n';
		strResult += '<div>'+GetWebcastPlayer(1, strMediaFile, numWidth, numHeight, 'true')+'</div>';
		strResult += '</BODY>\n';
		strResult += '</HTML>';

		if (typeof numWidth == 'undefined' || numWidth == '') {
			numWidth = 320;
			numHeight = 240;
		}
		if (typeof numHeight == 'undefined' || numHeight == '') {
			numWidth = 320;
			numHeight = 240;
		}

		var PopupWidth = numWidth;
		var PopupHeight = numHeight;
		newwindow=window.open('', 'WebcastPlayer', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width='+PopupWidth+',height='+PopupHeight);
		newdocument=newwindow.document;
		newdocument.write(strResult);
		newdocument.close();
	} 