<!--

function reset(thisform)
{
thisform.SUnit[0].selected = true;
thisform.TUnit[0].selected = true;
thisform.SValue.value = "";
thisform.TValue.value = "";
}

function convert (thisform, limit)
{
var num1 , num2, schoice, tchoice
valid = true

for (i = 0; i < limit; i++)
if (thisform.SUnit[i].selected)
choice1 = i;

if (thisform.SValue.value == "")
{
alert("Voc\u00EA n\u00E3o digitou nenhum n\u00FAmero");
valid = false;
}

if (valid == true && thisform.SUnit[choice1].value == "")
{
alert("Por favor selecione a unidade que deseja converter");
valid = false;
}

for (i = 0; i < limit; i++)
if (thisform.TUnit[i].selected)
choice2 = i;

if (valid == true && thisform.TUnit[choice2].value == "")
{
alert("Por favor selecione para que unidade voc\u00EA deseja a convers\u00E3o");
valid = false;
}

if (valid == true)
{
if (thisform.SUnit[choice1].value == thisform.TUnit[choice2].value)
{
num2 = thisform.SValue.value;
}
num1 = thisform.SValue.value;

<!-- Length

if (thisform.SUnit[choice1].value == "mm")
{
if (thisform.TUnit[choice2].value == "cm")
num2 = num1/10;

if (thisform.TUnit[choice2].value == "m")
num2 = num1/1000;

if (thisform.TUnit[choice2].value == "km")
num2 = num1/1000000;

if (thisform.TUnit[choice2].value == "in")
num2 = num1/25.4;

if (thisform.TUnit[choice2].value == "ft")
num2 = num1/304.8;

if (thisform.TUnit[choice2].value == "yd")
num2 = num1/914.4;

if (thisform.TUnit[choice2].value == "mile")
num2 = num1/1609300;
}

if (thisform.SUnit[choice1].value == "cm")
{
if (thisform.TUnit[choice2].value == "mm")
num2 = num1*10;

if (thisform.TUnit[choice2].value == "m")
num2 = num1/100;

if (thisform.TUnit[choice2].value == "km")
num2 = num1/100000;

if (thisform.TUnit[choice2].value == "in")
num2 = num1/2.54;

if (thisform.TUnit[choice2].value == "ft")
num2 = num1/30.48;

if (thisform.TUnit[choice2].value == "yd")
num2 = num1/91.44;

if (thisform.TUnit[choice2].value == "mile")
num2 = num1/160930;
}

if (thisform.SUnit[choice1].value == "m")
{
if (thisform.TUnit[choice2].value == "mm")
num2 = num1*1000;

if (thisform.TUnit[choice2].value == "cm")
num2 = num1*100;

if (thisform.TUnit[choice2].value == "km")
num2 = num1/1000;

if (thisform.TUnit[choice2].value == "in")
num2 = num1*39.3701;

if (thisform.TUnit[choice2].value == "ft")
num2 = num1*3.2808;

if (thisform.TUnit[choice2].value == "yd")
num2 = num1*1.0936;

if (thisform.TUnit[choice2].value == "mile")
num2 = num1*0.000621;
}

if (thisform.SUnit[choice1].value == "km")
{
if (thisform.TUnit[choice2].value == "mm")
num2 = num1*1000000;

if (thisform.TUnit[choice2].value == "cm")
num2 = num1*100000;

if (thisform.TUnit[choice2].value == "m")
num2 = num1*1000;

if (thisform.TUnit[choice2].value == "in")
num2 = num1*39370.0787;

if (thisform.TUnit[choice2].value == "ft")
num2 = num1*3280.8399;

if (thisform.TUnit[choice2].value == "yd")
num2 = num1*1093.6133;

if (thisform.TUnit[choice2].value == "mile")
num2 = num1*0.621;
}

if (thisform.SUnit[choice1].value == "in")
{
if (thisform.TUnit[choice2].value == "cm")
num2 = num1*2.54;

if (thisform.TUnit[choice2].value == "m")
num2 = num1*.0254;

if (thisform.TUnit[choice2].value == "km")
num2 = num1*.0000254;

if (thisform.TUnit[choice2].value == "mm")
num2 = num1*25.4;

if (thisform.TUnit[choice2].value == "ft")
num2 = num1/12;

if (thisform.TUnit[choice2].value == "yd")
num2 = num1/36;

if (thisform.TUnit[choice2].value == "mile")
num2 = num1/63360;
}

if (thisform.SUnit[choice1].value == "ft")
{
if (thisform.TUnit[choice2].value == "cm")
num2 = num1*30.48;

if (thisform.TUnit[choice2].value == "m")
num2 = num1*.3048;

if (thisform.TUnit[choice2].value == "km")
num2 = num1*.0003048;

if (thisform.TUnit[choice2].value == "mm")
num2 = num1*304.8;

if (thisform.TUnit[choice2].value == "in")
num2 = num1*12;

if (thisform.TUnit[choice2].value == "yd")
num2 = num1/3;

if (thisform.TUnit[choice2].value == "mile")
num2 = num1/5280;
}

if (thisform.SUnit[choice1].value == "yd")
{
if (thisform.TUnit[choice2].value == "cm")
num2 = num1*91.44;

if (thisform.TUnit[choice2].value == "m")
num2 = num1*0.9144;

if (thisform.TUnit[choice2].value == "km")
num2 = num1*0.0009144;

if (thisform.TUnit[choice2].value == "in")
num2 = num1*36;

if (thisform.TUnit[choice2].value == "ft")
num2 = num1*3;

if (thisform.TUnit[choice2].value == "mm")
num2 = num1*914.4;

if (thisform.TUnit[choice2].value == "mile")
num2 = num1/1760;
}

if (thisform.SUnit[choice1].value == "mile")
{
if (thisform.TUnit[choice2].value == "cm")
num2 = num1*160930;

if (thisform.TUnit[choice2].value == "m")
num2 = num1*1609.3;

if (thisform.TUnit[choice2].value == "km")
num2 = num1*1.6093;

if (thisform.TUnit[choice2].value == "in")
num2 = num1*63360;

if (thisform.TUnit[choice2].value == "ft")
num2 = num1*5280;

if (thisform.TUnit[choice2].value == "yd")
num2 = num1*1760;

if (thisform.TUnit[choice2].value == "mm")
num2 = num1*1609300;
}

<!-- Weight

if (thisform.SUnit[choice1].value == "mg")
{
if (thisform.TUnit[choice2].value == "g")
num2 = num1/1000;

if (thisform.TUnit[choice2].value == "kg")
num2 = num1/1000000;

if (thisform.TUnit[choice2].value == "tonne")
num2 = num1/1000000000;

if (thisform.TUnit[choice2].value == "oz")
num2 = num1*0.0000353;

if (thisform.TUnit[choice2].value == "lb")
num2 = num1*0.000002206;

if (thisform.TUnit[choice2].value == "stone")
num2 = num1*0.000000157;

}

if (thisform.SUnit[choice1].value == "g")
{
if (thisform.TUnit[choice2].value == "mg")
num2 = num1*1000;

if (thisform.TUnit[choice2].value == "kg")
num2 = num1/1000;

if (thisform.TUnit[choice2].value == "tonne")
num2 = num1/100000;

if (thisform.TUnit[choice2].value == "oz")
num2 = num1*0.0353;

if (thisform.TUnit[choice2].value == "lb")
num2 = num1*0.00220625;

if (thisform.TUnit[choice2].value == "stone")
num2 = num1*0.000157;
}

if (thisform.SUnit[choice1].value == "kg")
{
if (thisform.TUnit[choice2].value == "mg")
num2 = num1*1000000;

if (thisform.TUnit[choice2].value == "g")
num2 = num1*1000;

if (thisform.TUnit[choice2].value == "tonne")
num2 = num1/1000;

if (thisform.TUnit[choice2].value == "oz")
num2 = num1*35.3;

if (thisform.TUnit[choice2].value == "lb")
num2 = num1*2.2046;

if (thisform.TUnit[choice2].value == "stone")
num2 = num1*0.15747;
}

if (thisform.SUnit[choice1].value == "tonne")
{
if (thisform.TUnit[choice2].value == "mg")
num2 = num1*1000000000;

if (thisform.TUnit[choice2].value == "g")
num2 = num1*1000000;

if (thisform.TUnit[choice2].value == "kg")
num2 = num1*1000;

if (thisform.TUnit[choice2].value == "oz")
num2 = num1*35300;

if (thisform.TUnit[choice2].value == "lb")
num2 = num1*2206.25;

if (thisform.TUnit[choice2].value == "stone")
num2 = num1*6350.3;
}

if (thisform.SUnit[choice1].value == "oz")
{
if (thisform.TUnit[choice2].value == "mg")
num2 = num1*28350;

if (thisform.TUnit[choice2].value == "g")
num2 = num1*28.350;

if (thisform.TUnit[choice2].value == "kg")
num2 = num1*0.02835;

if (thisform.TUnit[choice2].value == "tonne")
num2 = num1*0.00002835;

if (thisform.TUnit[choice2].value == "lb")
num2 = num1/16;

if (thisform.TUnit[choice2].value == "stone")
num2 = num1/224;
}

if (thisform.SUnit[choice1].value == "lb")
{
if (thisform.TUnit[choice2].value == "mg")
num2 = num1*453600;

if (thisform.TUnit[choice2].value == "g")
num2 = num1*453.6;

if (thisform.TUnit[choice2].value == "kg")
num2 = num1*0.4536;

if (thisform.TUnit[choice2].value == "tonne")
num2 = num1*0.0004536;

if (thisform.TUnit[choice2].value == "oz")
num2 = num1*16;

if (thisform.TUnit[choice2].value == "stone")
num2 = num1/14;

}

if (thisform.SUnit[choice1].value == "stone")
{
if (thisform.TUnit[choice2].value == "mg")
num2 = num1*6350300;

if (thisform.TUnit[choice2].value == "g")
num2 = num1*6350.3

if (thisform.TUnit[choice2].value == "kg")
num2 = num1*6.3503;

if (thisform.TUnit[choice2].value == "tonne")
num2 = num1*0.0063503;

if (thisform.TUnit[choice2].value == "oz")
num2 = num1*224;

if (thisform.TUnit[choice2].value == "lb")
num2 = num1*14;

}

<!-- Capacity

if (thisform.SUnit[choice1].value == "ml")
{
if (thisform.TUnit[choice2].value == "l")
num2 = num1/1000;

if (thisform.TUnit[choice2].value == "floz")
num2 = num1/1000000;

if (thisform.TUnit[choice2].value == "pt")
num2 = num1/1000000000;

if (thisform.TUnit[choice2].value == "gn")
num2 = num1*0.22;

if (thisform.TUnit[choice2].value == "qt")
num2 = num1*0.000002206;
}

if (thisform.SUnit[choice1].value == "l")
{
if (thisform.TUnit[choice2].value == "ml")
num2 = num1/1000;

if (thisform.TUnit[choice2].value == "floz")
num2 = num1*35.1927;

if (thisform.TUnit[choice2].value == "pt")
num2 = num1/0.5683;

if (thisform.TUnit[choice2].value == "gn")
num2 = num1/4.5461;

if (thisform.TUnit[choice2].value == "qt")
num2 = num1/1.1365;
}

if (thisform.SUnit[choice1].value == "floz")
{
if (thisform.TUnit[choice2].value == "ml")
num2 = num1*0.000028415;

if (thisform.TUnit[choice2].value == "l")
num2 = num1*0.028415;

if (thisform.TUnit[choice2].value == "pt")
num2 = num1*0.05;

if (thisform.TUnit[choice2].value == "gn")
num2 = num1*0.00625;

if (thisform.TUnit[choice2].value == "qt")
num2 = num1*0.025;
}

if (thisform.SUnit[choice1].value == "pt")
{
if (thisform.TUnit[choice2].value == "l")
num2 = num1*0.5683;

if (thisform.TUnit[choice2].value == "floz")
num2 = num1*20;

if (thisform.TUnit[choice2].value == "ml")
num2 = num1*568.3;

if (thisform.TUnit[choice2].value == "gn")
num2 = num1*0.125;

if (thisform.TUnit[choice2].value == "qt")
num2 = num1*0.5;
}

if (thisform.SUnit[choice1].value == "gn")
{
if (thisform.TUnit[choice2].value == "l")
num2 = num1*4.5461;

if (thisform.TUnit[choice2].value == "floz")
num2 = num1*160;

if (thisform.TUnit[choice2].value == "pt")
num2 = num1*8;

if (thisform.TUnit[choice2].value == "ml")
num2 = num1*4546.1;

if (thisform.TUnit[choice2].value == "qt")
num2 = num1*4;
}

if (thisform.SUnit[choice1].value == "qt")
{
if (thisform.TUnit[choice2].value == "l")
num2 = num1*1.1365

if (thisform.TUnit[choice2].value == "floz")
num2 = num1*40

if (thisform.TUnit[choice2].value == "pt")
num2 = num1*2;

if (thisform.TUnit[choice2].value == "gn")
num2 = num1*0.25;

if (thisform.TUnit[choice2].value == "ml")
num2 = num1*1136.5;
}

<!-- Temperature		

if (thisform.SUnit[choice1].value == "c")
{
if (thisform.TUnit[choice2].value == "f")
num2 = (9/5)*num1 + 32;
}

if (thisform.SUnit[choice1].value == "f")
{
if (thisform.TUnit[choice2].value == "c")
num2 = (5/9)*(num1 - 32)
}

thisform.TValue.value = num2;
}
}

//-->