function scrollIntoViewIfOutOfView(el) {
  var topOfPage = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
  var heightOfPage = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
  var elY = 0;
  var elH = 0;
  var scrollOffset = 300;
  if (document.layers) { // NS4
    elY = el.y;
    elH = el.height + scrollOffset;
  }
  else {
    for(var p=el; p&&p.tagName!='BODY'; p=p.offsetParent){
      elY += p.offsetTop;
    }
    elH = el.offsetHeight + scrollOffset;
  }
  if ((topOfPage + heightOfPage) < (elY + elH)) {
    el.scrollIntoView(false);
  }
  else if (elY < topOfPage) {
    el.scrollIntoView(true);
  }
}

function dhtmlxIgnoreErrors(type, desc, erData)
{
  return false;
}

