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 = "Your email address contains illegal characters.\n";
       }
    }
return error;    
}


// phone number - strip out delimiters and check for 10 digits

function checkPhone (strng) {
var error = "";
if (strng == "") {
   error = "Please enter a phone number.\n";
}

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "The phone number field is empty or contains illegal characters.\n";
  
    }
    if (!(stripped.length > 9)) {
	error = "The phone number is the wrong length. Make sure you included an area code and international code if applicable.\n";
    } 
return error;
}

// non-empty textbox

function isEmpty(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your first name.\n";
  }
 else {
 	if (strng.length < 2) {
       error = "Your first name must contain at least 2 letters.\n";
  	}
  }
return error;	  
}


// non-empty textbox

function isEmptyLn(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your last name.\n";
  }
 else {
 	if (strng.length < 2) {
       error = "Your last name must contain at least 2 letters.\n";
  	}
  }
return error;	  
}

// non-empty textbox

function isEmptyCo(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your company name.\n";
  }
 else {
 	if (strng.length < 2) {
       error = "Your company name must contain at least 2 letters.\n";
  	}
  }
return error;	  
}

// non-empty textbox

function isEmptyJt(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your job title.\n";
  }
 else {
 	if (strng.length < 2) {
       error = "Your job title must contain at least 2 letters.\n";
  	}
  }
return error;	  
}

// non-empty textbox

function isEmptyUrl(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your website URL.\n";
  }
return error;	  
}


// non-empty textbox

function isEmptyComments(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Please enter your question or comments.\n";
  }
return error;	  
}


// valid selector from dropdown list

function checkDropdown(choice) {
var error = "";
    if (choice == 0) {
    error = "Please choose an option from the preferred contact method drop-down list.\n";
    }    
return error;
}   

// validate word

function isValidWord(strng) {
	if (strng == "natghz") {
	error="";
	}
	else
	{
    error = "Please re-enter the code you see in the box.\n";
    }    
return error;
}   