function checkMDays(who) {
  str=who.value;
  str=str.split('-');
  dte=new Date();
  dte.setFullYear(str[0]);
  dte.setDate(str[2]); // it must be before setMonth, since setMonth gets current date otherwise
  dte.setMonth(str[1] - 1);
  mStr=''+(dte.getMonth()+1);
  mStr=(mStr<10)?'0'+mStr:mStr;
  if(mStr!=str[1]||isNaN(dte)) {
    alert('Invalid date!');
    who.focus();
    return false;
  }
  return true;
}

function goodFloat(who, allow_zero) {
  if(isNaN(who.value)) {
    alert('Invalid number!');
    who.focus();
    return false;
  }
  else if(parseFloat(who.value)==0 && !allow_zero) {
    alert('Zero is not allowed!');
    who.focus();
    return false;
  }
  return true;
}

function goodInteger(who, allow_zero) {
  if(isNaN(who.value) || who.value.indexOf('.') > 0 || who.value.indexOf(',') > 0) {
    alert('Invalid number!');
    who.focus();
    return false;
  }
  else if(parseInt(who.value)==0 && !allow_zero) {
    alert('Zero is not allowed!');
    who.focus();
    return false;
  }
  return true;
}

function goodString(who) {
  if(who.value == "") {
    alert('Empty Field!');
    who.focus();
    return false;
  }
  return true;
}

function goodConfirmPassword(who1,who2) {
  if(who1.value != who2.value) {
    alert('Password and Confirm Password do not match!');
    who1.focus();
    return false;
  }
  return true;
}

function goodEmail(who) {
  if ((who.value.indexOf(".") > 2) && (who.value.indexOf("@") > 0)) {
    return true;
  }
  alert('Email is not valid!');
  who.focus();
  return false;
}

function selectedItems(who) {
  if(who.selectedIndex == -1) {
    alert('You must select users from the list!');
    who.focus();
    return false;
  }
  return true;
}


