/*
  Written by Kevin Newman and elibol (recent rev drew heavy inspiration from Karina Steffens's ObjectSwap - thanks!)
  http://www.unfocus.com/projects/PatentMagic/

  Updated on 16-Aug-2006 by Sorin Mocanu ( http://www.webprodevelopment.com/ )
  ChangeLog:
    * 2006-08-16 Support multiple flash objects within the same HTML document
*/
(function() {
  var _objects = document.getElementsByTagName("object"),
    i,j,_object,_params;
  for (i = 0; i < _objects.length; i++) {
    _object = _objects[i].outerHTML.split(">")[0] + '>'; // from ObjectSwap
    // Kevin Newman: I noticed that this script was preventing onload from firing, so I adopted
    // ObjectSwap's method of generating the html string, rather than messing with
    // DOM methods.
    _params = _objects[i].getElementsByTagName('param');
    for (j = 0; j < _params.length; j++)
      if (_params[j].parentNode == _objects[i])
        _object += '<param name="'+_params[j].name+'" value="'+_params[j].value+'">';
   // here is the actual replacement
    _objects[i].outerHTML = _object + "</object>";
  }
  document.getElementById("ObjectPatentMagic").disabled = true;
})();
