
function formValidate(FN,MN,LN)
{		
	var fName = FN.value;
	var mName = MN.value;
	var lName = LN.value;

   // Strip out characters that are not allowed in a name
   fName = fName.replace(/(\'|\"|\!|\@|\#|\$|\%|\^|\&|\(|\)|\+|\=|\[|\]|\{|\}|\<|\>|\~|\`|\|)/g, " ");
   mName = mName.replace(/(\'|\"|\!|\@|\#|\$|\%|\^|\&|\(|\)|\+|\=|\[|\]|\{|\}|\<|\>|\~|\`|\|)/g, " ");
   lname = lName.replace(/(\'|\"|\!|\@|\#|\$|\%|\^|\&|\(|\)|\+|\=|\[|\]|\{|\}|\<|\>|\~|\`|\|)/g, " ");
   
	
	

    // Specifics tests for this form
    // Need first name if there is a middle name
    if (! isblank(mName) && isblank(fName))  {
				//errors += "You cannot have a middle name without a first name.\n";
				alert('You cannot have a middle name without a first name.');
				return false;
    }
    // Check for wildcards in name
    if (iswildcard(fName) || iswildcard(mName) || iswildcard(lName))  {
				//errors += "You cannot use wildcards in the search fields.\n";
				alert('You cannot use wildcards in the name search fields.');		
				return false;
    }
    // Check for wildcards in name
	if(isblank(lName))
	{
			alert('Can\'t search without a last name! Please enter names and search again.');
			return false;
	}
	//if(isblank(fName))
	//{
	//		alert('Can\'t search without a first and last name! Please enter names and search again.');
	//		return false;
	//}		
	
	
}










// A utility function that returns true if a string contains only 
// whitespace characters.
function isblank(s)
{
	if (s == null) return true;
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t') && (c != '\:') && (c != '\;') && (c != '\.') && (c != '\/') && (c != '\\') && (c != '\-') && (c != '\_')) return false;
    }
    return true;
}
function iswildcard(s)
{
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if (c == '*') return true;
		if (c == '?')  {
			// Jumping through hoops to support queries of A??? but
			// reject queries of A? or A??
			if (s.length >= (i+2))  {
				if ((s.charAt(i+1) == '?') && (s.charAt(i+2) == '?'))  {
					i = i + 2;
				}else {
					return true;
				}
			}else 
				return true;
			}
    }
    return false;
}


