var isEqual = true;
var isRequiredMore = false;
var isIngredientMore = false;

function CalculateText(RatioMulti) {
   if (isIngredientMore == true) {
      return (RatioMulti + " times more crafting machines creating the <strong>product</strong>.");
   }
   if (isRequiredMore == true) {
      return (RatioMulti + " times more crafting machines creating the <strong>ingredient</strong>.");
   }
   if (isEqual == true) {
      return "an <strong>equal</strong> amount of crafting machines creating the ingredient and the product.";
   }
}

function CalculateRatio() {
   isRequiredMore = false;
   isIngredientMore = false;
   isEqual = false;
   var TimeToCreateInSecIngredient = document.getElementById("IngredientTime").value;
   var ItemsProduced = document.getElementById("IngredientNumber").value;
   var CraftingSpeedIngredient = document.getElementById("IngredientSpeed").value;
   var TimeToCreateInSecProduct = document.getElementById("ProductTime").value;
   var ItemsRequired = document.getElementById("ProductNumber").value;
   var CraftingSpeedProduct = document.getElementById("ProductSpeed").value;
   console.log("wasd");
   if (TimeToCreateInSecIngredient !== TimeToCreateInSecIngredient) {
      console.log("wasd");
      return 0;
   }
   //console.log(TimeToCreateInSecIngredient, ItemsProduced, CraftingSpeedIngredient, TimeToCreateInSecProduct, ItemsRequired, CraftingSpeedProduct);

   var IngredientTimePerRecipeInSec = TimeToCreateInSecIngredient / CraftingSpeedIngredient;
   var RequiredTimePerRecipeInSec = TimeToCreateInSecProduct / CraftingSpeedProduct;
   var IngredientTimesPerMinute = 60 / IngredientTimePerRecipeInSec;
   var RequiredTimesPerMinute = 60 / RequiredTimePerRecipeInSec;
   var IngredientPerMinute = IngredientTimesPerMinute * ItemsProduced;
   var RequiredPerMinute = RequiredTimesPerMinute * ItemsRequired;
   var PerSI = IngredientPerMinute / 60;
   var PerSR = RequiredPerMinute / 60;

   document.getElementById("ipm").innerHTML = "Ingredients produced per <strong>minute</strong> by one crafting machine: " + IngredientPerMinute;
   document.getElementById("rpm").innerHTML = "Required ingredients per <strong>minute</strong> for one crafting machine: " + RequiredPerMinute;
   document.getElementById("psi").innerHTML = "Ingredients produced per <strong>second</strong> by one crafting machine: " + PerSI;
   document.getElementById("psr").innerHTML = "Required ingredients per <strong>second</strong> for one crafting machine: " + PerSR;

   var RatioMulti;

   if (IngredientPerMinute > RequiredPerMinute && IngredientPerMinute != RequiredPerMinute) {
      RatioMulti = (IngredientPerMinute / RequiredPerMinute);
      isIngredientMore = true;
   }
   if (IngredientPerMinute < RequiredPerMinute && IngredientPerMinute != RequiredPerMinute) {
      RatioMulti = (RequiredPerMinute / IngredientPerMinute);
      isRequiredMore = true;
   }
   if (IngredientPerMinute == RequiredPerMinute) {
      RatioMulti = (RequiredPerMinute / RequiredPerMinute);
      isEqual = true;
   }

   //console.log("RatioMulti: ", RatioMulti);

   document.getElementById("ratiomulti").innerHTML = "RatioMultiplier: " + "<strong>" + RatioMulti + "</strong>";
   document.getElementById("need").innerHTML = "Which means you need " + CalculateText(RatioMulti);

   var max = (IngredientPerMinute > RequiredPerMinute) ? IngredientPerMinute : RequiredPerMinute;
   //console.log(max);
   while (true) {
      if ((max % IngredientPerMinute == 0 && max % RequiredPerMinute == 0) || isNaN(max) || max == 0 || !isFinite(RatioMulti)) {
         break;
      } else ++max;
   }
   var IngredientRatio = max / IngredientPerMinute;
   var ProductRatio = max / RequiredPerMinute;
   //console.log(ProductRatio);
   document.getElementById("ratio").innerHTML = ("Ratio: " + IngredientRatio + ":" + ProductRatio);
}
@@ -1113,300 +1113,8 @@
 lue;
-%0A   console.log(%22wasd%22);%0A   if (TimeToCreateInSecIngredient !== TimeToCreateInSecIngredient) %7B%0A      console.log(%22wasd%22);%0A      return 0;%0A   %7D%0A   //console.log(TimeToCreateInSecIngredient, ItemsProduced, CraftingSpeedIngredient, TimeToCreateInSecProduct, ItemsRequired, CraftingSpeedProduct);
 %0A%0A  
@@ -2744,55 +2744,8 @@
  %7D%0A%0A
-   //console.log(%22RatioMulti: %22, RatioMulti);%0A%0A
    d
@@ -2854,16 +2854,16 @@
 rong%3E%22;%0A
+
    docum
@@ -3057,31 +3057,9 @@
 te;%0A
-   //console.log(max);
 %0A
+
    w
@@ -3345,39 +3345,8 @@
 te;%0A
-   //console.log(ProductRatio);
 %0A   

remove test code