// NAV ************************************************************************
// Nav object
var menu	= {
	opacityTransact : function(item) {

	},

	level	: null,
	current	: null,
	timer	: {
		over	: null,
		reset	: null
	},
	set		: function (level_0, level_1) {
				this.level		= [level_0, level_1];
				this.current	= this.level[0];
			},
	init	: function () {
				var self	= this;

				$$("#menu-sub-"+self.level[0]+":first").each(function(menu) {menu.style.opacity = 1; menu.style.display = 'block';menu.style.zIndex = 1;})

				$$("#menu > li:not(.end)").each( function(menuli, i) {
					Event.observe( menuli, 'mouseout', function(){
						self.timer.reset = setTimeout("menu.reset()", 700);
					});

					Event.observe( menuli, 'mouseover', function(){
						clearTimeout(self.timer.over);
						clearTimeout(self.timer.reset);
						try {
						self.timer.over	= setTimeout("menu.over(" + i + ")", 250);
						} catch(e){
						}
					});
				});


				$$("#menu-sub").each(function(sub) {
					Event.observe(sub, 'mouseover', function(){
						clearTimeout(self.timer.over);
						clearTimeout(self.timer.reset);
					});

					Event.observe(sub, 'mouseout', function(){
						self.timer.reset = setTimeout("menu.reset()", 700);
					});
				});

				$$("#menu-sub ul").each(function(ul) {
					Event.observe(ul, 'mouseover', function(){
						clearTimeout(self.timer.reset);
					});
					ul.style.visibility = "visible";
				});

			},

	over	: function (i) {
		clearTimeout(this.timer.reset);
		if (i == this.current)	return;

		$$("#menu-"+this.current+" a").each(function(menu) {menu.removeClassName("selected");});
		$$("#menu-"+i+" a").each(function(menu) {menu.addClassName("selected");});

		$$("#menu-sub-"+this.current).each(function(menu) {menu.style.opacity = 0; menu.style.display = 'none';menu.style.zIndex = 0;});
		//new Effect.Fade(menu, {duration:0.2, AfterFinish:function(){menu.style.zIndex = 0;}});});//fadeOut("fast").css("z-index", "0");});

		$$("#menu-sub-"+i).each(function(menu) {menu.style.opacity = 1; menu.style.display = 'block';menu.style.zIndex = 10;});
		//new Effect.Fade(menu, {duration:0.2, from:0, to:1, AfterFinish:function(){menu.style.zIndex = 10;}});});//fadeIn("fast").css("z-index", "10");});

		this.current	= i;
	},

	reset 	: function () {
				var self	= this;

				if (self.current == self.level[0]) return;

				$$("#menu-"+self.current+" a").each(function(a) { a.removeClassName("selected");});

				$$("#menu-sub-"+self.current).each(function(cur) { cur.style.opacity = 0; cur.style.display = 'none';cur.style.zIndex = 0;});
				//Effect.Fade(cur, {duration:0.2, AfterFinish:cur.style.zIndex = 0});});//fadeOut("fast").css("z-index", "0");

				$$("#menu-"+self.level[0]+" a").each(function(a) {a.addClassName("selected");});

				$$("#menu-sub-"+self.level[0]).each(function(cur) { cur.style.opacity = 1; cur.style.display = 'block';cur.style.zIndex = 10;});
				//Effect.Fade(cur, {duration:0.2,  from:0, to:1, AfterFinish:cur.style.zIndex = 10});});//fadeIn("fast").css("z-index", "10");
				self.current	= self.level[0];
			},
	redirect	: function(url) {
					location	= url;
				}
}