﻿/*
  see http://forums.esri.com/Thread.asp?c=158&f=2396&t=276110&mc=2

  NIMBUS ID: NIM042985: Map navigation operations cause excessive memory consumption in the JavaScript API
  versions 1.2 and 1.3 when using Internet Explorer 7. 

 override the dojo 1.2, 1.3 version of dojo._setOpacity to revert back to the dojo 1.1 implementation
 this version doesnt allow multiple filters on an element, but it is free from the memory spike issue */


(function() {
  var d = dojo;
  if (dojo.isIE) {
    dojo._setOpacity = function(/*DomNode*/node, /*Number*/opacity) {
      if (opacity == 1) {
        var filterRE = /FILTER:[^;]*;?/i;
        node.style.cssText = node.style.cssText.replace(filterRE, "");
        if (node.nodeName.toLowerCase() == "tr") {
          d.query("> td", node).forEach(function(i) {
            i.style.cssText = i.style.cssText.replace(filterRE, "");
          });
        }
      } else {
        var o = "Alpha(Opacity=" + opacity * 100 + ")";
        node.style.filter = o;
      }
      if (node.nodeName.toLowerCase() == "tr") {
        d.query("> td", node).forEach(function(i) {
          i.style.filter = o;
        });
      }
      return opacity;
    };
  }
})();

