/*
This work is licensed under the Creative Commons Attribution License.
To view a copy of this license, visit http://creativecommons.org/licenses/by/2.0/
2004 Björn Graf, bjoern.graf@gmx.net, http://b-cage.net/
*/

function picPop(url, text) {
	// Required for some IE versions only
	if(window.event) window.event.cancelBubble = true;
	var win = window.open('', 'picPopup', 'width=200,height=200,location=0,menubar=0,statusbar=0');
	win.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\n' +
		'	"http://www.w3.org/TR/html4/strict.dtd">\n' +
		'<html><head><title>' + text + '</title><style type="text/css">\n' +
		'html,body{margin:0;padding:0;overflow:hidden;width:100%;height:100%;}\n' +
		'img{margin:0;padding:0;}\n' +
		'p{margin:0;padding:0.5em;text-align:center;}\n' +
		'</style><script type="text/javascript">\n' +
		'function imgLoaded() {\n' +
		'	var b = document.body;\n' +
		'	var d = document.getElementById("d");\n' + 
		'	if(!d.offsetWidth) { b.style.overflow = "visible"; b.style.overflow = "hidden"; }\n' +
		'	window.resizeBy(d.offsetWidth - b.offsetWidth, d.offsetHeight - b.offsetHeight);\n' +
		'	window.moveTo((screen.availWidth - b.offsetWidth) / 2, (screen.availHeight - b.offsetHeight) / 2);\n' + 
		'	window.focus();\n' +
		'}</scr' + 'ipt></head><body onload="imgLoaded();"><div id="d"><img src="' + url + '">\n');
	//if(text) win.document.write('<p>' + text + '</p>');
	win.document.write('</div></body></html>');
	win.document.close();
	return !win;
}
