// Script by Thomas Stich
// http://www.stichpunkt.de/beitrag/popup.html
// use it if you like it
// 
// <a href="html-or.jpg" onclick="return popup(this,123,456)" title="..."
// or
// <a href="html-or.jpg" onclick="return popup(this)" title="..."


var pop = null;

function popdown() {
  if (pop && !pop.closed) pop.close();
}

function popup(obj,w,h) {
	var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href;
	if (!url) return true;
	w = (w) ? w += 0 : 150;  // 150px*150px is the default size, w += 20 bzw. h += 20 enstpricht Rand von 20px
	h = (h) ? h += 0 : 150;
  
	var winleft = (screen.width-w)/2;
	var wintop = (screen.height-h)/2;
	var args = 'width='+w+', height='+h+', top='+wintop+', left='+winleft+', resizable=0, scrollbars=no, toolbar=no';
	popdown();
	pop = window.open(url,'',args);
	return (pop) ? false : true;
}

// www.web-toolbox.net , W. Jansen
// Übergabeparameter: bildquelle, -breite und -höhe
// hand over parameters for source, width and height

function popupimage(obj,b,h,faviconurl)
{
	var url = (obj.getAttribute) ? obj.getAttribute('href') : obj.href;
	if (!url) return true;
	
	x = (screen.width-b)/2;
	y = (screen.height-h)/2;
	var args="left="+x+",top="+y+",screenX="+x+",screenY="+y+",width="+b+",height="+h+",menubar=no,toolbar=no,statusbar=0";

	pop=window.open("","",args);
	pop.focus();
	pop.document.open();
	
	with (pop) {
		document.write("<html>");
		document.write("	<head>");
		document.write("		<title>Familie Scheckenbach</title>");
		document.write('		<link' + ' rel="shortcut icon' + '" href='+'"'+faviconurl+'" />');
		// geändert 2004 für Mozilla
		document.write(			'<scr' + 'ipt type="text/javascr' + 'ipt" language="JavaScr' + 'ipt">');
		// bei click  schliessen , on click close
		document.write(				"function click() { window.close(); } ");
		document.write(				"document.onmousedown=click ");
		// geändert 2004 für Mozilla
		document.write('		</scr' + 'ipt>');
		document.write("	</head>");
		// bei Focusverlust schliessen, close if window looses focus
		// Zeile geändert Aug 2003 (Dreamweaver machte Probleme)
		document.write("	<" + "body onblur='window.close()';");
		document.write(			"marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'>");
		document.write(			"<img src='"+url+"' border='0'>");
		document.write("</body></html>");
		pop.document.close();
	}
	return (pop) ? false : true;
}

window.onunload = popdown;
window.onfocus = popdown;

