var testresults
function checkemail(){
var str=document.commentform.email.value;
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
var emailresult=0;
else{
var emailresult="Email address (valid)\n";
}
return (emailresult)
}


function checkterms(){
	
var checkBoxMsg = 0;

	if (!document.commentform.terms.checked){

	checkBoxMsg = "Posting rules confirmation\n\n"; 

	}

	return checkBoxMsg;

}


function checkfieldlength(){

var errorMsg = "0";

var name=document.commentform.author.value.length;
var comments=document.commentform.comment.value.length;

	if( (name == 0) || (comments == 0) ){
		
		errorMsg ="";
		

	}

	if(name == 0){
		errorMsg = errorMsg + "Name\n";
	}

	if(comments == 0){
		errorMsg = errorMsg + "Comment\n";
	}

return errorMsg;
}


function checkfields(){

		var emailresult = checkemail();
		
		var fieldresult = checkfieldlength();
		
		//var checkBoxMsg = checkterms();
		
		var	theWholeError = "";
		
		if(fieldresult != 0){
		
			theWholeError = theWholeError + fieldresult;
		
		}

		if(emailresult != 0){
		
			theWholeError = theWholeError + emailresult;
		
		}
		
	/*	if(checkBoxMsg != 0){
		
			theWholeError = theWholeError + checkBoxMsg;
		
		}
	*/	
		
		
	//	if( (emailresult != 0) || (fieldresult != 0) || (checkBoxMsg != 0)){
	
		if( (emailresult != 0) || (fieldresult != 0) ){

		alert("Sorry, you forgot to enter your:\n\n" + theWholeError);
		
		}else{

		document.commentform.submit();

		}

}







