<!-- BEGIN: Hiding Javascript module from old browsers


//=============================================================================
// Returns True if Email is Valid
//=============================================================================
function EmailBad( email ) {
 var Result   = 0;
 var AtSym    = email.indexOf('@');
 var Period   = email.lastIndexOf('.');
 var Space    = email.indexOf(' ');
 var Length   = email.length - 1; // Array is from 0 to length-1
 if( (AtSym < 1) ||               // '@' cannot be in first position
     (Period <= AtSym+1) ||       // Must be atleast one valid char btwn '@' and '.'
     (Period == Length ) ||       // Must be atleast one valid char after '.'
     (Space  != -1))              // No empty spaces permitted
   {  
      Result = 1; // bad
   }
 return Result;
}
//=============================================================================
// Format Phone Number from: Anything to: (ddd)ddd-dddd
// Added: OCT 4 2007
//=============================================================================
function FormatPhoneNumber( szInitialString ) {
 var FmtStr="";    // Resulting Phone Number String
 var len = szInitialString.length;
 var j;
 for( j=0; j<len; j++ ) {
    if( isNaN(parseInt(szInitialString.charAt(j))) ) {
       j = j;   // Not a Number, do nothing
    } else {
       FmtStr = FmtStr + szInitialString.charAt(j);
    }
 }
 if( FmtStr.length == 10 ) {   // Good Exit, return Formatted Phone Number
    FmtStr = "("+FmtStr.substring(0,3)+")"+FmtStr.substring(3,6)+"-"+FmtStr.substring(6,10);
 }
 return FmtStr;
}

//====================================================================
// Validadate the FORM on "Submit"
// Called by 'onsubmit(this)' from <form> tag in HTML
// returns FALSE (and alerts) if form fails validation
// returns TRUE and calls the Perl script if validation passes
//====================================================================
function ValidateForm(theForm) {
  var str = "";   // String variable
  // Normalize the Phone Number ======================================
  theForm.Phone.value = FormatPhoneNumber( theForm.Phone.value ); // Standardize Phone Number
  // Begin validation ================================================
  if( theForm.Name.value.length < 7 )  {   // Must be at least 7 characters
    alert("Please enter your Full Name.\nWe need your name to contact you about your upload.\n");
    theForm.Name.focus(); return false;
  }
  if( EmailBad(theForm.Email.value) ) {
    alert("Please enter a Valid E-Mail Address.\nThis is where your upload confirmation will be sent.","Bad Email");
    theForm.Email.focus(); return false;
  }
  if( theForm.Phone.value.length < 13 )  {   // (ddd)ddd-dddd = 13 chars
    alert("Please enter your Phone number, with the Area Code.\nYou will only be contacted if there is a problem with the upload.\nWe keep all phone numbers confidential.");
    theForm.Phone.focus(); return false;
  }
  if( theForm.datafile.value.length < 6 )  {   // Datafile to upload from local drive
    alert("No File was given to upload.\nYou should press the Browse button,\nThen search your computer for the file to upload.\n");
    theForm.datafile.focus(); return false;
  }
  return true;
}




// END: Hiding from old browsers -->

