function validateRegister(){
	theForm = document.forms['sendusyours']
	
	// First undo any previous highlighting
	for(i=1; i<theForm.elements.length; i++){
            // unless we have a button
            elmName = theForm.elements[i].type;
            if((elmName != 'submit') && (elmName != 'button') && (elmName != 'select-one')){
                theForm.elements[i].style.backgroundColor = '#FFFFFF';
            }
        }
        
	//  check that all required elements are populated
	if (theForm.elements['myname'].value == ""){
		alert('You must enter a name.');
		theForm.elements['myname'].style.backgroundColor = '#FF9999';
		theForm.elements['myname'].focus();        	
		return false;
        }
		
	if (theForm.elements['myward'].value == ""){
		alert('You must choose your ward.');
		theForm.elements['myward'].style.backgroundColor = '#FF9999';
		theForm.elements['myward'].focus();        	
		return false;
        }
		
		if (theForm.elements['myaddress'].value == ""){
		alert('You must fill in a postal address.');
		theForm.elements['myaddress'].style.backgroundColor = '#FF9999';
		theForm.elements['myaddress'].focus();        	
		return false;
        }
		
		
		// agreement
		if (document.forms['sendusyours'].elements['myimages'].checked == true) {
        		//alert('If you have images please supply an email address or telephone number where we can contact you');
			//theForm.elements['agreement'].focus();
        		//return false;
				if ((theForm.elements['mytelephone'].value == "") && (theForm.elements['myemail'].value == "")) {
		alert('You must supply a valid email address or telephone number in case we need to contact you about the supporting images.');
		theForm.elements['myemail'].style.backgroundColor = '#FF9999';
		theForm.elements['myemail'].focus();        	
		return false;
        }
		
if ((document.forms['sendusyours'].elements['myimages'].checked == true) && (theForm.elements['mytelephone'].value == "")) {
		// test if valid email address, must have @ and .
		var checkEmail = "@.";
		var checkStr = theForm.myemail.value;
		var EmailValid = false;
		var EmailAt = false;
		var EmailPeriod = false;
		for (i = 0;  i < checkStr.length;  i++)
		{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkEmail.length;  j++)
		{
		if (ch == checkEmail.charAt(j) && ch == "@")
		EmailAt = true;
		if (ch == checkEmail.charAt(j) && ch == ".")
		EmailPeriod = true;
			  if (EmailAt && EmailPeriod)
				break;
			  if (j == checkEmail.length)
				break;
			}
			// if both the @ and . were in the string
		if (EmailAt && EmailPeriod)
		{
				EmailValid = true
				break;
			}
		}
		if (!EmailValid)
		{
		alert("The \"email\" field must contain an \"@\" and a \".\".");
		theForm.myemail.focus();
		return (false);
		}

		
}
		
		
		
		
		
		
		
        	}  
			
			
		
	return true;
}
