$(function(){var g=function(){var a=loan_data[b];$("#loan_payback_time").html(a.payback_time);$("#loan_lots").html(a.lots);$("#loan_costs").html(a.costs);$("#loan_you_pay").html(a.costs+b);$("#loan_annual_rate").html(a.annual_rate)},e=function(a,b,f){var c=0,d;for(d in b){var e=b[d];("up"==f?e>=a:e<=a)&&a>=c&&(c=e)}return c},c=function(a){var b=[];$.each(a,function(a){b.push(parseInt(a))});return b}(loan_data),d=Math.min.apply(Math,c),h=Math.max.apply(Math,c),b=d;$("#loan_current_sum").html(d);g(); $("#loan_slider").bind("slide",function(a,d){var f=e(d.value,c,"up");f!=b&&(b=f,$("#sum").val(b),$("#loan_current_sum").html(b),g())}).slider({max:h,min:d-1,range:"min"});$("#loan_more, #loan_less").click(function(a){a.preventDefault();if("loan_more"==$(this).attr("id")&&b!=h)a=e(b+1,c,"up");else if("loan_less"==$(this).attr("id")&&b!=d)a=e(b-1,c,"down");else return;$("#loan_slider").slider("value",a).trigger("slide",{value:a-1})})});
