var rubTariff1 = 777;
var rubTariff2 = 1777;
var rubTariff3 = 2777;
var rubTariff4 = 4777;
var bankUSD = document.getElementById('bank-usd').innerText;
var bankEUR = document.getElementById('bank-eur').innerText;
var bankBYR = document.getElementById('bank-byr').innerText;
var bankUAH = document.getElementById('bank-uah').innerText;
var bankKZT = document.getElementById('bank-kzt').innerText;
document.getElementById('usdTariff1').innerHTML = (rubTariff1/bankUSD).toFixed(2);
document.getElementById('eurTariff1').innerHTML = (rubTariff1/bankEUR).toFixed(2);
document.getElementById('byrTariff1').innerHTML = (rubTariff1/bankBYR).toFixed(0);
document.getElementById('uahTariff1').innerHTML = (rubTariff1/bankUAH).toFixed(1);
document.getElementById('kztTariff1').innerHTML = (rubTariff1/bankKZT).toFixed(0);
document.getElementById('usdTariff2').innerHTML = (rubTariff2/bankUSD).toFixed(2);
document.getElementById('eurTariff2').innerHTML = (rubTariff2/bankEUR).toFixed(2);
document.getElementById('byrTariff2').innerHTML = (rubTariff2/bankBYR).toFixed(0);
document.getElementById('uahTariff2').innerHTML = (rubTariff2/bankUAH).toFixed(1);
document.getElementById('kztTariff2').innerHTML = (rubTariff2/bankKZT).toFixed(0);
document.getElementById('usdTariff3').innerHTML = (rubTariff3/bankUSD).toFixed(2);
document.getElementById('eurTariff3').innerHTML = (rubTariff3/bankEUR).toFixed(2);
document.getElementById('byrTariff3').innerHTML = (rubTariff3/bankBYR).toFixed(0);
document.getElementById('uahTariff3').innerHTML = (rubTariff3/bankUAH).toFixed(1);
document.getElementById('kztTariff3').innerHTML = (rubTariff3/bankKZT).toFixed(0);
document.getElementById('usdTariff4').innerHTML = (rubTariff4/bankUSD).toFixed(2);
document.getElementById('eurTariff4').innerHTML = (rubTariff4/bankEUR).toFixed(2);
document.getElementById('byrTariff4').innerHTML = (rubTariff4/bankBYR).toFixed(0);
document.getElementById('uahTariff4').innerHTML = (rubTariff4/bankUAH).toFixed(1);
document.getElementById('kztTariff4').innerHTML = (rubTariff4/bankKZT).toFixed(0);
$.each({usd: 2, eur: 2, byr: 0, uah: 1, kzt: 0}, function(currency, precision) {
var bankCurrency = document.getElementById('bank-' + currency).innerText;
$.each([777, 1777, 2777, 4777], function(i, tariff) {
document.getElementById(currency + 'Tariff' + (i + 1)).innerHTML = (tariff / bankCurrency).toFixed(precision);
});
});