function ComputeDisplace()
    {
        var bore = 0
        var str = 0
        var numCyl = 0
        var disp = 0

    while (bore == 0)
         {
         bore = prompt("Enter BORE of your engine in inches - ", 0);
         }

      while (str == "0")
         {
         str = prompt("Enter STROKE of your engine in inches - ", 0);
         }

      while (numCyl == "0")
         {
         numCyl = prompt("Enter the NUMBER OF CYLINDERS in your engine - ", 0);
         }

      if (bore != 0)
         {
         disp = (bore * bore) * str * (0.7854 * numCyl)
         disp = disp + " "
         alert("Your engine DISPLACEMENT is " + disp.substring(0,6) + " cubic inches")
         }
   }

function hgVol()
   {
      var gVol = 0 // head gasket volume, what we're solving for
      var bore = 0 // bore of head gasket
      var thk = 0   // compressed head gasket thickness

      while (bore == 0)
         {
         bore = prompt("Enter BORE of your head gasket in inches - ", 0);
         }

      while (thk == "0")
         {
         thk = prompt("Enter the COMPRESSED GASKET THICKNESS of your gasket in decimal inches - ", 0);
         }

      if (bore != 0)
         {
         gVol = (bore * bore) * thk * 12.87
         gVol = gVol + " "
         alert("Your HEAD GASKET VOLUME is " + gVol.substring(0,6) + " cubic inches")
         }
   }


function PistSpd()
   {
   var pspd    = 0  // piston speed, what we're solving for
   var str = 0  // the stroke of the engine
   var RPM = 0  // the RPM we're interested in
   while (str == 0)
      {
         str = prompt("Enter the STROKE of the engine in inches - ", 0);
      }
   while (RPM == 0)
      {
         RPM = prompt ("Enter the RPM you're interested in - ", 0);
      }
   pspd = (str * RPM) / 6
   pspd = pspd + " "
   if (pspd != 0)
   {
      alert("The PISTON SPEED at " + RPM + " RPM is " + pspd.substring(0,5) + " FPM");
   }
}


function ComputeCompRatio()
   {
      var disp = 0		   // engine displacement
      var cVol  = 0		   // chamber volume
      var cRat  = 0		   // compression ratio, what we're
	  	  		  		   //    solving for

      while (disp == 0)
         {
         disp = prompt("Enter DISPLACEMENT of one cylinder in cubic inches - ", 0);
         }

      while (cVol == 0)
         {
         cVol = prompt("Enter CHAMBER VOLUME of one cylinder in cubic inches - ", 0);
         }

      if (disp != 0)
         {
        cRat = ((disp * 1) + (cVol * 1)) / cVol;
        cRat = cRat + " "
        alert("Your engine COMPRESSION RATIO is " + cRat.substring(0,4) + " : 1");
        }
   }


function CompAmtMill()
   {
      var oldCR = 0	  // old compression ratio
      var newCR  = 0  // new compression ratio
      var str = 0  	  // stroke
      var amtMill = 0 // amount to mill from head

      while (oldCR == 0)
         {
         oldCR = prompt("Enter your old COMPRESSION RATIO - ", 0);
         }

      while (newCR == 0)
         {
         newCR = prompt("Enter the desired NEW COMPRESSION RATIO - ", 0);
         }

      while (str == 0)
         {
         str = prompt("Enter your engine's STROKE  - ", 0);
         }

      if (oldCR != 0)
         {
         amtMill = (((newCR - 1) - (oldCR - 1)) / ((newCR - 1) * (oldCR - 1))) * str;
         amtMill = amtMill + " "
         alert("The AMOUNT TO MILL from your head is " + amtMill.substring(0,5));
         }
   }


