function checkForm(contactform) {

if (contactform.author) {
	if (contactform.author.value == null || contactform.author.value == "") {
	
		alert("Please enter your name");
		
		contactform.author.focus();
		
		return false;
		
	}
}
if (contactform.email) {
	if (contactform.email.value == null || contactform.email.value == "") {
	
		alert("Please enter your email address");
		
		contactform.email.focus();
		
		return false;
		
	}
	
	
	if (!validEmail(contactform.email.value)) {
	
		alert("Please enter a valid email address");
		
		contactform.email.focus();
		
		return false;
		
	}
}
if (contactform.comment) {
	if (contactform.comment.value == null || contactform.comment.value == "") {
	
		alert("Please write your comment");
		
		contactform.comment.focus();
		
		return false;
		
	}
}

  return true;

  

}

function validEmail(str) {

  // are regular expressions supported?

  var supported = 0;

  if (window.RegExp) {

    var tempStr = "a";

    var tempReg = new RegExp(tempStr);

    if (tempReg.test(tempStr)) supported = 1;

  }

  if (!supported) 

    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);

  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");

  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");

  return (!r1.test(str) && r2.test(str));

}
