<!-- 

//--------------------------------------------------------------------------------
// Copyright 2004, Ed Colet (EdC), All rights reserved.
// EdC owns and will retain all right, title interest and ownership 
// in and to the Program and any copies or updates of the Program.
//--------------------------------------------------------------------------------

function Validate(form)
	{
		if (CheckforText(form))
		{
			FixApos_new()
			return true
		}
		else
			return false
	}

function CheckforText(form)
	{
	// check if the name field is not blank (length>0).
		var first_name = contact_info.first_name.value
		var last_name = contact_info.last_name.value
		var fn_textLength = first_name.length
		var ln_textLength = last_name.length
		// alert('length is ' + stextLength)
		if (fn_textLength==1 || ln_textLength==1)
		{
			alert('First name, and/or last name is missing Please correct and then re-submit.')
			return false
		}
		else 
			return true
	}

// search and replace apostrophes as they screw up the perl-sql server-side code...
function FixApos_new(form)
	{
		//7 free text fields in the form so run this code 7 times
		for (n=1; n<=7; n++)
		{
			if (n==1)       var usr_text = contact_info.first_name.value
			else if (n==2)	var usr_text = contact_info.last_name.value
			else if (n==3)	var usr_text = contact_info.email_1.value
			else if (n==4)	var usr_text = contact_info.email_2.value
			else if (n==5)	var usr_text = contact_info.street_address.value
			else if (n==6)	var usr_text = contact_info.city.value
			else if (n==7)	var usr_text = contact_info.emergency_name.value
			var hex_array = new Array()
			var new_text = ""
			var text_length = usr_text.length

			// search and replace apostrophe characters in the array, and put array contents into new text string
			for(i=0; i<text_length; i++)
			{
				var hexchar = usr_text.charCodeAt(i)
				// 39 is the hexcharacter for an apostrophe. 96 is the tilde...
				if (hexchar == 39)
				{				
					hexchar = 96
				}
				var str = String.fromCharCode(hexchar)
				//alert ('str is ' + str)
				new_text = new_text + str
				//alert ('new_text is ' + new_text)
			}
			if (n==1)      contact_info.first_name.value = new_text
			else if (n==2) contact_info.last_name.value = new_text
			else if (n==3) contact_info.email_1.value = new_text
			else if (n==4) contact_info.email_2.value = new_text
			else if (n==5) contact_info.street_address.value = new_text
			else if (n==6) contact_info.city.value = new_text
			else if (n==7) contact_info.emergency_name.value = new_text
		}
	}

//-->

