function custom_alert(obj, message) {
  new_div = document.getElementById('custom_alert_block');
  gray_bg = document.getElementById('custom_alert_gray_bg');
  
  
  document.getElementById('custom_alert_block_text').innerHTML = message;
  //new_div.innerHTML = "<p>"+message+"</p><div class='custom_alert_button' onclick='custom_alert_close()'>OK</div>";
  //new_div.innerHTML = "<p>"+message+"</p><img src='/images/popup_close.gif' onclick='custom_alert_close()' style='padding-left: 100px; cursor: pointer;'><br />";
  new_div.style.left=entity_absolutePosition(obj).x+"px";
  new_div.style.top=entity_absolutePosition(obj).y+"px";

//new_div.style.left=screen.width/2+"px";
//new_div.style.top=screen.height/2+"px";



  gray_bg.style.height = document.body.clientHeight+"px";
  gray_bg.style.width = document.body.clientWidth+"px";
  gray_bg.style.display = 'block';
  new_div.style.display = 'block';
  }

function custom_alert_close() {
  document.getElementById('custom_alert_block').style.display = 'none';
  document.getElementById('custom_alert_gray_bg').style.display = 'none';
  }

function entity_absolutePosition(el)
{
  var sLeft = 0, sTop = 0;
  var isDiv = /^div$/i.test(el.tagName);
  
  if (isDiv && el.scrollLeft) {
    sLeft = el.scrollLeft;
  }
  if (isDiv && el.scrollTop) {
    sTop = el.scrollTop;
  }
  
  var r = { x: el.offsetLeft - sLeft, y: el.offsetTop - sTop };
  if (el.offsetParent) 
  {
         var tmp = entity_absolutePosition(el.offsetParent);
         r.x += tmp.x;
         r.y += tmp.y;
  }

  return r;
}


