var _time = [];
var _timec = [];
var nodes = null;
function initPhotoList()
{
	nodes = document.getElementsByTagName("li");
	for (var i=0; i<nodes.length; i++)
	{
		nodes[i].index = i;
		nodes[i].onmouseover = function()
		{
			if (this.parentNode.id == "photo-list") {
				if (_timec[this.index]) {
					clearTimeout(_timec[this.index]);
				}
				_time[this.index] = setTimeout('hoverLi(' + this.index + ')', 250);
			} else {
				this.className += " hover";
			}
		}
		nodes[i].onmouseout = function()
		{
			if (this.parentNode.id == "photo-list") {
				if (_time[this.index]) {
					clearTimeout(_time[this.index]);
				}
				_timec[this.index] = setTimeout('hoverOffLi(' + this.index + ')', 250);
			} else {
				this.className = this.className.replace("hover", "");
			}
		}
	}
}
function hoverLi(_li){
	if(nodes[_li].className.indexOf("hover") == -1)
		nodes[_li].className += " hover";
}
function hoverOffLi(_li){
	nodes[_li].className = nodes[_li].className.replace("hover", "");
}

if (window.addEventListener)
	window.addEventListener("load", initPhotoList, false);
else if (window.attachEvent)
	window.attachEvent("onload", initPhotoList);
