function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function ongletClick(ong) {
 vonglet=document.frm.onglet.value;
 if ((vonglet==1)||(vonglet==4))
  location="index.php?id_apporteur="+document.frm.id_apporteur.value+"&param="+document.frm.param.value+"&mnt="+strtoint(document.frm.montant.value)+"&mnn="+document.frm.monnaie.value+"&dur="+(document.frm.duree.options[document.frm.duree.selectedIndex].text)+"&txi="+lectnb(document.frm.txinteret.value)+"&txa="+lectnb(document.frm.txassurance.value)+"&age="+document.frm.age.value+"&debm="+(document.frm.debutmois.selectedIndex+1)+"&deba="+(document.frm.debutannee.selectedIndex+(document.frm.currentyear.value-2))+"&det="+document.frm.detail.value+"&ong="+ong;
 else
  location="index.php?id_apporteur="+document.frm.id_apporteur.value+"&param="+document.frm.param.value+"&mnt="+document.frm.montant.value+"&mnn="+document.frm.monnaie.value+"&dur="+document.frm.duree.value+"&txi="+document.frm.txinteret.value+"&txa="+document.frm.txassurance.value+"&age="+document.frm.age.value+"&debm="+document.frm.debutmois.value+"&deba="+document.frm.debutannee.value+"&det="+document.frm.detail.value+"&ong="+ong;
 return false;
}
function printClick() {
 bn=navigator.appName;
 bv=navigator.appVersion;
 nsv=parseFloat(bv);
 iev=bv.substring(bv.indexOf('MSIE ')+5);
 iev=parseFloat(iev);
 if ((bn=="Netscape" && nsv >=4) || (bn=="Microsoft Internet Explorer" && iev >=5))
  print()
 else
  alert("Cette fonction nécessite Microsoft Internet Explorer 5 ou Netscape Navigator 4!");
}
function convertClick() {
 vonglet=document.frm.onglet.value;
 if ((vonglet==1)||(vonglet==4)) {
  vmontant=strtoint(document.frm.montant.value);
  vduree=document.frm.duree.options[document.frm.duree.selectedIndex].text;
  vtxinteret=lectnb(document.frm.txinteret.value);
  vtxassurance=lectnb(document.frm.txassurance.value);
  vmois=document.frm.debutmois.selectedIndex+1;
  vannee=(document.frm.debutannee.selectedIndex + (document.frm.currentyear.value-2));
  vdetail=document.frm.detail.value;
 } else {
  vmontant=parseInt(document.frm.montant.value);
  vduree=document.frm.duree.value;
  vtxinteret=document.frm.txinteret.value;
  vtxassurance=document.frm.txassurance.value;
  vmois=document.frm.debutmois.value;
  vannee=document.frm.debutannee.value;
  vdetail=document.frm.detail.value;
 }
 vage=document.frm.age.value;
 vmonnaie=document.frm.monnaie.value;
 coeff=(vmonnaie==0)?  1/pariteEuro : pariteEuro;
 vmontant=parseInt(vmontant*coeff+.5);
 vmonnaie=1-vmonnaie;
 location="index.php?id_apporteur="+document.frm.id_apporteur.value+"&param="+document.frm.param.value+"&mnt="+vmontant+"&mnn="+vmonnaie+"&dur="+vduree+"&txi="+vtxinteret+"&txa="+vtxassurance+"&age="+vage+"&debm="+vmois+"&deba="+vannee+"&det="+vdetail+"&ong="+vonglet;
 return false;
}
function dureeChange() {
 var d=document.frm.duree.options[document.frm.duree.selectedIndex].text;
 if (d<9) d=7
 else if (d<12) d=10
 else if (d<14) d=12
 else if (d<18) d=15
 else if (d<23) d=20
 else if (d<28) d=25
 else d=30;
 st=eval("document.frm.tauxInteretDefault"+d+".value");
 document.frm.txinteret.value=floattostr(st);
}
function ageChange() {
 document.frm.age.value=document.frm.ageselect.selectedIndex;
 document.frm.txassurance.value=document.frm.ageselect.options[document.frm.ageselect.selectedIndex].value;
}
function calcClick() {
 vonglet=document.frm.onglet.value;
 if (vonglet==1)
  return ongletClick(2)
 else
  return ongletClick(vonglet);
}
function persoClick() {
 document.frm.perso.value=1-document.frm.perso.value;
 return ongletClick(document.frm.onglet.value);
}
function detailClick() {
 document.frm.detail.value=1-document.frm.detail.value;
 return ongletClick(document.frm.onglet.value);
}