function initializeMainMenu() {

	/* MAIN LINKS
	 * Set mouse out and mouse over
	 * functions on the main links
	 */
	var currentEl = null;
	$S('.mainLink').action({
		onmouseover: function(){
			var current = this;
			var el = this.parentNode.id;
			var subMenu = "#" + el + " " + "ul";
			var links = "#" + el + " .mainLinks";
			this.style.backgroundColor = "#FBFBFB";
			$S('#mainMenuUl .mainLink').action({
				initialize: function(){
					if(current != this){
						this.style.backgroundColor = "";
					}
				}
			});

			// hide all submenus
			$S('#mainMenu ul ul').action({
				initialize: function(){
					this.style.display = "none";
				}
			});
			// display current menu
			$S(subMenu).action({
				initialize: function(){
					//currentEl = this;
					new Effect.Appear(this, {duration: 0.5});
				}
			});
		},
		onmouseout: function() {
			var el = this;
			el.outTime = setTimeout(function(){ mainHideMenu(el); }, 100); //this.style.display = "none";
		}
	});

	/* SUB MENU LINKS
	 * set mouse over and mouse out
	 * function on the sub menu links
	 */

	 $S('#mainMenu ul ul').action({
		onmouseover: function(){
			this.style.display = "block";
			if(currentEl != this && currentEl != null){
				new Effect.Fade(currentEl, {duration: .2});
			}
			if(currentEl == this){
				clearTimeout(currentEl.outTime);
			}
			currentEl = this;

		},
		onmouseout: function(){
			currentEl = this
			var el = this;
			currentEl.outTime = setTimeout(function(){ hideMenu(el); }, 300);
		}

	 });

	 function mainHideMenu(el){

		var id = el.parentNode.id;
		var subMenu = "#" + id + " " + "ul";
		var subEl;

		$S(subMenu).action({
			initialize: function(){
				subEl = this;
			}
		});

		if(subEl== currentEl){
			// do nothing
		}
		else{
			new Effect.Fade(subEl, {duration: .2});
			el.style.backgroundColor = "";
		}
	 }

	 function hideMenu(el){
		var parent = el.parentNode.id;
		var childLink = "#" + parent + " .mainLink";
		var item1 = setTimeout(
					function(el){
						$S(childLink).action({
							initialize: function(){
								this.style.backgroundColor = "";
							}
						});
					}, 200);

		new Effect.Fade(el, {duration: .2});//el.style.display = "none";
		clearTimeout(currentEl.outTime);
	 }
}


