// Documentation & Updates available at:
// http://codecentre.eplica.is/js/ie_clicktoactivateflash_fix/test.htm

/*@cc_on  /*@if (@_jscript_version >= 5.6)
(function(){
  // run only once!
  if (window.__IE_ClickToActivateControl_Fixed) { return; }
  __IE_ClickToActivateControl_Fixed = 1;

  // Walk through all `<object>`s in the HTML...
  var _objectElms = document.getElementsByTagName("object");
  for (var i = 0, _objectElm; (_objectElm = _objectElms[i]); i++)
  {
    // First collect a snapshot of the html for the <object> `childNodes`
    // ...because IE is weird about outerHTML/innerHTML for `<object>`s.
    var _paramHTML = "";
    for (var j = 0, _childNode; (_childNode = _objectElm.childNodes[j]); j++)
    {
      _paramHTML += _childNode.outerHTML;
    }
    // Then clone and replace the `_objectElm` in the DOM and insert `_paramHTML`.
    _objectElm.outerHTML = _objectElm.outerHTML.replace(/(<\/object>$)/i, _paramHTML+"$1");
  }
})();
/*@end   @*/
