function bookmark(title,url){if(window.external&&window.external.AddFavorite){window.external.AddFavorite(url,title);}else{alert('Netscape users\nPress [CTRL]+[D] to bookmark this page\nThank you!');}}function column(topic,count){document.write('<script type="text/javascript" src="/scripts/link.php?key='+topic+'&amp;hit='+count+'&amp;mode=column"></script>');}function links(topic,count){document.write('<script type="text/javascript" src="/scripts/link.php?key='+topic+'&amp;hit='+count+'"></script>');}function wnew(){window.open(this.href,'_blank','height=650px,width=900px,resizable=1,left=50,top=50,scrollbars=1');return false;}var mcalc={};var Calculators=function(frm){var stamp_duty_normal=[125000,0.01,250000,0.03,500000,0.04],stamp_duty_disadvantaged=[150000,0.01,250000,0.03,500000,0.04],borrow_single_min=350,borrow_joint_min=275,borrow_ltv=100,borrow_single_max=500,borrow_joint_max=450,borrow_bonus_ratio=100,buy_to_let_pay_rate_pc=100,buy_to_let_interest_rate_pc=5.5,buy_to_let_maximum_ltv=85,early_repayment_charge=800;function getInt(n){var x =frm[n].value;return Math.round(x.replace(/[^0-9.]/g,'')-0);}function getNum(n){var x =frm[n].value;return x.replace(/[^0-9.]/g,'')-0.0;}function getTxt(n){return(frm[n].selectedIndex?frm[n].options[frm[n].selectedIndex].value:frm[n].value);}function setInt(n,i){if(frm&&frm[n]){frm[n].value=Math.round(i-0);}}function setMny(n,i){if(frm&&frm[n]){frm[n].value=Math.round((i-0)*100)/100;}}function setNum(n,i){if(frm&&frm[n]){frm[n].value=i-0.0;}}function setTxt(n,t){if(frm&&frm[n]){frm[n].value=t;}}function getChk(n){if(frm&&frm[n]){return frm[n].checked?true:false;}return false;}function getRepay(price,rate,term){var n,r=rate/12.0,t=term*12,tp=1;for(n=0;n<t;++n)tp*=(1+(r/100));return(price*r/100)/(1-(1/tp));}function getInterest(price,rate,term){var r=rate/12.0,t=term*12;return(price*r/100);}this.stampDuty=function(){var n,r=0.0,v=getInt('price'),a=(frm.disadv[0].checked?stamp_duty_disadvantaged:stamp_duty_normal);for(n=0;n<a.length;n+=2)if(a[n]<v)r=a[n+1];else break;setInt('total',v*r);setTxt('tell','Stamp Duty on a £'+v+' property would be approx £'+Math.round(v*r));};this.mortgageRepayment=function(){var n,p=getInt('price'),r=getNum('rate'),t=getInt('term');var p1=getRepay(p,r,t),i1=getInterest(p,r,t),p2=getRepay(p,r+1,t),i2=getInterest(p,r+1,t);setMny('month',p1);setMny('monthp1',p2);setMny('intrs',i1);setMny('intrsp1',i2);setMny('total',t*p1*12);setMny('totalp1',t*p2*12);setTxt('tell','Mortgage repayment on a £'+p+' loan over '+t+' years at '+r+'% would be £'+p1+' pcm (£'+t*p1*12+' total) or £'+i1+' pcm (£'+t*i1*12+' total)');};this.remortgageRepayment=function(){var n,p=getInt('price'),r=getNum('rate'),t=getInt('term')*12;var np=getNum('nprice'),nr=getNum('nrate'),nt=getInt('nterm')*12;var p1=getRepay(p,r,t/12),p2=getRepay(p,r+1,t/12),p1n=getRepay(np,nr,nt/12),p2n=getRepay(np,nr+1,nt/12);var s1=t*p1-nt*p1n,s2=t*p2-nt*p2n,s1y=(t<24?t:24)*p1-(nt<24?nt:24)*p1n,s2y=(t<24?t:24)*p2-(nt<24?nt:24)*p2n;setMny('month',p1);setMny('monthp1',p2);setMny('nmonth',p1n);setMny('nmonthp1',p2n);setTxt('saves',(0<=s1?Math.round(s1)+' saving':(0-Math.round(s1))+' more'));setTxt('save2',(0<=s1y?Math.round(s1y)+' saving':(0-Math.round(s1y))+' more'));setTxt('savesp1',(0<=s2?Math.round(s1)+' saving':(0-Math.round(s2))+' more'));setTxt('save2p1',(0<=s2y?Math.round(s1y)+' saving':(0-Math.round(s2y))+' more'));setTxt('tell','By remortgaging there would be '+(0<=s1?' a £'+Math.round(s1)+' saving':' £'+(0-Math.round(s1))+' more')+' when changing the term to '+t+' years at '+r+'%');};this.howMuchBorrow=function(){var m=getInt('maxltv'),p=getInt('property');var i1=getInt('incomem'),i2=getInt('incomep'),b1=getInt('bonusm'),b2=getInt('bonusp');var xx=getNum('mulbonus'),xj=getNum('muljoint'),xb=getNum('mulbest');var d,a=xj*(i1+i2+xx*(b1+b2)),am=xb*(i1+xx*b1),ap=xb*(i2+xx*b2);d=((p-(a=Math.max(a,Math.max(am,ap))))/100+1)*100;setInt('deposit',d>0?d:'none ('+d+')');setInt('borrow',Math.min(a,p));setTxt('tell','A mortgage of upto £'+Math.min(a,p)+' with a typical deposit of around £'+(d>0?d:0)+' should be availiable for your wages (subject to terms and conditions)');};this.howMuchBorrow2=function(){var i1=getInt('income1')+getInt('bonus1')*borrow_bonus_ratio/100,i2=getInt('income2')+getInt('bonus2')*borrow_bonus_ratio/100;setInt('borrow',Math.floor((frm.joint.checked?(i1+i2)*borrow_joint_min:i1*borrow_single_min)*borrow_ltv/10000));setInt('borrowmax',Math.floor((frm.joint.checked?(i1+i2)*borrow_joint_max:i1*borrow_single_max)*borrow_ltv/10000));};this.howMuchBorrowBTL=function(){var p=getInt('property'),r=getNum('rent');var ml=p*buy_to_let_maximum_ltv/100,mx=(r*12/(buy_to_let_pay_rate_pc/100.0))/(buy_to_let_interest_rate_pc/100.0);setInt('maxloan',Math.floor(mx<ml?mx:ml));};this.requiredRentalBTL=function(){var b=getInt('property')-getInt('deposit');setInt('rent',Math.ceil(((b*(buy_to_let_interest_rate_pc/100.0))/12.0)*(buy_to_let_pay_rate_pc/100.0)));};this.requiredRate=function(){var l=getInt('loan'),r=getNum('rate'),t=getInt('term'),p=getNum('penalty');if('p'==getTxt('type')){p=l*(p/100);}setNum('nofee',getChk('addv')?((l*r/100*(t/12))-p)/(((t/12)/100)*(l+p)):r-((p/l)*1200)/t);setNum('payfee',getChk('addv')?((l*r/100*(t/12))-p-early_repayment_charge)/(((t/12)/100)*(l+p)):r-((((early_repayment_charge*100)/l)+(p/l)*100)*12)/t);};};google_ad_client='pub-1568843168671928';google_ad_slot='1502010998';google_ad_width=120;google_ad_height=240;function checkNumber(num){var n =num.value.replace(/[,]/g,'');if(isNaN(n-0)){num.value=num.value.replace(/[^0-9]/g,'');}}window.onload=function(){if(document.getElementsByTagName){var n,l=document.getElementsByTagName('A');for(n=0;n<l.length;++n)if(l[n].className&&'new'==l[n].className)l[n].onclick=wnew;}if(document.getElementById){var x =document.getElementById('apr');if(x)x.innerHTML='4.50%';}var n;for(n=0;n<document.forms.length;++n)if(document.forms[n].className='calculator'){mcalc=new Calculators(document.forms[n]);break;}}
