/*
As seen on:
http://activecontent.blogspot.com/

ORIGINAL SOLUTION:
theObjects = document.getElementsByTagName("object");
for (var i = 0; i < theObjects.length; i++) {
  theObjects[i].outerHTML = theObjects[i].outerHTML;
}

Unfortunately there are a few problems with this solution. 
For a start some browsers (such as IE on a Mac) have trouble with the code, 
and outerHTML is an IE only property. This can easily be fixed with a 
check for the platform/browser.

Another issue is that if you use the data attribute in the <object> tag 
(such as in the Flash Satay method) then for some reason IE doesn't see 
any of the parameters, but again this can be overcome with a bit of JavaScript 
to remove the attribute, as IE doesn't use it anyway, it is only there for other browsers.

More troublesome though is the fact that IE tends to remember the original <object>, 
and this can cause issues such as increased memory/cpu usage, especially as IE doesn't 
always seem to remove the original <object> when leaving the page.

In the Macromedia Forums, fpproductions came up with a simple solution of including 
an window.onunload event, that kills the <object> by setting the outerHTML to an empty string.

Combining these additions together we have:
*/

window.onload = function(){
 var strBrowser = navigator.userAgent.toLowerCase();
 if(strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0){
  var theObjects = document.getElementsByTagName('object');
  var theObjectsLen = theObjects.length;
  for (var i = 0; i < theObjectsLen; i++) {
   if(theObjects[i].outerHTML){
    if(theObjects[i].data){
     theObjects[i].removeAttribute('data');
    }
    var theParams = theObjects[i].getElementsByTagName("param");
    var theParamsLength = theParams.length;
    for (var j = 0; j < theParamsLength; j++) {
      if(theParams[j].name.toLowerCase() == 'flashvars'){
        var theFlashVars = theParams[j].value;
      }
    }
    var theOuterHTML = theObjects[i].outerHTML;
    var re = /<param name="FlashVars" value="">/ig;
    theOuterHTML = theOuterHTML.replace(re,"<param name='FlashVars' value='" + theFlashVars + "'>");
    theObjects[i].outerHTML = theOuterHTML;
   }
  }
 }
}

window.onunload = function() {
 if (document.getElementsByTagName) {
  var objs = document.getElementsByTagName("object");
  for (i=0; i<objs.length; i++) {
   objs[i].outerHTML = "";
  }
 }
}
