function calcson(form,val,index)
// calculations for sound converter, Apr. 2003
// copyright Bernd C. Krueger
{
    var Pref = parseFloat(form.pref.value);
    if(Pref<=0) {warnings(1);return;}
    var Iref = parseFloat(form.iref.value);
    if(Iref<=0) {warnings(1);return;}

    var value=parseFloat(val);
    if(index==0) v=value;                                  // dB (base)
    if(index==1) {
	if(value<=0){warnings(1);return;}
	v=20.*Math.log(value/Pref)*Math.LOG10E;   // sound pressure, Pa
    }
    if(index==2) {
	if(value<=0){warnings(1);return;}
	v=10.*Math.log(value/Iref)*Math.LOG10E;   // sound intensity , W/m2
    }

    form.lpdb.value = ausgab(v);                               // dB (base)
    form.pval.value = ausgab(Pref*Math.pow(10.,v/20.));	       // sound pressure, Pa
    form.ival.value = ausgab(Iref*Math.pow(10.,v/10.));	       // sound intensity , W/m2
}
