function dsfsdf(nStr,inD,outD,sep){nStr+='';var dpos=nStr.indexOf(inD);var nStrEnd='';if(dpos!=-1){nStrEnd=outD+nStr.substring(dpos+1,nStr.length);nStr=nStr.substring(0,dpos);}var rgx=/(\d+)(\d{3})/;while(rgx.test(nStr)){nStr=nStr.replace(rgx,'$1'+sep+'$2');}return nStr+nStrEnd;}function gtrddhds(str){if(str.indexOf(',')!=-1){temp=str.split(',');var i=temp.length;var j=0;var tmpStr="";while(i>j){tmpStr+=temp[j];j++;}str=tmpStr;}return str;}function iugujf(value){var z=document.getElementById("form1"),a=z.starting.value,b=z.monthly.value,c=z.rate.value,d=z.years.value;if(value=='a'){str=a;}if(value=='b'){str=b;}if(value=='c'){str=c;}if(value=='d'){str=d;}str=gtrddhds(str);if(value=='a'){z.starting.value=dsfsdf(str,'.','.',',');}if(value=='b'){z.monthly.value=dsfsdf(str,'.','.',',');}if(value=='c'){z.rate.value=dsfsdf(str,'.','.',',');}if(value=='d'){z.years.value=dsfsdf(str,'.','.',',');}setTimeout("wesat()",200);}function wesat(){var z=document.getElementById("form1"),a=z.starting.value,b=z.monthly.value,c=z.rate.value,d=z.years.value;var as=gtrddhds(a);z.starting.value=dsfsdf(as,'.','.',',');var bs=gtrddhds(b);z.monthly.value=dsfsdf(bs,'.','.',',');var cs=gtrddhds(c);z.rate.value=dsfsdf(cs,'.','.',',');var ds=gtrddhds(d);z.years.value=dsfsdf(ds,'.','.',',');jkfhjksd(as,bs,cs,ds);}function jkfhjksd(a,b,c,d){var p=a;var m=b;var i=c;var y=d;var under=(1.0+i/100/12);var over=Math.pow(under,(12*y));var result=p*over+m*(over-1.0)/(under-1.0);var inter=result-(m*12*y)-p;result=sgds(result,2);inter=sgds(inter,2);var z=document.getElementById("form1");z.finalamount.value=dsfsdf(result,'.','.',',');if(z.finalamount.value=="NaN"){z.finalamount.value="";}z.amount.value=dsfsdf(inter,'.','.',',');if(z.amount.value=="NaN"){z.amount.value="";}}function sgds(num,dec){var result=Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);return result;}