
<!--

 function moveLoginCursor(form) {
  //if username is blank put cursor there
  //otherwise go to password field
  if(form.username.value == '') {
    form.username.focus()
  }
  else
    form.password.focus()
 }



 function checkSearchForm(form) {
 //check the validity of a search
    if ((form.query_first_name.value == '') && (form.query_family_name.value == '') && (form.query_user_type.value == '') && (form.query_school.value == ' ') && (form.query_final_year.value == '')) {
       alert('No search criteria provided.');
       form.query_first_name.focus()
	   return false;
    }
    else return true;
 }



 function checkStorySearchForm(form) {
 //check the validity of a story search 
    if ((form.title.value == '') && (form.category.value == '') && (form.author.value == '')) {
       alert('No search criteria provided.');
       form.title.focus()
	   return false;
    }
    else return true;
 }
 
 
 
  function checkReunionEventForm(form) {
 //check the validity of a new reunion/event 
    if (form.topic.value == '') {
       alert('You need to specify a topic (e.g Reunion, Event, Informal Gathering)');
       form.topic.focus()
	   return false;
	   }
	else if (form.message.value == '') {
       alert('You didn\'t give any information!');
       form.message.focus()
	   return false;
	   }		
    else return true;
 }




 function checkStoryForm(form) {
 //check the validity of a new story
    if (form.title.value == '') {
		alert("Your story needs a title");
		form.title.focus()
		return false;	
	}
	
	else if (form.story.value == '') {
		alert("Your story is empty");
		form.story.focus()
		return false;	
	}
	
	else if (form.author.value == '') {
		alert("Please put your name in the author field");
		form.author.focus()
		return false;	
	}		
	
	else return true;
 }



 function checkPasswordForm(form) {
 //check the validity of changing password form
    if (form.old_password.value == '') {
		alert("Your old password is not valid");
		form.old_password.focus()
		return false;	
	}

	else if (form.new_password.value == form.old_password.value) {
		alert("Try changing your new password to something \n other than your old password!");
		form.new_password.focus()
		return false;	
	}
	
	else if (form.new_password.value == '') {
		alert("Your new password cannot be empty");
		form.new_password.focus()
		return false;	
	}
	
	else if (form.new_password.value != form.new_password_check.value) {
		alert("Your new password could not be verified. \n Please enter the same password in both fields");
		form.new_password_check.focus()
		return false;	
	}		
	
	else return true;
 }


 function checkDetailsForm(form) {
 //check the validity of user contact details
    if (form.firstName.value == '') {
		alert("You forgot to enter your first name");
		form.firstName.focus()
		return false;	
	}
	
	else if (form.familyNameSchool.value == '') {
		alert("Please supply your family name from school");
		form.familyNameSchool.focus()
		return false;	
	}
	
	else if (form.familyNameNow.value == '') {
		alert("Since you did not indicate a new family name, \n it is assumed that your name at school is the \n same as your name now");
		form.familyNameNow.value = form.familyNameSchool.value;
		form.familyNameNow.focus()
		return false;	
	}



	//check the teaching dates
	/*
	else if(!form.eduDamascus.checked && (form.dc_start.value != "" || form.dc_end.value != "")) {
		alert("If you taught at Damascus, you need to \n indicate this with the appropriate checkbox");
		form.eduDamascus.checked = true
		return false;
		}

	else if(parseInt(form.dc_start.value) > parseInt(form.dc_end.value)) {
		alert("You cannot finish teaching before you start. \n Please verify these dates");
		form.dc_start.focus()
		return false;
		}

	else if(!form.eduStMartins.checked && (form.sm_start.value != "" || form.sm_end.value != "")) {
		alert("If you taught at St. Martins, you need to \n indicate this with the appropriate checkbox");
		form.eduStMartins.checked = true
		return false;
		}

	else if(parseInt(form.sm_start.value) > parseInt(form.sm_end.value)) {
		alert("You cannot finish teaching before you start. \n Please verify these dates");
		form.sm_start.focus()
		return false;
		}
		
	else if(!form.eduStPauls.checked && (form.sp_start.value != "" || form.sp_end.value != "")) {
		alert("If you taught at St Pauls, you need to \n indicate this with the appropriate checkbox");
		form.eduStPauls.checked = true
		return false;
		}

	else if(parseInt(form.sp_start.value) > parseInt(form.sp_end.value)) {
		alert("You cannot finish teaching before you start. \n Please verify these dates");
		form.sp_start.focus()
		return false;
		}
		
	else if(!form.eduSacredHeart.checked && (form.sh_start.value != "" || form.sh_end.value != "")) {
		alert("If you taught at Sacred Heart, you need to \n indicate this with the appropriate checkbox");
		form.eduSacredHeart.checked = true
		return false;
		}

	else if(parseInt(form.sh_start.value) > parseInt(form.sh_end.value)) {
		alert("You cannot finish teaching before you start. \n Please verify these dates");
		form.sh_start.focus()
		return false;
		}
		
	

	//if dates entered, check for a school
	else if((!form.atDamascus.checked && !form.atStMartins.checked && !form.atStPauls.checked && !form.atSacredHeart.checked ) &&
			(form.entryYear.value != "" || form.finalYear.value != "")) {
		alert("You didn't select the school/s that you attended");
		form.atDamascus.focus()
		return false;
		}
*/
	//if entry year but not level, ask for level
	else if((form.entryYear.value != '' ||  form.finalYear.value != '') && 
			(form.entryYearLevel.value == '' && form.finalYearLevel.value == '')) {
		alert("You didn't enter the year level/s that you attended school");
		form.entryYear.focus()
		return false;
		}
		
		
	//if entry level but not year, ask for year
	else if((form.entryYear.value == '' &&  form.finalYear.value == '') && 
			(form.entryYearLevel.value != '' || form.finalYearLevel.value != '')) {
		alert("You didn't enter the year/s that you attended school");
		form.entryYear.focus()
		return false;
		}			


	//check validity of student years and levels			
	else if(parseInt(form.entryYear.value) > parseInt(form.finalYear.value)) {
		alert("You schooling years you entered were invalid. \n Please verify these dates");
		form.entryYear.focus()
		return false;
		}				
		
	else if(parseInt(form.entryYearLevel.value) > parseInt(form.finalYearLevel.value)) {
		alert("The year levels you entered were invalid. \n Please verify these dates");
		form.entryYearLevel.focus()
		return false;
		}						

	

	//check for email
	else if (form.email.value == '') {
		alert("It is recommended that you supply an email address \n to allow other users the ability to contact you");
		if (confirm("Do you want to include an email address now?", "yes", "no")) {
			form.email.focus()
			return false;
			}
		else return true;
	}
	
	
	else if (form.email.value.search('@') == -1) {
		alert("Email address invalid!");
		form.email.focus()
		return false;
	}	


	else if (form.subscriber.checked && form.address.value == "") {
		alert("You need an enter an address to be \n mailed THE ROAD magazine");
		form.address.focus()
		return false;
	}	


	else if (form.subscriber.checked && form.postcode.value == "") {
		alert("You need an enter a postcode to be \n mailed THE ROAD magazine");
		form.postcode.focus()
		return false;
	}	
	
			
	
	else return true;
 }


// -->
