// JavaScript Document

function checkEmail (thisString) {
    var at="@"
	var dot="."
	var lat=thisString.indexOf(at)
	var lstr=thisString.length
	var ldot=thisString.indexOf(dot)

		if (thisString.indexOf(at) == -1 )
				{
				alert('The e-mail address has not been entered or is invalid')
				return false;
				}
		if  (thisString.indexOf(at) == -1 || thisString.indexOf(at) == 0
	    		|| thisString.indexOf(at) == lstr)
				{
				alert('The e-mail address has not been entered or is invalid')
				return false;
				}
		if  (thisString.indexOf(dot) == -1 || thisString.indexOf(dot) == 0
	     		|| thisString.indexOf(dot) == lstr)	
				{
				alert('The e-mail address has not been entered or is invalid')
				return false;
				}
		if (thisString.indexOf(at, (lat+1)) != -1)
				{
				alert('The e-mail address has not been entered or is invalid')
				return false;
				}
		if (thisString.substring(lat-1, lat) == dot || thisString.substring (lat+1, lat+2) == dot )		
				{
				alert('The e-mail address has not been entered or is invalid')
				return false;
				}
		if (thisString.indexOf(dot, (lat+2)) == -1)
				{
				alert('The e-mail address has not been entered or is invalid')
				return false;
				}
		if  (thisString.indexOf(" ") != -1)
				{
				alert('The e-mail address has not been entered or is invalid')
				return false;
				}
		return true
}

function checkFormSubmit (thisForm)
{ 
    if (thisForm.contactname.value == '' || thisForm.contactname.value == null ) 
	 		{
	 		 alert('Please enter your contact name');
	 		 return false;
			 }
	if (thisForm.email.value != ' ' && checkEmail (thisForm.email.value) == false)
	       		{	
		   		thisForm.email.value = ""
				thisForm.email.focus()
				return false;
				}
	if (thisForm.comment.value == '' || thisForm.comment.value == null ) 
	 		{
	 		 alert('Please enter your message');
			return false;
			 }			 
			 								
	return true;		 
}