// JavaScript Document

function showMenu2FromMenu1(menu1Element) {
	var className = $(menu1Element).attr('id') + "_2";
	var menu2element = document.getElementById(className);
	showMenu2(menu2element);
}
function hideMenu2FromMenu1(menu1Element) {
	var className = $(menu1Element).attr('id') + "_2";
	var menu2element = document.getElementById(className);
	hideMenu2(menu2element);
}

function showMenu2(element) {
	//var element = document.getElementById(menuElement);
	if(element && $(element).height()>20) {
		element.style.display = '';
		
		var wrapHeight = $(element).find(".menu2dropdown").height() - 8;
		
		$(element).find("ul").stop().animate({
			height: wrapHeight+"px",
			top: wrapHeight - $(this).height()
		}, animationSpeed);
		
		/*$(element).find(".menu2dropdown").stop().animate({
			top: "0px"
		}, 400);*/
		$(element).stop().animate({
			opacity: 1
		}, animationSpeed);
	}
}
function hideMenu2(element) {
	//var element = document.getElementById(menuElement);
	if(element && $(element).height()>20) {
		
		$(element).find("ul").stop().animate({
			height: "0px"
		}, animationSpeed);
		
		/*$(element).find(".menu2dropdown").stop().animate({
			top: -$(element).height()
		}, 400);*/
		$(element).stop().animate({
			opacity: 0.0
		}, {
			duration: animationSpeed, 
			complete: function() {
				element.style.display = 'none';
			}
		});
	}
}
