var usewgt;
var last;
var nlast;
// **************************Weight

function gramc(g)
{
y=g / 28.3495 ;
x=y.toFixed(3);
document.forms.wgt.oz.value=x;
y=g / 453.592 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.pound.value=x;
y=g / 1000;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.kgram.value=x;
x=(g / 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.ton.value=x;
x=(g / 3785.361).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.h2o.value=x;
}
function ozc(oz)
{
g=oz * 28.3495;
x=g.toFixed(3);
document.forms.wgt.gram.value=x;
y=g / 453.592 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.pound.value=x;
y=g / 1000;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.kgram.value=x;
x=(g / 3785.361).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.h2o.value=x;
x=(g / 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.ton.value=x;
}
function kgramc(kgram)
{
g=kgram * 1000;
x=g.toFixed(3);
document.forms.wgt.gram.value=x;
y=g / 28.3495 ;
x=y.toFixed(3);
document.forms.wgt.oz.value=x;
y=g / 453.592 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.pound.value=x;
x=(g / 3785.361).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.h2o.value=x;
x=(g / 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.ton.value=x;
}

function poundc(p)
{
g=p * 453.592 ;
x=g.toFixed(3);
document.forms.wgt.gram.value=x;
y=g / 28.3495 ;
x=y.toFixed(3);
document.forms.wgt.oz.value=x;
y=g / 1000;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.kgram.value=x;
x=(g / 3785.361).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.h2o.value=x;
x=(g / 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.ton.value=x;
}
function h2oc(p)
{
g=p * 3785.361 ;
x=g.toFixed(3);
document.forms.wgt.gram.value=x;
y=g / 28.3495 ;
x=y.toFixed(3);
document.forms.wgt.oz.value=x;
y=g / 453.592 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.pound.value=x;
y=g / 1000;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.kgram.value=x;
x=(g / 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.ton.value=x;
// do volume also
x=gc(p)
}
function tonc(p)
{
g=p * 1000000;
x=g.toFixed(3);
document.forms.wgt.gram.value=x;
y=g / 28.3495 ;
x=y.toFixed(3);
document.forms.wgt.oz.value=x;
y=g / 453.592 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.pound.value=x;
y=g / 1000;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.kgram.value=x;
x=(g / 3785.361).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.wgt.h2o.value=x;
}

// **************************length

function inc(g)
{
y=g * 0.08333;
x=y.toFixed(3);
document.forms.len.foot.value=x;
y=g * 0.027778;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.yard.value=x;
y=g * 25400;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.micron.value=x;
x=(y / 1000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.milli.value=x;
x=(y / 10000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.centi.value=x;
x=(y / 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.meter.value=x;
}

function footc(g)
{
y=g * 12;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.inch.value=x;
y=g * 0.3333333;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.yard.value=x;
y=g * 304800;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.micron.value=x;
x=(y / 1000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.milli.value=x;
x=(y / 10000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.centi.value=x;
x=(y / 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.meter.value=x;
}

function yardc(g)
{
y=g * 36;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.inch.value=x;
y=g / 3;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.foot.value=x;
y=g * 914400;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.micron.value=x;
x=(y / 1000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.milli.value=x;
x=(y / 10000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.centi.value=x;
x=(y / 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.meter.value=x;
}

function micronc(g)
{
y=g / 25400;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.inch.value=x;
y=g / 304800;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.foot.value=x;
y=g / 914400;
x=y.toFixed(3);
document.forms.len.yard.value=x;
y=g;
x=(y / 1000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.milli.value=x;
x=(y / 10000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.centi.value=x;
x=(y / 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.meter.value=x;
}

function millic(g)
{
y=g / 25.400;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.inch.value=x;
y=g / 304.800;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.foot.value=x;
y=g / 914.400;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.yard.value=x;
y=g;
x=(y * 1000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.micron.value=x;
x=(y / 10).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.centi.value=x;
x=(y / 1000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.meter.value=x;
}

function centic(g)
{
y=g / 2.540;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.inch.value=x;
y=g / 30.480;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.foot.value=x;
y=g / 91.440;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.yard.value=x;
y=g;
x=(y * 10000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.micron.value=x;
x=(y * 10).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.milli.value=x;
x=(y / 100).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.meter.value=x;
}

function meterc(g)
{
y=g / .02540;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.inch.value=x;
y=g / .30480;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.foot.value=x;
y=g / .91440;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.yard.value=x;
y=g;
x=(y * 1000000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.micron.value=x;
x=(y * 1000).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.milli.value=x;
x=(y * 100).toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.len.centi.value=x;
}

// **************************Volume

function gc(g)
{
// liters
l=g * 3.785411784 ;
x=l.toFixed(3);
document.forms.vol.l.value=x;
// uk gallons
ukg=l / 4.54609;
x=ukg.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.ukg.value=x;
// cu feet
cuft=l * 0.0353147;
x=cuft.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cuft.value=x;
// cu meters
cum=l * 0.001;
x=cum.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cum.value=x;
// cups
y=l * 4.22675 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cups.value=x;
// cu tblspoon
y=l * 67.6281;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.tbls.value=x;
// floz
y=l * 33.814 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.floz.value=x;
 
} 

function lc(l)
{
// gallons
g=l / 3.785411784 ;
x=g.toFixed(3);
document.forms.vol.g.value=x;
// uk gallons
ukg=l / 4.54609;
x=ukg.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.ukg.value=x;
// cu feet
cuft=l * 0.0353147;
x=cuft.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cuft.value=x;
// cu meters
cum=l * 0.001;
x=cum.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cum.value=x;
// cups
y=l * 4.22675 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cups.value=x;
// cu tblspoon
y=l * 67.6281;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.tbls.value=x;
// floz
y=l * 33.814 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.floz.value=x;
 
} 
 
function ukgc(ukg)
{
// liters
l=ukg * 4.54609 ;
x=l.toFixed(3);
document.forms.vol.l.value=x;
// gallons
g=l / 3.785411784 ;
x=g.toFixed(3);
document.forms.vol.g.value=x;
// cu feet
cuft=l * 0.0353147;
x=cuft.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cuft.value=x;
// cu meters
cum=l * 0.001;
x=cum.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cum.value=x;
// cups
y=l * 4.22675 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cups.value=x;
// cu tblspoon
y=l * 67.6281;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.tbls.value=x;
// floz
y=l * 33.814 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.floz.value=x;
 
} 
function cuftc(cuft)
{
// liters
l=cuft / 0.0353147;
x=l.toFixed(3);
document.forms.vol.l.value=x;
// gallons
g=l / 3.785411784 ;
x=g.toFixed(3);
document.forms.vol.g.value=x;
// uk gallons
ukg=l / 4.54609;
x=ukg.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.ukg.value=x;
// cu meters
cum=l * 0.001;
x=cum.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cum.value=x;
// cups
y=l * 4.22675 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cups.value=x;
// cu tblspoon
y=l * 67.6281;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.tbls.value=x;
// floz
y=l * 33.814 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.floz.value=x;
 
} 
function cumc(cum)
{
// liters
l=cum / 0.001;
x=l.toFixed(3);
document.forms.vol.l.value=x;
// gallons
g=l / 3.785411784 ;
x=g.toFixed(3);
document.forms.vol.g.value=x;
// uk gallons
ukg=l / 4.54609;
x=ukg.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.ukg.value=x;
// cu feet
cuft=l * 0.0353147;
x=cuft.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cuft.value=x;

// cups
y=l * 4.22675 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cups.value=x;
// cu tblspoon
y=l * 67.6281;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.tbls.value=x;
// floz
y=l * 33.814 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.floz.value=x;
 
} 
function cupsc(cups)
{
// liters
l=cups / 4.22675;
x=l.toFixed(3);
document.forms.vol.l.value=x;
// gallons
g=l / 3.785411784 ;
x=g.toFixed(3);
document.forms.vol.g.value=x;
// uk gallons
ukg=l / 4.54609;
x=ukg.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.ukg.value=x;
// cu feet
cuft=l * 0.0353147;
x=cuft.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cuft.value=x;
// cu meters
cum=l * 0.001;
x=cum.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cum.value=x;
//  tblspoon
y=l * 67.6281;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.tbls.value=x;
// floz
y=l * 33.814 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.floz.value=x;
 
} 
function flozc(floz)
{
// liters
l=floz / 33.814;
x=l.toFixed(3);
document.forms.vol.l.value=x;
// gallons
g=l / 3.785411784 ;
x=g.toFixed(3);
document.forms.vol.g.value=x;
// uk gallons
ukg=l / 4.54609;
x=ukg.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.ukg.value=x;
// cu feet
cuft=l * 0.0353147;
x=cuft.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cuft.value=x;
// cu meters
cum=l * 0.001;
x=cum.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cum.value=x;
// cu tblspoon
y=l * 67.6281;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.tbls.value=x;
 
} 
function tblsc(tbls)
{
// liters
l=tbls / 67.6281;
x=l.toFixed(3);
document.forms.vol.l.value=x;
// gallons
g=l / 3.785411784 ;
x=g.toFixed(3);
document.forms.vol.g.value=x;
// uk gallons
ukg=l / 4.54609;
x=ukg.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.ukg.value=x;
// cu feet
cuft=l * 0.0353147;
x=cuft.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cuft.value=x;
// cu meters
cum=l * 0.001;
x=cum.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.cum.value=x;
// floz
y=l * 33.814 ;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.vol.floz.value=x;
 
} 

//     *************************pressure****************
function psic(g)
{
y=g * 2.307;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.pressure.head.value=x;
}

function headc(g)
{
y=g * 0.43346;
x=y.toFixed(3);
if (isNaN(x)) {x=0;}
document.forms.pressure.psi.value=x;
}


//     *************************temperature****************
function farc(g)
{
y=((parseFloat(g)-32) * 5) / 9;
x=y.toFixed(1);
if (isNaN(x)) {x=0;}
document.forms.temp.cen.value=x;
}

function cenc(g)
{
y=((parseFloat(g) * 9) / 5) + 32;
x=y.toFixed(1);
if (isNaN(x)) {x=0;}
document.forms.temp.far.value=x;
}

