Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--
- var a = 100000.00;
- var p = 11;
- var t = 12;
- var pr1 = 0.12;
- var min1 = 1000;
- var option1 = 1;
- var pr2 = 0.10;
- var option2 = 2;
- var min3 = 170;
- var option3 = 3;
- var d = 0;
- function add_favorite(a) {
- title=document.title;
- url=document.location;
- try {
- // Internet Explorer
- window.external.AddFavorite(url, title);
- }
- catch (e) {
- try {
- // Mozilla
- window.sidebar.addPanel(title, url, "");
- }
- catch (e) {
- // Opera
- if (typeof(opera)=="object") {
- a.rel="sidebar";
- a.title=title;
- a.url=url;
- return true;
- }
- else {
- // Unknown
- alert('Нажмите Ctrl-D чтобы добавить страницу в закладки');
- }
- }
- }
- return false;
- }
- function Init()
- {
- document.forms.mainform["amount"].value = a.toString();
- document.forms.mainform["term"].value = t.toString();
- document.forms.mainform["percent"].value = p.toString();
- document.forms.mainform["pr1"].value = pr1.toString();
- document.forms.mainform["min1"].value = min1.toString();
- document.forms.mainform["option1"].value = option1.toString();
- document.forms.mainform["pr2"].value = pr2.toString();
- document.forms.mainform["option2"].value = option2.toString();
- document.forms.mainform["min3"].value = min3.toString();
- document.forms.mainform["option3"].value = option3.toString();
- onChangeParameter();
- }
- /* Made by Mathias Bynens <http://mathiasbynens.be/> */
- function number_format(a, b, c, d) {
- a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
- e = a + '';
- f = e.split('.');
- if (!f[0]) {
- f[0] = '0';
- }
- if (!f[1]) {
- f[1] = '';
- }
- if (f[1].length < b) {
- g = f[1];
- for (i=f[1].length + 1; i <= b; i++) {
- g += '0';
- }
- f[1] = g;
- }
- if(d != '' && f[0].length > 3) {
- h = f[0];
- f[0] = '';
- for(j = 3; j < h.length; j+=3) {
- i = h.slice(h.length - j, h.length - j + 3);
- f[0] = d + i + f[0] + '';
- }
- j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
- f[0] = j + f[0];
- }
- c = (b <= 0) ? '' : c;
- return f[0] + c + f[1];
- }
- function onChangeParameter()
- {
- var sPay = 0
- var mPay = 0;
- var yPay = 0;
- var Pay = 0;
- var aPay = 0;
- var ePay = 0;
- var ePr = 0;
- var minV, maxV;
- var year;
- var eff = 0.0;
- var emPay, effPay = 0;
- a = Number(document.forms.mainform["amount"].value.replace(",","."));
- p = Number(document.forms.mainform["percent"].value.replace(",","."));
- t = Number(document.forms.mainform["term"].value.replace(",","."));
- d = a*p/1200/(1-Math.pow(1+p/1200,-t));
- year = ( Math.floor(t / 12) == (t / 12) ) ? t / 12 : Math.floor (t / 12) + 1;
- for(i=1;i<=5;i++)
- {
- Pay = Number(document.forms.mainform["pr"+i+""].value.replace(",",".")) * a / 100;
- minV = Number(document.forms.mainform["min"+i+""].value.replace(",","."));
- maxV = Number(document.forms.mainform["max"+i+""].value.replace(",","."));
- if (minV && Pay < minV) Pay = minV;
- if (maxV && Pay > maxV) Pay = maxV;
- switch (document.forms.mainform["option"+i+""].value)
- {
- case "1":
- sPay = sPay + Pay;
- break;
- case "2":
- mPay = mPay + Pay;
- break;
- case "3":
- yPay = yPay + Pay;
- break;
- }
- }
- aPay = sPay + (mPay + d)*t + yPay * year;
- ePay = aPay - a;
- ePr = ePay / a * 100;
- emPay = aPay / t;
- while (emPay - effPay > 0) {
- eff = eff + 0.01;
- effPay = a*eff/1200/(1-Math.pow(1+eff/1200,-t));
- }
- document.forms.mainform["singlePay"].value = number_format(sPay, 0, ".", " ");
- document.forms.mainform["comission"].value = number_format(mPay, 0, ".", " ");
- document.forms.mainform["yearPay"].value = number_format(yPay, 0, ".", " ");
- document.forms.mainform["basic"].value = number_format(d, 0, ".", " ");
- document.forms.mainform["monthPay"].value = number_format(mPay + d, 0, ".", " ");
- document.forms.mainform["allPay"].value = number_format(aPay, 0, ".", " ");
- document.forms.mainform["extraPay"].value = number_format(ePay, 0, ".", " ");
- document.forms.mainform["extraPercent"].value = number_format(ePr, 1, ".", " ");
- document.forms.mainform["comissionPercent"].value = number_format(eff, 1, ".", " ");
- }
- -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement