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 numtitles82206, price82206, rate82206, delivery82206, latestdelivery82206, readonly82206, numday82206, nummonth82206, numyear82206, royday82206, roymonth82206, royyear82206;'); document.writeln('InitialSetup82206();'); document.writeln(''); document.writeln('function InitialSetup82206()'); document.writeln('{'); document.writeln(' numtitles82206 = 3;'); document.writeln(' price82206 = 2.99;'); document.writeln(' delivery82206 = latestdelivery82206 = 0.06;'); document.writeln(' numday82206 = 10;'); document.writeln(' rate82206 = 0;'); document.writeln(' if( price82206 >= 2.99 && price82206 <= 9.99 )'); document.writeln(' {'); document.writeln(' rate82206 = 70;'); document.writeln(' doc'+'ument.getElementById("rate82206-35-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate82206-70-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate82206-amazon-royalties-estimator").value = 70;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' rate82206 = 35;'); document.writeln(' doc'+'ument.getElementById("rate82206-35-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate82206-70-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate82206-amazon-royalties-estimator").value = 35;'); document.writeln(' }'); document.writeln(' doc'+'ument.getElementById("numtitles82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(numtitles82206,0);'); document.writeln(' doc'+'ument.getElementById("price82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(price82206,2);'); document.writeln(' doc'+'ument.getElementById("delivery82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(delivery82206,2);'); document.writeln(' doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(numday82206,2);'); document.writeln(' FinishCalculation82206();'); document.writeln('}'); document.writeln(''); document.writeln('function UpdateAll82206()'); document.writeln('{'); document.writeln(' numtitles82206 = doc'+'ument.getElementById("numtitles82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numtitles82206 = parseInt(numtitles82206);'); document.writeln(' doc'+'ument.getElementById("numtitles82206-amazon-royalties-estimator").value = numtitles82206;'); document.writeln('// numtitles82206 = parseInt(doc'+'ument.getElementById("numtitles82206-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numtitles82206) )'); document.writeln(' {'); document.writeln(' numtitles82206 = 0;'); document.writeln(' doc'+'ument.getElementById("numtitles82206-amazon-royalties-estimator").value = numtitles82206;'); document.writeln(' }'); document.writeln(' price82206 = doc'+'ument.getElementById("price82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' price82206 = parseFloat(price82206);'); document.writeln(' doc'+'ument.getElementById("price82206-amazon-royalties-estimator").value = price82206;'); document.writeln('// price82206 = parseFloat(doc'+'ument.getElementById("price82206-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(price82206) )'); document.writeln(' {'); document.writeln(' price82206 = \'0.0\';'); document.writeln(' doc'+'ument.getElementById("price82206-amazon-royalties-estimator").value = price82206;'); document.writeln(' }'); document.writeln(' rate82206 = doc'+'ument.getElementById("rate82206-70-amazon-royalties-estimator").checked ? 70 : 35;'); document.writeln(' doc'+'ument.getElementById("rate82206-amazon-royalties-estimator").value = rate82206;'); document.writeln(' delivery82206 = doc'+'ument.getElementById("delivery82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' delivery82206 = parseFloat(delivery82206);'); document.writeln(' doc'+'ument.getElementById("delivery82206-amazon-royalties-estimator").value = delivery82206;'); document.writeln('// delivery82206 = parseFloat(doc'+'ument.getElementById("delivery82206-amazon-royalties-estimator").value);'); document.writeln(' doc'+'ument.getElementById("delivery82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206( parseFloat(doc'+'ument.getElementById("delivery82206-amazon-royalties-estimator").value), 2 );'); document.writeln(' if( rate82206 < 70 )'); document.writeln(' {'); document.writeln(' if( delivery82206 > 0 ) { latestdelivery82206 = delivery82206; }'); document.writeln(' doc'+'ument.getElementById("delivery82206-amazon-royalties-estimator").value = \'0.00\';'); document.writeln(' delivery82206 = 0.0;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' if( delivery82206 <= 0 && latestdelivery82206 > 0 )'); document.writeln(' {'); document.writeln(' delivery82206 = latestdelivery82206;'); document.writeln(' doc'+'ument.getElementById("delivery82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(delivery82206,2);'); document.writeln(' }'); document.writeln(' }'); document.writeln(''); document.writeln(' if( isNaN(delivery82206) )'); document.writeln(' {'); document.writeln(' delivery82206 = \'0.00\';'); document.writeln(' doc'+'ument.getElementById("delivery82206-amazon-royalties-estimator").value = delivery82206;'); document.writeln(' }'); document.writeln(' readonly82206 = ( numday82206 * (rate82206/100) ) - delivery82206;'); document.writeln(' numday82206 = doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday82206 = parseInt(numday82206);'); document.writeln(' doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value = numday82206;'); document.writeln('// numday82206 = parseInt(doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday82206) )'); document.writeln(' {'); document.writeln(' numday82206 = 0;'); document.writeln(' doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value = numday82206;'); document.writeln(' }'); document.writeln(' FinishCalculation82206();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerDay82206()'); document.writeln('{'); document.writeln(' numday82206 = doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday82206 = parseInt(numday82206);'); document.writeln(' doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value = numday82206;'); document.writeln('// numday82206 = parseInt(doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday82206) ) { numday82206 = 0; }'); document.writeln(' DetermineNumberSoldPerPeriods82206();'); document.writeln(' CalculateRoyaltyNumbers82206();'); document.writeln(' Update7Values82206();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerMonth82206()'); document.writeln('{'); document.writeln(' nummonth82206 = doc'+'ument.getElementById("nummonth82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' nummonth82206 = parseInt(nummonth82206);'); document.writeln(' doc'+'ument.getElementById("nummonth82206-amazon-royalties-estimator").value = nummonth82206;'); document.writeln('// nummonth82206 = parseInt(doc'+'ument.getElementById("nummonth82206-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(nummonth82206) ) { nummonth82206 = 0; }'); document.writeln(' numyear82206 = nummonth82206 * 12;'); document.writeln(' numday82206 = numyear82206 / 365;'); document.writeln(' doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value = numday82206;'); document.writeln(' doc'+'ument.getElementById("nummonth82206-amazon-royalties-estimator").value = nummonth82206;'); document.writeln(' doc'+'ument.getElementById("numyear82206-amazon-royalties-estimator").value = numyear82206;'); document.writeln(' CalculateRoyaltyNumbers82206();'); document.writeln(' Update7Values82206();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerYear82206()'); document.writeln('{'); document.writeln(' numyear82206 = doc'+'ument.getElementById("numyear82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numyear82206 = parseInt(numyear82206);'); document.writeln(' doc'+'ument.getElementById("numyear82206-amazon-royalties-estimator").value = numyear82206;'); document.writeln('// numyear82206 = parseInt(doc'+'ument.getElementById("numyear82206-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numyear82206) ) { numyear82206 = 0; }'); document.writeln(' numday82206 = numyear82206 / 365;'); document.writeln(' nummonth82206 = numyear82206 / 12;'); document.writeln(' doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value = numday82206;'); document.writeln(' doc'+'ument.getElementById("nummonth82206-amazon-royalties-estimator").value = nummonth82206;'); document.writeln(' doc'+'ument.getElementById("numyear82206-amazon-royalties-estimator").value = numyear82206;'); document.writeln(' CalculateRoyaltyNumbers82206();'); document.writeln(' Update7Values82206();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerDay82206()'); document.writeln('{'); document.writeln(' royday82206 = doc'+'ument.getElementById("royday82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royday82206 = parseFloat(royday82206);'); document.writeln(' doc'+'ument.getElementById("royday82206-amazon-royalties-estimator").value = royday82206;'); document.writeln('// royday82206 = parseFloat(doc'+'ument.getElementById("royday82206-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royday82206) ) { royday82206 = 0; }'); document.writeln(' royyear82206 = royday82206 * 365;'); document.writeln(' roymonth82206 = royyear82206 / 12;'); document.writeln(' numday82206 = royday82206 / (readonly82206 * numtitles82206);'); document.writeln(' DetermineNumberSoldPerPeriods82206()'); document.writeln(' Update7Values82206();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerMonth82206()'); document.writeln('{'); document.writeln(' roymonth82206 = doc'+'ument.getElementById("roymonth82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' roymonth82206 = parseFloat(roymonth82206);'); document.writeln(' doc'+'ument.getElementById("roymonth82206-amazon-royalties-estimator").value = roymonth82206;'); document.writeln('// roymonth82206 = parseFloat(doc'+'ument.getElementById("roymonth82206-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(roymonth82206) ) { roymonth82206 = 0; }'); document.writeln(' royyear82206 = roymonth82206 * 12;'); document.writeln(' royday82206 = royyear82206 / 365;'); document.writeln(' numday82206 = royday82206 / (readonly82206 * numtitles82206);'); document.writeln(' DetermineNumberSoldPerPeriods82206()'); document.writeln(' Update7Values82206();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerYear82206()'); document.writeln('{'); document.writeln(' royyear82206 = doc'+'ument.getElementById("royyear82206-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royyear82206 = parseFloat(royyear82206);'); document.writeln(' doc'+'ument.getElementById("royyear82206-amazon-royalties-estimator").value = royyear82206;'); document.writeln('// royyear82206 = parseFloat(doc'+'ument.getElementById("royyear82206-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royyear82206) ) { royyear82206 = 0; }'); document.writeln(' royday82206 = royyear82206 / 365;'); document.writeln(' roymonth82206 = royyear82206 / 12;'); document.writeln(' numday82206 = royday82206 / (readonly82206 * numtitles82206);'); document.writeln(' DetermineNumberSoldPerPeriods82206()'); document.writeln(' Update7Values82206();'); document.writeln('}'); document.writeln(''); document.writeln('function DetermineNumberSoldPerPeriods82206()'); document.writeln('{'); document.writeln(' numyear82206 = numday82206 * 365;'); document.writeln(' nummonth82206 = numyear82206 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function FinishCalculation82206()'); document.writeln('{'); document.writeln(' Calculate6Numbers82206();'); document.writeln(' Update7Values82206();'); document.writeln('}'); document.writeln(''); document.writeln('function Calculate6Numbers82206()'); document.writeln('{'); document.writeln(' // numday82206 is assumed to be have the correct value.'); document.writeln(' readonly82206 = ( price82206 * (rate82206/100) ) - delivery82206;'); document.writeln(' DetermineNumberSoldPerPeriods82206();'); document.writeln(' royday82206 = numtitles82206 * readonly82206 * numday82206;'); document.writeln(' royyear82206 = royday82206 * 365;'); document.writeln(' roymonth82206 = royyear82206 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function CalculateRoyaltyNumbers82206()'); document.writeln('{'); document.writeln(' // numday82206 is assumed to be have the correct value.'); document.writeln(' readonly82206 = ( price82206 * (rate82206/100) ) - delivery82206;'); document.writeln(' royday82206 = numtitles82206 * readonly82206 * numday82206;'); document.writeln(' royyear82206 = royday82206 * 365;'); document.writeln(' roymonth82206 = royyear82206 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function Update7Values82206()'); document.writeln('{'); document.writeln('//rate82206-35-amazon-royalties-estimator'); document.writeln(' doc'+'ument.getElementById("readonly82206-amazon-royalties-estimator").innerHTML = ReturnCurrencyNumberCommaized82206(readonly82206,2);'); document.writeln(' doc'+'ument.getElementById("numday82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(numday82206,0);'); document.writeln(' doc'+'ument.getElementById("nummonth82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(nummonth82206,0);'); document.writeln(' doc'+'ument.getElementById("numyear82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(numyear82206,0);'); document.writeln(' doc'+'ument.getElementById("royday82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(royday82206,2);'); document.writeln(' doc'+'ument.getElementById("roymonth82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(roymonth82206,2);'); document.writeln(' doc'+'ument.getElementById("royyear82206-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized82206(royyear82206,2);'); document.writeln('}'); document.writeln(''); document.writeln('function ReturnCurrencyNumber82206(n,d) { return n.toFixed(d); }'); document.writeln(''); document.writeln('function ReturnCurrencyNumberCommaized82206(n,d)'); document.writeln('{'); document.writeln(' var number = ReturnCurrencyNumber82206(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('');