Difference between revisions of "MediaWiki:Calculator.js/Mana Regeneration.js"

m
m
 
Line 2: Line 2:
 
  * Calculator that calculates your mana regenerated per second based on Meditation, Focus, Intelligence, and equipped MR.
 
  * Calculator that calculates your mana regenerated per second based on Meditation, Focus, Intelligence, and equipped MR.
 
  */
 
  */
var ManaPerSecondCalculator = Calculator.extend({
+
function ManaPerSecondCalculator() {
     init: function() {
+
     var calculate = function(meditation, focus, int, mr, passive, active, nonMed) {
        var calculate = function(meditation, focus, int, mr, passive, active, nonMed) {
+
        var gmBonus = 1.0;
            var gmBonus = 1.0;
+
        if (!meditation.value || !isNumeric(meditation.value)) {
            if (!meditation.value || !isNumeric(meditation.value)) {
+
            meditation.value = '0.0';
                meditation.value = '0.0';
+
        } else if (meditation.value >= 100) {
            } else if (meditation.value >= 100) {
+
            gmBonus = 1.1;
                gmBonus = 1.1;
+
            if (meditation.value > 120) {
                if (meditation.value > 120) {
+
                meditation.value = '120.0'
                    meditation.value = '120.0'
+
                }
+
            }
+
            if (!focus.value || !isNumeric(focus.value)) {
+
                focus.value = '0.0';
+
            } else if (focus.value > 120) {
+
                focus.value = '120.0';
+
            }
+
            if (!int.value || !isNumeric(int.value)) {
+
                int.value = '0';
+
            } else if (int.value > 168) {
+
                int.value = '168';
+
            }
+
            if (!mr.value || !isNumeric(mr.value)) {
+
                mr.value = '0';
+
 
             }
 
             }
 +
        }
 +
        if (!focus.value || !isNumeric(focus.value)) {
 +
            focus.value = '0.0';
 +
        } else if (focus.value > 120) {
 +
            focus.value = '120.0';
 +
        }
 +
        if (!int.value || !isNumeric(int.value)) {
 +
            int.value = '0';
 +
        } else if (int.value > 168) {
 +
            int.value = '168';
 +
        }
 +
        if (!mr.value || !isNumeric(mr.value)) {
 +
            mr.value = '0';
 +
        }
  
            var baseRate = 0.2;
+
        var baseRate = 0.2;
            var focusBonus = parseFloat(focus.value) / 200;
+
        var focusBonus = parseFloat(focus.value) / 200;
            var medBonus = gmBonus * ((0.0075 * parseFloat(meditation.value)) + (0.0025 * parseFloat(int.value)));
+
        var medBonus = gmBonus * ((0.0075 * parseFloat(meditation.value)) + (0.0025 * parseFloat(int.value)));
            var finalItemBonus = 0;
+
        var finalItemBonus = 0;
            if (parseFloat(mr.value) > 0) {
+
        if (parseFloat(mr.value) > 0) {
                var baseItemBonus = ((((parseFloat(meditation.value) / 2) + (parseFloat(focus.value) / 4)) / 90) * 0.65) + 2.35;
+
            var baseItemBonus = ((((parseFloat(meditation.value) / 2) + (parseFloat(focus.value) / 4)) / 90) * 0.65) + 2.35;
                var intensityBonus = Math.min(Math.sqrt(parseFloat(mr.value)), 5.5);
+
            var intensityBonus = Math.min(Math.sqrt(parseFloat(mr.value)), 5.5);
                finalItemBonus = ((baseItemBonus * intensityBonus) - (baseItemBonus - 1)) / 10;
+
            finalItemBonus = ((baseItemBonus * intensityBonus) - (baseItemBonus - 1)) / 10;
            }
+
        }
            var manaPerSecond = baseRate + focusBonus + medBonus + finalItemBonus;
+
        var manaPerSecond = baseRate + focusBonus + medBonus + finalItemBonus;
            manaPerSecond = manaPerSecond.toFixed(4);
+
        manaPerSecond = manaPerSecond.toFixed(4);
            removeChildren(passive);
+
        removeChildren(passive);
            passive.appendChild(document.createTextNode(manaPerSecond + ' MPS'));
+
        passive.appendChild(document.createTextNode(manaPerSecond + ' MPS'));
            manaPerSecond = baseRate + focusBonus + (2 * medBonus) + finalItemBonus;
+
        manaPerSecond = baseRate + focusBonus + (2 * medBonus) + finalItemBonus;
            manaPerSecond = manaPerSecond.toFixed(4);
+
        manaPerSecond = manaPerSecond.toFixed(4);
            removeChildren(active);
+
        removeChildren(active);
            active.appendChild(document.createTextNode(manaPerSecond + ' MPS'));
+
        active.appendChild(document.createTextNode(manaPerSecond + ' MPS'));
            manaPerSecond = baseRate + focusBonus + finalItemBonus;
+
        manaPerSecond = baseRate + focusBonus + finalItemBonus;
            manaPerSecond = manaPerSecond.toFixed(4);
+
        manaPerSecond = manaPerSecond.toFixed(4);
            removeChildren(nonMed);
+
        removeChildren(nonMed);
            nonMed.appendChild(document.createTextNode(manaPerSecond + ' MPS'));
+
        nonMed.appendChild(document.createTextNode(manaPerSecond + ' MPS'));
        };
+
    };
        var resetCalculator = function() {
+
            meditationInput.value = '';
+
            focusInput.value = '';
+
            intInput.value = '';
+
            mrInput.value = '';
+
            removeChildren(passivePerSecond);
+
            passivePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
+
            removeChildren(activePerSecond);
+
            activePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
+
            removeChildren(nonMedPerSecond);
+
            nonMedPerSecond.appendChild(document.createTextNode('0.0000 MPS'));
+
            meditationInput.focus();
+
        };
+
        var detectKey = function(keyEvent) {
+
            var keyID = window.event ? event.keyCode : keyEvent.keyCode;
+
            if (keyID == 13)
+
                calculate(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
+
            else if (keyID == 27)
+
                resetCalculator(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
+
        };
+
        var calcTableRow = document.createElement('tr');
+
        var calcTableCell = document.createElement('td');
+
        calcTableRow.appendChild(calcTableCell);
+
  
        var innerTable = document.createElement('table');
+
    var resetCalculator = function() {
         innerTable.style.borderCollapse = 'collapse';
+
        meditationInput.value = '';
         calcTableCell.appendChild(innerTable);
+
        focusInput.value = '';
 +
        intInput.value = '';
 +
        mrInput.value = '';
 +
        removeChildren(passivePerSecond);
 +
        passivePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
 +
         removeChildren(activePerSecond);
 +
        activePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
 +
         removeChildren(nonMedPerSecond);
 +
        nonMedPerSecond.appendChild(document.createTextNode('0.0000 MPS'));
 +
        meditationInput.focus();
 +
    };
  
         var innerBody = document.createElement('tbody');
+
    var detectKey = function(keyEvent) {
         innerTable.appendChild(innerBody);
+
         var keyID = window.event ? event.keyCode : keyEvent.keyCode;
 +
        if (keyID == 13)
 +
            calculate(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
 +
         else if (keyID == 27)
 +
            resetCalculator(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
 +
    };
  
        var innerRow = document.createElement('tr');
+
    var calcTableRow = document.createElement('tr');
 +
    var calcTableCell = document.createElement('td');
 +
    calcTableRow.appendChild(calcTableCell);
  
        var innerCell = document.createElement('td');
+
    var innerTable = document.createElement('table');
        innerCell.style.textAlign = 'right';
+
    innerTable.style.borderCollapse = 'collapse';
        innerCell.appendChild(document.createTextNode('Meditation:'));
+
    calcTableCell.appendChild(innerTable);
        innerRow.appendChild(innerCell);
+
  
        var meditationInput = document.createElement('input');
+
    var innerBody = document.createElement('tbody');
        meditationInput.maxLength = '5';
+
    innerTable.appendChild(innerBody);
        meditationInput.type = 'text';
+
        meditationInput.style.width = '50px';
+
        meditationInput.onkeyup = function(keyEvent) {
+
            detectKey(keyEvent);
+
        };
+
innerCell = document.createElement('td');
+
        innerCell.style.textAlign = 'left';
+
        innerCell.appendChild(meditationInput);
+
        innerRow.appendChild(innerCell);
+
        innerBody.appendChild(innerRow);
+
  
innerCell = document.createElement('td');
+
    var innerRow = document.createElement('tr');
        innerCell.style.textAlign = 'right';
+
        innerCell.appendChild(document.createTextNode('Focus:'));
+
        innerRow = document.createElement('tr');
+
        innerRow.appendChild(innerCell);
+
  
        var focusInput = document.createElement('input');
+
    var innerCell = document.createElement('td');
        focusInput.maxLength = '5';
+
    innerCell.style.textAlign = 'right';
        focusInput.type = 'text';
+
    innerCell.appendChild(document.createTextNode('Meditation:'));
        focusInput.style.width = '50px';
+
    innerRow.appendChild(innerCell);
        focusInput.onkeyup = function(keyEvent) {
+
            detectKey(keyEvent);
+
        };
+
innerCell = document.createElement('td');
+
        innerCell.style.textAlign = 'left';
+
        innerCell.appendChild(focusInput);
+
        innerRow.appendChild(innerCell);
+
        innerBody.appendChild(innerRow);
+
  
innerCell = document.createElement('td');
+
    var meditationInput = document.createElement('input');
        innerCell.style.textAlign = 'right';
+
    meditationInput.maxLength = '5';
        innerCell.appendChild(document.createTextNode('Intelligence:'));
+
    meditationInput.type = 'text';
        innerRow = document.createElement('tr');
+
    meditationInput.style.width = '50px';
        innerRow.appendChild(innerCell);
+
    meditationInput.onkeyup = function(keyEvent) {
 +
        detectKey(keyEvent);
 +
    };
 +
    innerCell = document.createElement('td');
 +
    innerCell.style.textAlign = 'left';
 +
    innerCell.appendChild(meditationInput);
 +
    innerRow.appendChild(innerCell);
 +
    innerBody.appendChild(innerRow);
  
        var intInput = document.createElement('input');
+
    innerCell = document.createElement('td');
        intInput.maxLength = '3';
+
    innerCell.style.textAlign = 'right';
        intInput.type = 'text';
+
    innerCell.appendChild(document.createTextNode('Focus:'));
        intInput.style.width = '50px';
+
    innerRow = document.createElement('tr');
        intInput.onkeyup = function(keyEvent) {
+
    innerRow.appendChild(innerCell);
            detectKey(keyEvent);
+
        };
+
innerCell = document.createElement('td');
+
        innerCell.style.textAlign = 'left';
+
        innerCell.appendChild(intInput);
+
        innerRow.appendChild(innerCell);
+
        innerBody.appendChild(innerRow);
+
  
innerCell = document.createElement('td');
+
    var focusInput = document.createElement('input');
        innerCell.style.textAlign = 'right';
+
    focusInput.maxLength = '5';
        innerCell.appendChild(document.createTextNode('Equipped MR:'));
+
    focusInput.type = 'text';
        innerRow = document.createElement('tr');
+
    focusInput.style.width = '50px';
        innerRow.appendChild(innerCell);
+
    focusInput.onkeyup = function(keyEvent) {
 +
        detectKey(keyEvent);
 +
    };
 +
    innerCell = document.createElement('td');
 +
    innerCell.style.textAlign = 'left';
 +
    innerCell.appendChild(focusInput);
 +
    innerRow.appendChild(innerCell);
 +
    innerBody.appendChild(innerRow);
  
        var mrInput = document.createElement('input');
+
    innerCell = document.createElement('td');
        mrInput.maxLength = '2';
+
    innerCell.style.textAlign = 'right';
        mrInput.type = 'text';
+
    innerCell.appendChild(document.createTextNode('Intelligence:'));
        mrInput.style.width = '50px';
+
    innerRow = document.createElement('tr');
        mrInput.onkeyup = function(keyEvent) {
+
    innerRow.appendChild(innerCell);
            detectKey(keyEvent);
+
        };
+
innerCell = document.createElement('td');
+
        innerCell.style.textAlign = 'left';
+
        innerCell.appendChild(mrInput);
+
        innerRow.appendChild(innerCell);
+
        innerBody.appendChild(innerRow);
+
  
        var calculateButton = document.createElement('input');
+
    var intInput = document.createElement('input');
        calculateButton.type = 'button';
+
    intInput.maxLength = '3';
        calculateButton.value = 'Calculate';
+
    intInput.type = 'text';
        calculateButton.style.width = '75px';
+
    intInput.style.width = '50px';
        calculateButton.onclick = function() {
+
    intInput.onkeyup = function(keyEvent) {
            calculate(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
+
        detectKey(keyEvent);
        };
+
    };
innerCell = document.createElement('td');
+
    innerCell = document.createElement('td');
        innerCell.appendChild(calculateButton);
+
    innerCell.style.textAlign = 'left';
        innerRow = document.createElement('tr');
+
    innerCell.appendChild(intInput);
        innerRow.appendChild(innerCell);
+
    innerRow.appendChild(innerCell);
 +
    innerBody.appendChild(innerRow);
  
        var resetButton = document.createElement('input');
+
    innerCell = document.createElement('td');
        resetButton.type = 'button';
+
    innerCell.style.textAlign = 'right';
        resetButton.value = 'Reset';
+
    innerCell.appendChild(document.createTextNode('Equipped MR:'));
        resetButton.style.width = '75px';
+
    innerRow = document.createElement('tr');
        resetButton.onclick = function() {
+
    innerRow.appendChild(innerCell);
            resetCalculator(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
+
        };
+
        innerCell = document.createElement('td');
+
        innerCell.appendChild(resetButton);
+
        innerRow.appendChild(innerCell);
+
        innerBody.appendChild(innerRow);
+
  
        innerCell = document.createElement('td');
+
    var mrInput = document.createElement('input');
        innerCell.style.textAlign = 'right';
+
    mrInput.maxLength = '2';
        innerCell.appendChild(document.createTextNode('Passive:'));
+
    mrInput.type = 'text';
        innerRow = document.createElement('tr');
+
    mrInput.style.width = '50px';
        innerRow.appendChild(innerCell);
+
    mrInput.onkeyup = function(keyEvent) {
 +
        detectKey(keyEvent);
 +
    };
 +
    innerCell = document.createElement('td');
 +
    innerCell.style.textAlign = 'left';
 +
    innerCell.appendChild(mrInput);
 +
    innerRow.appendChild(innerCell);
 +
    innerBody.appendChild(innerRow);
  
        var passivePerSecond = document.createElement('div');
+
    var calculateButton = document.createElement('input');
        passivePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
+
    calculateButton.type = 'button';
        passivePerSecond.style.textAlign = 'right';
+
    calculateButton.value = 'Calculate';
        passivePerSecond.style.width = '75px';
+
    calculateButton.style.width = '75px';
innerCell = document.createElement('td');
+
    calculateButton.onclick = function() {
        innerCell.appendChild(passivePerSecond);
+
        calculate(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
        innerRow.appendChild(innerCell);
+
    };
        innerBody.appendChild(innerRow);
+
    innerCell = document.createElement('td');
 +
    innerCell.appendChild(calculateButton);
 +
    innerRow = document.createElement('tr');
 +
    innerRow.appendChild(innerCell);
  
        innerCell = document.createElement('td');
+
    var resetButton = document.createElement('input');
        innerCell.style.textAlign = 'right';
+
    resetButton.type = 'button';
        innerCell.appendChild(document.createTextNode('Active:'));
+
    resetButton.value = 'Reset';
        innerRow = document.createElement('tr');
+
    resetButton.style.width = '75px';
        innerRow.appendChild(innerCell);
+
    resetButton.onclick = function() {
 +
        resetCalculator(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
 +
    };
 +
    innerCell = document.createElement('td');
 +
    innerCell.appendChild(resetButton);
 +
    innerRow.appendChild(innerCell);
 +
    innerBody.appendChild(innerRow);
  
        var activePerSecond = document.createElement('div');
+
    innerCell = document.createElement('td');
        activePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
+
    innerCell.style.textAlign = 'right';
        activePerSecond.style.textAlign = 'right';
+
    innerCell.appendChild(document.createTextNode('Passive:'));
        activePerSecond.style.width = '75px';
+
    innerRow = document.createElement('tr');
innerCell = document.createElement('td');
+
    innerRow.appendChild(innerCell);
        innerCell.appendChild(activePerSecond);
+
        innerRow.appendChild(innerCell);
+
        innerBody.appendChild(innerRow);
+
  
        innerCell = document.createElement('td');
+
    var passivePerSecond = document.createElement('div');
        innerCell.style.textAlign = 'right';
+
    passivePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
        innerCell.appendChild(document.createTextNode('Non-Meddable:'));
+
    passivePerSecond.style.textAlign = 'right';
        innerRow = document.createElement('tr');
+
    passivePerSecond.style.width = '75px';
        innerRow.appendChild(innerCell);
+
    innerCell = document.createElement('td');
 +
    innerCell.appendChild(passivePerSecond);
 +
    innerRow.appendChild(innerCell);
 +
    innerBody.appendChild(innerRow);
  
        var nonMedPerSecond = document.createElement('div');
+
    innerCell = document.createElement('td');
        nonMedPerSecond.appendChild(document.createTextNode('0.0000 MPS'));
+
    innerCell.style.textAlign = 'right';
        nonMedPerSecond.style.textAlign = 'right';
+
    innerCell.appendChild(document.createTextNode('Active:'));
        nonMedPerSecond.style.width = '75px';
+
    innerRow = document.createElement('tr');
innerCell = document.createElement('td');
+
    innerRow.appendChild(innerCell);
        innerCell.appendChild(nonMedPerSecond);
+
 
        innerRow.appendChild(innerCell);
+
    var activePerSecond = document.createElement('div');
        innerBody.appendChild(innerRow);
+
    activePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
 +
    activePerSecond.style.textAlign = 'right';
 +
    activePerSecond.style.width = '75px';
 +
    innerCell = document.createElement('td');
 +
    innerCell.appendChild(activePerSecond);
 +
    innerRow.appendChild(innerCell);
 +
    innerBody.appendChild(innerRow);
 +
 
 +
    innerCell = document.createElement('td');
 +
    innerCell.style.textAlign = 'right';
 +
    innerCell.appendChild(document.createTextNode('Non-Meddable:'));
 +
    innerRow = document.createElement('tr');
 +
    innerRow.appendChild(innerCell);
 +
 
 +
    var nonMedPerSecond = document.createElement('div');
 +
    nonMedPerSecond.appendChild(document.createTextNode('0.0000 MPS'));
 +
    nonMedPerSecond.style.textAlign = 'right';
 +
    nonMedPerSecond.style.width = '75px';
 +
    innerCell = document.createElement('td');
 +
    innerCell.appendChild(nonMedPerSecond);
 +
    innerRow.appendChild(innerCell);
 +
    innerBody.appendChild(innerRow);
  
        this._super(calcTableRow, 'ManaPerSecond', 'Mana Per Second', 1);
+
    return calcTableRow;
    }
+
}
});
+
  
 
function searchForCalculators() {
 
function searchForCalculators() {
Line 236: Line 237:
 
     for (var i in calculators) {
 
     for (var i in calculators) {
 
         if (calculators[i].id == 'ManaPerSecond') {
 
         if (calculators[i].id == 'ManaPerSecond') {
             new ManaPerSecondCalculator();
+
             Calculator(ManaPerSecondCalculator(), 'ManaPerSecond', 'Mana Per Second', 1);
 
         }
 
         }
 
     }
 
     }
 
}
 
}
 
addOnloadHook(searchForCalculators);
 
addOnloadHook(searchForCalculators);

Latest revision as of 14:06, 11 January 2011

/**
 * Calculator that calculates your mana regenerated per second based on Meditation, Focus, Intelligence, and equipped MR.
 */
function ManaPerSecondCalculator() {
    var calculate = function(meditation, focus, int, mr, passive, active, nonMed) {
        var gmBonus = 1.0;
        if (!meditation.value || !isNumeric(meditation.value)) {
            meditation.value = '0.0';
        } else if (meditation.value >= 100) {
            gmBonus = 1.1;
            if (meditation.value > 120) {
                meditation.value = '120.0'
            }
        }
        if (!focus.value || !isNumeric(focus.value)) {
            focus.value = '0.0';
        } else if (focus.value > 120) {
            focus.value = '120.0';
        }
        if (!int.value || !isNumeric(int.value)) {
            int.value = '0';
        } else if (int.value > 168) {
            int.value = '168';
        }
        if (!mr.value || !isNumeric(mr.value)) {
            mr.value = '0';
        }

        var baseRate = 0.2;
        var focusBonus = parseFloat(focus.value) / 200;
        var medBonus = gmBonus * ((0.0075 * parseFloat(meditation.value)) + (0.0025 * parseFloat(int.value)));
        var finalItemBonus = 0;
        if (parseFloat(mr.value) > 0) {
            var baseItemBonus = ((((parseFloat(meditation.value) / 2) + (parseFloat(focus.value) / 4)) / 90) * 0.65) + 2.35;
            var intensityBonus = Math.min(Math.sqrt(parseFloat(mr.value)), 5.5);
            finalItemBonus = ((baseItemBonus * intensityBonus) - (baseItemBonus - 1)) / 10;
        }
        var manaPerSecond = baseRate + focusBonus + medBonus + finalItemBonus;
        manaPerSecond = manaPerSecond.toFixed(4);
        removeChildren(passive);
        passive.appendChild(document.createTextNode(manaPerSecond + ' MPS'));
        manaPerSecond = baseRate + focusBonus + (2 * medBonus) + finalItemBonus;
        manaPerSecond = manaPerSecond.toFixed(4);
        removeChildren(active);
        active.appendChild(document.createTextNode(manaPerSecond + ' MPS'));
        manaPerSecond = baseRate + focusBonus + finalItemBonus;
        manaPerSecond = manaPerSecond.toFixed(4);
        removeChildren(nonMed);
        nonMed.appendChild(document.createTextNode(manaPerSecond + ' MPS'));
    };

    var resetCalculator = function() {
        meditationInput.value = '';
        focusInput.value = '';
        intInput.value = '';
        mrInput.value = '';
        removeChildren(passivePerSecond);
        passivePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
        removeChildren(activePerSecond);
        activePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
        removeChildren(nonMedPerSecond);
        nonMedPerSecond.appendChild(document.createTextNode('0.0000 MPS'));
        meditationInput.focus();
    };

    var detectKey = function(keyEvent) {
        var keyID = window.event ? event.keyCode : keyEvent.keyCode;
        if (keyID == 13)
            calculate(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
        else if (keyID == 27)
            resetCalculator(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
    };

    var calcTableRow = document.createElement('tr');
    var calcTableCell = document.createElement('td');
    calcTableRow.appendChild(calcTableCell);

    var innerTable = document.createElement('table');
    innerTable.style.borderCollapse = 'collapse';
    calcTableCell.appendChild(innerTable);

    var innerBody = document.createElement('tbody');
    innerTable.appendChild(innerBody);

    var innerRow = document.createElement('tr');

    var innerCell = document.createElement('td');
    innerCell.style.textAlign = 'right';
    innerCell.appendChild(document.createTextNode('Meditation:'));
    innerRow.appendChild(innerCell);

    var meditationInput = document.createElement('input');
    meditationInput.maxLength = '5';
    meditationInput.type = 'text';
    meditationInput.style.width = '50px';
    meditationInput.onkeyup = function(keyEvent) {
        detectKey(keyEvent);
    };
    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'left';
    innerCell.appendChild(meditationInput);
    innerRow.appendChild(innerCell);
    innerBody.appendChild(innerRow);

    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'right';
    innerCell.appendChild(document.createTextNode('Focus:'));
    innerRow = document.createElement('tr');
    innerRow.appendChild(innerCell);

    var focusInput = document.createElement('input');
    focusInput.maxLength = '5';
    focusInput.type = 'text';
    focusInput.style.width = '50px';
    focusInput.onkeyup = function(keyEvent) {
        detectKey(keyEvent);
    };
    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'left';
    innerCell.appendChild(focusInput);
    innerRow.appendChild(innerCell);
    innerBody.appendChild(innerRow);

    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'right';
    innerCell.appendChild(document.createTextNode('Intelligence:'));
    innerRow = document.createElement('tr');
    innerRow.appendChild(innerCell);

    var intInput = document.createElement('input');
    intInput.maxLength = '3';
    intInput.type = 'text';
    intInput.style.width = '50px';
    intInput.onkeyup = function(keyEvent) {
        detectKey(keyEvent);
    };
    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'left';
    innerCell.appendChild(intInput);
    innerRow.appendChild(innerCell);
    innerBody.appendChild(innerRow);

    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'right';
    innerCell.appendChild(document.createTextNode('Equipped MR:'));
    innerRow = document.createElement('tr');
    innerRow.appendChild(innerCell);

    var mrInput = document.createElement('input');
    mrInput.maxLength = '2';
    mrInput.type = 'text';
    mrInput.style.width = '50px';
    mrInput.onkeyup = function(keyEvent) {
        detectKey(keyEvent);
    };
    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'left';
    innerCell.appendChild(mrInput);
    innerRow.appendChild(innerCell);
    innerBody.appendChild(innerRow);

    var calculateButton = document.createElement('input');
    calculateButton.type = 'button';
    calculateButton.value = 'Calculate';
    calculateButton.style.width = '75px';
    calculateButton.onclick = function() {
        calculate(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
    };
    innerCell = document.createElement('td');
    innerCell.appendChild(calculateButton);
    innerRow = document.createElement('tr');
    innerRow.appendChild(innerCell);

    var resetButton = document.createElement('input');
    resetButton.type = 'button';
    resetButton.value = 'Reset';
    resetButton.style.width = '75px';
    resetButton.onclick = function() {
        resetCalculator(meditationInput, focusInput, intInput, mrInput, passivePerSecond, activePerSecond, nonMedPerSecond);
    };
    innerCell = document.createElement('td');
    innerCell.appendChild(resetButton);
    innerRow.appendChild(innerCell);
    innerBody.appendChild(innerRow);

    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'right';
    innerCell.appendChild(document.createTextNode('Passive:'));
    innerRow = document.createElement('tr');
    innerRow.appendChild(innerCell);

    var passivePerSecond = document.createElement('div');
    passivePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
    passivePerSecond.style.textAlign = 'right';
    passivePerSecond.style.width = '75px';
    innerCell = document.createElement('td');
    innerCell.appendChild(passivePerSecond);
    innerRow.appendChild(innerCell);
    innerBody.appendChild(innerRow);

    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'right';
    innerCell.appendChild(document.createTextNode('Active:'));
    innerRow = document.createElement('tr');
    innerRow.appendChild(innerCell);

    var activePerSecond = document.createElement('div');
    activePerSecond.appendChild(document.createTextNode('0.0000 MPS'));
    activePerSecond.style.textAlign = 'right';
    activePerSecond.style.width = '75px';
    innerCell = document.createElement('td');
    innerCell.appendChild(activePerSecond);
    innerRow.appendChild(innerCell);
    innerBody.appendChild(innerRow);

    innerCell = document.createElement('td');
    innerCell.style.textAlign = 'right';
    innerCell.appendChild(document.createTextNode('Non-Meddable:'));
    innerRow = document.createElement('tr');
    innerRow.appendChild(innerCell);

    var nonMedPerSecond = document.createElement('div');
    nonMedPerSecond.appendChild(document.createTextNode('0.0000 MPS'));
    nonMedPerSecond.style.textAlign = 'right';
    nonMedPerSecond.style.width = '75px';
    innerCell = document.createElement('td');
    innerCell.appendChild(nonMedPerSecond);
    innerRow.appendChild(innerCell);
    innerBody.appendChild(innerRow);

    return calcTableRow;
}

function searchForCalculators() {
    var calculators = document.getElementsByTagName('div');

    for (var i in calculators) {
         if (calculators[i].id == 'ManaPerSecond') {
             Calculator(ManaPerSecondCalculator(), 'ManaPerSecond', 'Mana Per Second', 1);
         }
    }
}
addOnloadHook(searchForCalculators);