
; /* Start:/bitrix/templates/main/components/informunity/loancalc/.default/script.js*/
function selectCurrency(calc, curr) {
	var spans = document.getElementsByTagName('span');
	var pp = spans.length;
	for(var i = 0; i < pp; i++)
		if(spans[i].className == 'iu-currency-'+calc)
			spans[i].innerHTML = ar_currency[calc][curr];
}

function collapsParams(calc) {
	var el_more = document.getElementById('calcu-more-'+calc);
	var el_vis = document.getElementById('more-vis-'+calc);
	var el_a = document.getElementById('more-a-'+calc);
	if (el_more.className == 'iu-disp-no') {
		el_more.className = '';
		el_vis.value = 'Y';
		el_a.innerHTML = txt_more_d;
	} else {
		el_more.className = 'iu-disp-no';
		el_vis.value = 'N';
		el_a.innerHTML = txt_more;
	}
}

function selectCalcu(id_calc) {
	for (var i = 0; i < count_calc; i++) {
		var el_calc = document.getElementById('calculator-'+i);
		var el_a = document.getElementById('calc-a-'+i);
		if (el_calc.className != 'iu-disp-no') 
			el_calc.className = 'iu-disp-no';
		if (el_a.className != '') 
			el_a.className = '';
	}
	document.getElementById('calculator-'+id_calc).className = '';
	document.getElementById('calc-a-'+id_calc).className = 'iu-sel';
	document.getElementById('calculator-id').value = id_calc;
}

function sendform() {
	var id_calc = document.getElementById('calculator-id').value;
	var div_err = document.getElementById('iu-calc-err-'+id_calc);
	var ar_inp = document.getElementsByTagName('input');
	var reg_inp = new RegExp('calc_'+id_calc);
	var reg_num = new RegExp('^[0-9]*\.?[0-9]+$');
	var text_err = '';
	var allow = true;
	for(var i = 0; i < ar_inp.length; i++) {
		if(reg_inp.test(ar_inp[i].name) && ar_inp[i].type == 'text') {
			ar_inp[i].className = '';
			if(ar_inp[i].name == 'calc_'+id_calc+'[amount_credit]') {
				if(ar_inp[i].value == '') {
					text_err += '<p>'+txt_amount+'</p>';
					ar_inp[i].className = 'iu-inp-err';
				} else if(!reg_num.test(ar_inp[i].value)) {
					allow = false;
					ar_inp[i].className = 'iu-inp-err';
				}
			} else if(ar_inp[i].name == 'calc_'+id_calc+'[credit_period]') {
				if(ar_inp[i].value == '') {
					text_err += '<p>'+txt_period+'</p>';
					ar_inp[i].className = 'iu-inp-err';
				} else if(!reg_num.test(ar_inp[i].value)) {
					allow = false;
					ar_inp[i].className = 'iu-inp-err';
				}
			} else if(ar_inp[i].name == 'calc_'+id_calc+'[interest_rate]') {
				if(ar_inp[i].value == '') {
					text_err += '<p>'+txt_inter+'</p>';
					ar_inp[i].className = 'iu-inp-err';
				} else if(!reg_num.test(ar_inp[i].value)) {
					allow = false;
					ar_inp[i].className = 'iu-inp-err';
				}
			} else if(ar_inp[i].name == 'calc_'+id_calc+'[first_payment]' && ar_inp[i].value !== '' && !reg_num.test(ar_inp[i].value)) {
				allow = false;
				ar_inp[i].className = 'iu-inp-err';
			} else if(ar_inp[i].name == 'calc_'+id_calc+'[one_time_commission]' && ar_inp[i].value !== '' && !reg_num.test(ar_inp[i].value)) {
				allow = false;
				ar_inp[i].className = 'iu-inp-err';
			} else if(ar_inp[i].name == 'calc_'+id_calc+'[monthly_commission]' && ar_inp[i].value !== '' && !reg_num.test(ar_inp[i].value)) {
				allow = false;
				ar_inp[i].className = 'iu-inp-err';
			}
		}
	}
	if(text_err != '' || !allow) {
		if(!allow) text_err += '<p>'+txt_allow+': .0123456789</p>';
		div_err.innerHTML = text_err;
		div_err.className = 'iu-row iu-err';
		return false;
	}
	return true;
}
/* End */
;; /* /bitrix/templates/main/components/informunity/loancalc/.default/script.js*/
