function rondaf(value) {
	return Math.round(value*100)/100;
}

//function frm12() {
//	window.document.frm12.first.value*=1;
//	window.document.frm12.second.value=rondaf(window.document.frm12.first.value*(273/293));
//}

function frm12() {
	window.document.frm12.first.value*=1;
	window.document.frm12.second.value=rondaf(window.document.frm12.first.value/(1.0549));
}

function frm122() {
	window.document.frm122.first.value*=1;
	window.document.frm122.second.value=rondaf(window.document.frm122.first.value*(1.0549));
}

function frm25() {
	window.document.frm25.first.value*=1;
	window.document.frm25.second.value=rondaf(window.document.frm25.first.value*1.359623);
}

function frm26() {
	window.document.frm26.first.value*=1;
	window.document.frm26.second.value=rondaf(window.document.frm26.first.value*0.73549800202);
}

function frm27() {
	window.document.frm27.first.value*=1;
	window.document.frm27.second.value=rondaf(window.document.frm27.first.value*(1/1.605));
}

function frm28() {
	window.document.frm28.first.value*=1;
	window.document.frm28.second.value=rondaf(window.document.frm28.first.value/(1/1.605));
}

function frm13() {
	window.document.frm13.qw.value*=1;
	window.document.frm13.pv.value*=1;
	window.document.frm13.h.value*=1;
	if (window.document.frm13.pv.value==0) { alert('Vapour Pressoure may not be 0'); }
	if (window.document.frm13.h.value==0) { alert('Humidity may not be 0'); }
	if (window.document.frm13.h.value != 0 && window.document.frm13.pv.value != 0) {
		window.document.frm13.qd.value=rondaf(window.document.frm13.qw.value*((1013-(window.document.frm13.h.value/100)*window.document.frm13.pv.value)/1013));
	}
}

function frm14() {
	window.document.frm14.nm3.value*=1;
	window.document.frm14.scfm.value*=1;
	if (window.document.frm14.menu.value=='nm3-scfm') {
		window.document.frm14.scfm.value=rondaf(window.document.frm14.nm3.value*(1/1.605));
	}
	if (window.document.frm14.menu.value=='scfm-nm3') {
		window.document.frm14.nm3.value=rondaf(window.document.frm14.scfm.value/(1/1.605));
	}
}

function frm21() {
	window.document.frm21.bar.value*=1;
	window.document.frm21.pascal.value*=1;
	window.document.frm21.psia.value*=1;
	if (window.document.frm21.from.value=='bar') {
		window.document.frm21.pascal.value=rondaf(window.document.frm21.bar.value*100000);
		window.document.frm21.psia.value=rondaf(window.document.frm21.bar.value*14.5);
	}
	if (window.document.frm21.from.value=='pascal') {
		window.document.frm21.bar.value=rondaf(window.document.frm21.pascal.value/100000);
		window.document.frm21.psia.value=rondaf(window.document.frm21.bar.value*14.5);
	}
	if (window.document.frm21.from.value=='psia') {
		window.document.frm21.bar.value=rondaf(window.document.frm21.psia.value/14.5);
		window.document.frm21.pascal.value=rondaf(window.document.frm21.bar.value*100000);
	}
}

function frm31() {
	window.document.frm31.celsius.value*=1;
	window.document.frm31.kelvin.value*=1;
	window.document.frm31.fahrenheit.value*=1;
	if (window.document.frm31.from.value=='celsius') {
		window.document.frm31.kelvin.value=rondaf(window.document.frm31.celsius.value*1+273);
		window.document.frm31.fahrenheit.value=rondaf((window.document.frm31.celsius.value*1)*(9/5)+32);
	}
	if (window.document.frm31.from.value=='kelvin') {
		window.document.frm31.celsius.value=rondaf(window.document.frm31.kelvin.value-273);
		window.document.frm31.fahrenheit.value=rondaf((((window.document.frm31.kelvin.value*1)-273)*(9/5))+32);
	}
	if (window.document.frm31.from.value=='fahrenheit') {
		window.document.frm31.celsius.value=rondaf(((window.document.frm31.fahrenheit.value*1)-32)*(5/9));
		window.document.frm31.kelvin.value=rondaf((((window.document.frm31.fahrenheit.value*1)-32)*(5/9))+273);
	}
}

function frm32() {
	if (window.document.frm32.p1.value==0) {
		alert('Pressure 1 may not be 0');
	} else {
		window.document.frm32.p1.value*=1;
		window.document.frm32.p2.value*=1;
		window.document.frm32.ts.value*=1;
		window.document.frm32.td.value=rondaf((window.document.frm32.ts.value*1+273)*Math.pow((window.document.frm32.p2.value/window.document.frm32.p1.value),0.2857)-273);
		window.document.frm32.tk.value=rondaf((window.document.frm32.ts.value*1+273)*Math.pow((window.document.frm32.p2.value/window.document.frm32.p1.value),0.2857));
	}
}

function frm41() {
	if (window.document.frm41.pressure.value==0) {
		alert('Air pressure may not be 0');
	} else {
		window.document.frm41.dewpoint.value=rondaf((window.document.frm41.vp.value/window.document.frm41.pressure.value))+" °C";
	}
}

function frm5() {
	window.document.frm5.absorbed.value*=1;
	if (window.document.frm5.from.value=='kw') {
		window.document.frm5.motorkw.value=rondaf(window.document.frm5.absorbed.value*1.15);
		window.document.frm5.motorhp.value=rondaf(window.document.frm5.motorkw.value/0.7335);
	}
	if (window.document.frm5.from.value=='hp') {
		window.document.frm5.motorhp.value=rondaf(window.document.frm5.absorbed.value*1.15);
		window.document.frm5.motorkw.value=rondaf(window.document.frm5.motorhp.value*0.7335);
	}
}

function showtable() {
	window.open('conversiontable.htm','table');
}
