
newModule = registerModule('Unscaled-Image-Window', 'onclick', 'loadImageWindow(this,\'%0\');', 'RIED_02', 'lnk');


addParam(newModule, 'Fenstertitel','','Geben Sie den Titel des Popup-Fensters an');


var imgWindow;

function loadImageWindow(objLink, winTitle) {
  
  var src = objLink.children[0].src;
  var origImg = src.substring(0,src.indexOf("/scaler/x"));
  var part2 = src.substring(src.indexOf("/scaler/x") + 8);
  part2 = part2.substring(part2.indexOf("/") + 1);
  part2 = part2.substring(part2.indexOf("/") + 1);
  origImg = origImg + "/" + part2;
  
  
  
  if (window.top.document.location.pathname.indexOf("ie_edit") < 0  || confirm("---EDITMODE---\n'Unscaled-Image-Window' ausführen?")) {
    
    try
  	{
  			imgWindow.close();
  	} catch (e) {
  	}
  
  
  	imgWindow = window.open("", "images", "channelmode=0,width=10,height=10");

    try 
    {
      if (imgWindow.document.body.innerHTML.length > 0) {
        imgWindow.close();
        imgWindow = window.open("", "images", "channelmode=0,width=10,height=10");
      }
    } catch (e) {
    }

  	var mx = window.screenLeft + (document.body.clientWidth / 2)
  	var my = window.screenTop + (document.body.clientHeight / 2)


  	imgWindow.document.write("<html><head><title>" + winTitle + "</title><style>body{margin:0px;padding:0px;background-color:none}</style></head><body marginheight=0 marginwidth=0>");
  	//imgWindow.document.write("<table width='100%' height='100%' border=0 cellpadding=0 cellspacing=0><tr><td align='center'><img src='" + origImg + "' onload='window.resizeBy(body.scrollWidth - body.clientWidth, body.scrollHeight - body.clientHeight); window.focus()'></td></tr></table>");
  	imgWindow.document.write("<table width='100%' height='100%' border=0 cellspacing=0 cellpadding=0><tr><td align='center'><img src='" + origImg + "' onload='window.resizeBy(this.width-document.body.clientWidth,this.height-document.body.clientHeight); window.moveTo(" + mx + " - (document.body.clientWidth / 2) , " + my + "- (document.body.clientHeight) / 2 )'></td></tr></table>");
  	imgWindow.document.write("</body></html>");
  	imgWindow.document.close();
  	//imgWindow.focus();
  
    window.event.cancelBubble=true;
    window.event.returnValue=false;
    return false;
  } else {
    
  }
}


