var currentTextInputValue; // used to track value of text input fields

function clearTextBox(){
  currentTextInputValue=this.value;
  this.value='';
}

function checkTextBox(){
  var blanks=/^\s*$/;
  if(blanks.test(this.value)){
    this.value=currentTextInputValue;
  }
}

function showMenu(menuName){
  $("#"+menuName).show("fast");
  //subMenu.style.display="block";
  return false;
}

function hideMenu(menuName){
  $("#"+menuName).hide("fast");
  //subMenu.style.display="none";
  return false;
}

window.onload=function(){
  var inputFields=document.getElementsByTagName("input");
  var inputFieldsLength=inputFields.length;
  for(var i=0;i<inputFieldsLength;i++){
    if(inputFields[i].getAttribute("type")!="text") continue;
    inputFields[i].onfocus=clearTextBox;
    inputFields[i].onblur=checkTextBox;
  }
};
