Function UT(strWork)

	UT = Ucase(Trim(strWork))
		
End Function

Function LT(strWork)

	LT = Lcase(Trim(strWork))
		
End Function

Function Is_Dirty(objForm, blnShowChange)

	Dim intNumElems
	Dim intNumOpts
	Dim cOpts
	Dim el
	Dim eOpt
	Dim x, y
	
	Is_Dirty = False
	intNumElems = objForm.elements.length
	
	for x = 0 to intNumElems - 1
		set el = objForm.elements(x)
		select case True
			case UT(el.type) = "TEXT"
				if UT(el.value) <> UT(el.defaultValue) then
					Is_Dirty = True
					if blnShowChange then
						msgbox "Form is DIRTY - dirty field is " & el.id & vbcr & "  Initial value: " & el.defaultValue & vbcr & _
								 "  Modified value: " & el.value
					end if
				end if
			case UT(el.tagname) = "TEXTAREA"
				if UT(el.value) <> UT(el.defaultValue) then
					Is_Dirty = True
					if blnShowChange then
						msgbox "Form is DIRTY - dirty field is " & el.id & vbcr & "  Initial value: " & el.defaultValue & vbcr & _
								 "  Modified value: " & el.value
					end if
				end if
			case UT(el.type) = "RADIO"
				if UT(el.checked) <> UT(el.defaultChecked) then
					Is_Dirty = True
					if blnShowChange then
						msgbox "Form is DIRTY - dirty field is " & el.id & vbcr & "  Initial value: " & el.defaultChecked & vbcr & _
								 "  Modified value: " & el.checked
					end if
				end if
			case UT(el.type) = "CHECKBOX"
				if UT(el.checked) <> UT(el.defaultChecked) then
					Is_Dirty = True
					if blnShowChange then
						msgbox "Form is DIRTY - dirty field is " & el.id & vbcr & "  Initial value: " & el.defaultChecked & vbcr & _
								 "  Modified value: " & el.checked
					end if
				end if
			case UT(el.tagname) = "SELECT"
				set cOpts = el.options
				intNumOpts = cOpts.length
				for y = 0 to intNumOpts - 1
					set eOpt = cOpts(y)
					if UT(eOpt.selected) <> UT(eOpt.defaultSelected) then
						Is_Dirty = True
						if blnShowChange then
							msgbox "Form is DIRTY - dirty field is " & el.id & vbcr & "  Initial value: " & eOpt.defaultSelected & vbcr & _
									 "  Modified value: " & eOpt.selected & vbcr & "  Innertext: " & eOpt.innertext
						end if
						exit for
					end if
				next
		end select
		if Is_Dirty then
			exit for
		end if
	next

end function

Sub PageNav(oForm, sURL)

	oForm.action = sURL
	oForm.submit

End Sub

Sub SayMsg(sMsg)

	msgbox sMsg, vbOKOnly, "functions_client.vbs"
	
End Sub

