<!--

function checkWholeForm(theForm) {
    var why = "";
    why += isEmpty(theForm.fname.value, 'First name');
    why += isEmpty(theForm.lname.value, 'Last name');
    why += checkEmail(theForm.email0.value);
    why += checkEmail(theForm.email1.value);
    why += isDifferent(theForm.email0.value,theForm.email1.value);
    why += isEmpty(theForm.company.value, 'Company name');
    why += checkPassword(theForm.pword.value);
    why += isEmpty(theForm.addr.value, 'Address');
    why += checkState(theForm.state.selectedIndex, theForm.state1.value);
       if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkProfileForm(theForm) {
    var why = "";
    why += isEmpty(theForm.addr.value, 'Address');
    why += isEmpty(theForm.company.value, 'Company name');
    why += checkEmail(theForm.email.value);
    why += isEmpty(theForm.state.value, 'State');
    why += isEmpty(theForm.country.value, 'Country');
       if (why != "") {
       alert(why);
       return false;
    }
return true;
}


function checkSpotlightForm(theSform) {
    var why = "";
    why += isEmpty(theSform.email.value, 'Your email address');
    why += isEmpty(theSform.com_name.value, 'Company name');
    why += checkEmail(theSform.email.value);
    why += isEmpty(theSform.contact.value, 'Contact name');
    why += isEmpty(theSform.ugname.value, 'User group name');
    why += isEmpty(theSform.ugtime.value, 'Time as member');
    why += isEmpty(theSform.country.value, 'Country');
       if (why != "") {
       alert(why);
       return false;
    }
return true;
}

// non-empty textbox

function isEmpty(strng,errorcode) {
var error = "";
  if (strng.length == 0) {
     error =  errorcode + " field has not been filled in.\n";
  }
return error;	  
}

function isDifferent(strng, strng2) {
  var error = "";
  if (strng != strng2) {
     error = "Email addresses do not match.\n";
  }
return error;
}

function checkEmail (strng) {
var error="";
if (strng == "") {
   error = "You didn't enter an email address.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}

function checkPassword (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a password.\n";
}

    
    if ((strng.length < 6) || (strng.length > 8)) {
       error = "The password must be 6-8 characters.\n";
    }

return error;    
}    


// valid selector from dropdown list

function checkDropdown(choice) {
var error = "";
    if (choice == 0) {
    error = "Please choose an option from the drop-down list.\n";
    }    
return error;
}    

//check state entry


function checkState(choice, strng) {
var error = "";
    if ((choice == 0) && (strng =="")) {
    error = "Please choose a state from the drop down or enter a state name.\n";
    }    
return error;
}

//-->


