window.onload = addEnlargeHandler;


function addEnlargeHandler()
{
	for(counter = 0; counter < document.images.length;counter++)
	{
		var theImage = document.images[counter];
		var lastPeriod = theImage.src.lastIndexOf(".");
		if (lastPeriod != -1)
		{
			
			if(theImage.src.substr(lastPeriod-6,6) == "_small")
			{
				theImage.style.cursor = "hand";
				theImage.title = "Klik for at forstørre";
				
				theImage.onclick = function (e)
						{
							var targ;
							if (window.event) var e = window.event;
							if (e.target) targ = e.target;
							else if (e.srcElement) targ = e.srcElement;
							 // defeat Safari bug
							if (targ.nodeType == 3)	targ = targ.parentNode;

							var bigImageSource = targ.src.replace("_small", "");
							var newWindow = window.open("/scripts/showimage.html?" + bigImageSource, "popup", "resizable=1,HEIGHT=200,WIDTH=200");
						}   
			}
		}
	}
	return true;
}

