/* foo */

var bigImg;

function addEvent(obj, evt, fn) {
    if (obj.addEventListener) { /* W3C */
	obj.addEventListener(evt, fn, false);
    } else if (obj.attachEvent) { /* MSIE */
	obj.attachEvent("on"+evt, fn);
    }
}

function loadBigImg(evt) {
    var t;
    if (!evt) var evt = window.event;
    if (evt.target)
	t = evt.target;
    else if (evt.srcElement)
	t = evt.srcElement;
    bigImg.src = t.src.replace("-klein.", "-big.");
}

function showBigImg() {
    bigImg.style.visibility = "visible";
    var width = 800, height = 600;
    if (typeof(window.innerWidth) == 'number') {
	width = window.innerWidth;
	height = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
	width = document.documentElement.clientWidth;
	height = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
	width = document.body.clientWidth;
	height = document.body.clientHeight;
    }
    bigImg.style.left = (width-bigImg.width)/2 + "px";
    bigImg.style.top = (height-bigImg.height)/2 + "px";
}

function hideBigImg(evt) {
    bigImg.style.visibility = "hidden";
}

function activate_pics (className) {
    bigImg = document.createElement("img");
    bigImg.id = "bigimg";
    bigImg.style.visibility = "hidden";
    bigImg.style.position = "fixed";
    bigImg.onload = showBigImg;
    addEvent(bigImg, "click", hideBigImg);
    if (document.body) {
	document.body.appendChild(bigImg);
    }
    var imgs = document.getElementsByTagName('img');
    for (k = 0; k < imgs.length; k++) {
	if (imgs[k].className == className) {
	    addEvent(imgs[k], "click", loadBigImg);
	}
    }
}