' VB Script Document
sub CheckForm()
	if Len(Trim(ContactForm.fname.value))=0 then
		alert "Your Name must not be left blank"
		ContactForm.fname.focus
		exit sub
	end if
			
	Dim email
	email=ContactForm.femail.value
	if Len(Trim(email))=0 then
		alert "Your Email must not be left blank"
		ContactForm.femail.focus
		exit sub
	else		
		If Not InStr(email,"@")>0 then
			alert "Address contains no @ sign"
			ContactForm.femail.focus
			Exit sub
		end if
		if Not InStr(email,".")>0 then
			alert "Address contains no dot"
			ContactForm.femail.focus
			exit sub
		else
			if InStr(email,".")<InStr(email,"@") then
				alert "The dot must be after @ sign"
				ContactForm.femail.focus
				exit sub
			end if			
		end if
		if Len(Left(email,InStr(email,"@")-1))<=3 then
			alert "Address before the @ sign is to short"
			ContactForm.femail.focus
			exit sub
		end if
		emailx=Mid(email,InStr(email,"@")+1,Len(email))
		if Len(Left(emailx,InStr(emailx,".")-1))<=2 then
			alert "Address before the dot is to short"
			ContactForm.femail.focus
			exit sub
		end if
		if Len(Right(email,Len(email)-InStr(email,".")))<=1 then
			alert "Address after the dot is to short"
			ContactForm.femail.focus
			exit sub
		end if
	end if	
	if Len(Trim(ContactForm.fcomment.value))=0 then
		alert "Your Comments must not be left blank"
		ContactForm.fcomment.focus
		exit sub
	end if
	
	Call ContactForm.submit()
end sub

sub MailAlert(Flag)	
	if Flag = "t" then
		alert "Your Contact Information has been sent. Thank you!"
		exit sub
	else
		if Flag = "f" then
			alert "Your Contact Information has not been sent. Please try again."
			exit sub
		end if
		exit sub
	end if
end sub
