function validate_email(theControl)
{

    if ( theControl.value == "" || theControl.value.length <= 0 )
    {

   alert("Please type in an Email address or verify"
   +" the prefix and '@' sign.");
   theControl.focus()
        return false;
    }

    var reEmail = /^.+\@.+\..+$/
    var holderValue;
    var thisValue = theControl.value;

    // Check for e-mail addresses from ISPs and other sources that have been consistently
    // entered incorrectly.  If detected, correct the situation.
    if
        (
            (thisValue.substring(thisValue.length - 4, thisValue.length).toLowerCase()) == '@aol' ||
            (thisValue.substring(thisValue.length - 4, thisValue.length).toLowerCase()) == '@msn' ||
            (thisValue.substring(thisValue.length - 6, thisValue.length).toLowerCase()) == '@yahoo' ||
            (thisValue.substring(thisValue.length - 6, thisValue.length).toLowerCase()) == '@lycos' ||
            (thisValue.substring(thisValue.length - 7, thisValue.length).toLowerCase()) == '@excite' ||
            (thisValue.substring(thisValue.length - 10, thisValue.length).toLowerCase()) == '@altavista' ||
            (thisValue.substring(thisValue.length - 11, thisValue.length).toLowerCase()) == '@compuserve' ||
            (thisValue.substring(thisValue.length - 8, thisValue.length).toLowerCase()) == '@prodigy' ||
            (thisValue.substring(thisValue.length - 8, thisValue.length).toLowerCase()) == '@hotmail' ||
            (thisValue.substring(thisValue.length - 9, thisValue.length).toLowerCase()) == '@netscape'
        )
        {
            holderValue = thisValue.concat('.com');
            thisValue = holderValue;
            theControl.value = thisValue;
        }
    if
        (
            (thisValue.substring(thisValue.length - 5, thisValue.length).toLowerCase()) == '@home'
        )
        {
            holderValue = thisValue.concat('.net');
            thisValue = holderValue;
            theControl.value = thisValue;
        }

    // Now check the actual value of the e-mail address for validity.
    var flagFirstCheck = (theControl.value.length < 6) ||
        (thisValue.indexOf('@') == -1) ||
        (thisValue.indexOf('.') == -1) ||
        (thisValue.indexOf('@',(thisValue.indexOf('@')+1)) != -1) ||
        ((thisValue.indexOf('.')+1) == thisValue.length) ||
        ((thisValue.indexOf('@')+1) == thisValue.length)
    var flagSecondCheck = reEmail.test(thisValue)
    if ( flagFirstCheck || !flagSecondCheck)
    {

   alert("Please type in an Email address or verify"
   +" the prefix and '@' sign.");
   theControl.focus()

        return false;
    }
    else {

        return true;
    }
}

function FValidateControl(control, prompt) {
  if (control.value=="" || control == prompt) {
    alert("Your " + prompt +" field is a required field, all required fields must be filled out before submitting.")
    control.focus()
    return false }
  return true }

function FSubmitValidation(form) {
if (!FValidateControl(form.First_name,'first name')) return false
if (!FValidateControl(form.Last_name,'last name')) return false
if (!validate_email(form.Email)) return false
if (!FValidateControl(form.friends_first_name,'friends first name')) return false
if (!FValidateControl(form.friends_last_name,'friends last name')) return false
if (!FValidateControl(form.friends_email,'friends email')) return false
if (!FValidateControl(form.Message,'message')) return false
   return true }

function validatefield(thisfield,imgname){
  if (thisfield.value == "") {
  imgname.src="images/stop.gif";
  }
  else
  {
  imgname.src="images/blank.gif";
  }
}
function sendAvail() {
  if (window.document.myFlash) {
   window.document.myFlash.SetVariable("calstring1","");
   window.document.myFlash.SetVariable("calstring2","");
  }
}
