var err = "\n Please enter a value between 0 and 5. Incorrect fields are marked red. \t\n\n ";

function change(val){
   err = val;
}

function compute(x) {
	var val = eval("document.form1."+x);
	var val2 = parseFloat(val.value);
	if ( ((val.value < 0) || (val.value > 5) || val.value!=val2 ) && val.value!='') {
		val.value = "";
		msg = err;
		alert(msg);
		val.parentNode.parentNode.style.color  = 'red';
		val.focus();
	}else{
		val.parentNode.parentNode.style.color  = 'black';
	}
}
function validate(){
	var error = false;
	for( x=1 ; x<161 ; x++){
		var val = eval("document.form1.spq"+x);
		var val2 = parseFloat(val.value);
		if ( (val.value < 0) || (val.value > 5) || val.value!=val2) {
			error = true;
			val.parentNode.parentNode.style.color  = 'red';
			erroval = val;
		}else{
			val.parentNode.parentNode.style.color  = 'black';
		}
	}
	if(error){
		msg = err  ;
		alert(msg);
		erroval.focus();
	}else{
		document.form1.submit();
	}
}
