function checkContactForm(theForm) {
	var error = "";
    var why = "";
    why += checkLastName(theForm.LastName.value);
    why += checkFirstName(theForm.FirstName.value);
    why += checkEmail(theForm.email.value);
     if ((theForm.Comments.value))
		 why += checkComment(theForm.Comments.value);
	//alert("Stop!");
    //return false;
	var re = /\S/;
    if (re.test(why)) {

       alert(why);
	   why = "";
	   error = "";
       return false;
    }
	return true;
}

function checkLastName(strval) {
	var error = "";
	var lnameFilter=/[a-zA-Z]{2,}/;
	if (!(lnameFilter.test(strval))) { 
		error = "Please enter a valid last name.\n";
	}

	return error;
}
function checkFirstName(strval) {
	var error = "";
	var FnameFilter=/[a-zA-Z]{2,}/;
	if (!(FnameFilter.test(strval))) { 
		error = "Please enter a valid first name.\n";
	}

	return error;
}


function checkEmail(strval) {
	var error = "";
	var emailFilter=/^[A-Z0-9._%-]+\@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
	if (!(emailFilter.test(strval))) { 
		   error = "Please enter a valid email address.\n";
	}

	var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
	if (strval.match(illegalChars)) {
	   error = "The email address contains illegal characters.\n";
	}
	return error;
}

function checkComment(strval) {
	var error = "";
    var nourlRegexp = /(ftp|http):\/\/([_a-z\d\-]+(\.[_a-z\d\-]+)+)(([_a-z\d\-\\\.\/]+[_a-z\d\-\\\/])+)*/;
    if (strval.match(nourlRegexp)) {
         error = "The Question/Comments contains illegal input.\n";
	}
	return error;
}