function PrimRatio()
{
   var mtrSpkt = 0	// number of teeth on motor sprocket
   var cltchBskt = 0 // number of teeth on clutch basket
   var pr = 0	 // primary ratio, what we're solving for

   while (mtrSpkt == 0)
      {
      mtrSpkt = prompt("Enter the number of teeth on your ENGINE SPROCKET - ", 0);
      mtrSpkt = mtrSpkt * 1;
      }

   while (cltchBskt == 0)
      {
      cltchBskt = prompt("Enter the number of teeth on your CLUTCH BASKET - ", 0);
      cltchBskt = cltchBskt * 1;
      }
      pr = cltchBskt / mtrSpkt;
      pr = pr + " ";

   if (pr != 0)
      {
      alert("Your PRIMARY GEAR ratio is " + pr.substring(0,5) + " : 1");
      }
}


function SecondRatio()
    {
    var trannyTeeth = 0 // number of teeth on tranny
    var wheelTeeth = 0  // number of teeth on rear wheel
    var sr = 0	 // seconary ratio, what we're solving for

      while (trannyTeeth == 0)
         {
         trannyTeeth = prompt("Enter number of teeth on your TRANNY GEAR - ", 0);
         }

      while (wheelTeeth == "0")
         {
         wheelTeeth = prompt("Enter number of teeth on your REAR WHEEL - ", 0);
         }
         sr = wheelTeeth/trannyTeeth
         sr = sr + " "

      if (sr != 0)
         {
         alert("Your SECONDARY GEAR ratio is " + sr.substring(0,5) + "  :  1")
         }
   }


function FnlDrvRat()
{
   var pr = 0           // primary drive ratio
   var sr = 0           // secodary ratio
   var fdr = 0          // final drive ratio, what we're solving for

   while (pr == 0)
      {
      pr = prompt("Enter your PRIMARY GEAR RATIO - ", 0);
      }

   while (sr == 0)
      {
      sr = prompt("Enter your SECONDARY GEAR RATIO - ", 0);
      }
   fdr = pr * sr;
   fdr = fdr + " ";
   if (fdr != 0)
      {
      alert("Your FINAL DRIVE ratio is " + fdr.substring(0,5) + " : 1");
      }
}

function OvrallRat()
   {
   var ir = 0           // internal ratio
   var fdr = 0          // final drive ratio
   var or = 0           // overall ratio, what we're solving for

   while (ir == 0)
      {
      ir = prompt("Enter your INTERNAL GEAR RATIO - ", 0);
      }

   while (fdr == 0)
      {
      fdr = prompt("Enter your FINAL GEAR RATIO - ", 0);
      }
      or = ir * fdr;
      or = or + " ";
   if (or != 0)
      {
      alert("Your OVERALL GEAR ratio is " + or.substring(0,5) + " : 1");
      }
}


function ShiftRPM()
{
    var rpmafter = 0.0          // rpm after shift
    var ratiointo = 0.0         // gear ratio shifting into
    var ratiofrom = 0.0         // gear ratio shifting from
    var rpmbefore = 0.0         // rpm before shift

    while (ratiointo == 0)
    {
        ratiointo = prompt("Enter the GEAR RATIO you are shifting into - ", 0);
        ratiointo = ratiointo * 1;
    }

    while (ratiofrom == 0)
    {
        ratiofrom = prompt("Enter the GEAR RATIO you are shifting from - ", 0);
        ratiofrom = ratiofrom * 1;
    }

    while (rpmbefore == 0)
    {
        rpmbefore = prompt("Enter the RPM at which you shift - ", 0);
        rpmbefore = rpmbefore * 1;
    }

    rpmafter = (ratiointo/ratiofrom) * rpmbefore;
    rpmafter = rpmafter + " ";
    if (rpmafter != 0)
    {
        alert("Your RPM after shift is " + rpmafter.substring(0,8) + " ");
    }
}


function force()
    {
    var trq = 0          // torque
    var dts = 0          // diameter tranny sprocket
    var dws = 0          // diameter wheel sprocket
    var rr  = 0          // rolling radius of rear wheel
    var frc = 0          // force, what we're solving for
    var ttrq = 0         // temporary torque value
    var tfrc = 0         // temporary force value

    while (trq == 0)
        {
            trq = prompt("Enter your TORQUE - ", 0);
        }

   while (dts == 0)
      {
      dts = prompt("Enter the DIAMETER OF YOUR TRANNY SPROCKET (IN FEET) - ", 0);
      }

   while (dws == 0)
      {
      dws = prompt("Enter the DIAMETER OF YOUR WHEEL SPROCKET (IN FEET) - ", 0);
      }

    while (rr == 0)
    {
        rr = prompt("Enter the ROLLING RADIUS OF YOUR REAR WHEEL (IN FEET) - ", 0);
    }

        tfrc = trq/(.5 * dts);
        ttrq = tfrc * (.5 * dws);
        frc = ttrq * rr;
        frc = frc + " ";
    if (frc != 0)
      {
      alert("The FORCE at your rear wheel is " + frc.substring(0,7));
      }
}



