var OpenMenu = '';
var timHandle = '';

function ShowMenu(o,lt){
	HideMenuNow();
  obj = 'mnu' + o.substring(3);
  if(document.getElementById(obj)){
    document.getElementById(obj).style.visibility = 'visible';
		document.getElementById(obj).style.left = lt + 'px';
    OpenMenu = obj;
  } else {
    if(document.all[obj]){
      document.all[obj].style.visibility = 'visible';
      OpenMenu = obj;
    }
  }
}

function HideMenuNow(){
  if(document.getElementById(OpenMenu)){
    document.getElementById(OpenMenu).style.visibility = 'hidden';
    clearTimeout(timHandle);
  } else {
    if(OpenMenu!=''){
      document.all[OpenMenu].style.visibility = 'hidden';
      clearTimeout(timHandle);
    }
  }
}

function HideMenu(){
  timHandle = setTimeout('HideMenuNow()', 300);
}

function LTrim(str){
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(0)) != -1) {
    var j=0, i = s.length;
    while (j < i && whitespace.indexOf(s.charAt(j)) != -1){
      j++;
    }
    s = s.substring(j, i);
  }
  return s;
}

function RTrim(str){
  var whitespace = new String(" \t\n\r");
  var s = new String(str);
  if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
    var i = s.length - 1;
    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1){
      i--;
    }
    s = s.substring(0, i+1);
  }
   return s;
}

function Trim(str){
  return RTrim(LTrim(str));
}

function CheckForm(o){
  for (i=0; i<o.elements.length; i++) {
    if(Trim(o.elements[i].value)=='' && o.elements[i].name.indexOf("omment")==(-1) && o.elements[i].name.indexOf("mail")==(-1)){
      alert('Please enter the ' + o.elements[i].name.substring(3));
      o.elements[i].focus();
      return false;
    }
  }
  return true;
}

function OpenMap(){
  window.open("map.html", "bombaymap", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=yes,directories=no,location=no,width="+(((screen.Width-40)*620)/640)+",height="+((((((screen.Width-40)*480)/640))*460)/480)+",top=" + (((screen.Height-19)/2) - ((((((((screen.Width-40)*480)/640))*460)/480))/2) - 5) + ", left="+((screen.Width/2) - (((((screen.Width-39)*620)/640))/2) - 5));
//  window.open("map.html", "bombaymap", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,directories=no,location=no,width=620,height=460,top=" + ((screen.Height/2)-230) + ", left=" + ((screen.Width/2)-310));
}

