var etMenu = {
	/* TWEAKABLES */
	menuId:"nav",
	galleryPrepend: "etBackground-",
	timeout:300,
	/* INIT VARS */
	defaultBackground:false,
	currentBackground:false,
	initd:false,
	/* */
	init: function () {
		if(!etMenu.initd && document.getElementById && document.getElementById(etMenu.menuId)){
			var container = document.getElementById(etMenu.menuId);
			var as = container.getElementsByTagName('a');
			if (container.className == "home") {

			}
			for(j in as){
				if (as[j] && as[j].nodeType && as[j].nodeType == 1 && as[j].parentNode.parentNode.parentNode.id == etMenu.menuId){
					var keyId = "etMenu_"+j;
					as[j].id = keyId;
					if(as[j].addEventListener){
						as[j].addEventListener('mouseover', function(){etMenu.show(this.className);},false);
						as[j].addEventListener('mouseout', function(){etMenu.hide();},false);
					} else {
						as[j].onmouseover = new Function('etMenu.show(this.className);');
						as[j].onmouseout = new Function('etMenu.hide();');
					}
					if (etMenu.galleryPrepend + as[j].className != etMenu.defaultBackground){
						animate.hide(etMenu.galleryPrepend + as[j].className);
					}
				}
			}
			etMenu.defaultBackground = etMenu.galleryPrepend + container.className;
			etMenu.currentBackground = etMenu.defaultBackground;
			animate.show(etMenu.currentBackground);
			etMenu.initd = true;
		}
	},
	//these functions rewritten from concept as above.
	show: function(id){
		if (id){
			var newBackground = etMenu.galleryPrepend + id;
			if (newBackground != etMenu.currentBackground){
				animate.fadeOut(etMenu.currentBackground);
				animate.fadeIn(newBackground);
				etMenu.currentBackground = newBackground;
			}
		}
	},
	hide: function(){
		newBackground = etMenu.defaultBackground;
		if (newBackground != etMenu.currentBackground){
			animate.fadeOut(etMenu.currentBackground);
			animate.fadeIn(newBackground);
			etMenu.currentBackground = newBackground;
		}
	}
}

/* from themaninblue, it works. :) */

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 {
		return false;
	}
	return true;
};

function attachEventListener(target, eventType, functionRef, capture) {
    if (typeof target.addEventListener != "undefined") {
        target.addEventListener(eventType, functionRef, capture);
    } else if (typeof target.attachEvent != "undefined") {
        target.attachEvent("on" + eventType, functionRef);
    } else {
        return false;
    }
    return true;
};

//  init
addLoadListener(etMenu.init);
etMenu.init();
// */