// www.jjam.de - Kontextmenü mit JavaScript - Version 15.12.2002
// Nur für IE 5+ und NN 6+
ie5=(document.getElementById && document.all && document.styleSheets)?1:0;
nn6=(document.getElementById && !document.all)?1:0;

// Kontextmenü initialisieren
if (ie5 || nn6) {
  menuWidth=115, menuHeight=150;
  menuStatus=0; 

  sp2="&nbsp;&nbsp;";
  sp5=sp2+sp2+"&nbsp;"; // Leerzeichen als Abstandshalter (flexibler und code-sparender als eine aufwendige Tabellenkonstruktion)

  oF="onfocus='if(this.blur)this.blur()'"; // Um hässlichen Linkrahmen in einigen Browsern zu vermeiden


  document.write(
    "<style type='text/css'>"+
    "a.menu { text-decoration:none; font-family:Verdana,Arial; font-size:10pt }"+
    "a.menu:link,a.menu:visited {text-decoration:none;color:#5A5BB5}"+
    "a.menu:hover,a.menu:active {text-decoration:none;background-color:#E8E8FF;color:#000040}"+
    "hr.menu {border:0px;height:1px;background-color:#E8E8FF;color:#B0C4DE}</style>"+
    "<div id='menu' style='position:absolute;top:-250;left:0;z-index:100'>"+
    "<table cellpadding='3' cellspacing='0' width='"+menuWidth+"' height='"+menuHeight+"' style='border-style:solid;border-width:2;border-color:#E8E8FF;background-color:#F7F7FF'>"+
    "<tr><td><a class='menu' href='javascript:history.back()'"+oF+">&nbsp;Zur&uuml;ck"+sp5+sp5+sp2+"</a></td></tr>"+
    "<tr><td><a class='menu' href='javascript:history.forward()'"+oF+">&nbsp;Vorw&auml;rts"+sp5+sp2+sp2+"</a></td></tr>"+
    "<tr><td><hr class='menu'><a class='menu' href='javascript:location.reload()'"+oF+">&nbsp;Aktualisieren"+sp2+sp2+"</a></td></tr>"+
    "<tr><td><a class='menu' href='javascript:print()'"+oF+">&nbsp;Drucken"+sp5+sp5+"</a></td></tr>"+
    "<tr><td><hr class='menu'><a class='menu' href='javascript:openFrameInNewWindow()' "+oF+">&nbsp;Neues&nbsp;Fenster"+sp2+"</a></td></tr>"+
    "</table></div>");

  // Rechter Mausklick: Menü anzeigen, linker Mausklick: Menü verstecken
  document.oncontextmenu=showMenu; //oncontextmenu geht nicht bei NN 6.01
  document.onmouseup=hideMenu;
  }

// Kontextmenü anzeigen
function showMenu(e) {
  if(ie5) {
    if(event.clientX>menuWidth) xPos=event.clientX-menuWidth+document.body.scrollLeft;
    else xPos=event.clientX+document.body.scrollLeft;
    if (event.clientY>menuHeight) yPos=event.clientY-menuHeight+document.body.scrollTop;
    else yPos=event.clientY+document.body.scrollTop;
    }
    else {
      if(e.pageX>menuWidth+window.pageXOffset) xPos=e.pageX-menuWidth;
      else xPos=e.pageX;
      if(e.pageY>menuHeight+window.pageYOffset) yPos=e.pageY-menuHeight;
      else yPos=e.pageY;
      }
    document.getElementById("menu").style.left=xPos;
    document.getElementById("menu").style.top=yPos;
    menuStatus=1;
    return false;
  }

// Kontextmenü verstecken
function hideMenu(e) {
  if (menuStatus==1 && ((ie5 && event.button==1) || (nn6 && e.which==1))) {
    setTimeout("document.getElementById('menu').style.top=-250",250);
    menuStatus=0;
    }
  }

// Quelltext anzeigen
function viewSource() {
  var w=window.open("view-source:"+window.location,'','resizable=1,scrollbars=1');
  }

// Seite in neuem Fenster öffnen
function openFrameInNewWindow() {
  var w=window.open(window.location,'','resizable=1,scrollbars=1,status=1,location=1,menubar=1,toolbar=1');
  }
  
