var x,y,xs,ys;

function DOMEventGetClientX(e) {
  if (document.all)                  return window.event.screenX;
  else if (document.getElementById)  return e.screenX;
  else if (document.layers)          return e.screenX;
}

function DOMEventGetDocumentX(e) {
  if (document.all)                  return window.event.x;
  else if (document.getElementById)  return e.pageX;
  else if (document.layers)          return e.pageX;
}

function DOMEventGetDocumentY(e) {
  if (document.all)                  return window.event.y;
  else if (document.getElementById)  return e.pageY -window.pageYOffset;
  else if (document.layers)          return e.pageY;
}

function DOMEventGetClientY(e) {
  if (document.all)                  return window.event.screenY;
  else if (document.getElementById)  return e.screenY;
  else if (document.layers)          return e.screenY;
}

if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = trackMouse;

function trackMouse(e) {
  x = DOMEventGetClientX(e);
  y = DOMEventGetClientY(e);
  xs = DOMEventGetDocumentX(e);
  ys = DOMEventGetDocumentY(e);
}

function editwin(URL,breite, hoehe){
  editWin = open(URL,"TextInput","width=" + breite +",height=" + hoehe +",left="+(x-430)+",top="+y+",toolbar=no,scrollbars,status=yes,location=no");
  editWin.focus();
}

function conteditwin(URL,breite, hoehe){
    var jetzt = new Date();
    var tmptime=jetzt.getTime();
    conteditWin = open(URL,"Container"+tmptime,"width=" + breite +",height=" + hoehe +",toolbar=no,scrollbars,status=no,location=no,resizable=yes");
    conteditWin.focus();
}

function linkwin(URL,breite, hoehe){
  conteditWin = open(URL,"Verweise","width=" + breite +",height=" + hoehe +",left="+(x-xs)+",top="+(y-ys-500)+",toolbar=no,scrollbars,status=no,location=no");
  conteditWin.focus();
}

function editwinstat(URL,breite, hoehe){
  editWin = open(URL,"TextInput","width=" + breite +",height=" + hoehe +",left="+(x-xs)+",top="+(y-ys)+",toolbar=no,scrollbars,status=no,location=no");
  editWin.focus();
}

function openImgWindow() {
  window.open("htmlarea/popups/insert_image.php","ImgFenster","status=no,toolbar=no");
}
function extwinopen(URL,breite, hoehe){
    extWin = open(URL,"TextInput","width=" + breite +",height=" + hoehe +",toolbar=no,scrollbars,status=no,location=no");
    extWin.focus();
}
