// generic object tag replacer version 0.1
// author: Lucien Immink

function showObject (filetype, url, id, width, height, params) {
   if (filetype == 'wmv') {
      showWmv (url, id, width, height, params);
   }
   else if (filetype == 'flash') {
      showFlash (url, id, width, height, params);
   }
   else if (filetype == 'quicktime') {
      showQuicktime(url, id, width, height, params);
   } else {
      alert('unknown filetype: ' + filetype);
   }
}
function showWmv (url, id, width, height, params) {
   // show the windowsmedia tag
   document.writeln('<object id="'+id+'" width="'+width+'" height="'+height+'" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject">');
   document.writeln('<param name="fileName" value="'+url+'">');
   showParams(params);
   document.writeln('<embed type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" id="'+id+'" name="'+id+'" src="'+url+'" qtsrc="+url+" width="'+width+'" height="'+height+'" ' + showEmbedParams(params) + '></embed>');
   document.writeln('</object>');
   // debug option : show the innerhtml of the debugdiv
   var debug = document.getElementById('debug');
   // alert(debug.innerHTML);
}
function showFlash(url, id, width, height, params) {
   document.writeln('<object id="'+id+'" width="'+width+'" height="'+height+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">');
   document.writeln('<param name="movie" value="'+url+'">');
   showParams(params);
   document.writeln('<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="'+id+'" name="'+id+'" src="'+url+'" qtsrc="+url+" width="'+width+'" height="'+height+'" ' + showEmbedParams(params) + '></embed>');
   document.writeln('</object>');
}
function showQuicktime(url, id, width, height, params) {
   document.writeln('<object id="'+id+'" width="'+width+'" height="'+height+'" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab">');
   document.writeln('<param name="SRC" value="'+url+'">');
   showParams(params);
   document.writeln('<embed type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/" id="'+id+'" name="'+id+'" src="'+url+'" qtsrc="+url+" width="'+width+'" height="'+height+'" ' + showEmbedParams(params) + '></embed>');
   document.writeln('</object>');
}
function showParams(params) {
   for (var i = 0; i < params.length; i ++ ) {
      var param = params[i];
      var arr = param.split('=');
      document.writeln('<param name="'+arr[0]+'" value="'+arr[1]+'">');
   }
}
function showEmbedParams(params) {
   var ret = "";
   for (var i = 0; i < params.length; i ++ ) {
      var param = params[i];
      ret += param + " ";
   }
   return ret;
}
/*

zeearenden tags

 < param name = 'fileName' value = "http://www.staatsbosbeheer.nl/actueel/zeearend/media/zeearend.asx" >
 < param name = 'animationatStart' value = '1' >
 < param name = 'transparentatStart' value = '1' >
 < param name = 'ShowControls' value = '0' >
 < param name = 'ShowDisplay' value = '0' >

 < param name = 'ShowStatusBar' value = '0' >
 < param name = 'AutoSize' value = '1' >
 < embed type = "application/x-mplayer2" pluginspage = "http://microsoft.com/windows/mediaplayer/ en/download/"
id = "mediaPlayer" name = "mediaPlayer" src = "http://www.staatsbosbeheer.nl/actueel/zeearend/media/zeearend.asx" showcontrols = "1"
showdisplay = "0" showstatusbar = "0" width = "320" height = "240" > < / embed >

 */
