function test_it(entry)
   {
	if (entry.value!=null && entry.value.length!=0) {
	   entry.value=""+ eval(entry.value);
	}
	computeForm(entry.form);
}

function computeForm(form) {
	if ((form.col_hdl.value==null || form.col_hdl.value.length==0) ||
   (form.col_totale.value==null || form.col_totale.value.length==0) ||
   (form.tri.value==null || form.tri.value.length==0))
   		{
   		alert("Inserire tutti i valori richiesti!")
   		return;
   		}
		if (!alrt_msg(form.col_hdl,1,10000," col. HDL") ||
		!alrt_msg(form.col_totale,1,10000," col. totale") ||
		!alrt_msg(form.tri,1,10000," trigliceridi"))
   		{
   		form.des.value="Valori errati - Premere Annulla";
   		return;
		}
		var ct=form.col_totale.value;
			ch=form.col_hdl.value;
			tr=form.tri.value;
		ld = parseInt(ct)-(parseInt(ch)+parseInt(tr)/5)
		ld2 = parseInt(ct)/parseInt(ch)
		
		form.ldl.value=(ld)
		form.ldl2.value=(ld2)
}

function reset_it(form) {
	form.col_totale.value="";
	form.col_hdl.value="";
	form.tri.value="";
	form.ldl.value="";
}

function alrt_msg(entry,low,high,prompt) {
	prompt="Errore, valore "+prompt+"  non valido : "+entry.value;
	var scratch=entry.value;
	for (var i=0;i<scratch.length;i++) {
		var letter=scratch.substring(i,i+1);
		if ((letter<"0" || "9"<letter) && letter!='.') {
			alert(prompt);
			return false;
   		}
   	}
	var errtst=parseFloat(scratch)
	if (errtst<low || high<errtst) {
		alert(prompt+ " inserire valori compresi tra " + low + " e " +high+"!");
		return false;
	}
	entry.value=scratch;
	return true;
}

