document.writeln(''); document.writeln(''); document.writeln('
'); document.writeln('
Amazon Royalties Estimator
'); document.writeln('
Change numbers in fields.
'); document.writeln('
Calculated results are rounded.
'); document.writeln('
'); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln('
Number of titles
Average —
Price
Royalty'); document.writeln(' 35%   70%'); document.writeln(''); document.writeln('
Delivery
Per book:
Books sold per title —
Per day
Per month
Per year*
Total royalty income —
Per day
Per month
Per year*
*365-day year.
'); document.writeln('
'); document.writeln('
With compliments of Will Bontrager
'); document.writeln(''); document.writeln('
'); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln('var numtitles6491, price6491, rate6491, delivery6491, latestdelivery6491, readonly6491, numday6491, nummonth6491, numyear6491, royday6491, roymonth6491, royyear6491;'); document.writeln('InitialSetup6491();'); document.writeln(''); document.writeln('function InitialSetup6491()'); document.writeln('{'); document.writeln(' numtitles6491 = 3;'); document.writeln(' price6491 = 2.99;'); document.writeln(' delivery6491 = latestdelivery6491 = 0.06;'); document.writeln(' numday6491 = 10;'); document.writeln(' rate6491 = 0;'); document.writeln(' if( price6491 >= 2.99 && price6491 <= 9.99 )'); document.writeln(' {'); document.writeln(' rate6491 = 70;'); document.writeln(' doc'+'ument.getElementById("rate6491-35-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate6491-70-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate6491-amazon-royalties-estimator").value = 70;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' rate6491 = 35;'); document.writeln(' doc'+'ument.getElementById("rate6491-35-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate6491-70-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate6491-amazon-royalties-estimator").value = 35;'); document.writeln(' }'); document.writeln(' doc'+'ument.getElementById("numtitles6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(numtitles6491,0);'); document.writeln(' doc'+'ument.getElementById("price6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(price6491,2);'); document.writeln(' doc'+'ument.getElementById("delivery6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(delivery6491,2);'); document.writeln(' doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(numday6491,2);'); document.writeln(' FinishCalculation6491();'); document.writeln('}'); document.writeln(''); document.writeln('function UpdateAll6491()'); document.writeln('{'); document.writeln(' numtitles6491 = doc'+'ument.getElementById("numtitles6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numtitles6491 = parseInt(numtitles6491);'); document.writeln(' doc'+'ument.getElementById("numtitles6491-amazon-royalties-estimator").value = numtitles6491;'); document.writeln('// numtitles6491 = parseInt(doc'+'ument.getElementById("numtitles6491-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numtitles6491) )'); document.writeln(' {'); document.writeln(' numtitles6491 = 0;'); document.writeln(' doc'+'ument.getElementById("numtitles6491-amazon-royalties-estimator").value = numtitles6491;'); document.writeln(' }'); document.writeln(' price6491 = doc'+'ument.getElementById("price6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' price6491 = parseFloat(price6491);'); document.writeln(' doc'+'ument.getElementById("price6491-amazon-royalties-estimator").value = price6491;'); document.writeln('// price6491 = parseFloat(doc'+'ument.getElementById("price6491-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(price6491) )'); document.writeln(' {'); document.writeln(' price6491 = \'0.0\';'); document.writeln(' doc'+'ument.getElementById("price6491-amazon-royalties-estimator").value = price6491;'); document.writeln(' }'); document.writeln(' rate6491 = doc'+'ument.getElementById("rate6491-70-amazon-royalties-estimator").checked ? 70 : 35;'); document.writeln(' doc'+'ument.getElementById("rate6491-amazon-royalties-estimator").value = rate6491;'); document.writeln(' delivery6491 = doc'+'ument.getElementById("delivery6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' delivery6491 = parseFloat(delivery6491);'); document.writeln(' doc'+'ument.getElementById("delivery6491-amazon-royalties-estimator").value = delivery6491;'); document.writeln('// delivery6491 = parseFloat(doc'+'ument.getElementById("delivery6491-amazon-royalties-estimator").value);'); document.writeln(' doc'+'ument.getElementById("delivery6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491( parseFloat(doc'+'ument.getElementById("delivery6491-amazon-royalties-estimator").value), 2 );'); document.writeln(' if( rate6491 < 70 )'); document.writeln(' {'); document.writeln(' if( delivery6491 > 0 ) { latestdelivery6491 = delivery6491; }'); document.writeln(' doc'+'ument.getElementById("delivery6491-amazon-royalties-estimator").value = \'0.00\';'); document.writeln(' delivery6491 = 0.0;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' if( delivery6491 <= 0 && latestdelivery6491 > 0 )'); document.writeln(' {'); document.writeln(' delivery6491 = latestdelivery6491;'); document.writeln(' doc'+'ument.getElementById("delivery6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(delivery6491,2);'); document.writeln(' }'); document.writeln(' }'); document.writeln(''); document.writeln(' if( isNaN(delivery6491) )'); document.writeln(' {'); document.writeln(' delivery6491 = \'0.00\';'); document.writeln(' doc'+'ument.getElementById("delivery6491-amazon-royalties-estimator").value = delivery6491;'); document.writeln(' }'); document.writeln(' readonly6491 = ( numday6491 * (rate6491/100) ) - delivery6491;'); document.writeln(' numday6491 = doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday6491 = parseInt(numday6491);'); document.writeln(' doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value = numday6491;'); document.writeln('// numday6491 = parseInt(doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday6491) )'); document.writeln(' {'); document.writeln(' numday6491 = 0;'); document.writeln(' doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value = numday6491;'); document.writeln(' }'); document.writeln(' FinishCalculation6491();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerDay6491()'); document.writeln('{'); document.writeln(' numday6491 = doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday6491 = parseInt(numday6491);'); document.writeln(' doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value = numday6491;'); document.writeln('// numday6491 = parseInt(doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday6491) ) { numday6491 = 0; }'); document.writeln(' DetermineNumberSoldPerPeriods6491();'); document.writeln(' CalculateRoyaltyNumbers6491();'); document.writeln(' Update7Values6491();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerMonth6491()'); document.writeln('{'); document.writeln(' nummonth6491 = doc'+'ument.getElementById("nummonth6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' nummonth6491 = parseInt(nummonth6491);'); document.writeln(' doc'+'ument.getElementById("nummonth6491-amazon-royalties-estimator").value = nummonth6491;'); document.writeln('// nummonth6491 = parseInt(doc'+'ument.getElementById("nummonth6491-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(nummonth6491) ) { nummonth6491 = 0; }'); document.writeln(' numyear6491 = nummonth6491 * 12;'); document.writeln(' numday6491 = numyear6491 / 365;'); document.writeln(' doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value = numday6491;'); document.writeln(' doc'+'ument.getElementById("nummonth6491-amazon-royalties-estimator").value = nummonth6491;'); document.writeln(' doc'+'ument.getElementById("numyear6491-amazon-royalties-estimator").value = numyear6491;'); document.writeln(' CalculateRoyaltyNumbers6491();'); document.writeln(' Update7Values6491();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerYear6491()'); document.writeln('{'); document.writeln(' numyear6491 = doc'+'ument.getElementById("numyear6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numyear6491 = parseInt(numyear6491);'); document.writeln(' doc'+'ument.getElementById("numyear6491-amazon-royalties-estimator").value = numyear6491;'); document.writeln('// numyear6491 = parseInt(doc'+'ument.getElementById("numyear6491-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numyear6491) ) { numyear6491 = 0; }'); document.writeln(' numday6491 = numyear6491 / 365;'); document.writeln(' nummonth6491 = numyear6491 / 12;'); document.writeln(' doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value = numday6491;'); document.writeln(' doc'+'ument.getElementById("nummonth6491-amazon-royalties-estimator").value = nummonth6491;'); document.writeln(' doc'+'ument.getElementById("numyear6491-amazon-royalties-estimator").value = numyear6491;'); document.writeln(' CalculateRoyaltyNumbers6491();'); document.writeln(' Update7Values6491();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerDay6491()'); document.writeln('{'); document.writeln(' royday6491 = doc'+'ument.getElementById("royday6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royday6491 = parseFloat(royday6491);'); document.writeln(' doc'+'ument.getElementById("royday6491-amazon-royalties-estimator").value = royday6491;'); document.writeln('// royday6491 = parseFloat(doc'+'ument.getElementById("royday6491-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royday6491) ) { royday6491 = 0; }'); document.writeln(' royyear6491 = royday6491 * 365;'); document.writeln(' roymonth6491 = royyear6491 / 12;'); document.writeln(' numday6491 = royday6491 / (readonly6491 * numtitles6491);'); document.writeln(' DetermineNumberSoldPerPeriods6491()'); document.writeln(' Update7Values6491();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerMonth6491()'); document.writeln('{'); document.writeln(' roymonth6491 = doc'+'ument.getElementById("roymonth6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' roymonth6491 = parseFloat(roymonth6491);'); document.writeln(' doc'+'ument.getElementById("roymonth6491-amazon-royalties-estimator").value = roymonth6491;'); document.writeln('// roymonth6491 = parseFloat(doc'+'ument.getElementById("roymonth6491-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(roymonth6491) ) { roymonth6491 = 0; }'); document.writeln(' royyear6491 = roymonth6491 * 12;'); document.writeln(' royday6491 = royyear6491 / 365;'); document.writeln(' numday6491 = royday6491 / (readonly6491 * numtitles6491);'); document.writeln(' DetermineNumberSoldPerPeriods6491()'); document.writeln(' Update7Values6491();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerYear6491()'); document.writeln('{'); document.writeln(' royyear6491 = doc'+'ument.getElementById("royyear6491-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royyear6491 = parseFloat(royyear6491);'); document.writeln(' doc'+'ument.getElementById("royyear6491-amazon-royalties-estimator").value = royyear6491;'); document.writeln('// royyear6491 = parseFloat(doc'+'ument.getElementById("royyear6491-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royyear6491) ) { royyear6491 = 0; }'); document.writeln(' royday6491 = royyear6491 / 365;'); document.writeln(' roymonth6491 = royyear6491 / 12;'); document.writeln(' numday6491 = royday6491 / (readonly6491 * numtitles6491);'); document.writeln(' DetermineNumberSoldPerPeriods6491()'); document.writeln(' Update7Values6491();'); document.writeln('}'); document.writeln(''); document.writeln('function DetermineNumberSoldPerPeriods6491()'); document.writeln('{'); document.writeln(' numyear6491 = numday6491 * 365;'); document.writeln(' nummonth6491 = numyear6491 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function FinishCalculation6491()'); document.writeln('{'); document.writeln(' Calculate6Numbers6491();'); document.writeln(' Update7Values6491();'); document.writeln('}'); document.writeln(''); document.writeln('function Calculate6Numbers6491()'); document.writeln('{'); document.writeln(' // numday6491 is assumed to be have the correct value.'); document.writeln(' readonly6491 = ( price6491 * (rate6491/100) ) - delivery6491;'); document.writeln(' DetermineNumberSoldPerPeriods6491();'); document.writeln(' royday6491 = numtitles6491 * readonly6491 * numday6491;'); document.writeln(' royyear6491 = royday6491 * 365;'); document.writeln(' roymonth6491 = royyear6491 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function CalculateRoyaltyNumbers6491()'); document.writeln('{'); document.writeln(' // numday6491 is assumed to be have the correct value.'); document.writeln(' readonly6491 = ( price6491 * (rate6491/100) ) - delivery6491;'); document.writeln(' royday6491 = numtitles6491 * readonly6491 * numday6491;'); document.writeln(' royyear6491 = royday6491 * 365;'); document.writeln(' roymonth6491 = royyear6491 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function Update7Values6491()'); document.writeln('{'); document.writeln('//rate6491-35-amazon-royalties-estimator'); document.writeln(' doc'+'ument.getElementById("readonly6491-amazon-royalties-estimator").innerHTML = ReturnCurrencyNumberCommaized6491(readonly6491,2);'); document.writeln(' doc'+'ument.getElementById("numday6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(numday6491,0);'); document.writeln(' doc'+'ument.getElementById("nummonth6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(nummonth6491,0);'); document.writeln(' doc'+'ument.getElementById("numyear6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(numyear6491,0);'); document.writeln(' doc'+'ument.getElementById("royday6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(royday6491,2);'); document.writeln(' doc'+'ument.getElementById("roymonth6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(roymonth6491,2);'); document.writeln(' doc'+'ument.getElementById("royyear6491-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized6491(royyear6491,2);'); document.writeln('}'); document.writeln(''); document.writeln('function ReturnCurrencyNumber6491(n,d) { return n.toFixed(d); }'); document.writeln(''); document.writeln('function ReturnCurrencyNumberCommaized6491(n,d)'); document.writeln('{'); document.writeln(' var number = ReturnCurrencyNumber6491(n,d);'); document.writeln('return number;'); document.writeln(' var ta = number.split(\'.\',2);'); document.writeln(' if( ta[0] < 10000 ) { return number; }'); document.writeln(' var holder = new Array();'); document.writeln(' while( ta[0] > 999 )'); document.writeln(' {'); document.writeln('alert(n + "***" + number + \'***\' + ta[0]);'); document.writeln(' holder.unshift( ta[0].substr(-3) );'); document.writeln(' ta[0] = ta[0].substr(0,ta[0].length-3);'); document.writeln('alert( ta[0] + "---" + holder.join(\',\') );'); document.writeln(' }'); document.writeln(' ta[0] = holder.join(",");'); document.writeln(' return ta.join(".");'); document.writeln('}'); document.writeln(''); document.writeln(''); document.writeln('');