function add_popups(p)
{
	var as = p.getElementsByTagName('A');
	for (var i = 0; i < as.length; i++) {
		as[i].onclick = function() {
			showbig(this);
			return false;
		}
	}
}

function showbig(el)
{
	var pageScroll = getPageScroll();
	var pageSize = getPageSize();
	var c = document.createElement('DIV');
	c.id = 'modal';
	var dimw = pageSize[2];
	var dimh = pageSize[3];
	c.style.height = pageSize[1] + 'px';
	var i = document.createElement('IMG');
	i.className = 'bigimg';
	i.onclick = function() { closebig(this); };
	var b = dimw > dimh ? dimh : dimw;
	var h = document.createElement('H3');
	h.id = 'bigdesc';
	h.innerHTML = el.getElementsByTagName('SPAN')[0].innerHTML;// + '\n<em>Klik op de afbeelding om deze popup te sluiten<\/em>';
	i.onload = function() {
		var pageScroll = getPageScroll();
		var pageSize = getPageSize();
	    var dimw = pageSize[2] + (document.body.scrollLeft ? document.body.scrollLeft : 0);
    	var dimh = pageSize[3] + (document.body.scrollTop ? document.body.scrollTop : 0) - h.offsetHeight - 24;

		var mv = (pageSize[3] - this.offsetHeight - h.offsetHeight - 8) / 2;// + pageScroll[1];
		var mh = (pageSize[2] - this.offsetWidth) / 2;// + pageScroll[0];
		this.style.top = mv + 'px';
		this.style.left = mh + 'px';
		this.style.visibility = 'visible';
		h.className = 'full';
	};
	document.body.appendChild(c);
	document.body.appendChild(h);
	i.src = '/image.php?i=' + escape(el.href).replace("/", "%2F") + '&b=' + (b - h.offsetHeight - 24);
	document.body.appendChild(i);
}

function closebig(el)
{
	var p = el.parentNode;
	p.removeChild(el);
	var m = document.getElementById('modal');
	document.body.removeChild(m);
	document.body.removeChild(document.getElementById('bigdesc'));
}


