function showImg(ev) {
  
	if (!ev) var ev = window.event;
	if (typeof(ev.target) != 'undefined') {
		ev.stopPropagation();
		ev.preventDefault();
	} else {
		ev.target = ev.srcElement;
		ev.cancelBubble = true;
	}
	big.alt = ev.target.title;
	big.title = ev.target.title;
	if (!document.getElementById('big')) {
		document.body.appendChild(big);
	}
	big.src = ev.target.parentNode.href;
	return false;
}

function init() {

	if (document.getElementById('gallery') ) {

		big = document.createElement('img');
		big.id = 'img';
		big.style.position = 'absolute'; big.style.top = '10px'; big.style.left = '10px';
		big.style.border = '1px solid #770000'; big.style.cursor = 'pointer'; big.style.zIndex = '100';
		big.onload = function () {
			this.style.left = Math.floor((document.documentElement.offsetWidth - this.width - 1) / 2) + 'px';
			this.style.top = Math.max(0, Math.floor(document.documentElement.scrollTop + (document.documentElement.offsetHeight - this.height - 1) / 2)) + 'px';
		};
		big.onclick = function () { this.style.left = '-10000px';};
     
		thumbs = document.getElementById('right').getElementsByTagName('a');
		for (i in thumbs) {
	
			if (thumbs[i].href && thumbs[i].href.match(/\.(gif|bmp|jpe?g|png)$/))
		
				thumbs[i].onclick = showImg();
			
		}
	
	}
}
window.onload = init;
