function initMacWidth(el,min,max) {
  document.macDiv = el; document.macMin = min; document.macMax = max;
  // Only want this happening on Mac IE - conditional comment and this test should do it...
  if (document.getElementById && navigator.appVersion.indexOf("MSIE") > -1 && !window.opera) {
    onload = macSetWidth;
    onresize = macSetWidth;
  }
}

function macSetWidth() {
  var el,gs,cw,min,max,tmp,pl,pr,ml,mr,br,bl,adj;
  el = document.getElementById(document.macDiv);
  min = parseInt(document.macMin);
  max = parseInt(document.macMax);
  if (el && document.body && document.body.clientWidth) {
    cw = parseInt(document.body.clientWidth);

    // Don't do the style calcs unless the width needs to be set...
    if (cw <= min || cw >= max) {
      // Get the padding, border, and margins - if any - and sum them
      gs = el.currentStyle;
      pl = parseInt(gs.paddingLeft);
      pr = parseInt(gs.paddingRight);
      ml = parseInt(gs.marginLeft);
      mr = parseInt(gs.marginRight);
      bl = parseInt(gs.borderLeftWidth);
      br = parseInt(gs.borderRightWidth);
      ml = ml ? ml : 0;
      mr = mr ? mr : 0;
      pl = pl ? pl : 0;
      pr = pr ? pr : 0;
      bl = bl ? bl : 0;
      br = br ? br : 0;
      adj = pl + pr + ml + mr + bl + br;

      if (cw <= min) {
        tmp =  (min -= adj) + "px";
      } else {
        tmp = (max -= adj) + "px";
      }
    } else {
      tmp = "auto";
    }
    el.style.width = tmp;
  }
}

function isMacIE() {
  // This is dependent upon being called from inside a <!--[if !IE]>--> conditional comment (CC)
  // The CC will weed out Win IE - leaving the navigator test to pick up IE on the Mac
  return (document.getElementById && navigator.appVersion.indexOf("MSIE") > -1 && !window.opera);
}

