/* Copyright (c) Sonet Network Solutions, Inc. - www.sonetinc.com */

window.onload = function(x, i)
{
	initLightbox();
	for(i in x = document.links)
	{
		if(x[i].rel && x[i].rel == "nofollow")
		{
			x[i].target = "_blank";
		}
	}
	for(i in x = document.images)
	{
		if(x[i].className && x[i].className == "zoom")
		{
			x[i].onclick = function(){showLightbox(this.src.replace(/\-m\.jpg$/, "-b.jpg"));}
		}
	}
}

function showPopup(url, windowTitle, width, height, t)
{
	if(!url) return;
	function readSize()
	{
		if(t.complete)
		{
			showPopup(t.width, t.height);
		}
		else
		{
			setTimeout(readSize, 1e2);
		}
	}
	function showPopup(w, h)
	{
		with(window.open('', '', 'width='+(width||w)+',height='+(height||h)).document)
		{
			open();
			write('<html><head><title>'+(windowTitle||'')+'</title></head><body style="padding: 0; margin: 0;"><img src="'+url+'" alt="" style="display: block; cursor: pointer;" title="Close" onclick="self.close();"></body></html>');
			close();
		}
	}
	if(!width || !height)
	{
		t = new Image();
		t.src = url;
		readSize();
	}
	else
	{
		showPopup(width, height);
	}
}