function afterLoad() {
	var el = document.getElementById("loading")
	if (el) el.style.display="none";
	addLytebox();
	initLytebox();
}

if (window.addEventListener) {
	window.addEventListener("load",afterLoad,false);
} else if (window.attachEvent) {
	window.attachEvent("onload",afterLoad);
} else {
	window.onload = function() {afterLoad();}
}
function addLytebox() {
	var images = document.getElementById('contents').getElementsByTagName('img');
	var e;
	if (images.length>0) {
		for (i=0; i<images.length; i++) {
			p = images[i].parentNode;
			if (p.tagName =='A') continue;
			link = document.createElement("a");
			link.href = images[i].src.replace(/\.thumb([^"])+/i, '');
			link.rel = 'lytebox[1]';
			img = images[i].cloneNode(true);
			img.border = 0;
			link.appendChild(img);
			link.onclick = function() { return viewPix(images[i].src); return false; }
			p.replaceChild(link, images[i])
		}
	}
}

function toggleRegForm(date) {
	var el = document.getElementById('regForm');
	
	el.style.display = (el.style.display == 'none' ? 'block' : 'none');
	
	if (el.style.display == 'block') {
		document.getElementById('regFormDate').value = date;
	}
	return false;
}
