// ROLLOVERS
function setupPhotohider() 
{
	if (!document.getElementsByTagName)
		return;
		
	var lis = new Array;
	lis[0] = document.getElementById('wedding');
	lis[1] = document.getElementById('people');
	lis[2] = document.getElementById('other');
	
	document.divArray = new Array;
	for(var i = 0; i < lis.length; i++) {
		var the_li = lis[i];
		// setup events
		the_li.onmouseover = mouseover;
		the_li.onmouseout = mouseout;
		pic_id = the_li.id+'-pic';
		document.getElementById(pic_id).style.visibility = 'visible';
	}
}

function mouseover(e)
{
	var target = findTarget(e);
	if(!target) return;
	the_id = target.id+'-pic';
	document.getElementById(the_id).style.visibility = "hidden";
}

function mouseout(e)
{
	var target = findTarget(e);
	if(!target) return;
	the_id = target.id+'-pic';
	document.getElementById(the_id).style.visibility = "visible";
}

function findTarget(e)
{
	var target;

	if (window.event && window.event.srcElement)
		target = window.event.srcElement;
	else if (e && e.target)
		target = e.target;
	if (!target)
		return null;

	while (target != document.body && target.className != 'photobox')
		target = target.parentNode;
	if (target.className != 'photobox')
		return null;

	return target;
}

function addEvent(elm, evType, fn, useCapture)
// Cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
// By Scott Andrew
{
	if (elm.addEventListener) {
		elm.addEventListener(evType, fn, useCapture);
		return true;
	} else if (elm.attachEvent) {
		var r = elm.attachEvent('on' + evType, fn);
		return r;
	} else {
		elm['on' + evType] = fn;
	}
}

addEvent(window, 'load', setupPhotohider, false);
