<!--

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 += isEmpty(theForm.job_title.value, 'Job Title');
    why += checkPassword(theForm.pword.value);
    why += checkState(theForm.state.selectedIndex, theForm.state1.value);
    why += checkDropdownP(theForm.com_type.selectedIndex, 'Company Business Acitivity');
    why += checkDropdownP(theForm.job_type.selectedIndex, 'Job Responsibility');
    why += checkDropdownP(theForm.platform.selectedIndex, 'Server Environment');
    why += checkDropdownP(theForm.com_size.selectedIndex, 'Company Size');
    why += checkRadio(theForm.is_ibm, 'IBM Content');
       if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkRequiredForm(theForm) {
    var why = "";
    why += isEmpty(theForm.company.value, 'Company name');
    why += isEmpty(theForm.job_title.value, 'Job Title');
    why += checkState(theForm.state.selectedIndex, theForm.state1.value);
    why += checkDropdownP(theForm.com_size.selectedIndex, 'Company Size');
    why += checkDropdownP(theForm.com_type.selectedIndex, 'Company Business Acitivity');
    why += checkDropdownP(theForm.job_type.selectedIndex, 'Job Responsibility');
    why += checkDropdownP(theForm.platform.selectedIndex, 'Server Environment');
       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;
}

// 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,4}$/;
    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;    
}    


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

// valid selector from dropdown list

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

function checkRadio(choice, errorcode) {
var error = "";
var radiock = -1;
for (i=0; i<choice.length; i++)
{ 
	if (choice[i].checked) {
		radiock = i 
	}
}    
	if(radiock == -1) {
    		error =  "Please indicate \"" + errorcode + "\".\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;
}

//-->

