myonload = function() {
	startList();
	checkHref('');
}

// url anchor reader
function checkHref(e) {
	if (e.target && e.target.parentNode.href) {
		var imga=e.target.parentNode.href.split("#")[1];
	} else if (e.target && e.target.href) {
		var imga=e.target.href.split("#")[1];
	} else if (!e) {
		var imga=window.location.href.split("#")[1];
	}
	//alert(imga);
	if (imga) {
		$('#gallery a').each(function (n){
			var imgb=this.href.split("/");
			var imgb=imgb[imgb.length-1].split(".")[0];
			if (imga == imgb) {
				$('#gallery a').lightBox({fixedNavigation:true}).eq(n).click();
			}
		});
	}
} 


// IE 5+ Dropdown fix
startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("main-nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}

window.onload=myonload;