/*
Science & Engineering Encyclopaedia. Copyright Dirac Delta Consultants Ltd. 2001-2002

No part of this document may be reproduced or transmitted in any form or by any mean, electronic or mechanical, including printing, placing on the internet or by any information storage and retrieval system without permission from the Publisher in writing
*/
function f1from1to2(){
f11=parseFloat(document.Conversion.F11.value)

if (mconv!=0.0)
document.Conversion.F12.value=(f11-cconv)*(1/mconv)

else
document.Conversion.F12.value=f11-cconv


}

function f1from2to1(){
f12=parseFloat(document.Conversion.F12.value)
if (mconv==0.0)
document.Conversion.F11.value=f12+cconv

else
document.Conversion.F11.value=f12*mconv+cconv


}



function clip(){
txturl=document.location
clipwindow=open("", "clipboardWindow", "scrollbars=yes, width=300, height=400")
clipwindow.focus();
clipwindow.document.writeln('<title>Clipboard</title>')
clipwindow.document.writeln('<body vlink=blue link=blue>')
clipwindow.document.writeln('<p><b><a href="' + txturl + '" target="main">' + ttle + ' Unit Conversion</a></b></p>')
clipwindow.document.writeln('<table border=0>')
clipwindow.document.writeln('<tr><td align=left><font size=-1>')
clipwindow.document.writeln(parseFloat(document.Conversion.F11.value))
clipwindow.document.writeln('</font></td><td align=right><font size=-1>' + xiunt + ' =</font></td><td align=right><font size=-1>')
clipwindow.document.writeln('</font></td><td align=left><font size=-1>')
clipwindow.document.writeln(parseFloat(document.Conversion.F12.value))
clipwindow.document.writeln('</font></td><td align=right><font size=-1>' + yiunt + '</font></td></tr></table>')
clipwindow.document.writeln('<hr>')
}

document.writeln('<FORM NAME="Conversion">')

document.writeln('<Table id="convertjs">')
document.writeln('<caption>Convert: &nbsp; &nbsp;' + xiunt + ' &lt;--&gt; ' + yiunt + '</caption>')
document.writeln('<TR><TD align="right" width="180"><INPUT TYPE="TEXT" Name="F11" SIZE="20" ONBLUR="f1from1to2()"></TD>')
document.writeln('<TD align="left" width="50">' + xiunt + '</TD>')
document.writeln('<TD align="center" width="50"><INPUT TYPE="BUTTON" Name="Calculate" Value = "< - >" Size="5"></TD>')
document.writeln('<TD align="right" width="180"><INPUT TYPE="TEXT" Name="F12" SIZE="20" ONBLUR="f1from2to1()"></TD>')
document.writeln('<TD align="left" width="50">' + yiunt + '</TD>')
document.writeln('<TD align="right"><a href="javascript:clip()"><img src="../../../images/clip.gif" width=30 height=25 border=0 alt="paste results in clipboard"></a></td>')
document.writeln('</TR>')


if (mconv==0.0){
document.writeln('<TR><TD align=center colspan=6><font size=-1>' + (cconv) + ' ' + xiunt + ' = 0 ' + yiunt + '</font></TD></TR>')
}else{
document.writeln('<TR><TD align=center colspan=6><font size=-1>' + (mconv * 1.0 + cconv) + ' ' + xiunt + ' = 1 ' + yiunt + '</font></TD></TR>')
}

document.writeln('</table>')


document.writeln('</form>')