/*****************************************************************

  AbsoluteFudge module
  ====================

  Example usage. set the onload handler of the document to point to:
  
function onLoad() {
  if (AbsoluteFudge != undefined) {
    AbsoluteFudge.apply(document.getElementsByTagName('body')[0], true, true)
  }
  // other loading stuff...
}

  The apply() method walks the entire document. If you set the second and
  third parameters to true. The second parameter instructs apply() to walk the
  entire document looking for absolutely positioned elements. The third
  tells it to carry on through non absolutely positioned elements. If both
  are true, the entire document is traversed. If both are false it will just
  apply the fudge to that single element. If true,false then recursion
  is limited to absolutely positioned elements. searching stops once
  non-absolute elements are found.
  
  If you are generating html elements dynamically (eg Ajax programming) then
  you may have to explicitly call apply() for the new element(s).


******************************************************************/

var AbsoluteFudge;  // setup as undefined

// create a suitable instance if IE5/6
/*@cc_on
@if (@_jscript)
@if (@_jscript_version > 5.6)

@else

  AbsoluteFudge = new Object();

  AbsoluteFudge.isAbsolute = function (element) {
    return (element.currentStyle.position == 'absolute');
  }

  AbsoluteFudge.set = function(element) {
    if (element) {
      element.style.setExpression("height", "AbsoluteFudge.fudgeHeight(this)");
      element.style.setExpression("width", "AbsoluteFudge.fudgeWidth(this)");
    }
  }

  AbsoluteFudge.apply = function(element, recurse, full) {
    for (var i = 0; i < element.childNodes.length; i++) {
      var child = element.childNodes[i];
      if (child.nodeType == 1) {
        if (this.isAbsolute(child)) {
          this.set(child);
          if (recurse) {
            this.apply(child, recurse, full);
          }
        }
        else {
          if (full && recurse) {
            this.apply(child, recurse, full);
          }
        }
      }
    }
  }

  AbsoluteFudge.fudgeWidth = function(el) {
  if (el.currentStyle.right != 'auto') {
    try {
      var parent = el;
      var w = 0;
      do {
        parent = parent.parentNode;
        w = parent.clientWidth;
      }
      while (w == 0);
      if (document.documentElement.clientHeight != 0) {
        // in standards mode so width that gets set is inside padding/margin
        w = w - parseInt(el.currentStyle.paddingLeft)
              - parseInt(el.currentStyle.paddingRight);

        if (el.currentStyle.borderLeftStyle != 'none') {
          try {
            w = w - parseInt(el.currentStyle.borderLeftWidth);
          }
          catch(e) {
            w = w - 2; //estimated
          }
        }
        if (el.currentStyle.borderRightStyle != 'none') {
          try {
            w = w - parseInt(el.currentStyle.borderRightWidth);
          }
          catch(e) {
            w = w -2; //estimated
          }
        }
      }
      el.style.width = (w - parseInt(el.currentStyle.left) - parseInt(el.currentStyle.right)) + 'px';
    }
    catch(e) { }
  }
}

  AbsoluteFudge.fudgeHeight = function(el) {
  if (el.currentStyle.bottom != 'auto') {
    try {
      var parent = el;
      var h = 0;
      do {
        parent = parent.parentNode;
        h = parent.clientHeight;
      }
      while (h == 0);
      if (document.documentElement.clientHeight != 0) {
        //standards mode
        h = h - parseInt(el.currentStyle.paddingTop)
              - parseInt(el.currentStyle.paddingBottom);
        if (el.currentStyle.borderTopStyle != 'none') {
          try {
            h = h - parseInt(el.currentStyle.borderTopWidth);
          }
          catch(e) {
            h = h - 2;
          }
        }
        if (el.currentStyle.borderBottomStyle != 'none') {
          try {
            h = h - parseInt(el.currentStyle.borderBottomWidth);
          }
          catch(e) {
            h = h - 2;
          }
        }
      }
      var x = (h - parseInt(el.currentStyle.top) - parseInt(el.currentStyle.bottom)) + 'px';
      el.style.height = x;
    }
    catch(e) {}
  }
}


@end
@end
@*/



