var subwin = null;
function handleClick(e) {
	if(!e) e = event;
	var target = e.target;
	if(!target) target = e.srcElement;
	var href = target ? target.href : null;
	var result = true;
	if(href)
	{
		if(href.indexOf("#") == -1 && target.parentElement && typeof(target.parentElement.href) == "string")
		{
			href = target.parentElement.href;
		}
		var parts = href.split("#");
		if(parts.length > 1)
		{
			var wh = parts[1].split(",");
			var width = wh[0];
			var margin = document.layers ? "marginheight=0 marginwidth=0" : 'style="margin: 0"';
			if(wh.length > 1)
			{
				var height = wh[1];
				if(subwin != null && !subwin.closed) subwin.close();
				subwin = window.open('', 'subwin', 'menubar=0,status=0,toolbar=0,scrollbars=0,resizable=1,screenX=40,screenY=40,left=40,top=40,width=' + width + ',height=' + height);
				subwin.document.open();
				var title = (parts.length > 2) ? parts[2] : null;
				if(!title) title = target.title;
				if(!title) title = target.name;
				if(!title) title = "Picture";
				subwin.document.write('<html><head><title>' + title + '</title></head><body ' + margin + '><img src="' + parts[0] + '" width="' + width + '" height="' + height + '"></body></html>');
				subwin.document.close();
				subwin.focus();
				result = false;
			}
		}
	}
	return result;
}
if(document.captureEvents && Event && Event.CLICK) document.captureEvents(Event.CLICK);
document.onclick=handleClick;