'EMPLOYEE EDIT VBSCRIPT

'VOLUNTEER
Sub CheckVTel_1()
	strTel_1 = Trim(volunteer.phone_area.value & "")
	intLength = Len(strTel_1)
	If intLength = 3 Then
		volunteer.phone_first3.select()
	End If
End Sub

Sub CheckVTel_2()
	strTel_2 = Trim(volunteer.phone_first3.value & "")
	intLength = Len(strTel_2)
	If intLength = 3 Then
		volunteer.phone_last4.select()
	End If
End Sub

Sub CheckVTel_3()
	strTel_3 = Trim(volunteer.phone_last4.value & "")
	intLength = Len(strTel_3)
	If intLength = 4 Then
		volunteer.cell_area.select()
	End If
End Sub

Sub CheckVCell_1()
	strCell_1 = Trim(volunteer.cell_area.value & "")
	intLength = Len(strCell_1)
	If intLength = 3 Then
		volunteer.cell_first3.select()
	End If
End Sub

Sub CheckVCell_2()
	strCell_2 = Trim(volunteer.cell_first3.value & "")
	intLength = Len(strCell_2)
	If intLength = 3 Then
		volunteer.cell_last4.select()
	End If
End Sub

Sub CheckVCell_3()
	strTel_3 = Trim(volunteer.cell_last4.value & "")
	intLength = Len(strTel_3)
	If intLength = 4 Then
		volunteer.email.select()
	End If
End Sub

'CONTRIBUTIONS
Sub CheckCTel_1()
	strTel_1 = Trim(contributions.phone_area.value & "")
	intLength = Len(strTel_1)
	If intLength = 3 Then
		contributions.phone_first3.select()
	End If
End Sub

Sub CheckCTel_2()
	strTel_2 = Trim(contributions.phone_first3.value & "")
	intLength = Len(strTel_2)
	If intLength = 3 Then
		contributions.phone_last4.select()
	End If
End Sub

Sub CheckCTel_3()
	strTel_3 = Trim(contributions.phone_last4.value & "")
	intLength = Len(strTel_3)
	If intLength = 4 Then
		contributions.cell_area.select()
	End If
End Sub

Sub CheckCCell_1()
	strCell_1 = Trim(contributions.cell_area.value & "")
	intLength = Len(strCell_1)
	If intLength = 3 Then
		contributions.cell_first3.select()
	End If
End Sub

Sub CheckCCell_2()
	strCell_2 = Trim(contributions.cell_first3.value & "")
	intLength = Len(strCell_2)
	If intLength = 3 Then
		contributions.cell_last4.select()
	End If
End Sub

Sub CheckCCell_3()
	strTel_3 = Trim(contributions.cell_last4.value & "")
	intLength = Len(strTel_3)
	If intLength = 4 Then
		contributions.email.select()
	End If
End Sub

'FEEDBACK
Sub CheckFTel_1()
	strTel_1 = Trim(feedback.phone_area.value & "")
	intLength = Len(strTel_1)
	If intLength = 3 Then
		feedback.phone_first3.select()
	End If
End Sub

Sub CheckFTel_2()
	strTel_2 = Trim(feedback.phone_first3.value & "")
	intLength = Len(strTel_2)
	If intLength = 3 Then
		feedback.phone_last4.select()
	End If
End Sub

Sub CheckFTel_3()
	strTel_3 = Trim(feedback.phone_last4.value & "")
	intLength = Len(strTel_3)
	If intLength = 4 Then
		feedback.cell_area.select()
	End If
End Sub

Sub CheckFCell_1()
	strCell_1 = Trim(feedback.cell_area.value & "")
	intLength = Len(strCell_1)
	If intLength = 3 Then
		feedback.cell_first3.select()
	End If
End Sub

Sub CheckFCell_2()
	strCell_2 = Trim(feedback.cell_first3.value & "")
	intLength = Len(strCell_2)
	If intLength = 3 Then
		feedback.cell_last4.select()
	End If
End Sub

Sub CheckFCell_3()
	strTel_3 = Trim(feedback.cell_last4.value & "")
	intLength = Len(strTel_3)
	If intLength = 4 Then
		feedback.email.select()
	End If
End Sub

'Friend (your)
Sub CheckYourTel_1()
	strTel_1 = Trim(friendForm.yphone_area.value & "")
	intLength = Len(strTel_1)
	If intLength = 3 Then
		friendForm.yphone_first3.select()
	End If
End Sub

Sub CheckYourTel_2()
	strTel_2 = Trim(friendForm.yphone_first3.value & "")
	intLength = Len(strTel_2)
	If intLength = 3 Then
		friendForm.yphone_last4.select()
	End If
