function validate(frm) 
{
// check if field is blank
    if (frm.fname.value.length == 0)
    {
        alert("Please enter a value for the \" First Name\" field.");
        document.myform.fname.focus();
        return false;
	   
	if (frm.lname.value.length == 0)
    {
        alert("Please enter a value for the \"Last Name\" field.");
        document.myform.lname.focus();
        return false;
   if (frm.email.value.length == 0)
    {
        alert("Please enter a value for the \"Email\" field.");
        document.myform.email.focus();
        return false;
	}
// test if valid email address, must have @ and .
	var checkemail = "@.";
	var checkStr = frm.email.value;
	var emailValid = false;
	var emailAt = false;
	var emailPeriod = false;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkemail.length;  j++)
	{
	if (ch == checkemail.charAt(j) && ch == "@")
	emailAt = true;
	if (ch == checkemail.charAt(j) && ch == ".")
	emailPeriod = true;
	if (emailAt && emailPeriod)
	break;
	if (j == checkemail.length)
	break;
	}
// if both the @ and . were in the string
	if (emailAt && emailPeriod)
	{
		emailValid = true
		break;
	}
	}
	if (!emailValid)
	{
	alert("The \"email\" field must contain an \"@\" and a \".\".");
	frm.email.focus();
	return (false);
	}
}
