﻿// When the page loads:
window.onload = 
function(){
  var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
  if(isIE){
  if (document.getElementsByTagName) {
    // Get all the tags of type object in the page.
      var objs = document.getElementsByTagName("object");
      for (i=0; i<objs.length; i++) {
        // Get the HTML content of each object tag
        // and replace it with itself.
        //objs[i].outerHTML = objs[i].outerHTML;
        var obj=objs[i];
        var par=obj.parentNode;
        var obj2=obj.cloneNode(true);
        par.removeChild(obj);
        par.innerHTML=obj2.outerHTML;
      }
   }
   }
}
// When the page unloads:
window.onunload = function() {
  if (document.getElementsByTagName) {
    //Get all the tags of type object in the page.
    var objs = document.getElementsByTagName("object");
    for (i=0; i<objs.length; i++) {
      // Clear out the HTML content of each object tag
      // to prevent an IE memory leak issue.
      objs[i].outerHTML = "";
    }
  }
}
// To activate if the object is loaded after the Page Load event
function PostPageLoadActivate(){
  var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
  if(isIE){
  if (document.getElementsByTagName) {
    // Get all the tags of type object in the page.
      var objs = document.getElementsByTagName("object");
      for (i=0; i<objs.length; i++) {
        // Get the HTML content of each object tag
        // and replace it with itself.
        //objs[i].outerHTML = objs[i].outerHTML;
        var obj=objs[i];
        var par=obj.parentNode;
        var obj2=obj.cloneNode(true);
        par.removeChild(obj);
        par.innerHTML=obj2.outerHTML;
      }
   }
   }
}
