function isInt(myInt, myLabel) {
//Check if field is an integer

  //Local Variables
  var num = parseInt(myInt.value,10);
  var result = true;

  if (isNaN(num)) {
    alert('Please enter valid number in the "' + myLabel +'" field.');
    myInt.focus();
    result = false;
  }

  return result;

}

function validLength(myField, validLength, myLabel){
//Check if field is valid length

  var result = true;
  
  if ( myField.value.length != parseInt(validLength,10) ){
    alert('Please enter ' +  parseInt(validLength,10) + ' digits in the "' + myLabel +'" field.');  
    myField.focus();
    result = false;
  }    
  
  return result;

}


function validEmail(myField){
//Check if email is in valid format with an "@" and "."

  var result = false;
  var tempstr = new String(myField.value);
  var aindex = tempstr.indexOf("@");

  if(aindex > 0){
    var pindex = tempstr.indexOf(".",aindex);
    if ((pindex > aindex+1) && (tempstr.length > pindex+1)) {
      result = true;
    }
    else {
      result = false;
    }
  }
  if (!result){
    alert("Please enter a valid email address in the form: " +  "yourname@yourdomain.com");
    myField.focus();
  }
  return result;
}

function leaving(){
  alert('You are now leaving the St Philip Catholic Web Site');
}

