function imagePopup(path, image) {
  var win=window.open(ctx + "/popup.html?path="+path+"&image="+image , "imagePopupWindow", "scrollbars=yes,resizable=yes,width=400,height=600");
  // 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);
}







/**
 * Attach events to onload.
 */
 
function callOnLoad(init) {
	if (window.addEventListener) {
		window.addEventListener("load", init, false);
	}
	else if (window.attachEvent) {
		window.attachEvent("onload", init);
	}
	else {
		window.onload = init;
	}
}


function openNewWindow(pfad){
F1 = window.open(pfad ,"Detailansicht","width=620,height=820,left=0,top=0");
F1.focus();
 }

var product = "";

function changeProduct(name){
	product = name;
}

function getProduct(){
	return product;
}
