
/**
 * set a div visible, define a imagesource and show the div beside the musepointer.
 *
 * @param imgSrc        popup window url
 * @param evnet       popup window name
 * @param anything      popup window specifications
 */






function showImageDiv (imgSrc, mouseMover, showMe) {
/*
	var pos = mouseMover.offsetLeft + "/" + mouseMover.offsetTop;
	var bildli = document.getElementById("image_div_main");
	x = (document.all) ? window.event.x : mouseMover.offsetLeft;
	y = (document.all) ? window.event.y : window.pageY;
	if(showMe){
		bildli.style.visibility = 'visible';
		bildli.innerHTML='<p><b>'+imgSrc+' '+pos+' '+x+' '+y+'</b></p>';
	}
	else{
		bildli.style.visibility = 'hidden';
	}
	
	//alert(bildli+" "+pos);
 	//alert("Bild: "+imgSrc+ " x-Wert: " + Ereignis.screenX + " / y-Wert: " + Ereignis.screenY);
*/
}








/**
 * Open a popup window and move it to the center.
 *
 * @param winUrl        popup window url
 * @param winName       popup window name
 * @param features      popup window specifications
 */

function imagePopup(path, contentCounter, collectionName) {
 //var win=window.open("/templates/dreirosen/templates/popup.jsp?path="+path, "imagePopupWindow", "scrollbars=yes,resizable=yes,width=420,height=620");
 var win=window.open("/popup.jsp?path="+path+"&ccounter="+contentCounter+"&collectionName="+collectionName, "imagePopupWindow", "scrollbars=yes,resizable=yes,width=100,height=100");
  // 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);
}
