// JavaScript Document
// Batmosphere Embedded Media Player, version 2006-05-31 
// Written by David Battino, www.batmosphere.com
// adapted to automatically use different heights by Pat Edison
// OK to use if this notice is included
// This function reads an MP3 URL and title from the referring page and generates embedding code to play back the audio file.
// Windows browsers (except for Internet Explorer) will play back the file with the Windows Media Player *plugin.* Internet Explorer will use Windows Media Player.
// Non-Windows browsers will play back the file with their standard audio handler for the MIME type audio/mpeg. On Macs, that handler will usually be QuickTime.




function embedPlayer() { 

   // Get Operating System 
   var isWin = navigator.userAgent.toLowerCase().indexOf("windows") != -1;
   if (isWin) { // Use MIME type application/x-mplayer2 for WMP
	  var MP3URL = "http://www.lazygit.org/listen.asx" // needs a different type of 'listen' file
	  var objTypeTag = "application/x-mplayer2"; // The MIME type to load the WMP plugin in non-IE browsers on Windows
	  var itsheight = "45"; // and a different height
   } else { // Use MIME type audio/mpeg, audio/x-wav, etc. for Mac and maybe Linex
   	  var MP3URL = "http://www.lazygit.org/listen.pls";
	  var objTypeTag = "audio/mpeg"
	  itsheight = "24";
	  document.getElementById('mediaplayer_slideDiv').style.height = "42px"; // reduce height for Quicktime player
   }

   document.writeln("<div id='embedded_player_div'>");
   document.writeln("<object width='160' height='"+ itsheight + "' CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'>");
   document.writeln("<param name='type' value='" + objTypeTag + "'>");
   document.writeln("<param name='src' value='" + MP3URL + "'>");
   document.writeln("<param name='URL' value='" + MP3URL + "'>");
   document.writeln("<param id='media_player_autostart' name='autostart' value='0'>");
   document.writeln("<param name='showpositioncontrols' value='0'>");
   document.writeln("<param name='showstatusbar' value='0'>");
   document.writeln("<embed id = 'media_player_embed' src ='" + MP3URL + "' type='" + objTypeTag + "' autoplay='false' autostart='0' width='160' height='"+ itsheight + "' controller='0' showstatusbar='0' bgcolor='#ffffff'></embed>"); // seems Firefox still needs embed!
   
   // Firefox and Opera Win require both autostart and autoplay
   document.writeln("</object>");
   document.writeln("</div>");
   document.close(); // Finalises the document
   
  
}