/* Module:	tca.js
   Version:     1.0.0
   Date:        6/26/2004
   Programmer:  M. Kevin Jackson
   Description: This module provides a conversion utility between
                celsius and fahrenheit temperature scales
*/

/*
 The Tc2Tf function accepts one paramater.  
 The expected parameter is a temperature value in celsius scale.
*/
function Tc2Tf(Tc)
{
    var Tf=((9/5)*Tc)+32;
    return Tf;
}

/*
 The Tf2Tc function accepts one parameter.
 The expected parameter is a temperature value in fahrenheit scale.
*/
function Tf2Tc(Tf)
{
    var Tc=(5/9)*(Tf-32);
    return Tc
}

/*
 The compute function accepts one parameter.
 The expected parameter is a form object.  The function will evaluate
 the scale radio button to determine scale of the temperature value
 If the scale is Celsius then it will call Tc2Tf function to calculate
 the result.
*/
function compute(f)
{
    if (f.scale[0].checked == "1") {
      f.result.value = Tc2Tf(f.temp.value);
      f.r_scale.value = "F";
    }
    if (f.scale[1].checked == "1") {
      f.result.value = Tf2Tc(f.temp.value);
      f.r_scale.value = "C";
    }
}

