function playMovie(whichMovie) { //v2.0

// Internet Explorer ONLY
  var user_agent = navigator.userAgent.toLowerCase();
  if (user_agent.indexOf("msie") != -1) {
     
   var contents = document.getElementById("MediaPlayer1");
   var source = whichMovie.getAttribute("name"); 
   contents.FileName = source;
//controlSwitch removes control bar for youTube video
   var controlSwitch = whichMovie.getAttribute("controls"); 
   contents.ShowControls = controlSwitch;
//videoHeight changes height for youTube video
   var videoHeight = whichMovie.getAttribute("height"); 
   contents.height = videoHeight;


	} else {

//Remove ENTIRE Object tag
  var top_Div = document.getElementById("container");
  var old_object = document.getElementById("MediaPlayer1");
  var throw_away = top_Div.removeChild(old_object);
  
//This is for the OBJECT tag
var newObject = document.createElement('object');
top_Div.appendChild(newObject);
newObject.id = "MediaPlayer1";
newObject.classid= "CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"; 
newObject.codebase = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701";
newObject.standby = "Loading Microsoft® Windows® Media Player components..."
newObject.type = "application/x-oleobject";
newObject.uiMode = "none" ;
newObject.AutoStart = "True";
newObject.FileName = source;
newObject.width = "320";
////newObject.height = "290"; this seems to HELP youTube when it matches the EMBED tag below
   var videoHeight = whichMovie.getAttribute("height"); 
   newObject.height = (parseInt(videoHeight)-25);
newObject.ShowControls = "True";
newObject.ShowStatusBar = "True";

   }

//This is for the EMBED tag
  var Object_Id = document.getElementById("MediaPlayer1");
  var newEmbed = document.createElement('embed');
  var source = whichMovie.getAttribute("name"); //same as above
Object_Id.appendChild(newEmbed);
newEmbed.type = "application/x-mplayer2";
newEmbed.pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/";
newEmbed.name = "MediaPlayer1";
newEmbed.src= source; 
newEmbed.uiMode = "none" ;
newEmbed.autostart = "true";
newEmbed.width = "320";
////newEmbed.height = "290"; // value for Firefox and Netscape
   var videoHeight = whichMovie.getAttribute("height"); 
   newEmbed.height = (parseInt(videoHeight)-25);
newEmbed.showcontrols = "1";
newEmbed.showstatusbar = "1";
//   var controlSwitch = whichMovie.getAttribute("controls"); 
//   newEmbed.showcontrols = controlSwitch;
//   newEmbed.showstatusbar = controlSwitch;

}