function TotalAmount(formval) {
	
	formval.total_amount.value = (formval.membership_fee.value * 1) + (formval.additional_gift.value * 1);
	if (formval.total_amount.value>999) {	
	    document.getElementById("hiddendiv").style.display="";
	} else {
	    document.getElementById("hiddendiv").style.display="none";
	}

}

function NQTCheck(formval, togval) {

	if(togval==0) { formval.NQT.checked=false; formval.subscription[5].checked=true;}
	if(togval==1) { formval.student.checked=false; formval.subscription[6].checked=true; }

}

function JoinActsubmitFields(formval) {


	if(formval.NQT.checked==true && formval.NQT_date.value=="") {
		alert("Please add a NQT date");
		return false;
	}

	if(formval.student.checked==true && formval.student_qualify_date.value=="") {
		alert("Please state the month and year you expect to finish your initial teacher training");
		return false;
	}


	

myOption = -1;
	for (i=formval.subscription.length-1; i > -1; i--) {
		if (formval.subscription[i].checked) {
		myOption = i; i = -1;
		}
	}
		
		if(myOption==-1) { alert("Please select a type of membership"); return false;};

		if(myOption==1) {
			myOption = -1;
				for (i=formval.discdescription.length-1; i > -1; i--) {
					if (formval.discdescription[i].checked) {
					myOption = i; i = -1;
					}
				}
					if(myOption==-1) { alert("Please select an option for 'discounted membership'"); return false;};
		}

		if(myOption==2) {
			myOption = -1;
				for (i=formval.freedescription.length-1; i > -1; i--) {
					if (formval.freedescription[i].checked) {
					myOption = i; i = -1;
					}
				}
					if(myOption==-1) { alert("Please select an option for 'free membership'"); return false;};
		}

		if(myOption==3) {
			myOption = -1;
				for (i=formval.lifedescription.length-1; i > -1; i--) {
					if (formval.lifedescription[i].checked) {
					myOption = i; i = -1;
					}
				}
					if(myOption==-1) { alert("Please select an option for 'life membership'"); return false;};
		}

		return true;
}

function JoinPaymentsubmitFields(formval) {

	return true;

}

function load() {

//	document.forms[0].Membershipfee.value = "40";

}

function totalamount(formval) {

	document.forms[0].Totalamount.value = (document.forms[0].Donation.value *1) + (document.forms[0].Membershipfee.value *1);

	if (document.forms[0].Totalamount.value>999) {	
	    document.getElementById("hiddendiv").style.display="";
	} else {
	    document.getElementById("hiddendiv").style.display="none";
	}

}