function addLoadListener(fn)
{
	if (typeof window.addEventListener != 'undefined')
	{
		window.addEventListener('load', fn, false);
	}
	else if (typeof document.addEventListener != 'undefined')
	{
		document.addEventListener('load', fn, false);
	}
	else if (typeof window.attachEvent != 'undefined')
	{
		window.attachEvent('onload', fn);	
	}
	else
	{
		var oldfn = window.onload;
		if (typeof window.onload != 'function')
		{
			window.onload = fn;
		}
		else
		{
			window.onload = function() {
       			oldfn();
       			fn();
     		};
		}
 	}
}
 
function initMenu()
{
	var nodes = document.getElementById("menu").getElementsByTagName("li");
	for (var i=0; i<nodes.length; i++)
	{
		nodes[i].onmouseover = function()
		{
			this.className += " hover";
		}
		nodes[i].onmouseout = function()
		{
			this.className = this.className.replace(" hover", "");
		}
	}
}

addLoadListener(initMenu);
var DOM = {
	getElementById:function(id, tag) {
		if(document.getElementById && document.getElementById(id)) {
			return document.getElementById(id);
		}
		if(document.layers && document.layers[id]) {
			return document.layers[id];
		}
		if(document.all && document.all[id]) {
			return document.all[id];
		}
		if(this.createElement) {
			tag=(tag)? tag : 'div';
			el=this.createElement(tag);
			el.setAttribute('id', id);
			this.getElementsByTagName('body')[0].appendChild(el);
			return el;
		}
		return null;
	}
}

var DHTML = {
	// centralize inner window width/height
	getInnerWidth:function() {
		if(window.innerWidth) { return innerWidth; }
		if(document.body.offsetWidth) { return document.body.offsetWidth; }
		return null;
	},
	getInnerHeight:function() {
		if(window.innerHeight) { return innerHeight; }
		if(document.body.clientWidth) { return document.body.clientWidth; }
		if(document.body.offsetHeight) { return document.body.offsetHeight; }
		return null;
	},
	// centralize number of pixels scrolled to
	getScrollX:function() {
		if(window.pageXOffset) { return pageXOffset; }
		if(document.body.scrollLeft) { return document.body.scrollLeft; }
		if(document.documentElement.scrollLeft) { return document.documentElement.scrollLeft; }
		return null;
	},
	getScrollY:function() {
		if(window.pageYOffset) { return pageYOffset; }
		if(document.body.scrollTop) { return document.body.scrollTop; }
		if(document.documentElement.scrollTop) { return document.documentElement.scrollTop; }
		return null;
	}
}
function popImage(path) {
	img=DOM.getElementById('image-pop');
			HTML=[
				'<a href="javascript:imagePopClose()" title="Click to Close"><img src="', path, '" alt="" /></a>'
			];
			img.innerHTML=HTML.join('');
			img.style.top=(DHTML.getScrollY() + 140) + "px";
			img.style.left=(DHTML.getInnerWidth() / 4) + "px";
			img.style.visibility="visible";
			img.style.styleFloat = 'none';
			img.style.cssFloat = 'none';
			
}
function imagePopup() {
			img=DOM.getElementById('image-pop');
			//img.className='story-photo';
			img.style.width=parseInt(image["width"]);
			img.style.height=parseInt(image["height"]);
			HTML=[
				'<a href="javascript:imagePopClose()" title="Click to Close"><img src="', image["path"], '" width="', image["width"], '" height="', image["height"], '" alt="" /></a>'
			];
			img.innerHTML=HTML.join('');
			img.style.top=(DHTML.getScrollY() + 120) + "px";
			img.style.left=(DHTML.getInnerWidth() / 4) + "px";
			img.style.visibility="visible";
}
function imagePopClose() {
	img=DOM.getElementById('image-pop');
	img.style.visibility="hidden";
}