End Sub

Sub CheckYourTel_3()
	strTel_3 = Trim(friendForm.yphone_last4.value & "")
	intLength = Len(strTel_3)
	If intLength = 4 Then
		friendForm.yemail.select()
	End If
End Sub

'Friend (Contact
Sub CheckContactTel_1()
	strTel_1 = Trim(friendForm.cphone_area.value & "")
	intLength = Len(strTel_1)
	If intLength = 3 Then
		friendForm.cphone_first3.select()
	End If
End Sub

Sub CheckContactTel_2()
	strTel_2 = Trim(friendForm.cphone_first3.value & "")
	intLength = Len(strTel_2)
	If intLength = 3 Then
		friendForm.cphone_last4.select()
	End If
End Sub

Sub CheckContactTel_3()
	strTel_3 = Trim(friendForm.cphone_last4.value & "")
	intLength = Len(strTel_3)
	If intLength = 4 Then
		friendForm.cemail.select()
	End If
End Sub


'Begin Error Checking
Sub ProcessFields()
	
	blnSubmit 		= 0	'Submit variable
	strYName		= Trim(friendForm.yname.value) & ""
	strYCompany		= Trim(friendForm.ycname.value) & ""
	strYAddress		= Trim(friendForm.yaddress1.value) & ""
	strYCity		= Trim(friendForm.ycity.value) & ""
	strYState		= Trim(friendForm.ystate.value) & ""
	strYZip			= Trim(friendForm.yzip.value) & ""
	strYPhoneArea	= Trim(friendForm.yphone_area.value) & ""
	strYphoneFirst3	= Trim(friendForm.yphone_first3.value) & ""
	strYPhoneLast4	= Trim(friendForm.yphone_last4.value) & ""
	strYEmail		= Trim(friendForm.yemail.value) & ""
	
	strCName		= Trim(friendForm.cname.value) & ""
	strCGreeting	= Trim(friendForm.cgeeting.value) & ""
	strCAddress		= Trim(friendForm.caddress1.value) & ""
	strCCity		= Trim(friendForm.ccity.value) & ""
	strCState		= Trim(friendForm.cstate.value) & ""
	strCZip			= Trim(friendForm.czip.value) & ""
	'strButton		= Trim(friendForm.form_button.value) & ""
	
	If strYName = "" Then	'Your Name Blank
		MsgBox "Please enter your full name."
		friendForm.yname.select()
	ElseIf strYAddress = "" Then	'Your Address Blank
		MsgBox "Please enter your address."
		friendForm.yaddress1.select()
	ElseIf strYCity = "" Then	'Your City Blank
		MsgBox "Please enter your city."
		friendForm.ycity.focus()
	ElseIf strYState = "" Then	'Your Address Blank
		MsgBox "Please select your state."
		friendForm.ystate.select()
	ElseIf strYZip = "" Then	'Your City Blank
		MsgBox "Please enter your zipcode."
		friendForm.yzip.select()
	ElseIf strYPhoneArea = "" Then	'Your Address Blank
		MsgBox "Please enter your area code."
		friendForm.yphone_area.select()
	ElseIf strYphoneFirst3 = "" Then	'Your City Blank
		MsgBox "Please enter the first 3 number of your phone."
		friendForm.yphone_first3.select()
	ElseIf strYPhoneLast4 = "" Then	'Your Address Blank
		MsgBox "Please enter the last 4 number of your phone."
		friendForm.yphone_last4.select()
	
	ElseIf strCName = "" Then	'Your Name Blank
		MsgBox "Please enter your friend's name."
		friendForm.cname.select()
	'ElseIf strCGreeting = "" Then	'Your Name Blank
		'MsgBox "Please enter a greeting."
		'friendForm.cgeeting.select()
	ElseIf strCAddress = "" Then	'Your Address Blank
		MsgBox "Please enter your friend's address."
		friendForm.caddress1.select()
	ElseIf strCCity = "" Then	'Your City Blank
		MsgBox "Please enter your friend's city."
		friendForm.ccity.focus()
	ElseIf strCState = "" Then	'Your Address Blank
		MsgBox "Please select your friend's state."
		friendForm.cstate.select()
	ElseIf strCZip = "" Then	'Your City Blank
		MsgBox "Please enter your friend's zipcode."
		friendForm.czip.select()
	Else	'Everything OK
		blnSubmit = 1
	End If
	
	'Submit Form If All Tests Passed
	If blnSubmit = 1 Then
		friendForm.method = "post"
		friendForm.action = "process_friend.asp"
		friendForm.submit()
	End If
	
End Sub


