
function trim(strText) {
	// this will get rid of leading spaces
	while (strText.substring(0,1) == ' ')
		strText = strText.substring(1, strText.length);

	// this will get rid of trailing spaces
	while (strText.substring(strText.length-1,strText.length) == ' ')
		strText = strText.substring(0, strText.length-1);

	return strText;
}


function showMenu(menu) {
  var x = getImageLeft(menu);
	var y = getImageTop(menu)+20;

  var divID = "menu_" + menu;

  document.getElementById(divID).style.left = x + "px";
  document.getElementById(divID).style.top = y + "px";
  document.getElementById(divID).style.display = "block";
  
  isCloseMenu = false;
}


var isCloseMenu=false;

function hideMenu(menu) {
  isCloseMenu = true;
  closeMenu(menu);
}

function closeMenu(menu) {
  if (isCloseMenu == true) {
  var menu = "menu_" + menu;
  document.getElementById(menu).style.display = "none";
  }
}

function showCalendar() {
  var x = getImageLeft('training');
	var y = getImageTop('training')+20;

  document.getElementById('divCalendar').style.left = x + "px";
  document.getElementById('divCalendar').style.top = y + "px";
  document.getElementById('divCalendar').style.display = "";
}


function hideCalendar() {
  top.document.getElementById('divCalendar').style.display = "none";
  return false;
}