/*
 * Telescope calculation function.
 * By Dave Pearson <davep@davep.org>
 */

function doTelescope()
{
   var result        = document.getElementById( "telescopeResult" );
   var scopeFL       = document.getElementById( "scopeFocalLength" ).value;
   var scopeAperture = document.getElementById( "scopeAperture" ).value;
   var epFL          = document.getElementById( "epFocalLength" ).value;
   var magnification = scopeFL / epFL;
   var fRatio        = scopeFL / scopeAperture;

   if ( isNaN( magnification ) || isNaN( fRatio ) )
   {
      result.innerHTML = "Input Error";
   }
   else
   {
      result.innerHTML = "Focal Ratio of the telescope: " + StringifyFloat( fRatio, 2 ) +
         "<br />Magnification with given eyepiece: " + StringifyFloat( magnification, 2 );
   }
}
