var timer = 0;
var drop_down = "";

var all_drop_down_menus = new Array();
all_drop_down_menus[0] = "managing_change";
all_drop_down_menus[1] = "leadership_development";
all_drop_down_menus[2] = "corporate_training";
all_drop_down_menus[3] = "speakers_and_events";
all_drop_down_menus[4] = "company";
all_drop_down_menus[5] = "store";

var menu_id = "";

var animation_duration = 0.5;


function show_drop_down(menu) {
	drop_down = document.getElementById(menu + "_drop_down");

	var num_drop_down_menus = all_drop_down_menus.length;
	for (i = 0; i < num_drop_down_menus; i++) {
		if (menu != all_drop_down_menus[i]) {
			var other_drop_down = document.getElementById(all_drop_down_menus[i] + "_drop_down");

			if (other_drop_down && other_drop_down.style.display != "none") {
				Effect.BlindUp(all_drop_down_menus[i] + "_drop_down", {duration: animation_duration});
				//alert("blindup " + all_drop_down_menus[i] + "_drop_down");
			}


				//other_drop_down.style.visibility = 'hidden';
		}
	}

	//drop_down.style.left = getMenuX(menu) + "px";
	//alert(getMenuX(menu));
	//alert(drop_down.style.left);
	drop_down.style.top = getMenuY(menu) + "px";
	//drop_down.style.visibility = 'visible';

	menu_id = menu + "_drop_down";
	if (drop_down.style.display == "none")
		Effect.BlindDown(menu_id, {duration: animation_duration});

	clearTimeout(timer);
}

function hide_drop_down(menu) {
	//drop_down = document.getElementById(menu + "_drop_down");
	//timer = setTimeout("drop_down.style.visibility = 'hidden';", 100);

	menu_id = menu + "_drop_down";
	timer = setTimeout("Effect.BlindUp(menu_id, {duration: animation_duration});", 1000);
}

function getMenuX(element_id){
	var xPos = document.getElementById(element_id).offsetLeft;
	var tempEl = document.getElementById(element_id).offsetParent;

	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}

	//alert(xPos);

	if (element_id == "products") {
		//xPos = xPos + 250;
	}
	else if (element_id == "brands") {
		//xPos = xPos + 250;
	}

	//xPos -= 194;

	return xPos;
}

function getMenuY(element_id) {
	var yPos = document.getElementById(element_id).offsetTop;
	var tempEl = document.getElementById(element_id).offsetParent;

	while (tempEl != null) {
		yPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
	}

	return yPos;
}
