// JavaScript Document
		function validate(formobj)
						{
							// check the Email address is valid
							if (!validEmail(formobj.txtemail.value)) {
								alert('Your Email address appears to be invalid');
								FocusAndSelect(formobj.txtemail);
								return false;
							}

							// check there is a name
							if (!formobj.txtname.value) {
								alert('Please fill in your name');
								FocusAndSelect(formobj.txtname);
								return false;
							}
							
							// no check for now on the comment
							// substitute the email as the from field
							//formobj.From.value = formobj.email.value;
							// form validated
							return true;
						}
function validate2(formobj)
						{
							// check the Email address is valid
							if (!validEmail(formobj.txtemail2.value)) {
								alert('Your Email address appears to be invalid');
								FocusAndSelect(formobj.txtemail2);
								return false;
							}

							
							// no check for now on the comment
							// substitute the email as the from field
							//formobj.From.value = formobj.email.value;
							// form validated
							return true;
						}
// common functions used for forms handling
// ******************************************************************
// VALIDATION -------------------------------------------------------
// ******************************************************************
// General validity check for Email addresses
	//Email validation function
	function validEmail(txtemail)
	{	// define the set of invalid characters
		invalidChars =" /:,;"
		// Email field empty??
		if (txtemail=="") { return false; }
		// check for presence of invalid chars
		for (i=0; i<invalidChars.length; i++) {
			badChar = invalidChars.charAt(i);
			if (txtemail.indexOf(badChar,0) > -1) { return false; }
		}
		// check for #@' positioning
		atPos = txtemail.indexOf("@",1);
		if (atPos == -1) { return false; }
		// check that there isnt more than 1 '@'
		if (txtemail.indexOf("@",atPos+1) > -1) { return false; }
		// check positioning of '.'
		periodPos = txtemail.indexOf(".",atPos);
		if ( periodPos == -1) { return false; }	
		if ( periodPos+3 > txtemail.length) { return false; }
		// above only checks for at least 2 chars after 1st period (including other periods)
		// maybe should check for at least 2 chars after the last period...basically repeat function above
		return true;
	}
// ******************************************************************
// Validate a phone number
	function validPhone(number)
	{
		validNumbers = "0123456789()"
		// if the number is empty it's ok ... it's not compulsory
		// FOR NOW
		if (number=="") {return true; }
		
		// check to see if all chars are numbers
		for (i=0; i<number.length; i++) {
			Char = number.charAt(i);
			if (validNumbers.indexOf(Char,0) < 0) { return false; }
		}
		return true;
	}
// ******************************************************************	
// Validate a group of Radio Buttons
	function validRadioGroup (radioGroup) {
		selected = -1;
		for (i=0; i<radioGroup.length; i++) {
			if (radioGroup[i].checked)  {
				selected = i;
			}
		}
		if (selected == -1) {
			return false;
		}
		return true;
	}
// ******************************************************************
// OTHER COMMON -----------------------------------------------------
// ******************************************************************
// put focus and select
	function FocusAndSelect(What) {
		What.focus();
		What.select();
	}
	

	
