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 numtitles81370, price81370, rate81370, delivery81370, latestdelivery81370, readonly81370, numday81370, nummonth81370, numyear81370, royday81370, roymonth81370, royyear81370;'); document.writeln('InitialSetup81370();'); document.writeln(''); document.writeln('function InitialSetup81370()'); document.writeln('{'); document.writeln(' numtitles81370 = 3;'); document.writeln(' price81370 = 2.99;'); document.writeln(' delivery81370 = latestdelivery81370 = 0.06;'); document.writeln(' numday81370 = 10;'); document.writeln(' rate81370 = 0;'); document.writeln(' if( price81370 >= 2.99 && price81370 <= 9.99 )'); document.writeln(' {'); document.writeln(' rate81370 = 70;'); document.writeln(' doc'+'ument.getElementById("rate81370-35-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate81370-70-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate81370-amazon-royalties-estimator").value = 70;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' rate81370 = 35;'); document.writeln(' doc'+'ument.getElementById("rate81370-35-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate81370-70-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate81370-amazon-royalties-estimator").value = 35;'); document.writeln(' }'); document.writeln(' doc'+'ument.getElementById("numtitles81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(numtitles81370,0);'); document.writeln(' doc'+'ument.getElementById("price81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(price81370,2);'); document.writeln(' doc'+'ument.getElementById("delivery81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(delivery81370,2);'); document.writeln(' doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(numday81370,2);'); document.writeln(' FinishCalculation81370();'); document.writeln('}'); document.writeln(''); document.writeln('function UpdateAll81370()'); document.writeln('{'); document.writeln(' numtitles81370 = doc'+'ument.getElementById("numtitles81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numtitles81370 = parseInt(numtitles81370);'); document.writeln(' doc'+'ument.getElementById("numtitles81370-amazon-royalties-estimator").value = numtitles81370;'); document.writeln('// numtitles81370 = parseInt(doc'+'ument.getElementById("numtitles81370-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numtitles81370) )'); document.writeln(' {'); document.writeln(' numtitles81370 = 0;'); document.writeln(' doc'+'ument.getElementById("numtitles81370-amazon-royalties-estimator").value = numtitles81370;'); document.writeln(' }'); document.writeln(' price81370 = doc'+'ument.getElementById("price81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' price81370 = parseFloat(price81370);'); document.writeln(' doc'+'ument.getElementById("price81370-amazon-royalties-estimator").value = price81370;'); document.writeln('// price81370 = parseFloat(doc'+'ument.getElementById("price81370-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(price81370) )'); document.writeln(' {'); document.writeln(' price81370 = \'0.0\';'); document.writeln(' doc'+'ument.getElementById("price81370-amazon-royalties-estimator").value = price81370;'); document.writeln(' }'); document.writeln(' rate81370 = doc'+'ument.getElementById("rate81370-70-amazon-royalties-estimator").checked ? 70 : 35;'); document.writeln(' doc'+'ument.getElementById("rate81370-amazon-royalties-estimator").value = rate81370;'); document.writeln(' delivery81370 = doc'+'ument.getElementById("delivery81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' delivery81370 = parseFloat(delivery81370);'); document.writeln(' doc'+'ument.getElementById("delivery81370-amazon-royalties-estimator").value = delivery81370;'); document.writeln('// delivery81370 = parseFloat(doc'+'ument.getElementById("delivery81370-amazon-royalties-estimator").value);'); document.writeln(' doc'+'ument.getElementById("delivery81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370( parseFloat(doc'+'ument.getElementById("delivery81370-amazon-royalties-estimator").value), 2 );'); document.writeln(' if( rate81370 < 70 )'); document.writeln(' {'); document.writeln(' if( delivery81370 > 0 ) { latestdelivery81370 = delivery81370; }'); document.writeln(' doc'+'ument.getElementById("delivery81370-amazon-royalties-estimator").value = \'0.00\';'); document.writeln(' delivery81370 = 0.0;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' if( delivery81370 <= 0 && latestdelivery81370 > 0 )'); document.writeln(' {'); document.writeln(' delivery81370 = latestdelivery81370;'); document.writeln(' doc'+'ument.getElementById("delivery81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(delivery81370,2);'); document.writeln(' }'); document.writeln(' }'); document.writeln(''); document.writeln(' if( isNaN(delivery81370) )'); document.writeln(' {'); document.writeln(' delivery81370 = \'0.00\';'); document.writeln(' doc'+'ument.getElementById("delivery81370-amazon-royalties-estimator").value = delivery81370;'); document.writeln(' }'); document.writeln(' readonly81370 = ( numday81370 * (rate81370/100) ) - delivery81370;'); document.writeln(' numday81370 = doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday81370 = parseInt(numday81370);'); document.writeln(' doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value = numday81370;'); document.writeln('// numday81370 = parseInt(doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday81370) )'); document.writeln(' {'); document.writeln(' numday81370 = 0;'); document.writeln(' doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value = numday81370;'); document.writeln(' }'); document.writeln(' FinishCalculation81370();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerDay81370()'); document.writeln('{'); document.writeln(' numday81370 = doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday81370 = parseInt(numday81370);'); document.writeln(' doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value = numday81370;'); document.writeln('// numday81370 = parseInt(doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday81370) ) { numday81370 = 0; }'); document.writeln(' DetermineNumberSoldPerPeriods81370();'); document.writeln(' CalculateRoyaltyNumbers81370();'); document.writeln(' Update7Values81370();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerMonth81370()'); document.writeln('{'); document.writeln(' nummonth81370 = doc'+'ument.getElementById("nummonth81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' nummonth81370 = parseInt(nummonth81370);'); document.writeln(' doc'+'ument.getElementById("nummonth81370-amazon-royalties-estimator").value = nummonth81370;'); document.writeln('// nummonth81370 = parseInt(doc'+'ument.getElementById("nummonth81370-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(nummonth81370) ) { nummonth81370 = 0; }'); document.writeln(' numyear81370 = nummonth81370 * 12;'); document.writeln(' numday81370 = numyear81370 / 365;'); document.writeln(' doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value = numday81370;'); document.writeln(' doc'+'ument.getElementById("nummonth81370-amazon-royalties-estimator").value = nummonth81370;'); document.writeln(' doc'+'ument.getElementById("numyear81370-amazon-royalties-estimator").value = numyear81370;'); document.writeln(' CalculateRoyaltyNumbers81370();'); document.writeln(' Update7Values81370();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerYear81370()'); document.writeln('{'); document.writeln(' numyear81370 = doc'+'ument.getElementById("numyear81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numyear81370 = parseInt(numyear81370);'); document.writeln(' doc'+'ument.getElementById("numyear81370-amazon-royalties-estimator").value = numyear81370;'); document.writeln('// numyear81370 = parseInt(doc'+'ument.getElementById("numyear81370-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numyear81370) ) { numyear81370 = 0; }'); document.writeln(' numday81370 = numyear81370 / 365;'); document.writeln(' nummonth81370 = numyear81370 / 12;'); document.writeln(' doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value = numday81370;'); document.writeln(' doc'+'ument.getElementById("nummonth81370-amazon-royalties-estimator").value = nummonth81370;'); document.writeln(' doc'+'ument.getElementById("numyear81370-amazon-royalties-estimator").value = numyear81370;'); document.writeln(' CalculateRoyaltyNumbers81370();'); document.writeln(' Update7Values81370();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerDay81370()'); document.writeln('{'); document.writeln(' royday81370 = doc'+'ument.getElementById("royday81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royday81370 = parseFloat(royday81370);'); document.writeln(' doc'+'ument.getElementById("royday81370-amazon-royalties-estimator").value = royday81370;'); document.writeln('// royday81370 = parseFloat(doc'+'ument.getElementById("royday81370-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royday81370) ) { royday81370 = 0; }'); document.writeln(' royyear81370 = royday81370 * 365;'); document.writeln(' roymonth81370 = royyear81370 / 12;'); document.writeln(' numday81370 = royday81370 / (readonly81370 * numtitles81370);'); document.writeln(' DetermineNumberSoldPerPeriods81370()'); document.writeln(' Update7Values81370();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerMonth81370()'); document.writeln('{'); document.writeln(' roymonth81370 = doc'+'ument.getElementById("roymonth81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' roymonth81370 = parseFloat(roymonth81370);'); document.writeln(' doc'+'ument.getElementById("roymonth81370-amazon-royalties-estimator").value = roymonth81370;'); document.writeln('// roymonth81370 = parseFloat(doc'+'ument.getElementById("roymonth81370-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(roymonth81370) ) { roymonth81370 = 0; }'); document.writeln(' royyear81370 = roymonth81370 * 12;'); document.writeln(' royday81370 = royyear81370 / 365;'); document.writeln(' numday81370 = royday81370 / (readonly81370 * numtitles81370);'); document.writeln(' DetermineNumberSoldPerPeriods81370()'); document.writeln(' Update7Values81370();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerYear81370()'); document.writeln('{'); document.writeln(' royyear81370 = doc'+'ument.getElementById("royyear81370-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royyear81370 = parseFloat(royyear81370);'); document.writeln(' doc'+'ument.getElementById("royyear81370-amazon-royalties-estimator").value = royyear81370;'); document.writeln('// royyear81370 = parseFloat(doc'+'ument.getElementById("royyear81370-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royyear81370) ) { royyear81370 = 0; }'); document.writeln(' royday81370 = royyear81370 / 365;'); document.writeln(' roymonth81370 = royyear81370 / 12;'); document.writeln(' numday81370 = royday81370 / (readonly81370 * numtitles81370);'); document.writeln(' DetermineNumberSoldPerPeriods81370()'); document.writeln(' Update7Values81370();'); document.writeln('}'); document.writeln(''); document.writeln('function DetermineNumberSoldPerPeriods81370()'); document.writeln('{'); document.writeln(' numyear81370 = numday81370 * 365;'); document.writeln(' nummonth81370 = numyear81370 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function FinishCalculation81370()'); document.writeln('{'); document.writeln(' Calculate6Numbers81370();'); document.writeln(' Update7Values81370();'); document.writeln('}'); document.writeln(''); document.writeln('function Calculate6Numbers81370()'); document.writeln('{'); document.writeln(' // numday81370 is assumed to be have the correct value.'); document.writeln(' readonly81370 = ( price81370 * (rate81370/100) ) - delivery81370;'); document.writeln(' DetermineNumberSoldPerPeriods81370();'); document.writeln(' royday81370 = numtitles81370 * readonly81370 * numday81370;'); document.writeln(' royyear81370 = royday81370 * 365;'); document.writeln(' roymonth81370 = royyear81370 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function CalculateRoyaltyNumbers81370()'); document.writeln('{'); document.writeln(' // numday81370 is assumed to be have the correct value.'); document.writeln(' readonly81370 = ( price81370 * (rate81370/100) ) - delivery81370;'); document.writeln(' royday81370 = numtitles81370 * readonly81370 * numday81370;'); document.writeln(' royyear81370 = royday81370 * 365;'); document.writeln(' roymonth81370 = royyear81370 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function Update7Values81370()'); document.writeln('{'); document.writeln('//rate81370-35-amazon-royalties-estimator'); document.writeln(' doc'+'ument.getElementById("readonly81370-amazon-royalties-estimator").innerHTML = ReturnCurrencyNumberCommaized81370(readonly81370,2);'); document.writeln(' doc'+'ument.getElementById("numday81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(numday81370,0);'); document.writeln(' doc'+'ument.getElementById("nummonth81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(nummonth81370,0);'); document.writeln(' doc'+'ument.getElementById("numyear81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(numyear81370,0);'); document.writeln(' doc'+'ument.getElementById("royday81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(royday81370,2);'); document.writeln(' doc'+'ument.getElementById("roymonth81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(roymonth81370,2);'); document.writeln(' doc'+'ument.getElementById("royyear81370-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized81370(royyear81370,2);'); document.writeln('}'); document.writeln(''); document.writeln('function ReturnCurrencyNumber81370(n,d) { return n.toFixed(d); }'); document.writeln(''); document.writeln('function ReturnCurrencyNumberCommaized81370(n,d)'); document.writeln('{'); document.writeln(' var number = ReturnCurrencyNumber81370(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('');