var shadow;

function mp_onload() {

	var tmp = document.getElementsByTagName("img");

	for (var i = 0; i < tmp.length; i++) {

		if (tmp[i].className === "thumbnail") {

			tmp[i].style.cursor = 'pointer';
			tmp[i].onclick = function() { show_image(this.src); };

		}

	}

}

function show_image(url) {
	
	shadow = document.createElement("div");

	shadow.style.position = "absolute";
	shadow.style.top = 0;
	shadow.style.left = 0;
	shadow.style.width = (document.body.scrollWidth + window.scrollMaxX) + "px";
	shadow.style.height = (document.body.scrollHeight + window.scrollMaxY) + "px";
	shadow.style.backgroundColor = "#000000";
	shadow.style.display = "block";
	shadow.style.opacity = 0.6;
	shadow.innerHTML = "a";

	img = document.createElement("img");
	img.src = url;
	img.style.position = "fixed";
	img.style.left = (((document.body.clientWidth - img.width) / 2) + document.body.scrollLeft) + "px";
	img.style.top = (((document.body.clientHeight - img.height) / 2) + document.body.scrollTop) + "px";
	img.style.border = "outset 10px #555";

	shadow.onclick = img.onclick = function() {

		document.body.removeChild(img);
		document.body.removeChild(shadow);
	
	}
	
	document.body.appendChild(shadow);
	document.body.appendChild(img);
	
}
