/**
 *	File:	 frontend javasript of the module "smooth gallery"
 *	Version: 1.0.1
 *	Date:	 2010-04-05
 *	Author:	 Dietrich Roland Pehlke (Aldus)
 *
 *	1.0.1	Add some code to center the pop up window on the screen.
 *	
 *	1.0.0	Outsource the script from the modul-php-code to get the frontend valid.
 *
 */
var funcList = new Array();
var previewWin = null;
		
function opnWin (link, w,h) {
	if (previewWin) previewWin.close();
	
	h = h - 20; 
	var x= 0;
	var y= 0;
	
	if (w < screen.availWidth || h < screen.availHeight) {
		
		/**
		 *	the following corrections could be differ from
		 *	the target browser - this one is used for an IE ...
		 *
		 */
		x = (screen.availWidth - w - 12) / 2; // 6 pixels left, 6 pixesl on the right one ...
		y = (screen.availHeight - h - 104) / 2; // the browser-window top

		/**
		 *	Make sure, that the window is in the left, top corner, so the 
		 *	users can find the "close" icons ...
		 *
		 */
		if (x < 0 || y < 0) {
			x=0;
			y=0;
		}
	}

	previewWin= open("#", "image_preview","toolbar=no,menubar=no,location=no,scrollbars=auto,resizable=yes,status=yes,width="+w+",height="+h+",left="+x+",top="+y+"");
	previewWin.document.write("<body style='margin: 0px;'><a href='javascript:this.close();' title='click to close'><img border='0' alt='detail' src='"+link+"' /></a></body>");
}
		
function rollGalleries() {
	var cnt;
	for (cnt=0; cnt<funcList.length; cnt++) {
		if (funcList[cnt] != undefined) eval(funcList[cnt]);
	}
}
