// JavaScript Document
//alert(navigator.appName);
function embedPlayer(MP3URL, heightwidth,auto_play)
{ 
	// Get Operating System 
	auto_play = typeof(auto_play) != 'undefined' ? auto_play : 'True';
	  
	var audioURL = MP3URL;
	var isWin = navigator.userAgent.toLowerCase().indexOf("windows") != -1
	
	if (isWin) { // Use MIME type application/x-mplayer2
		visitorOS="Windows";
	} else { // Use MIME type audio/mpeg, audio/x-wav, etc.
		visitorOS="Other";
	}
	
	var objTypeTag = "application/x-mplayer2"; // The  MIME type to load the WMP plugin in non-IE browsers on Windows

	if (visitorOS != "Windows")
	{
		if (navigator.appName=="Netscape")
		{
			objTypeTag = "audio/mpeg"
		}
	}


//	if (visitorOS != "Windows") { objTypeTag = "audio/mpeg"}; // The MIME type for Macs and Linux 
	document.writeln("<div id='mediaPlayerMozilla'>");
	document.writeln("<object align='middle' id='VideoPlayer' " + heightwidth + "classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' type='application/x-oleobject'>"); // Width is the WMP minimum. Height = 45(WMP controls) + 24 (WMP status bar) 
		//document.writeln("<PARAM NAME='fileName' VALUE='http://localhost:3000/playlist.wpl'>");
		document.writeln("<param name='loop' value='true'>");		
		document.writeln("<param name='URL' value='" + audioURL + "'>");
		document.writeln("<param name='type' value='" + objTypeTag + "'>");
		document.writeln("<param name='AutoStart' value='"+auto_play+"'>");
		document.writeln("<param name='showstatusbar' value='false'>");
		document.writeln("<param name='enablecontextmenu' value='false'>");
		document.writeln("<param name='WindowlessVideo' value='1'>");
		document.writeln("<embed align='middle' autostart='"+(auto_play == 'True'? '1': '0' )+"' " + heightwidth + "  loop='true'  src='" + audioURL + "' type='" + objTypeTag + "' autoplay='"+auto_play+"' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' id='VideoPlayer' name='VideoPlayer' showstatusbar='0' WindowlessVideo='1' enablecontextmenu='false'/>"); // Firefox and Opera Win require both autostart and autoplay			
	document.writeln("</object>");
	document.writeln("</div>");
	document.close(); // Finalizes the document
}
