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 numtitles77937, price77937, rate77937, delivery77937, latestdelivery77937, readonly77937, numday77937, nummonth77937, numyear77937, royday77937, roymonth77937, royyear77937;'); document.writeln('InitialSetup77937();'); document.writeln(''); document.writeln('function InitialSetup77937()'); document.writeln('{'); document.writeln(' numtitles77937 = 3;'); document.writeln(' price77937 = 2.99;'); document.writeln(' delivery77937 = latestdelivery77937 = 0.06;'); document.writeln(' numday77937 = 10;'); document.writeln(' rate77937 = 0;'); document.writeln(' if( price77937 >= 2.99 && price77937 <= 9.99 )'); document.writeln(' {'); document.writeln(' rate77937 = 70;'); document.writeln(' doc'+'ument.getElementById("rate77937-35-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate77937-70-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate77937-amazon-royalties-estimator").value = 70;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' rate77937 = 35;'); document.writeln(' doc'+'ument.getElementById("rate77937-35-amazon-royalties-estimator").checked = true;'); document.writeln(' doc'+'ument.getElementById("rate77937-70-amazon-royalties-estimator").checked = false;'); document.writeln(' doc'+'ument.getElementById("rate77937-amazon-royalties-estimator").value = 35;'); document.writeln(' }'); document.writeln(' doc'+'ument.getElementById("numtitles77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(numtitles77937,0);'); document.writeln(' doc'+'ument.getElementById("price77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(price77937,2);'); document.writeln(' doc'+'ument.getElementById("delivery77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(delivery77937,2);'); document.writeln(' doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(numday77937,2);'); document.writeln(' FinishCalculation77937();'); document.writeln('}'); document.writeln(''); document.writeln('function UpdateAll77937()'); document.writeln('{'); document.writeln(' numtitles77937 = doc'+'ument.getElementById("numtitles77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numtitles77937 = parseInt(numtitles77937);'); document.writeln(' doc'+'ument.getElementById("numtitles77937-amazon-royalties-estimator").value = numtitles77937;'); document.writeln('// numtitles77937 = parseInt(doc'+'ument.getElementById("numtitles77937-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numtitles77937) )'); document.writeln(' {'); document.writeln(' numtitles77937 = 0;'); document.writeln(' doc'+'ument.getElementById("numtitles77937-amazon-royalties-estimator").value = numtitles77937;'); document.writeln(' }'); document.writeln(' price77937 = doc'+'ument.getElementById("price77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' price77937 = parseFloat(price77937);'); document.writeln(' doc'+'ument.getElementById("price77937-amazon-royalties-estimator").value = price77937;'); document.writeln('// price77937 = parseFloat(doc'+'ument.getElementById("price77937-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(price77937) )'); document.writeln(' {'); document.writeln(' price77937 = \'0.0\';'); document.writeln(' doc'+'ument.getElementById("price77937-amazon-royalties-estimator").value = price77937;'); document.writeln(' }'); document.writeln(' rate77937 = doc'+'ument.getElementById("rate77937-70-amazon-royalties-estimator").checked ? 70 : 35;'); document.writeln(' doc'+'ument.getElementById("rate77937-amazon-royalties-estimator").value = rate77937;'); document.writeln(' delivery77937 = doc'+'ument.getElementById("delivery77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' delivery77937 = parseFloat(delivery77937);'); document.writeln(' doc'+'ument.getElementById("delivery77937-amazon-royalties-estimator").value = delivery77937;'); document.writeln('// delivery77937 = parseFloat(doc'+'ument.getElementById("delivery77937-amazon-royalties-estimator").value);'); document.writeln(' doc'+'ument.getElementById("delivery77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937( parseFloat(doc'+'ument.getElementById("delivery77937-amazon-royalties-estimator").value), 2 );'); document.writeln(' if( rate77937 < 70 )'); document.writeln(' {'); document.writeln(' if( delivery77937 > 0 ) { latestdelivery77937 = delivery77937; }'); document.writeln(' doc'+'ument.getElementById("delivery77937-amazon-royalties-estimator").value = \'0.00\';'); document.writeln(' delivery77937 = 0.0;'); document.writeln(' }'); document.writeln(' else'); document.writeln(' {'); document.writeln(' if( delivery77937 <= 0 && latestdelivery77937 > 0 )'); document.writeln(' {'); document.writeln(' delivery77937 = latestdelivery77937;'); document.writeln(' doc'+'ument.getElementById("delivery77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(delivery77937,2);'); document.writeln(' }'); document.writeln(' }'); document.writeln(''); document.writeln(' if( isNaN(delivery77937) )'); document.writeln(' {'); document.writeln(' delivery77937 = \'0.00\';'); document.writeln(' doc'+'ument.getElementById("delivery77937-amazon-royalties-estimator").value = delivery77937;'); document.writeln(' }'); document.writeln(' readonly77937 = ( numday77937 * (rate77937/100) ) - delivery77937;'); document.writeln(' numday77937 = doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday77937 = parseInt(numday77937);'); document.writeln(' doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value = numday77937;'); document.writeln('// numday77937 = parseInt(doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday77937) )'); document.writeln(' {'); document.writeln(' numday77937 = 0;'); document.writeln(' doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value = numday77937;'); document.writeln(' }'); document.writeln(' FinishCalculation77937();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerDay77937()'); document.writeln('{'); document.writeln(' numday77937 = doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numday77937 = parseInt(numday77937);'); document.writeln(' doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value = numday77937;'); document.writeln('// numday77937 = parseInt(doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numday77937) ) { numday77937 = 0; }'); document.writeln(' DetermineNumberSoldPerPeriods77937();'); document.writeln(' CalculateRoyaltyNumbers77937();'); document.writeln(' Update7Values77937();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerMonth77937()'); document.writeln('{'); document.writeln(' nummonth77937 = doc'+'ument.getElementById("nummonth77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' nummonth77937 = parseInt(nummonth77937);'); document.writeln(' doc'+'ument.getElementById("nummonth77937-amazon-royalties-estimator").value = nummonth77937;'); document.writeln('// nummonth77937 = parseInt(doc'+'ument.getElementById("nummonth77937-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(nummonth77937) ) { nummonth77937 = 0; }'); document.writeln(' numyear77937 = nummonth77937 * 12;'); document.writeln(' numday77937 = numyear77937 / 365;'); document.writeln(' doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value = numday77937;'); document.writeln(' doc'+'ument.getElementById("nummonth77937-amazon-royalties-estimator").value = nummonth77937;'); document.writeln(' doc'+'ument.getElementById("numyear77937-amazon-royalties-estimator").value = numyear77937;'); document.writeln(' CalculateRoyaltyNumbers77937();'); document.writeln(' Update7Values77937();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromNumPerYear77937()'); document.writeln('{'); document.writeln(' numyear77937 = doc'+'ument.getElementById("numyear77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' numyear77937 = parseInt(numyear77937);'); document.writeln(' doc'+'ument.getElementById("numyear77937-amazon-royalties-estimator").value = numyear77937;'); document.writeln('// numyear77937 = parseInt(doc'+'ument.getElementById("numyear77937-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(numyear77937) ) { numyear77937 = 0; }'); document.writeln(' numday77937 = numyear77937 / 365;'); document.writeln(' nummonth77937 = numyear77937 / 12;'); document.writeln(' doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value = numday77937;'); document.writeln(' doc'+'ument.getElementById("nummonth77937-amazon-royalties-estimator").value = nummonth77937;'); document.writeln(' doc'+'ument.getElementById("numyear77937-amazon-royalties-estimator").value = numyear77937;'); document.writeln(' CalculateRoyaltyNumbers77937();'); document.writeln(' Update7Values77937();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerDay77937()'); document.writeln('{'); document.writeln(' royday77937 = doc'+'ument.getElementById("royday77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royday77937 = parseFloat(royday77937);'); document.writeln(' doc'+'ument.getElementById("royday77937-amazon-royalties-estimator").value = royday77937;'); document.writeln('// royday77937 = parseFloat(doc'+'ument.getElementById("royday77937-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royday77937) ) { royday77937 = 0; }'); document.writeln(' royyear77937 = royday77937 * 365;'); document.writeln(' roymonth77937 = royyear77937 / 12;'); document.writeln(' numday77937 = royday77937 / (readonly77937 * numtitles77937);'); document.writeln(' DetermineNumberSoldPerPeriods77937()'); document.writeln(' Update7Values77937();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerMonth77937()'); document.writeln('{'); document.writeln(' roymonth77937 = doc'+'ument.getElementById("roymonth77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' roymonth77937 = parseFloat(roymonth77937);'); document.writeln(' doc'+'ument.getElementById("roymonth77937-amazon-royalties-estimator").value = roymonth77937;'); document.writeln('// roymonth77937 = parseFloat(doc'+'ument.getElementById("roymonth77937-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(roymonth77937) ) { roymonth77937 = 0; }'); document.writeln(' royyear77937 = roymonth77937 * 12;'); document.writeln(' royday77937 = royyear77937 / 365;'); document.writeln(' numday77937 = royday77937 / (readonly77937 * numtitles77937);'); document.writeln(' DetermineNumberSoldPerPeriods77937()'); document.writeln(' Update7Values77937();'); document.writeln('}'); document.writeln(''); document.writeln('function RecalculateFromRoyaltyPerYear77937()'); document.writeln('{'); document.writeln(' royyear77937 = doc'+'ument.getElementById("royyear77937-amazon-royalties-estimator").value.replace(/[^\\d\\.]/g,"");'); document.writeln(' royyear77937 = parseFloat(royyear77937);'); document.writeln(' doc'+'ument.getElementById("royyear77937-amazon-royalties-estimator").value = royyear77937;'); document.writeln('// royyear77937 = parseFloat(doc'+'ument.getElementById("royyear77937-amazon-royalties-estimator").value);'); document.writeln(' if( isNaN(royyear77937) ) { royyear77937 = 0; }'); document.writeln(' royday77937 = royyear77937 / 365;'); document.writeln(' roymonth77937 = royyear77937 / 12;'); document.writeln(' numday77937 = royday77937 / (readonly77937 * numtitles77937);'); document.writeln(' DetermineNumberSoldPerPeriods77937()'); document.writeln(' Update7Values77937();'); document.writeln('}'); document.writeln(''); document.writeln('function DetermineNumberSoldPerPeriods77937()'); document.writeln('{'); document.writeln(' numyear77937 = numday77937 * 365;'); document.writeln(' nummonth77937 = numyear77937 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function FinishCalculation77937()'); document.writeln('{'); document.writeln(' Calculate6Numbers77937();'); document.writeln(' Update7Values77937();'); document.writeln('}'); document.writeln(''); document.writeln('function Calculate6Numbers77937()'); document.writeln('{'); document.writeln(' // numday77937 is assumed to be have the correct value.'); document.writeln(' readonly77937 = ( price77937 * (rate77937/100) ) - delivery77937;'); document.writeln(' DetermineNumberSoldPerPeriods77937();'); document.writeln(' royday77937 = numtitles77937 * readonly77937 * numday77937;'); document.writeln(' royyear77937 = royday77937 * 365;'); document.writeln(' roymonth77937 = royyear77937 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function CalculateRoyaltyNumbers77937()'); document.writeln('{'); document.writeln(' // numday77937 is assumed to be have the correct value.'); document.writeln(' readonly77937 = ( price77937 * (rate77937/100) ) - delivery77937;'); document.writeln(' royday77937 = numtitles77937 * readonly77937 * numday77937;'); document.writeln(' royyear77937 = royday77937 * 365;'); document.writeln(' roymonth77937 = royyear77937 / 12;'); document.writeln('}'); document.writeln(''); document.writeln('function Update7Values77937()'); document.writeln('{'); document.writeln('//rate77937-35-amazon-royalties-estimator'); document.writeln(' doc'+'ument.getElementById("readonly77937-amazon-royalties-estimator").innerHTML = ReturnCurrencyNumberCommaized77937(readonly77937,2);'); document.writeln(' doc'+'ument.getElementById("numday77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(numday77937,0);'); document.writeln(' doc'+'ument.getElementById("nummonth77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(nummonth77937,0);'); document.writeln(' doc'+'ument.getElementById("numyear77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(numyear77937,0);'); document.writeln(' doc'+'ument.getElementById("royday77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(royday77937,2);'); document.writeln(' doc'+'ument.getElementById("roymonth77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(roymonth77937,2);'); document.writeln(' doc'+'ument.getElementById("royyear77937-amazon-royalties-estimator").value = ReturnCurrencyNumberCommaized77937(royyear77937,2);'); document.writeln('}'); document.writeln(''); document.writeln('function ReturnCurrencyNumber77937(n,d) { return n.toFixed(d); }'); document.writeln(''); document.writeln('function ReturnCurrencyNumberCommaized77937(n,d)'); document.writeln('{'); document.writeln(' var number = ReturnCurrencyNumber77937(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('');