$(document).ready(function(){var a=$("#turnover").val(),b=$("#equity").val(),c=$("#netdeposit").val(),d="",e=0,f=Array(0,0,0),g=1,h=0;$("input[type=text]").keyup(function(j){var k=$(this).val();minValue=function(a){mn=a[0];for(i=0;i<a.length;i++)a[i]<mn&&(mn=a[i]);return mn};var l=function(a){var b=/^[+-]?\d+(\.\d+)?([eE][+-]?\d+)?$/;return b.test(a)?a:"false"};switch($(this).attr("id")){case"turnover":a=l(k);break;case"equity":b=l(k);break;case"netdeposit":c=l(k)}e=1,a>0&&a<50?f[0]=4.8:a>=50&&a<100?f[0]=3.8:a>=100&&a<250?f[0]=3.2:a>=250&&a<500?f[0]=2.5:a>=500&&a<2500?f[0]=1.8:a>=2500&&a<5e3?f[0]=1.6:a>=5e3&&a<1e4?f[0]=1.4:a>=1e4&&a<2e4?f[0]=1.2:a>=2e4&&a<4e4?f[0]=.9:a>=4e4?f[0]=.5:(e="",f[0]="false"),b>0&&b<5e3?f[1]=4.8:b>=5e3&&b<1e4?f[1]=3.8:b>=1e4&&b<25e3?f[1]=3.2:b>=25e3&&b<5e4?f[1]=2.5:b>=5e4&&b<25e4?f[1]=1.8:b>=25e4&&b<5e5?f[1]=1.6:b>=5e5&&b<1e6?f[1]=1.4:b>=1e6&&b<5e6?f[1]=1.2:b>=5e6&&b<1e7?f[1]=.9:b>=1e7?f[1]=.5:f[1]="false",c>0&&c<5e3?f[2]=4.8:c>=5e3&&c<1e4?f[2]=3.8:c>=1e4&&c<25e3?f[2]=3.2:c>=25e3&&c<5e4?f[2]=2.5:c>=5e4&&c<25e4?f[2]=1.8:c>=25e4&&c<5e5?f[2]=1.6:c>=5e5&&c<1e6?f[2]=1.4:c>=1e6&&c<5e6?f[2]=1.2:c>=5e6&&c<1e7?f[2]=.9:c>=1e7?f[2]=.5:f[2]="false";var m="false";f=$.grep(f,function(a){return a!=m}),h=minValue(f),$("input[value=metals]:checked").val()=="metals"&&(h*=g),d=(e+h).toFixed(2),f.length==0||e==""?$(".ftt-commission").text("Enter your turnover to calculate"):$(".ftt-commission").text(e.toFixed(2)),f.length==0?$(".dc-commission").text("Fill in the value(s) to the left"):$(".dc-commission").text(h.toFixed(2)),d!="undefined"&&e!=""?$(".total-commission").text(d):$(".total-commission").text("")}),$("input[value=metals]").click(function(){if(g!=1.5){var a=parseFloat(h*1.5).toFixed(2);console.log(a),$(".dc-commission").text(a),$(".total-commission").text((parseFloat(a)+e).toFixed(2))}g=1.5}),$("input[value=currencies]").click(function(){if(g!=1){var a=parseFloat(h*1).toFixed(2);console.log(a),$(".dc-commission").text(a),$(".total-commission").text((parseFloat(a)+e).toFixed(2))}g=1})})
