// JavaScript Document - Рассчеты по формулам

function proverka(param, form_name, note, minim, maxim) {
var result = eval('document.' + form_name +'.' + param + '.value');
var v=result.indexOf(',',1)
	if ((v>0)||(result == "")||(result < parseFloat(minim))||(result > parseFloat(maxim)))
		{
		alert(note + ' \n *) дробные числа необходимо вводить через точку');
		pole = eval('document.' + form_name +'.' + param);
		pole.select();
		pole.focus();
		}
result = parseFloat(result);
//pole.value = result;
}

function rasschet_objem() {


q = document.resiver.q.value;
p_stand = document.resiver.p_stand.value;
p_min = document.resiver.p_min.value;
t = document.resiver.t.value;

p_atm = parseFloat(document.resiver.p_atm.value);

var v=t.indexOf(',',1)
	if ((v>0)||(document.resiver.t.value=="")||(document.resiver.t.value > 200)||(document.resiver.t.value < 1))
		{	
		alert('Время выхода на рабочее давление не указано или указано неверно! \n *) дробные числа необходимо вводить через точку')
		document.resiver.t.select();
		document.resiver.t.focus();
		}
t = parseFloat(t);

VR=(q * p_atm * t)/((p_stand - p_min) * 60);
document.resiver.VR.value = VR;
}

function rasschet_proizv() {
vr = document.resiver.vr.value;
p_i = document.resiver.p_i.value;
p_f = document.resiver.p_f.value;
t = document.resiver.t.value;

p_atm = parseFloat(document.resiver.p_atm.value);

var v=t.indexOf(',',1)
	if ((v>0)||(document.resiver.t.value=="")||(document.resiver.t.value > 200)||(document.resiver.t.value < 1))
		{	
		alert('Время выхода на рабочее давление не указано или указано неверно! \n *) дробные числа необходимо вводить через точку')
		document.resiver.t.select();
		document.resiver.t.focus();
		}
t = parseFloat(t);

q3=(vr * (p_i - p_f) * 60)/(p_atm * t);
document.resiver.q3.value = q3; // литры в минуту
q2=(vr * (p_i - p_f) * 60)/(p_atm * t * 1000);
document.resiver.q2.value = q2; // кубы в минуту
q1=(vr * (p_i - p_f) * 60 * 60)/(p_atm * t * 1000);
document.resiver.q1.value = q1; // кубы в час
}


function rasschet_perepad() {
q = document.resiver.q.value;
l = document.resiver.l.value;
d = document.resiver.d.value;
p = document.resiver.p.value;

f = parseFloat(document.resiver.f.value);

var v=p.indexOf(',',1)
	if ((v>0)||(document.resiver.p.value=="")||(document.resiver.p.value > 400)||(document.resiver.p.value < 1))
		{	
		alert('Минимальное абсолютное давление не указано или указано неверно! \n *) дробные числа необходимо вводить через точку')
		document.resiver.p.select();
		document.resiver.p.focus();
		}
p = parseFloat(p);
q = q/3600;
dp=(f * Math.pow(q, 1.85) * l * 1000)/(Math.pow(d, 5) * p);
document.resiver.dp.value = dp; // литры в минуту
}
