// Пересчёт скорости вращения в ускорение

var chkR=true;
var chk1=true;
var chk2=true;
var r=0;
function R()
{
chkR=true;
r = parseFloat(document.cf.r.value.replace(/,/g,".")); 
if(isNaN(r)||r==0){alert(alt10_01); document.cf.r.focus(); return true;};
r = Math.abs(r);
document.cf.r.value=r+"mm"
chkR=false;
}
function conv()
{
if(chk1==0){conv1()};
if(chk2==0){conv2()};
}
function conv1()
{
R(); 
if(chkR){return true};
w1=parseFloat(document.cf.w1.value.replace(/,/g,".")); 
if(isNaN(w1)){alert(alt10_02); document.cf.w1.focus(); return true;};
	w1=Math.abs(w1);
	a1=0.0011946*r*Math.pow(w1,2);
	r=Math.round(a1*1000)/1000;
	if(r>0){a1=r};
	document.cf.w1.value=w1;
	document.cf.a1.value=a1;
	chk1=false;
}
function conv2()
{
R(); 
if(chkR){return true};
a2=parseFloat(document.cf.a2.value.replace(/,/g,".")); 
if(isNaN(a2)){alert(alt10_03); document.cf.a2.focus(); return true;};
	a2=Math.abs(a2);
	w2=Math.pow(837.1*a2/r,0.5);
	r=Math.round(w2*1000)/1000;
	if(r>0){w2=r};
	document.cf.w2.value=w2;
	document.cf.a2.value=a2;
	chk2=false;
}
