
function resizeIframe(iframeName) {
  try {
    if (iframeName) {
      setIframeHeight(iframeName);
    }
  } catch (e) {}
}

function getDocHeight(doc) {
  var docHt = 0, sh, oh;
  if (doc.height) docHt = doc.height;
  else if (doc.body) {
    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
    if (sh && oh) docHt = Math.max(sh, oh);
  }
  return docHt;
}

function getDocWidth(doc) {
  var docW = 0, sw, ow;
  if (doc.height) docW = doc.height;
  else if (doc.body) {
    if (doc.body.scrollWidth) docW = sw = doc.body.scrollWidth;
    if (doc.body.offsetWidth) docW = ow = doc.body.offsetWidth;
    if (sw && ow) docW = Math.max(sw, ow);
  }
  return docW;
}

function setIframeHeight(iframeName) {
  if (!iframeName) return;
  var iframeWin = window.frames[iframeName];
  var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
  if ( iframeEl && iframeWin ) {
    var docW = getDocWidth(iframeWin.document);
    var docHt = getDocHeight(iframeWin.document);
    // need to add to height to be sure it will all show
    if (minWidth) {
      if (docW < minWidth) docW = minWidth;
    }
//    alert(docW +' x '+docHt);
    if (docHt) iframeEl.style.height = docHt + 25 + "px";
//    if (docW) iframeEl.style.width = docW + 10 + "px";
//     iframeEl.style.display = 'block';
//  } else  alert(iframeName+' not found');
    
  }
}

