Function sendit_OnClick

Dim pos1, lenEmail, diff1



If Trim(frmsupport.send_name.value) = "" Or Len(Trim(frmsupport.send_name.value)) < 2 Then
	MsgBox "Please enter your name.",vbInformation+vbOkOnly,"Incomplete Information"
	sendit_OnClick = False 
	Exit Function
End If

If Trim(frmsupport.send_email.value) = "" Or Len(Trim(frmsupport.send_email.value)) < 6 Then
	MsgBox "Please enter your email address.",vbInformation+vbOkOnly,"Incomplete Information"
	sendit_OnClick = False 
	Exit Function
End If


If InStr(frmsupport.send_email.value,Chr(64)) < 2 Or InStr(frmsupport.send_email.value,".") < 1 Or Right(frmsupport.send_email.value,1)="." Or InStr(frmsupport.send_email.value,",") > 0 Then
	MsgBox "Please enter a valid email address.",vbInformation+vbOkOnly,"Incomplete Information"
	sendit_OnClick = False
	Exit Function	
End If


If InStr(frmsupport.send_email.value,".") > 1 Then
	pos1 = InStrRev(frmsupport.send_email.value,".")
	lenEmail = Len(frmsupport.send_email.value)
	diff1 = lenEmail-pos1
	If diff1 > 3 Or diff1 < 2 Then
		MsgBox "Please enter a valid email address.",vbInformation+vbOkOnly,"Incomplete Information"
		sendit_OnClick = False
		Exit Function	
	End If
End If


If Len(Trim(frmsupport.regnum.value))< 7 Then
	MsgBox "Please enter your registration number.",vbInformation+vbOkOnly,"Incomplete Information"
	sendit_OnClick = False
	Exit Function 
End If


If Len(Trim(frmsupport.msgbody.value)) = 0 Then
	MsgBox "Please provide information in the message area on the specifics of the request.",vbInformation+vbOkOnly,"Incomplete Information"
	sendit_OnClick = False 
	Exit Function
End If


End Function

