
var videoPlayingInPlugin = false;

function showwmv( filename, width, height, host, replaceid ) {
   var obj = document.getElementById( replaceid );
   var ableToDetect = canDetectPlugins();
   var windowsMediaInstalled = detectWindowsMedia();

   if( obj && ableToDetect && windowsMediaInstalled ) {
      var str = "";
      str += '<OBJECT id="mediaPlayer" width="' + width + '" height="' + height + '"';
      str += 'classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"';
      str += 'codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"';
      str += 'standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">';
      str += '<param name="fileName" value="http://' + host + filename + '">';
      str += '<param name="animationatStart" value="true">';
      str += '<param name="transparentatStart" value="false">';
      str += '<param name="autoStart" value="true">';
      str += '<param name="showControls" value="true">';
      str += '<param name="loop" value="false">';
      str += '<EMBED type="application/x-mplayer2"';
      str += '  pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"';
      str += '  id="mediaPlayer" name="mediaPlayer" displaysize="4" autosize="-1"';
      str += '  bgcolor="darkblue" showcontrols="true" showtracker="-1"';
      str += '  showdisplay="0" showstatusbar="-1" videoborder3d="-1" width="' + width + '" height="' + height + '"';
      str += '  src="http://' + host + filename + '" autostart="true" designtimesp="5311" loop="false">';
      str += '     </EMBED>';
      str += '</OBJECT>';

      obj.innerHTML = str;
      videoPlayingInPlugin = true;
   } else {
      obj.innerHTML = "<p>The video should start playing in Windows Media Player.</p><p>If it does not, <b><a href=\"http://" + host + filename + "\">try launching it again</a></b></p><p>If you still cannot see the video, <b><a target=\"_blank\" href=\"http://www.microsoft.com/windows/windowsmedia/player/download/\">download Windows Media Player</a></b></p>";
      window.onload = function() { goURL('http://' + host + filename ); };
   }

}


function showmov( filename, width, height, host, replaceid ) {
   var obj = document.getElementById( replaceid );
   var ableToDetect = canDetectPlugins();
   var quickTimeInstalled = detectQuickTime();
   
   if( obj && ableToDetect && quickTimeInstalled ) {
      var str = "";

      str += '<OBJECT classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="' + width + '"';
      str += 'height="' + height + '" codebase="http://www.apple.com/qtactivex/qtplugin.cab">';
      str += '<param name="src" value="http://' + host + filename + '">';
      str += '<param name="autoplay" value="true">';
      str += '<param name="controller" value="true">';
      str += '<param name="loop" value="false">';
      str += '<EMBED src="http://' + host + filename + '" width="' + width + '" height="' + height + '" autoplay="true" ';
      str += 'controller="true" loop="false" pluginspage="http://www.apple.com/quicktime/download/">';
      str += '</EMBED>';
      str += '</OBJECT>';

      obj.innerHTML = str;
      videoPlayingInPlugin = true;
   } else {
      obj.innerHTML = "<p>The video should start playing in QuickTime.</p><p>If it does not, <b><a href=\"http://" + host + filename + "\">try launching it again</a></b></p><p>If you still cannot see the video, <b><a target=\"_blank\" href=\"http://www.apple.com/quicktime/download/\">download QuickTime</a></b></p>";
      window.onload = function() { goURL('http://' + host + filename ); };
   }
}


function showram( filename, width, height, host, replaceid ) {
   var obj = document.getElementById( replaceid );
   var ableToDetect = canDetectPlugins();
   var realPlayerInstalled = detectReal();

   if( obj && ableToDetect && realPlayerInstalled ) {
      var str = "";
      
      str += '<table border="0" cellpadding="0">';
      str += '   <tr><td>';
      str += '   <OBJECT id="rvocx" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="' + width + '" height="' + height + '">';
      str += '      <param name="src" value="http://' + host + filename + '">'
      str += '      <param name="autostart" value="true">';
      str += '      <param name="controls" value="imagewindow">';
      str += '      <param name="console" value="video">';
      str += '      <param name="loop" value="false">';
      str += '      <EMBED src="http://' + host + filename + '" width="' + width + '" height="' + height + '"';
      str += '         loop="false" type="audio/x-pn-realaudio-plugin" controls="imagewindow" console="video" autostart="true">';
      str += '      </EMBED>';
      str += '   </OBJECT>';
      str += '   </td></tr>';
      str += '   <tr><td>';
      str += '   <OBJECT id="rvocx" classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="' + width + '" height="30">';
      str += '      <param name="src" value="http://' + host + filename + '">';
      str += '      <param name="autostart" value="true">';
      str += '      <param name="controls" value="ControlPanel">';
      str += '      <param name="console" value="video">';
      str += '      <EMBED src="http://' + host + filename + '" width="' + width + '" height="30"';
      str += '         controls="ControlPanel" type="audio/x-pn-realaudio-plugin" console="video" autostart="true">';
      str += '      </EMBED>';
      str += '   </OBJECT>';
      str += '   </td></tr>';
      str += '</table>';

      obj.innerHTML = str;
      videoPlayingInPlugin = true;
   } else {
      obj.innerHTML = "<p>The video should start playing in Real Player.</p><p>If it does not, <b><a href=\"http://" + host + filename + "\">try launching it again</a></b></p><p>If you still cannot see the video, <b><a target=\"_blank\" href=\"http://www.real.com/products/player/index.html\">download Real Player</a></b></p>";
      window.onload = function() { goURL('http://' + host + filename ); };
   }
}

function showhelptext( id ) {
   var obj = document.getElementById( id );
   if( obj && videoPlayingInPlugin ) { obj.style.display = "block"; }
}
