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 numtitles65827, price65827, rate65827, delivery65827, latestdelivery65827, readonly65827, numday65827, nummonth65827, numyear65827, royday65827, roymonth65827, royyear65827;'); document.writeln('InitialSetup65827();'); document.writeln(''); document.writeln('function InitialSetup65827()'); document.writeln('{'); document.writeln(' numtitles65827 = 3;'); document.writeln(' price65827 = 2.99;'); document.writeln(' delivery65827 = latestdelivery65827 = 0.06;'); document.writeln(' numday65827 = 10;'); document.writeln(' rate65827 = 0;'); document.writeln(' if( price65827 >= 2.99 && price65827 <= 9.99 )'); document.writeln(' {'); document.writeln(' rate65827 = 70;'); document.writeln(' doc'+'ument.getElementById("rate65827-35-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate65827-70-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate65827-amazon-royalties-estimator").value = 70;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' rate65827 = 35;'); document.writeln(' doc'+'ument.getElementById("rate65827-35-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate65827-70-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate65827-amazon-royalties-estimator").value = 35;'); document.writeln(' }'); document.writeln(' doc'+'ument.getElementById("numtitles65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(numtitles65827,0);'); document.writeln(' doc'+'ument.getElementById("price65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(price65827,2);'); document.writeln(' doc'+'ument.getElementById("delivery65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(delivery65827,2);'); document.writeln(' doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(numday65827,2);'); document.writeln(' FinishCalculation65827();'); document.writeln('}'); document.writeln(''); document.writeln('function UpdateAll65827()'); document.writeln('{'); document.writeln(' numtitles65827 = doc'+'ument.getElementById("numtitles65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numtitles65827 = parseInt(numtitles65827);'); document.writeln(' doc'+'ument.getElementById("numtitles65827-amazon-royalties-estimator").value = numtitles65827;'); document.writeln('// numtitles65827 = parseInt(doc'+'ument.getElementById("numtitles65827-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numtitles65827) )'); document.writeln(' {'); document.writeln(' numtitles65827 = 0;'); document.writeln(' doc'+'ument.getElementById("numtitles65827-amazon-royalties-estimator").value = numtitles65827;'); document.writeln(' }'); document.writeln(' price65827 = doc'+'ument.getElementById("price65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' price65827 = parseFloat(price65827);'); document.writeln(' doc'+'ument.getElementById("price65827-amazon-royalties-estimator").value = price65827;'); document.writeln('// price65827 = parseFloat(doc'+'ument.getElementById("price65827-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(price65827) )'); document.writeln(' {'); document.writeln(' price65827 = \'0.0\';'); document.writeln(' doc'+'ument.getElementById("price65827-amazon-royalties-estimator").value = price65827;'); document.writeln(' }'); document.writeln(' rate65827 = doc'+'ument.getElementById("rate65827-70-amazon-royalties-estimator").checked ? 70 : 35;'); document.writeln(' doc'+'ument.getElementById("rate65827-amazon-royalties-estimator").value = rate65827;'); document.writeln(' delivery65827 = doc'+'ument.getElementById("delivery65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' delivery65827 = parseFloat(delivery65827);'); document.writeln(' doc'+'ument.getElementById("delivery65827-amazon-royalties-estimator").value = delivery65827;'); document.writeln('// delivery65827 = parseFloat(doc'+'ument.getElementById("delivery65827-amazon-royalties-estimator").value);'); document.writeln(' doc'+'ument.getElementById("delivery65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827( parseFloat(doc'+'ument.getElementById("delivery65827-amazon-royalties-estimator").value), 2 );'); document.writeln(' if( rate65827 < 70 )'); document.writeln(' {'); document.writeln(' if( delivery65827 > 0 ) { latestdelivery65827 = delivery65827; }'); document.writeln(' doc'+'ument.getElementById("delivery65827-amazon-royalties-estimator").value = \'0.00\';'); document.writeln(' delivery65827 = 0.0;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' if( delivery65827 <= 0 && latestdelivery65827 > 0 )'); document.writeln(' {'); document.writeln(' delivery65827 = latestdelivery65827;'); document.writeln(' doc'+'ument.getElementById("delivery65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(delivery65827,2);'); document.writeln(' }'); document.writeln(' }'); document.writeln(''); document.writeln(' if( isNaN(delivery65827) )'); document.writeln(' {'); document.writeln(' delivery65827 = \'0.00\';'); document.writeln(' doc'+'ument.getElementById("delivery65827-amazon-royalties-estimator").value = delivery65827;'); document.writeln(' }'); document.writeln(' readonly65827 = ( numday65827 * (rate65827/100) ) - delivery65827;'); document.writeln(' numday65827 = doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday65827 = parseInt(numday65827);'); document.writeln(' doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value = numday65827;'); document.writeln('// numday65827 = parseInt(doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday65827) )'); document.writeln(' {'); document.writeln(' numday65827 = 0;'); document.writeln(' doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value = numday65827;'); document.writeln(' }'); document.writeln(' FinishCalculation65827();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerDay65827()'); document.writeln('{'); document.writeln(' numday65827 = doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday65827 = parseInt(numday65827);'); document.writeln(' doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value = numday65827;'); document.writeln('// numday65827 = parseInt(doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday65827) ) { numday65827 = 0; }'); document.writeln(' DetermineNumberSoldPerPeriods65827();'); document.writeln(' CalculateRoyaltyNumbers65827();'); document.writeln(' Update7Values65827();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerMonth65827()'); document.writeln('{'); document.writeln(' nummonth65827 = doc'+'ument.getElementById("nummonth65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' nummonth65827 = parseInt(nummonth65827);'); document.writeln(' doc'+'ument.getElementById("nummonth65827-amazon-royalties-estimator").value = nummonth65827;'); document.writeln('// nummonth65827 = parseInt(doc'+'ument.getElementById("nummonth65827-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(nummonth65827) ) { nummonth65827 = 0; }'); document.writeln(' numyear65827 = nummonth65827 * 12;'); document.writeln(' numday65827 = numyear65827 / 365;'); document.writeln(' doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value = numday65827;'); document.writeln(' doc'+'ument.getElementById("nummonth65827-amazon-royalties-estimator").value = nummonth65827;'); document.writeln(' doc'+'ument.getElementById("numyear65827-amazon-royalties-estimator").value = numyear65827;'); document.writeln(' CalculateRoyaltyNumbers65827();'); document.writeln(' Update7Values65827();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerYear65827()'); document.writeln('{'); document.writeln(' numyear65827 = doc'+'ument.getElementById("numyear65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numyear65827 = parseInt(numyear65827);'); document.writeln(' doc'+'ument.getElementById("numyear65827-amazon-royalties-estimator").value = numyear65827;'); document.writeln('// numyear65827 = parseInt(doc'+'ument.getElementById("numyear65827-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numyear65827) ) { numyear65827 = 0; }'); document.writeln(' numday65827 = numyear65827 / 365;'); document.writeln(' nummonth65827 = numyear65827 / 12;'); document.writeln(' doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value = numday65827;'); document.writeln(' doc'+'ument.getElementById("nummonth65827-amazon-royalties-estimator").value = nummonth65827;'); document.writeln(' doc'+'ument.getElementById("numyear65827-amazon-royalties-estimator").value = numyear65827;'); document.writeln(' CalculateRoyaltyNumbers65827();'); document.writeln(' Update7Values65827();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerDay65827()'); document.writeln('{'); document.writeln(' royday65827 = doc'+'ument.getElementById("royday65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royday65827 = parseFloat(royday65827);'); document.writeln(' doc'+'ument.getElementById("royday65827-amazon-royalties-estimator").value = royday65827;'); document.writeln('// royday65827 = parseFloat(doc'+'ument.getElementById("royday65827-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royday65827) ) { royday65827 = 0; }'); document.writeln(' royyear65827 = royday65827 * 365;'); document.writeln(' roymonth65827 = royyear65827 / 12;'); document.writeln(' numday65827 = royday65827 / (readonly65827 * numtitles65827);'); document.writeln(' DetermineNumberSoldPerPeriods65827()'); document.writeln(' Update7Values65827();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerMonth65827()'); document.writeln('{'); document.writeln(' roymonth65827 = doc'+'ument.getElementById("roymonth65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' roymonth65827 = parseFloat(roymonth65827);'); document.writeln(' doc'+'ument.getElementById("roymonth65827-amazon-royalties-estimator").value = roymonth65827;'); document.writeln('// roymonth65827 = parseFloat(doc'+'ument.getElementById("roymonth65827-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(roymonth65827) ) { roymonth65827 = 0; }'); document.writeln(' royyear65827 = roymonth65827 * 12;'); document.writeln(' royday65827 = royyear65827 / 365;'); document.writeln(' numday65827 = royday65827 / (readonly65827 * numtitles65827);'); document.writeln(' DetermineNumberSoldPerPeriods65827()'); document.writeln(' Update7Values65827();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerYear65827()'); document.writeln('{'); document.writeln(' royyear65827 = doc'+'ument.getElementById("royyear65827-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royyear65827 = parseFloat(royyear65827);'); document.writeln(' doc'+'ument.getElementById("royyear65827-amazon-royalties-estimator").value = royyear65827;'); document.writeln('// royyear65827 = parseFloat(doc'+'ument.getElementById("royyear65827-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royyear65827) ) { royyear65827 = 0; }'); document.writeln(' royday65827 = royyear65827 / 365;'); document.writeln(' roymonth65827 = royyear65827 / 12;'); document.writeln(' numday65827 = royday65827 / (readonly65827 * numtitles65827);'); document.writeln(' DetermineNumberSoldPerPeriods65827()'); document.writeln(' Update7Values65827();'); document.writeln('}'); document.writeln(''); document.writeln('function DetermineNumberSoldPerPeriods65827()'); document.writeln('{'); document.writeln(' numyear65827 = numday65827 * 365;'); document.writeln(' nummonth65827 = numyear65827 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function FinishCalculation65827()'); document.writeln('{'); document.writeln(' Calculate6Numbers65827();'); document.writeln(' Update7Values65827();'); document.writeln('}'); document.writeln(''); document.writeln('function Calculate6Numbers65827()'); document.writeln('{'); document.writeln(' // numday65827 is assumed to be have the correct value.'); document.writeln(' readonly65827 = ( price65827 * (rate65827/100) ) - delivery65827;'); document.writeln(' DetermineNumberSoldPerPeriods65827();'); document.writeln(' royday65827 = numtitles65827 * readonly65827 * numday65827;'); document.writeln(' royyear65827 = royday65827 * 365;'); document.writeln(' roymonth65827 = royyear65827 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function CalculateRoyaltyNumbers65827()'); document.writeln('{'); document.writeln(' // numday65827 is assumed to be have the correct value.'); document.writeln(' readonly65827 = ( price65827 * (rate65827/100) ) - delivery65827;'); document.writeln(' royday65827 = numtitles65827 * readonly65827 * numday65827;'); document.writeln(' royyear65827 = royday65827 * 365;'); document.writeln(' roymonth65827 = royyear65827 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function Update7Values65827()'); document.writeln('{'); document.writeln('//rate65827-35-amazon-royalties-estimator'); document.writeln(' doc'+'ument.getElementById("readonly65827-amazon-royalties-estimator").innerHTML = ReturnCurrencyNumberCommaized65827(readonly65827,2);'); document.writeln(' doc'+'ument.getElementById("numday65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(numday65827,0);'); document.writeln(' doc'+'ument.getElementById("nummonth65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(nummonth65827,0);'); document.writeln(' doc'+'ument.getElementById("numyear65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(numyear65827,0);'); document.writeln(' doc'+'ument.getElementById("royday65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(royday65827,2);'); document.writeln(' doc'+'ument.getElementById("roymonth65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(roymonth65827,2);'); document.writeln(' doc'+'ument.getElementById("royyear65827-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized65827(royyear65827,2);'); document.writeln('}'); document.writeln(''); document.writeln('function ReturnCurrencyNumber65827(n,d) { return n.toFixed(d); }'); document.writeln(''); document.writeln('function ReturnCurrencyNumberCommaized65827(n,d)'); document.writeln('{'); document.writeln(' var number = ReturnCurrencyNumber65827(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('');