function drawPie(a,c,e){var d=[];d[0]={label:"principal: "+format_number(Math.round(a))+"$ "+Math.round(a*100/e)+"%",data:a,color:"#72dd81"};d[1]={label:"interest: "+format_number(Math.round(c))+"$ "+Math.round(c*100/e)+"%",data:c,color:"#f48c46"};var b=(e-a-c);d[2]={label:"insurance: "+format_number(Math.round(b))+"$ "+Math.round(b*100/e)+"%",data:b,color:"#a9c9ed"};$.plot($("#pie"),d,{series:{pie:{show:true}},legend:{show:true,height:90}});document.getElementById("mm").innerHTML=format_number(Math.round(e))}function getInternetExplorerVersion(){var c=-1;if(navigator.appName=="Microsoft Internet Explorer"){var a=navigator.userAgent;var b=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(b.exec(a)!=null){c=parseFloat(RegExp.$1)}}return c}function hide_all(){hide_mensualites_duree();hide_cout_duree();hide_mensualites_taux();hide_cout_taux();hide_mensualites_montant();hide_cout_montant();hide_amortissement()}var duree_taux_connecte=true;function fconnecte(){if(duree_taux_connecte){document.getElementById("connecte").src="deconnecte.png";document.getElementById("connecte").title="Automatically proposes the usual rate when changing the credit duration. Click once to reactivate this option.";duree_taux_connecte=false}else{document.getElementById("connecte").src="connecte.png";document.getElementById("connecte").title="Automatically proposes the usual rate when changing the credit duration. Click once to deactivate this option.";duree_taux_connecte=true}setTimeout(update,50);document.getElementById("mensualites_duree").focus()}var amortissement_hiden=true;function hide_amortissement(){if(amortissement_hiden){document.getElementById("tableau_amor").style.display="block";document.getElementById("header_amortissement").style.height="250px";document.getElementById("fleche_amortissement").src="up.png";document.getElementById("fleche_amortissement").title="Hide this chart";amortissement_hiden=false;update()}else{document.getElementById("tableau_amor").style.display="none";document.getElementById("header_amortissement").style.height="35px";document.getElementById("fleche_amortissement").src="down.png";document.getElementById("fleche_amortissement").title="Show this chart";amortissement_hiden=true}}var mensualites_duree_hiden=false;function hide_mensualites_duree(){if(mensualites_duree_hiden){document.getElementById("mensualites_duree").style.display="block";document.getElementById("header_mensualites_duree").style.height="250px";document.getElementById("fleche_mensualites_duree").src="up.png";document.getElementById("fleche_mensualites_duree").title="Hide this chart";mensualites_duree_hiden=false;update()}else{document.getElementById("mensualites_duree").style.display="none";document.getElementById("header_mensualites_duree").style.height="35px";document.getElementById("fleche_mensualites_duree").src="down.png";document.getElementById("fleche_mensualites_duree").title="Show this chart";mensualites_duree_hiden=true}}var cout_duree_hiden=false;function hide_cout_duree(){if(cout_duree_hiden){document.getElementById("cout_duree").style.display="block";document.getElementById("header_cout_duree").style.height="240px";document.getElementById("fleche_cout_duree").src="up.png";document.getElementById("fleche_cout_duree").title="Hide this chart";cout_duree_hiden=false;update()}else{document.getElementById("cout_duree").style.display="none";document.getElementById("header_cout_duree").style.height="35px";document.getElementById("fleche_cout_duree").src="down.png";document.getElementById("fleche_cout_duree").title="Show this chart";cout_duree_hiden=true}}var mensualites_taux_hiden=true;function hide_mensualites_taux(){if(mensualites_taux_hiden){document.getElementById("mensualites_taux").style.display="block";document.getElementById("header_mensualites_taux").style.height="240px";document.getElementById("fleche_mensualites_taux").src="up.png";document.getElementById("fleche_mensualites_taux").title="Hide this chart";mensualites_taux_hiden=false;update()}else{document.getElementById("mensualites_taux").style.display="none";document.getElementById("header_mensualites_taux").style.height="35px";document.getElementById("fleche_mensualites_taux").src="down.png";document.getElementById("fleche_mensualites_taux").title="Show this chart";mensualites_taux_hiden=true}}var cout_taux_hiden=true;function hide_cout_taux(){if(cout_taux_hiden){document.getElementById("cout_taux").style.display="block";document.getElementById("header_cout_taux").style.height="240px";document.getElementById("fleche_cout_taux").src="up.png";document.getElementById("fleche_cout_taux").title="Hide this chart";cout_taux_hiden=false;update()}else{document.getElementById("cout_taux").style.display="none";document.getElementById("header_cout_taux").style.height="35px";document.getElementById("fleche_cout_taux").src="down.png";document.getElementById("fleche_cout_taux").title="Show this chart";cout_taux_hiden=true}}var mensualites_montant_hiden=true;function hide_mensualites_montant(){if(mensualites_montant_hiden){document.getElementById("mensualites_montant").style.display="block";document.getElementById("header_mensualites_montant").style.height="240px";document.getElementById("fleche_mensualites_montant").src="up.png";document.getElementById("fleche_mensualites_montant").title="Hide this chart";mensualites_montant_hiden=false;update()}else{document.getElementById("mensualites_montant").style.display="none";document.getElementById("header_mensualites_montant").style.height="35px";document.getElementById("fleche_mensualites_montant").src="down.png";document.getElementById("fleche_mensualites_montant").title="Show this chart";mensualites_montant_hiden=true}}var cout_montant_hiden=true;function hide_cout_montant(){if(cout_montant_hiden){document.getElementById("cout_montant").style.display="block";document.getElementById("header_cout_montant").style.height="240px";document.getElementById("fleche_cout_montant").src="up.png";document.getElementById("fleche_cout_montant").title="Hide this chart";cout_montant_hiden=false;update()}else{document.getElementById("cout_montant").style.display="none";document.getElementById("header_cout_montant").style.height="35px";document.getElementById("fleche_cout_montant").src="down.png";document.getElementById("fleche_cout_montant").title="Show this chart";cout_montant_hiden=true}}var updating=null;var isClicking=false;var updatingLegend=false;function update(){try{updating=true;document.getElementById("taux").value=document.getElementById("taux").value.replace(",",".");document.getElementById("assurance").value=document.getElementById("assurance").value.replace(",",".");$("#slider_montant").slider("value",get_number(document.getElementById("montant").value));$("#slider_duree").slider("value",document.getElementById("duree").value);$("#slider_taux").slider("value",document.getElementById("taux").value);$("#slider_assurance").slider("value",document.getElementById("assurance").value);$("#slider_dossier").slider("value",document.getElementById("dossier").value);document.getElementById("montant").value=format_number(document.getElementById("montant").value);mensualites_assurance_float=get_number(document.getElementById("montant").value)*document.getElementById("assurance").value/1200;document.getElementById("assu_mens").innerHTML=Math.round(mensualites_assurance_float);document.getElementById("cout_assurance").value=format_number(Math.round(mensualites_assurance_float*document.getElementById("duree").value*12));var J=calcule_mensualite(get_number(document.getElementById("montant").value),document.getElementById("taux").value,document.getElementById("duree").value);document.getElementById("mensualites").value=format_number(Math.round(J));document.getElementById("cout").value=format_number(Math.round(calcule_cout(get_number(document.getElementById("montant").value),document.getElementById("taux").value,document.getElementById("duree").value)+get_number(document.getElementById("cout_assurance").value)));var b=Math.round(100*get_number(document.getElementById("cout").value)/get_number(document.getElementById("montant").value));document.getElementById("percent").innerHTML=b;if(b>54){document.getElementById("warning").style.display="block";document.getElementById("warning").title="Be aware that the total cost of your credit seems high to us because it stands as more as "+b+" % of the borrowed amount !"}else{document.getElementById("warning").style.display="none"}calcule_teg();if(!mensualites_duree_hiden){var K=[];var d=[];var t=10;if(r<7){t=1}else{if(r<12){t=5}}t=1;if(duree_taux_connecte){for(var Q=t;Q<=30;Q+=0.5){K.push([Q,calcule_mensualite(get_number(document.getElementById("montant").value),taux_duree(Q),Q)]);d.push([Q,calcule_cout(parseFloat(get_number(document.getElementById("montant").value)),taux_duree(Q),Q)])}}else{for(var Q=t;Q<=30;Q+=0.5){K.push([Q,calcule_mensualite(get_number(document.getElementById("montant").value),parseFloat(get_number(document.getElementById("taux").value)),Q)]);d.push([Q,calcule_cout(parseFloat(get_number(document.getElementById("montant").value)),parseFloat(get_number(document.getElementById("taux").value)),Q)])}}var k=$.plot($("#mensualites_duree"),[{data:K,label:""},{data:d,label:"",yaxis:2},{data:[],label:""}],{series:{lines:{show:true},points:{show:false},},xaxes:[{tickFormatter:function(i){return i+"years"}},{tickFormatter:function(i){return i+"years"}}],yaxes:[{color:"#EDC240",labelWidth:38,min:0,tickFormatter:function(i){return format_number(i)+""}},{color:"#CB4B4B",alignTicksWithAxis:1,position:"right",tickFormatter:function(i){return Math.round(i/1000)+""}}],legend:{position:"nw"},crosshair:{mode:"x"},grid:{hoverable:true,clickable:true},colors:["#EDC240","#CB4B4B","#008000"]});var V=get_number(document.getElementById("mensualites").value);var l=get_number(document.getElementById("cout").value);var r=parseFloat(document.getElementById("duree").value);k.lockCrosshair({x:r,y:V});k.clearCrosshair();var L=k.pointOffset({x:r,y:V});var h=k.pointOffset({x:r,y:l,yaxis:2});var p=k.getCanvas().getContext("2d");p.fillStyle="green";p.strokeStyle="green";p.beginPath();p.lineWidth=2;p.moveTo(L.left,4);p.lineTo(L.left,213);p.stroke();p.moveTo(L.left,50);p.arc(L.left,L.top,4,0,Math.PI*2,true);p.closePath();p.fill();p.beginPath();p.fillStyle="white";p.arc(L.left,L.top,2,0,Math.PI*2,true);p.closePath();p.fill();p=k.getCanvas().getContext("2d");p.fillStyle="green";p.arc(h.left,h.top,4,0,Math.PI*2,true);p.closePath();p.fill();p.beginPath();p.fillStyle="white";p.arc(h.left,h.top,2,0,Math.PI*2,true);p.closePath();p.fill();p.strokeStyle="white";p.fillStyle="white";p.arc(L.left,L.top,2,0,Math.PI*2,true);p.closePath();p.fill();var X=null;var e=$("#mensualites_duree .legendLabel");if(1==1){$("#mensualites_duree").bind("mouseup",function(){isClicking=false;if(!updating){document.getElementById("duree").value=Math.round(S.x);if(duree_taux_connecte){document.getElementById("taux").value=taux_duree(parseFloat(document.getElementById("duree").value))}updating=true;setTimeout(update,50)}});$("#mensualites_duree").bind("mousedown",function(){isClicking=true;k.unlockCrosshair()});var S=null;$("#mensualites_duree").bind("plothover",function(aa,ad,Z){S=ad;var ab=Math.abs(ad.x-parseFloat(document.getElementById("duree").value));if(ab<2){document.body.style.cursor="move"}else{document.body.style.cursor="default"}if(Z){if(X!=Z.dataIndex){X=Z.dataIndex;$("#tooltip").remove();var o=Z.datapoint[0].toFixed(2),ac=Z.datapoint[1].toFixed(2);var i=0;if(duree_taux_connecte){i=taux_duree(Math.round(o))}else{i=document.getElementById("taux").value}if(Z.seriesIndex==0){showTooltip(Z.pageX,Z.pageY,"Monthly payments : "+format_number(Math.round(ac))+" $/m for a credit of "+Math.round(o/10)*10+" years at the rate of "+i+" %")}else{showTooltip(Z.pageX,Z.pageY,"Total cost : "+format_number(Math.round(ac))+" $ for a credit of "+o+" years at the rate of "+i+" %")}}}else{$("#tooltip").remove();X=null}})}}if(true){var n=1;var U=parseFloat(document.getElementById("taux").value);var r=parseFloat(document.getElementById("duree").value);var w=parseFloat(get_number(document.getElementById("montant").value));var W=1;var C="";var g=[];var q=[];var f=[];var H=[];var W=1;var C="";if(!amortissement_hiden){C="<table><tr><th rowspan=2 scope='col' width=50px;>Year</th><th rowspan=2 scope='col' width=150px;>Monthly repayments</th><th rowspan=2 scope='col' width=240px;>Total amount still due </th><th colspan=3 scope='col' width=270px; align=center>Montly payment structure ("+format_number(Math.round(J))+" $/m)</th> </tr> <tr> <td align=center style='background-color: #72dd81;' width=90px;>principal</td><td align=center style='background-color: #f48c46;' width=90px;>interest</td><td align=center style='background-color: #a9c9ed;' width=90px;>insurance</td>  </tr></table>";document.getElementById("amor_header").innerHTML=C;C="<table>"}for(n=1;n<=r*12;n+=1){var E=(J-mensualites_assurance_float)/Math.pow((1+U/1200),(r*12+1-n));var a=mensualites_assurance_float;var Y=J-E-a;w=w-E;if(!amortissement_hiden){C=C+"<tr onMouseover=\"this.bgColor='#EEEEEE'; drawPie("+E+","+Y+","+J+');"onMouseout="this.bgColor=\'#FFFFFF\'"><td width=50px; align=center>'+Math.floor((n+11)/12)+"</td><td width=150px; align=center>n° "+n+"</td><td align=center width=240px;>"+format_number(Math.round(w))+" $</td><td align=center width=90px;>"+format_number(Math.round(E))+" $</td><td align=center width=90px;>"+format_number(Math.round(Y))+" $</td><td align=center width=90px;>"+Math.round(a)+" $</td><tr>"}g.push([n,w]);q.push([n,E]);f.push([n,a]);H.push([n,Y])}if(!amortissement_hiden){C=C+"</table>";document.getElementById("amor").innerHTML=C}drawPie(q[0][1],H[0][1],J);document.getElementById("auboutde").innerHTML="first montly payment";var s=0,A=true,D=false,F=false;var v=$.plot($("#amortissement"),[{data:q,label:"",bars:{show:true},color:"#72dd81"},{data:f,label:"",bars:{show:true},color:"#a9c9ed"},{data:H,label:"",bars:{show:true},color:"#f48c46"},{data:g,label:"",yaxis:2,bars:{show:false},lines:{show:true,fill:false},color:"#3b9230"},{data:[],label:""}],{series:{stack:true,lines:{show:D,fill:false,steps:F},bars:{show:A,barWidth:0.7,align:"left",lineWidth:1,fillColor:{colors:[{opacity:0.8},{opacity:0.8}]}}},xaxes:[{tickFormatter:function(i){return Math.round(i/12,1)+"years"}},{tickFormatter:function(i){return i+"years"}}],yaxes:[{color:"#EDC240",labelWidth:38,min:0,tickFormatter:function(i){return format_number(i)+""}},{color:"#3b9230",alignTicksWithAxis:1,position:"right",tickFormatter:function(i){return Math.round(i/1000)+""}}],legend:{position:"nw"},crosshair:{mode:"x"},grid:{hoverable:true,clickable:true}});$("#amortissement").bind("plothover",function(ac,ae,ab){S=ae;if(ab){if(X!=ab.dataIndex){X=ab.dataIndex;$("#tooltip").remove();var Z=ab.datapoint[0].toFixed(2),ad=ab.datapoint[1].toFixed(2);var o=Math.round(Z/12);var aa=Z%12;var i="";if(aa>0){i=" and "+aa+" months"}showTooltip(ab.pageX,ab.pageY,"After "+o+" years"+i+", the capital still due : "+format_number(Math.round(g[Math.round(Z)][1]))+" $");if(o>0){document.getElementById("auboutde").innerHTML="after "+o+" years"+i}else{document.getElementById("auboutde").innerHTML="after "+aa+" months"}drawPie(q[Math.round(Z)][1],H[Math.round(Z)][1],J)}}else{$("#tooltip").remove();X=null}})}if(!cout_duree_hiden&&false){var d=[];var r=parseFloat(document.getElementById("duree").value);var t=10;if(r<7){t=1}else{if(r<12){t=5}}for(var Q=t;Q<=30;Q+=1){d.push([Q,calcule_cout(parseFloat(get_number(document.getElementById("montant").value)),taux_duree(Q),Q)])}var N=$.plot($("#cout_duree"),[{data:d,label:""},{data:[],label:"Test",color:"green"}],{series:{lines:{show:true},points:{show:true}},grid:{hoverable:true,clickable:true},xaxis:{tickFormatter:function(i){return i+"years"}},yaxis:{tickFormatter:function(i){return i/1000+"K"}},legend:{position:"nw"},crosshair:{mode:"x"},grid:{hoverable:true,clickable:true},colors:["#CB4B4B"]});var l=get_number(document.getElementById("cout").value);var r=document.getElementById("duree").value;N.lockCrosshair({x:r,y:l});N.clearCrosshair();var L=N.pointOffset({x:r,y:l});var p=N.getCanvas().getContext("2d");p.fillStyle="green";p.strokeStyle="green";p.beginPath();p.lineWidth=2;p.moveTo(L.left,5);p.lineTo(L.left,178);p.stroke();p.moveTo(L.left,50);p.arc(L.left,L.top,4,0,Math.PI*2,true);p.closePath();p.fill();p.beginPath();p.fillStyle="white";p.arc(L.left,L.top,2,0,Math.PI*2,true);p.closePath();p.fill();var e=$("#cout_duree .legendLabel");e.eq(0).text(document.getElementById("cout").value+" $ for "+document.getElementById("duree").value+" years");if(1==1){$("#cout_duree").bind("mouseup",function(){isClicking=false;if(!updating){document.getElementById("duree").value=Math.round(S.x);updating=true;setTimeout(update,50)}});$("#cout_duree").bind("mousedown",function(){isClicking=true;N.unlockCrosshair()});var S=null;function B(){var o=$("#mensualites_duree .legendLabel");var Z=Math.round(S.x*10)/10;var i=calcule_mensualite(get_number(document.getElementById("montant").value),document.getElementById("taux").value,Z);o.eq(0).text(Math.round(i*10)/10+" $/m over "+Z+" years ");updatingLegend=false}$("#cout_duree").bind("plothover",function(Z,ac,o){S=ac;var aa=Math.abs(ac.x-parseFloat(document.getElementById("duree").value));if(aa<2){document.body.style.cursor="move"}else{document.body.style.cursor="default"}if(o){if(X!=o.dataIndex){X=o.dataIndex;$("#tooltip").remove();var i=o.datapoint[0].toFixed(2),ab=o.datapoint[1].toFixed(2);showTooltip(o.pageX,o.pageY,Math.round(ab)+" $ for "+Math.round(i)+" years")}}else{$("#tooltip").remove();X=null}})}}if(!mensualites_taux_hiden){var G=[];for(var Q=0.5;Q<=10;Q+=0.5){G.push([Q,calcule_mensualite(get_number(document.getElementById("montant").value),Q,document.getElementById("duree").value)])}var T=$.plot($("#mensualites_taux"),[{data:G,label:""},{data:[],label:"Test",color:"green"}],{series:{lines:{show:true},points:{show:true},},grid:{hoverable:true,clickable:true},crosshair:{mode:"x"},xaxis:{tickFormatter:function(i){return i+"%"}},yaxis:{tickFormatter:function(i){if(i>10000){return i/1000+"K"}else{return i}}},legend:{position:"nw"}});var e=$("#mensualites_taux .legendLabel");e.eq(0).text(document.getElementById("mensualites").value+" $/m at "+document.getElementById("taux").value+" %");var U=document.getElementById("taux").value;var V=get_number(document.getElementById("mensualites").value);T.lockCrosshair({x:U,y:V});T.clearCrosshair();var L=T.pointOffset({x:U,y:V});var p=T.getCanvas().getContext("2d");p.fillStyle="green";p.strokeStyle="green";p.beginPath();p.lineWidth=2;p.moveTo(L.left,5);p.lineTo(L.left,178);p.stroke();p.moveTo(L.left,50);p.arc(L.left,L.top,4,0,Math.PI*2,true);p.closePath();p.fill();p.beginPath();p.fillStyle="white";p.arc(L.left,L.top,2,0,Math.PI*2,true);p.closePath();p.fill();if(1==1){$("#mensualites_taux").bind("mouseup",function(){isClicking=false;if(!updating){document.getElementById("taux").value=Math.round(S.x*10)/10;updating=true;setTimeout(update,50)}});$("#mensualites_taux").bind("mousedown",function(){isClicking=true;T.unlockCrosshair()});var S=null;$("#mensualites_taux").bind("plothover",function(Z,ac,o){S=ac;var aa=Math.abs(ac.x-parseFloat(document.getElementById("taux").value));if(aa<0.5){document.body.style.cursor="move"}else{document.body.style.cursor="default"}if(o){if(X!=o.dataIndex){X=o.dataIndex;$("#tooltip").remove();var i=o.datapoint[0].toFixed(2),ab=o.datapoint[1].toFixed(2);showTooltip(o.pageX,o.pageY,Math.round(ab)+" $/m for a loan of "+document.getElementById("montant").value+" $ over "+document.getElementById("duree").value+" years at "+i+" %")}}else{$("#tooltip").remove();X=null}})}}if(!cout_taux_hiden){var O=[];for(var Q=0.5;Q<=10;Q+=0.5){O.push([Q,calcule_cout(get_number(document.getElementById("montant").value),Q,document.getElementById("duree").value)])}var x=$.plot($("#cout_taux"),[{data:O,label:""},{data:[],label:"Test",color:"green"}],{series:{lines:{show:true},points:{show:true}},grid:{hoverable:true,clickable:true},legend:{position:"nw"},crosshair:{mode:"x"},xaxis:{tickFormatter:function(i){return i+"%"}},yaxis:{tickFormatter:function(i){return i/1000+"K"}},colors:["#CB4B4B"]});var l=get_number(document.getElementById("cout").value);var U=document.getElementById("taux").value;x.lockCrosshair({x:U,y:l});x.clearCrosshair();var e=$("#cout_taux .legendLabel");e.eq(0).text(document.getElementById("cout").value+" $ at "+document.getElementById("taux").value+" %");var L=x.pointOffset({x:U,y:l});var p=x.getCanvas().getContext("2d");p.fillStyle="green";p.strokeStyle="green";p.beginPath();p.lineWidth=2;p.moveTo(L.left,5);p.lineTo(L.left,178);p.stroke();p.closePath();p.fill();p.beginPath();p.arc(L.left,L.top,4,0,Math.PI*2,true);p.closePath();p.fill();p.beginPath();p.fillStyle="white";p.arc(L.left,L.top,2,0,Math.PI*2,true);p.closePath();p.fill();if(1==1){$("#cout_taux").bind("mouseup",function(){isClicking=false;if(!updating){document.getElementById("taux").value=Math.round(S.x*10)/10;updating=true;setTimeout(update,50)}});$("#cout_taux").bind("mousedown",function(){isClicking=true;x.unlockCrosshair()});var S=null;$("#cout_taux").bind("plothover",function(Z,ac,o){S=ac;var aa=Math.abs(ac.x-parseFloat(document.getElementById("taux").value));if(aa<2){document.body.style.cursor="move"}else{document.body.style.cursor="default"}if(o){if(X!=o.dataIndex){X=o.dataIndex;$("#tooltip").remove();var i=o.datapoint[0].toFixed(2),ab=o.datapoint[1].toFixed(2);showTooltip(o.pageX,o.pageY,Math.round(ab)+" $ for a loan of "+document.getElementById("montant").value+" $ over "+document.getElementById("duree").value+" years at "+i+" %")}}else{$("#tooltip").remove();X=null}})}}if(!mensualites_montant_hiden){var u=[];for(var Q=0;Q<=1000000;Q+=50000){u.push([Q,calcule_mensualite(Q,document.getElementById("taux").value,document.getElementById("duree").value)])}var c=$.plot($("#mensualites_montant"),[{data:u,label:""},{data:[],label:"Test",color:"green"}],{series:{lines:{show:true},points:{show:true},},grid:{hoverable:true,clickable:true},crosshair:{mode:"x"},xaxis:{tickFormatter:function(i){return i/1000+"K"}},yaxis:{tickFormatter:function(i){if(i>10000){return i/1000+"K"}else{return i}}},legend:{position:"nw"}});var e=$("#mensualites_montant .legendLabel");e.eq(0).text(document.getElementById("mensualites").value+" $/m for "+document.getElementById("montant").value+" $");var I=get_number(document.getElementById("montant").value);var V=get_number(document.getElementById("mensualites").value);c.lockCrosshair({x:I,y:V});c.clearCrosshair();var L=c.pointOffset({x:I,y:V});var p=c.getCanvas().getContext("2d");p.fillStyle="green";p.strokeStyle="green";p.beginPath();p.lineWidth=2;p.moveTo(L.left,5);p.lineTo(L.left,178);p.stroke();p.moveTo(L.left,50);p.closePath();p.fill();p.arc(L.left,L.top,4,0,Math.PI*2,true);p.closePath();p.fill();p.beginPath();p.fillStyle="white";p.arc(L.left,L.top,2,0,Math.PI*2,true);p.closePath();p.fill();if(1==1){$("#mensualites_montant").bind("mouseup",function(){isClicking=false;if(!updating){document.getElementById("montant").value=format_number(Math.round(S.x));updating=true;setTimeout(update,50)}});$("#mensualites_montant").bind("mousedown",function(){isClicking=true;c.unlockCrosshair()});var S=null;$("#mensualites_montant").bind("plothover",function(Z,ac,o){S=ac;var aa=Math.abs(ac.x-I);if(aa<20000){document.body.style.cursor="move"}else{document.body.style.cursor="default"}if(o){if(X!=o.dataIndex){X=o.dataIndex;$("#tooltip").remove();var i=o.datapoint[0].toFixed(2),ab=o.datapoint[1].toFixed(2);showTooltip(o.pageX,o.pageY,Math.round(ab)+" $/m for a loan of "+Math.round(i)+" $ over "+document.getElementById("duree").value+" years at "+document.getElementById("taux").value+" %")}}else{$("#tooltip").remove();X=null}})}}if(!cout_montant_hiden){var z=[];for(var Q=0;Q<=1000000;Q+=50000){z.push([Q,calcule_cout(Q,document.getElementById("taux").value,document.getElementById("duree").value)])}var M=$.plot($("#cout_montant"),[{data:z,label:""},{data:[],label:"Test",color:"green"}],{series:{lines:{show:true},points:{show:true},},crosshair:{mode:"x"},grid:{hoverable:true,clickable:true},legend:{position:"nw"},xaxis:{tickFormatter:function(i){return i/1000+"K"}},yaxis:{tickFormatter:function(i){return i/1000+"K"}},colors:["#CB4B4B"]});var e=$("#cout_montant .legendLabel");e.eq(0).text(document.getElementById("cout").value+" $ for "+document.getElementById("montant").value+" $");var I=get_number(document.getElementById("montant").value);var l=get_number(document.getElementById("cout").value);M.lockCrosshair({x:r,y:V});M.clearCrosshair();var L=M.pointOffset({x:I,y:l});var p=M.getCanvas().getContext("2d");p.fillStyle="green";p.strokeStyle="green";p.beginPath();p.lineWidth=2;p.moveTo(L.left,5);p.lineTo(L.left,178);p.stroke();p.moveTo(L.left,50);p.closePath();p.fill();p.arc(L.left,L.top,4,0,Math.PI*2,true);p.closePath();p.fill();p.beginPath();p.fillStyle="white";p.arc(L.left,L.top,2,0,Math.PI*2,true);p.closePath();p.fill();if(1==1){$("#cout_montant").bind("mouseup",function(){isClicking=false;if(!updating){document.getElementById("montant").value=format_number(Math.round(S.x));updating=true;setTimeout(update,50)}});$("#cout_montant").bind("mousedown",function(){isClicking=true;M.unlockCrosshair()});var S=null;$("#cout_montant").bind("plothover",function(Z,ac,o){S=ac;var aa=Math.abs(ac.x-parseFloat(I));if(aa<2000){document.body.style.cursor="move"}else{document.body.style.cursor="default"}if(o){if(X!=o.dataIndex){X=o.dataIndex;$("#tooltip").remove();var i=o.datapoint[0].toFixed(2),ab=o.datapoint[1].toFixed(2);showTooltip(o.pageX,o.pageY,Math.round(ab)+" $ for a loan of "+Math.round(i)+" $ over "+document.getElementById("duree").value+" years at "+document.getElementById("taux").value+" %")}}else{$("#tooltip").remove();X=null}})}}if(true){var P=[{label:"Usual rates in the USA",data:les_taux,lines:{show:true},color:"rgb(50,50,255)"},{label:"My rate : "+document.getElementById("taux").value+" %",data:[[document.getElementById("duree").value,document.getElementById("taux").value]],lines:{show:true},color:"green"},{id:"m15%",data:les_taux_a,lines:{show:true,lineWidth:0,fill:false},color:"rgb(50,50,255)"},{id:"m25%",data:les_taux_b,lines:{show:true,lineWidth:0,fill:0.2},color:"rgb(50,50,255)",fillBetween:"m15%"},{id:"m50%",data:les_taux_c,lines:{show:true,lineWidth:0,fill:0.4,shadowSize:0},color:"rgb(50,50,255)",fillBetween:"m25%"},{id:"m75%",data:les_taux_d,lines:{show:true,lineWidth:0,fill:0.4},color:"rgb(50,50,255)",fillBetween:"m50%"},{id:"m85%",data:les_taux_e,lines:{show:true,lineWidth:0,fill:0.2},color:"rgb(50,50,255)",fillBetween:"m25%"},{id:"m",data:[[document.getElementById("duree").value,document.getElementById("taux").value]],lines:{show:true,lineWidth:5},points:{show:false},color:"green"}];var m=$.plot($("#taux_duree"),P,{xaxis:{tickFormatter:function(i){return i+" y"}},yaxis:{tickFormatter:function(i){return i+"%"}},grid:{hoverable:true,clickable:true},legend:{position:"se"}});var S=null;var e=$("#taux_duree .legendLabel");var j=null;var U=document.getElementById("taux").value;var L=m.pointOffset({x:r,y:U});var p=m.getCanvas().getContext("2d");p.fillStyle="green";p.strokeStyle="green";p.beginPath();p.lineWidth=2;p.moveTo(L.left,4);p.lineTo(L.left,178);p.stroke();p.moveTo(L.left,50);p.arc(L.left,L.top,4,0,Math.PI*2,true);p.closePath();p.fill();p.beginPath();p.fillStyle="white";p.arc(L.left,L.top,2,0,Math.PI*2,true);p.closePath();p.fill();function B(){j=null;e.eq(0).text(y.toFixed(2))}$("#taux_duree").bind("plothover",function(o,Z,i){S=Z;document.body.style.cursor="move"});$("#taux_duree").bind("mouseup",function(){if(!updating){document.getElementById("duree").value=Math.round(S.x);if(duree_taux_connecte){document.getElementById("taux").value=taux_duree(parseFloat(document.getElementById("duree").value))}else{document.getElementById("taux").value=Math.round(S.y*10)/10}updating=true;setTimeout(update,50)}});$("#taux_duree").bind("plothover",function(Z,ab,o){if(o){if(X!=o.dataIndex){X=o.dataIndex;$("#tooltip").remove();var i=o.datapoint[0].toFixed(2),aa=o.datapoint[1].toFixed(2);showTooltip(o.pageX,o.pageY,"Usual rate : "+Math.round(aa)+" % for a credit over "+Math.round(i)+" years")}}else{$("#tooltip").remove();X=null}})}force_analytics();updating=false}catch(R){alert("c"+R);alert("c"+R.stack)}}function init_reel(){var a=0;for(a=0;a<les_taux.length;a++){if(gcookie("rate_"+les_taux[a][0]).length>0){les_taux[a][1]=gcookie("rate_"+les_taux[a][0])}}for(a=0;a<les_taux.length;a++){les_taux_a[a][0]=les_taux[a][0];les_taux_b[a][0]=les_taux[a][0];les_taux_c[a][0]=les_taux[a][0];les_taux_d[a][0]=les_taux[a][0];les_taux_e[a][0]=les_taux[a][0];les_taux_a[a][1]=les_taux[a][1]*0.85;les_taux_b[a][1]=les_taux[a][1]*0.95;les_taux_c[a][1]=les_taux[a][1]*1.05;les_taux_d[a][1]=les_taux[a][1]*1.15;les_taux_e[a][1]=les_taux[a][1]*1.2}$("#slider_montant").slider({value:200000,min:1000,max:1000000,step:1000,slide:function(b,c){$("#montant").val(c.value);if(!updating){updating=true;setTimeout(update,50)}}});$("#montant").val(format_number($("#slider_montant").slider("value")));$("#slider_duree").slider({value:20,min:1,max:30,step:1,slide:function(b,c){$("#duree").val(c.value);if(duree_taux_connecte){document.getElementById("taux").value=taux_duree(c.value);$("#slider_taux").slider("value",document.getElementById("taux").value)}if(!updating){updating=true;setTimeout(update,50)}}});$("#duree").val($("#slider_duree").slider("value"));$("#slider_taux").slider({value:4,min:0.1,max:10,step:0.1,slide:function(b,c){$("#taux").val(c.value);if(!updating){updating=true;setTimeout(update,50)}}});$("#taux").val($("#slider_taux").slider("value"));$("#slider_assurance").slider({value:0.3,min:0,max:1,step:0.1,slide:function(b,c){$("#assurance").val(c.value);if(!updating){updating=true;setTimeout(update,50)}}});$("#assurance").val($("#slider_assurance").slider("value"));$("#dossier").val($("#slider_dossier").slider("value"));$("#slider_dossier").slider({value:200,min:0,max:2000,step:100,slide:function(b,c){$("#dossier").val(c.value);if(!updating){updating=true;setTimeout(update,50)}}});$("#dossier").val($("#slider_dossier").slider("value"));update()}function updatePageInit(){if(request.readyState==4&&request.status==200){init_reel()}}function linit(){try{request=null;if(window.XMLHttpRequest){request=new XMLHttpRequest()}else{if(window.ActiveXObject){request=new ActiveXObject("MSXML2.XMLHTTP.3.0")}}url="init.txt";request.open("GET",url,true);request.onreadystatechange=updatePageInit;request.send(null)}catch(a){alert("exception lors du analyse_intervalle "+a.stack)}};
