/*
   JavaScript Temperature Converter
   Created 9/16/98 by Michael Jones

   Include the following code where you want the converter to appear on the page
   The "Float" button will open a small separate window containing only the converter
*/

function FtoC()
  { var RawCtemp = 5/9 * (document.TempConversion.Ftemp.value-32);
    document.TempConversion.Ctemp.value = Math.round(100*RawCtemp)/100 }

function CtoF()
  { var RawFtemp = (9/5) * document.TempConversion.Ctemp.value + 32;
    document.TempConversion.Ftemp.value = Math.round(100*RawFtemp)/100 }

function FloatMe()
  { var FloatAtt = "height=140,width=250,menubar=no,toolbar=no,scrollbars=no,status=no";
    TempConvWindow = window.open("","FloatWindow",FloatAtt);
    TempConvWindow.document.write ('<HTML><HEAD><TITLE>Temperature Converter</TITLE></HEAD><BODY>');
    TempConvWindow.document.write ('<center><B>Temperature Converter</B></CENTER>');
    TempConvWindow.document.write ('<SCRIPT LANGUAGE="JavaScript" src="tempconvert.js"></SCRIPT>');
    TempConvWindow.document.write ('</BODY></HTML>'); }

if (window.name != "FloatWindow")
  { document.write ('<table border=1 cellpadding=5><tr><td align=center>'); }
document.write ('<FORM name="TempConversion"><TABLE border=0>');
// document.write ('<TR><TH colspan=2 align=center>Temperature Conversion</TH></TR>');
document.write ('<TR><TD align=center width=50%>Fahrenheit<BR>');
document.write ('<INPUT TYPE="TEXT" NAME="Ftemp" SIZE="5" MAXLENGTH="5" onChange="FtoC()">');
document.write ('</TD><TD align=center>Celsius<BR>');
document.write ('<INPUT TYPE="TEXT" NAME="Ctemp" SIZE="5" MAXLENGTH="5" onChange="CtoF()"></TD>');
document.write ('</TR><TR><TD colspan=2 align=center>');
document.write ('<small>Enter one value and click on the other to<BR>display the converted temperature.</small>');
if (window.name != "FloatWindow")
  { document.write ('<p><INPUT TYPE="button" VALUE="Float" onClick="FloatMe()"'); }
document.write ('</TD></TR></TABLE></FORM>');
if (window.name != "FloatWindow")
  { document.write ('</td></tr></table>'); }
