// Rate Calculator plugin for jQuery
		var amount = 30;
		var time = 7;
		var vip = 0;
		var first = 0;
		var first_b = 0;
		function updateSumSlide(amount){
			var sumP = amount/300*100;
			jQuery("#calc-sum-row-slide-bg").css('width', sumP+'%');
		}
		function updateDaySlide(time){
			var sumP = time/30*100;
			jQuery("#calc-day-row-slide-bg").css('width', sumP+'%');
		}
		function updateCalc(amount, time, vip){			if((amount >= 100)) {				first = 1;
				jQuery(".get-info").hide();
				if(amount < 100) {
					jQuery("#get1").show();
					jQuery("#credit_simple").hide();
					jQuery("#credit_first").show();
				} else if(amount < 200) {
					jQuery("#get2").show();
					jQuery("#credit_simple").show();
					jQuery("#credit_first").hide();
				} else {
					jQuery("#get3").show();
					jQuery("#credit_simple").show();
					jQuery("#credit_first").hide();
				}
			} else if((vip == 0) && (amount < 100)) {
				jQuery(".get-info").hide();
				jQuery("#get1").show();
				jQuery("#credit_simple").hide();
				jQuery("#credit_first").show();
				if(first_b == 0) {first = 0;}
				else {first = 1;}
			} else{				jQuery(".get-info").hide();
				jQuery("#get1").show();
				jQuery("#credit_simple").hide();
				jQuery("#credit_first").show();

			}
			if(first == 0 && vip == 0) {
				var sums = firstSums;
				var prolong_sums = firstProlong;
				data = sums[amount][time];
			} else if(first == 1 && vip == 0) {
				var sums = simpleSums;
				var prolong_sums = simpleProlong;
				data = sums[amount][time];
			} else {
				var sums = vipSums;
				var prolong_sums = vipProlong;
				data = sums[amount][time];
			}

			$('calc-sum-row-info-amount').value = Math.floor(amount);
			$('calc-day-row-info-days').value = Math.floor(time);
			(function($) {
				$('#calc-day-row-info-days').val();
				calccredit =  parseFloat(amount).toFixed(2).replace('.',',');
				calcintrest = (parseFloat(data)).toFixed(2).replace('.',',');
				calctotal = (parseFloat(data) + parseFloat(amount)).toFixed(2).replace('.',',');
				$('#calccredit').html( calccredit.toString() );
				$('#calcintrest').html(	calcintrest.toString() );
				$('#calctotal').html( calctotal.toString() );
				$('#prolong7').html(  parseFloat(prolong_sums[amount][7]).toFixed(2).replace('.',',') );
				$('#prolong14').html( parseFloat(prolong_sums[amount][15]).toFixed(2).replace('.',',') );
				$('#prolong30').html( parseFloat(prolong_sums[amount][30]).toFixed(2).replace('.',',') );
			})(jQuery);
		}
		function initCalt(){			updateSumSlide(amount);
			updateDaySlide(time);
			updateCalc(amount, time, vip);
					 slider1 = new Control.Slider("calc-sum-row-slide-handle" , "calc-sum-row-slide", {
						range: $R(0,300),
						sliderValue: amount,
						values: [30,50,70,100,150,200,250,300],

						onSlide: function(v) {
							amount = v;
							updateCalc(amount, time, vip);
							updateSumSlide(amount);
						},

						onChange: function(v) {
							amount = v;
							updateCalc(amount, time, vip);
							updateSumSlide(amount);
						}
					});
					 slider2 = new Control.Slider("calc-day-row-slide-handle" , "calc-day-row-slide", {
						range: $R(0,30),
						sliderValue: time,
						values: [7,15,30],

						onSlide: function(v) {
							time = v;
							updateCalc(amount, time, vip);
							updateDaySlide(time);
						},

						onChange: function(v) {
							time = v;
							updateCalc(amount, time, vip);
							updateDaySlide(time);
						}
					});
        		(function($) {
					$("#calctabsfirst").click(function(){
						first_b = 0;
						first = 0;
						vip = 0;
						updateCalc(amount, time, vip);
						$(".calc-tabs-a").removeClass('active-tab');
						$(this).addClass('active-tab');
						return false;
					});
					$("#calctabssimple").click(function(){
						first_b = 1;
						first = 1;
						vip = 0;
						updateCalc(amount, time, vip);
						$(".calc-tabs-a").removeClass('active-tab');
						$(this).addClass('active-tab');
						return false;
					});
					$("#calctabsvip").click(function(){
						first_b = 0;
						first = 0;
						vip = 1;
						updateCalc(amount, time, vip);
						$(".calc-tabs-a").removeClass('active-tab');
						$(this).addClass('active-tab');
						return false;
					});
					$("#loanForm").submit(function(){
						window.location = '/'+curLang+'/credits/get/'+time+'-'+amount;
						return false;
					});
				})(jQuery);		}
		jQuery(function() {			initCalt();
		});


