function calculate(x){

	var counter = 1;
	var total = 0;
	//if the points value is not a number, alert, highlight the field and disable all other input fields
	if (isNaN(x.value)==true){
		while(document.getElementById('a'+counter)){
			document.getElementById('a'+counter).disabled=true;
			x.disabled=false;
			counter++
		}
		x.style.backgroundColor="#EFD176";
		alert("Please enter a number");
	}
	//if points value is a number enable all input fields, calculate the total and write ot to the total textbox
	if(isNaN(x.value)==false){
		x.style.backgroundColor="white";
		while(document.getElementById('a'+counter)){
			document.getElementById('a'+counter).disabled=false;
			var points=Number(document.getElementById('a'+counter).value)
			total=total+points;
			document.getElementById('total').setAttribute("value",total);
			counter++
		}
	}
}

function loadPdf(x){
	opener.location.href=x;
}
