// Pop up window for images


// make imgPop window
function imgPop
(
	source,		// imgPop image source
	width,		// width of image
	height		// height of image
)
{
	imgPopWindow = window.open ('photo/' + source,"", "resizable=yes, status=no, width=" + width + ", height=" + height + "\"");
	with (imgPopWindow.document)
	{
		writeln('<html><head><title>n e d m a r t i n - Journal - Images - Loading...</title>');
		writeln('<link rel="stylesheet" href="_imgPop.css" type="text/css" />');

//		writeln('<style type="text/css">#pic { visibility:hidden; } </style>');

		writeln('<sc'+'ript>');

		// image fade script from http://clagnut.com/sandbox/imagefades/
		writeln('function initImage()');
		writeln('{');
		writeln('	imageId = \'pic\';');
		writeln('	image = document.getElementById(imageId);');
		writeln('	setOpacity(image, 0);');
		writeln('	image.style.visibility = \'visible\';');
		writeln('	fadeIn(imageId,0);');
		writeln('}');

		writeln('function setOpacity(obj, opacity)');
		writeln('{');
		writeln('	opacity = (opacity == 100)?99.999:opacity;');
		writeln('	');
		writeln('	// IE/Win');
		writeln('	obj.style.filter = "alpha(opacity:"+opacity+")";');
		writeln('	');
		writeln('	// Safari<1.2, Konqueror');
		writeln('	obj.style.KHTMLOpacity = opacity/100;');
		writeln('	');
		writeln('	// Older Mozilla and Firefox');
		writeln('	obj.style.MozOpacity = opacity/100;');
		writeln('	');
		writeln('	// Safari 1.2, newer Firefox and Mozilla, CSS3');
		writeln('	obj.style.opacity = opacity/100;');
		writeln('}');

		writeln('function fadeIn(objId,opacity)');
		writeln('{');
		writeln('	if (document.getElementById)');
		writeln('	{');
		writeln('		obj = document.getElementById(objId);');

		// ned: changed to <= 90 from <= 100 :ned
		writeln('		if (opacity <= 90)');
		writeln('		{');
		writeln('			setOpacity(obj, opacity);');
		writeln('			opacity += 10;');
		writeln('			window.setTimeout("fadeIn(\'"+objId+"\',"+opacity+")", 100);');
		writeln('		}');

		// ned: fix annoying white speckles in IE
		writeln('		else');
		writeln('		{');
		writeln('			document.body.style.backgroundImage = \'url(photo/' + source + ')\'');
//		writeln('			obj.src = \'photo/' + source + '\'');
		writeln('			obj.style.visibility = \'hidden\';');
		writeln('		}');
		// :ned

		writeln('	}');
		writeln('}');
		writeln('</sc'+'ript>');
		writeln('</head>');

		writeln('<body onload="initImage(); self.focus(); document.title=\'n e d m a r t i n - Journal - Images\'">');
		writeln('<div><img style="visibility:hidden" id="pic" src="photo/' + source + '" alt="Images" /></div>');
		writeln('</body></html>');
		close();
	}
}

