function addToQuals(qual)
{
	qualNum = document.editMembershipForm.qualNum.value;

	if (qual.checked && qual.name == "q0")
	{
		document.editMembershipForm.qualifications.value = qual.value;

		for (i = 1; i < qualNum; i++)
		{
			q = eval("document.editMembershipForm.q"+i);

			if (q) q.checked = false;
		}
		
		
		return true;
	}
	else
	{
		document.editMembershipForm.qualifications.value = "";

		for (i = 0; i < qualNum; i++)
		{
			qFormElement = "document.editMembershipForm.q"+i;
			q = eval(qFormElement);

			if (q)
			{
				if (i == 0) q.checked = false;
				if (q.checked)
				{
					document.editMembershipForm.qualifications.value += (document.editMembershipForm.qualifications.value.length > 0) ? ',' + q.value : q.value;
				}
			}
		}
	}
//	alert(document.editMembershipForm.qualifications.value);
}
			
			
function clearQuotes(theForm) {
	for (i=0;i<theForm.elements.length;i++) {
		if (theForm.elements[i].value) {
			theForm.elements[i].value = theForm.elements[i].value.replace(/'/gi,"`");
		}
	}
}

function checkEmail(theEmail) {
	if (theEmail.indexOf('.')==-1) return false;
	if (theEmail.indexOf('@')==-1) return false;
	if (theEmail.length<6) return false;
	return true;
}

function checkCompetition() {
	theForm=document.CompetitionForm;
	clearQuotes(theForm);
	
	if (theForm.fname.value.length<1) {alert("Please enter your first name.");return false;}
	if (theForm.lname.value.length<1) {alert("Please enter your last name.");return false;}
	if (theForm.email.value.length<1) {alert("Please enter your email address.");return false;}
	if (checkEmail(theForm.email.value)==false) {alert("The email address you have entered does not seem to be valid.");return false;}

	if (theForm.verificationCode) {
		if (theForm.verificationCode.value.length<1) {alert("Please enter the verification code.");return false;}
	}

	return true;
}

function checkSubscription() {
	theForm=document.SubscriptionForm;
	clearQuotes(theForm);
	
	if (theForm.fname.value.length<1) {alert("Please enter your first name.");return false;}
	if (theForm.lname.value.length<1) {alert("Please enter your last name.");return false;}
	if (theForm.email.value.length<1) {alert("Please enter your email address.");return false;}
	if (checkEmail(theForm.email.value)==false) {alert("The email address you have entered does not seem to be valid.");return false;}

	if (theForm.verificationCode) {
		if (theForm.verificationCode.value.length<1) {alert("Please enter the verification code.");return false;}
	}

	return true;
}

function checkEnquiry() {
	theForm=document.EnquiryForm;
	clearQuotes(theForm);
	
	if (theForm.fname.value.length<1) {alert("Please enter your first name.");return false;}
	if (theForm.lname.value.length<1) {alert("Please enter your last name.");return false;}
	if (theForm.email.value.length<1) {alert("Please enter your email address.");return false;}
	if (checkEmail(theForm.email.value)==false) {alert("The email address you have entered does not seem to be valid.");return false;}

	if (theForm.subject.value.length<1) {alert("Please enter a subject for your enquiry.");return false;}
	if (theForm.notes.value.length<1) {alert("Please enter a message.");return false;}

	if (theForm.verificationCode) {
		if (theForm.verificationCode.value.length<1) {alert("Please enter the verification code.");return false;}
	}

	return true;
}

function checkMember() {
	theForm=document.MemberForm;
	clearQuotes(theForm);
	
	if (theForm.fname.value.length<1) {alert("Please enter your first name.");return false;}
	if (theForm.lname.value.length<1) {alert("Please enter your last name.");return false;}
	if (theForm.email.value.length<1) {alert("Please enter your email address.");return false;}
	if (checkEmail(theForm.email.value)==false) {alert("The email address you have entered does not seem to be valid.");return false;}

	if (theForm.password.value.length<1) {alert("Please enter a password.");return false;}
	if (theForm.password2.value.length<1) {alert("Please enter your password again.");return false;}
	if (theForm.password.value != theForm.password2.value) {alert("Your passwords do not match. Please retype them.");return false;}

	if (theForm.verificationCode) {
		if (theForm.verificationCode.value.length<1) {alert("Please enter the verification code.");return false;}
	}

	return true;
}

function checkJoinNow(f)
{
	with(f)
	{
		if (checkEmail(email.value) == false)
		{
			alert("The email address you have entered does not seem to be valid.");
			return false;
		}
	}
	
}