
function imagePopup(path) {
  var win=window.open("/templates/jsp/bergrettung/popup.jsp?path="+path, "imagePopupWindow", "scrollbars=yes,resizable=yes,width=420,height=620");
  // Maybe the user has a popup blocker.
  if (! win)
    alert("Sie m??ssen Ihren Popup-Blocker deaktivieren, damit Sie das Bild sehen k??nnen!");
}


function imagePopup2(path) {
  var win=window.open("/templates/jsp/bergrettung/popup2.jsp?path="+path, "imagePopupWindow", "scrollbars=yes,resizable=yes,width=420,height=620");
  // Maybe the user has a popup blocker.
  if (! win)
    alert("Sie m??ssen Ihren Popup-Blocker deaktivieren, damit Sie das Bild sehen k??nnen!");
}

/**
 * Resize an image popup to fit the image.
 */

function resizeImagePopup() {
  var image = document.getElementById("popupImage");
  var imageWidth = image.width;
  var imageHeight = image.height;
  var resizeWidth = imageWidth;
  var resizeHeight = imageHeight;
  // Check if image is wider than screen.
  if (imageWidth >= (screen.width - 150))
    resizeWidth = screen.width - 150;
  // Check if image is higher than screen.
  if (imageHeight >= (screen.height - 150))
    resizeHeight = screen.height - 150;
  // ie needs more space because he always shows the vertical scrollbar
  if (document.all)
    window.resizeTo(resizeWidth + 50, resizeHeight + 120);
  else
    window.resizeTo(resizeWidth + 20, resizeHeight + 100);

  centerImagePopup();
}

/**
 * Center an image popup to the visible screen.
 */

function centerImagePopup() {
  var pixelX=document.all? window.document.body.clientWidth : window.innerWidth;
  var pixelY=document.all? window.document.body.clientHeight : window.innerHeight;
  var left = parseInt(screen.width/2-pixelX/2);
  var top = parseInt(screen.height/2-pixelY/1.3);
  // Check for negative values.
  if (left < 0)
    left = 0;
  if (top < 0)
    top = 0;
  window.moveTo(left, top);
}



/**
 * Add mouse over eventhandlers to the menubar.
 * Only for internet explorer.
 */

function startList() {
  if (document.all&&document.getElementById) {
    var navRoot = document.getElementById("navRoot");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
	node.onmouseover=function() {
	  this.className+=" over";
	}
	node.onmouseout=function() {
	  this.className=this.className.replace(" over", "");
	}
      }
    }
  }
}

/**
 * onload() event handler.
 */

init = function () {
  if (document.all)
    startList();
}
window.onload = init;

/**
 * onunload() event handler. 
 */

