<!--
//really not important (the first two should be small for Opera's sake)
PositionX = 10;
PositionY = 10;
defaultWidth  = 600;
defaultHeight = 400;

//kinda important
var AutoClose = true;

//don't touch
function onePic(imageURL){
	imageTitle="It's SElfMade! (tm)";
	var imgWin = window.open('','_blank','scrollbars=no,resizable=1,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY);
	if( !imgWin ) { return true; } //popup blockers should not cause errors
	imgWin.document.write('<html><head><title>'+imageTitle+'<\/title><script type="text\/javascript">\n'+
		'function resizeWinTo() {\n'+
		'if( !document.images.length ) { document.images[0] = document.layers[0].images[0]; }'+
		'var oH = document.images[0].height, oW = document.images[0].width;\n'+
		'if( !oH || window.doneAlready ) { return; }\n'+ //in case images are disabled
		'window.doneAlready = true;\n'+ //for Safari and Opera
		'var x = window; x.resizeTo( oW + 200, oH + 200 );\n'+
		'var myW = 0, myH = 0, d = x.document.documentElement, b = x.document.body;\n'+
		'if( x.innerWidth ) { myW = x.innerWidth; myH = x.innerHeight; }\n'+
		'else if( d && d.clientWidth ) { myW = d.clientWidth; myH = d.clientHeight; }\n'+
		'else if( b && b.clientWidth ) { myW = b.clientWidth; myH = b.clientHeight; }\n'+
		'if( window.opera && !document.childNodes ) { myW += 16; }\n'+
		'x.resizeTo( oW = oW + ( ( oW + 200 ) - myW ), oH = oH + ( (oH + 200 ) - myH ) );\n'+
		'var scW = screen.availWidth ? screen.availWidth : screen.width;\n'+
		'var scH = screen.availHeight ? screen.availHeight : screen.height;\n'+
		'if( !window.opera ) { x.moveTo(Math.round((scW-oW)/2),Math.round((scH-oH)/2)); }\n'+
		'}\n'+
		'<\/script>'+
		'<\/head><body onload="resizeWinTo();"'+(AutoClose?' onblur="self.close();"':'')+'>'+
		(document.layers?('<layer left="0" top="0">'):('<div style="position:absolute;left:0px;top:0px;display:table;">'))+
		'<img src='+imageURL+' alt="Loading image ..." title="" onload="resizeWinTo();">'+
		(document.layers?'<\/layer>':'<\/div>')+'<\/body><\/html>');
	imgWin.document.close();
	if( imgWin.focus ) { imgWin.focus(); }
	return false;
}

function XonePic(thePic)
{
	myWindow = window.open('', 'bigpicture', 'toolbar=no,location=no,width=1,height=1,resizable');
	myWindow.document.open("text/html");
	myWindow.document.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
	myWindow.document.writeln("<html><head><title>It's SElfMade! (tm)</title>");
	myWindow.document.writeln("<script language:'javascript' type=\"text/javascript\">");
	myWindow.document.writeln(" <!--\n \
	function myPic()\n \
	{\n \
		if ((window.document.images[0].width+30>screen.availWidth)||(window.document.images[0].height+150)>screen.availHeight))\n \
		{\n \
			if (window.document.images[0].width>window.document.images[0].height)\n \
			{\n \
				myR=window.document.images[0].height/window.document.images[0].width;\n \
				myW=screen.availWidth-50;\n \
				myH=myW*myR+150;\n \
				window.resizeTo(myW,myH);\n \
				myW=myW-30;\n \
				myH=myW*myR;\n \
				window.document.images[0].height=myH;\n \
				window.document.images[0].width=myW;\n \
			}\n \
			else if (window.document.images[0].height+150>screen.availHeight)\n \
			{\n \
				myR=window.document.images[0].height/window.document.images[0].width;\n \
				myH=screen.availHeight-50;\n \
				myW=myH/myR+30;\n \
				window.resizeTo(myW,myH);\n \
				myH=myH-150;\n \
				myW=myH/myR;\n \
				window.document.images[0].height=myH;\n \
				window.document.images[0].width=myW;\n \
			}\n \
		}\n \
		else\n \
		{\n \
			window.resizeTo(window.document.images[0].width+30,window.document.images[0].height+150);\n \
		}\n \
	}\n \
	//-->");
	myWindow.document.writeln("</script>");
	myWindow.document.writeln("</head>");
	myWindow.document.writeln("<body onLoad='myPic()'>");
//	myWindow.document.writeln("<body>");
	myWindow.document.writeln("<center><font name='arial' size='2'><b><a href='javascript:void(0)' onClick='window.close()'>Close window</a></b></font><p>");
//	myWindow.document.writeln("<center><font name='arial' size='2'><b><a href='javascript:void(0)' onClick='self.myPic()'>Close window</a></b></font><p>");
	myWindow.document.writeln("<img border='0' src='" + thePic + "' align='bottom'>");
	myWindow.document.writeln("</center></body></html>");
   	myWindow.document.close();
   	myWindow.focus();
}
// -->

