var use_gebi = false;
var use_css = false;
var use_layers = false;

var userBrowser = navigator.userAgent.toLowerCase();
var isFireFox = ((userBrowser.indexOf("gecko") >= 0) ? true : false);

if (document.getElementById)
  use_gebi = true;
else if (document.all)
  use_css = true;
else if (document.layers)
  use_layers = true;

function showLastMenu(linkObject) {
  x = findPosX(linkObject);
  y = findPosY(linkObject);
  if (use_gebi) {
    document.getElementById("lastMenu").style.display = "block";
    document.getElementById("lastMenu").style.position = "absolute";
    if (isFireFox) {
      document.getElementById("lastMenu").style.left = x + "px";
      document.getElementById("lastMenu").style.top = y + 15 + "px";
    }
    else {
      document.getElementById("lastMenu").style.left = x + 36;
      document.getElementById("lastMenu").style.top = y + 15;
    }
  }
  if (use_css) {
    document.all["lastMenu"].style.display = "block";
    document.all["lastMenu"].style.position = "absolute";
    document.all["lastMenu"].style.left = x + 40;
    document.all["lastMenu"].style.top = y + 15;
  }
  if (use_layers) {
    document.layers["lastMenu"].display = "block";
    document.layers["lastMenu"].position = "absolute";
    document.layers["lastMenu"].left = x + 40;
    document.layers["lastMenu"].top = y + 15;
  }
}

function findPosX(obj) {
  var curleft = 0;
  if (obj.offsetParent) {
    while (obj.offsetParent) {
      curleft += obj.offsetLeft;
      obj = obj.offsetParent;
    }
  }
  else if (obj.x)
    curleft += obj.x;
  return curleft;
}

function findPosY(obj) {
  var curtop = 0;
  if (obj.offsetParent) {
    while (obj.offsetParent) {
      curtop += obj.offsetTop;
      obj = obj.offsetParent;
    }
  }
  else if (obj.y)
    curtop += obj.y;
  return curtop;
}

function print(aid) {
  window.open('print.php?aid=' + aid + '', '', '');
}

function send(aid) {
  var email = prompt('Email на който да се изпрати', '');
  if (email != '')
    location.href = 'article.php?a=' + aid + '&ste=' + email;
}