// USAGE
//
// function popup_show(id, position, x, y)
//
// id          - id of a popup window;
// position    - positioning type: "mouse", "screen-center"
// x, y        - offset

// ***** popup_exit ************************************************************

function popup_exit(e)
{
  var ie      = navigator.appName == "Microsoft Internet Explorer";
  var element = document.getElementById(e);
  element.style.display = 'none';
}

// ***** popup_show ************************************************************

function popup_show(id, drag_id, exit_id, position, x, y, position_id)
{
  var element      = document.getElementById(id);
  var width        = window.innerWidth  ? window.innerWidth  : document.documentElement.clientWidth;
  var height       = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight;

  element.style.position = "absolute";
  element.style.display  = "block";

  if (position == "mouse")
  {
    element.style.left = (window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft + x) + 'px';
    element.style.top  = (window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop + y) + 'px';
 }

  if (position == "screen-center")
  {
    element.style.left = (document.documentElement.scrollLeft + document.body.scrollLeft + (document.body.clientWidth - document.slide2.width)/2) + 'px';
    element.style.top  = (document.documentElement.scrollTop + document.body.scrollTop + (document.body.clientHeight - document.slide2.height)/2) + 'px';
  }
}
