// © ATELIER 33 / ALL RIGHTS RESERVED / 2008 / http://www.atelier33.com / \\
//                                          APP RCPPJO1                                        \\
//=============================================================================================\\
//GLOBAL

//----------------------------
function Rcppj01Init(DaForm, DaPart){Rcppj01Calcul(DaForm);}
//----------------------------
function Rcppj01Manage(DaForm)
{
	var Dis=eval(DaForm);
	if(typeof(Dis.AutoCalc)!="object" || !Dis.AutoCalc[0].checked){Rcppj01Calcul(DaForm);}
}
//----------------------------
function Rcppj01Calcul(DaForm)
{
	var Dis=eval(DaForm); //alert(Dis);
	var DaPrice=""; var bFlag=false; var DMsg="";
	var iDiff=0; var iCoeff=1;
	var iTotCRCP=0; var iTotCPJP=0; var iTotCCP=0; var iTotal=0; 
	
	if(Dis.Contrat__Date_prise_effet.selectedIndex!=0)
		{
		iDiff=Dis.Contrat__Date_prise_effet.options[Dis.Contrat__Date_prise_effet.selectedIndex].value;
		iCoeff=iDiff/12;
		}
	else
		{iCoeff=0;}
	DMsg="DIFF="+iDiff+" | COEFF="+iCoeff+"<br>"
	//GetDivTxt(DMsg,"DATE_COMMENT");	

	//CRCP
	if(Dis.Contrat__Jeune_diplome.selectedIndex!=0 && Dis.Contrat__Responsabilite_civile.options[Dis.Contrat__Responsabilite_civile.selectedIndex].value==2 && iCoeff>0)
		{
		iTotCRCP=parseFloat(eval("Dis.CRCP_"+Dis.Contrat__Jeune_diplome.options[Dis.Contrat__Jeune_diplome.selectedIndex].value+".value"));
		iTotCRCP=iTotCRCP*iCoeff;
		}		
	//iTotCRCP=Roundit(iTotCRCP, 2);
	iTotCRCP=GeneRound(iTotCRCP, 1000); //alert(iTotCRCP);
	if(DaForm=="document.Form01"){Dis.Contrat__Responsabilite_civile_prime.value=iTotCRCP;}	else {GetDivTxt(iTotCRCP,"CRCP_PRIME");}
	
	//CPJP
	if(Dis.Contrat__Jeune_diplome.selectedIndex!=0 && Dis.Contrat__Protection_juridique_professionnelle.options[Dis.Contrat__Protection_juridique_professionnelle.selectedIndex].value==2 && iCoeff>0)
		{		
		iTotCPJP=parseFloat(eval("Dis.CPJP_"+Dis.Contrat__Jeune_diplome.options[Dis.Contrat__Jeune_diplome.selectedIndex].value+".value"));
		iTotCPJP=iTotCPJP*iCoeff;
		}
	//iTotCPJP=Roundit(iTotCPJP, 2);
	iTotCPJP=GeneRound(iTotCPJP, 1000);
	if(DaForm=="document.Form01"){Dis.Contrat__Protection_juridique_professionnelle_prime.value=iTotCPJP;} else {GetDivTxt(iTotCPJP,"CPJP_PRIME");}	
	
	//CCP
	if(Dis.Contrat__Jeune_diplome.selectedIndex!=0 && iCoeff>0){iTotCCP=parseFloat(Dis.CCP.value);}
	//iTotCCP=Roundit(iTotCCP, 2);
	iTotCCP=GeneRound(iTotCCP, 2);
	if(DaForm=="document.Form01"){Dis.Contrat__Cout_police.value=iTotCCP;}	else {GetDivTxt(iTotCCP,"CCP_PRIME");}

	
	//TOTAL
	iTotal=iTotCRCP+iTotCPJP+iTotCCP;
	if(DaForm=="document.Form01"){Dis.Total.value=iTotal;} else {GetDivTxt(iTotal,"TOTAL_PRIME");}
	
}
//----------------------------
function Rcppj01Edit(DaForm){var Dis=eval(DaForm); Dis.act.value="EDIT"; Dis.method="post"; Dis.submit();}
//----------------------------
function Rcppj01Recap(DaForm){var Dis=eval(DaForm); Dis.act.value="RECAP"; Dis.method="post"; Dis.submit();}
//----------------------------
function Rcppj01Record(DaForm){var Dis=eval(DaForm); Dis.act.value="RECORD"; Dis.method="post"; Dis.submit();}
//----------------------------
function Rcppj01Check(DaForm, DaLoc, DaAct)
{
	var Dis=eval(DaForm); //alert(Dis);
	var bFlag=true;
	//if(Dis.Mode_paiement.selectedIndex==0){bFlag=false; alert(ExpPayMode2); Dis.Mode_paiement.focus();}

	
	if(bFlag){Dis.act.value=DaAct; Dis.action=DaLoc; Dis.method="post"; Dis.submit();}
}
//----------------------------
function Rcppj01CheckAdm(DaForm, DaLoc, DaAct)
{
	var Dis=eval(DaForm); //alert(Dis);
	var bFlag=true;

	if(bFlag){Dis.act.value=DaAct; Dis.action=DaLoc; Dis.method="post"; Dis.submit();}
}
//----------------------------
function Rcppj01Reset(DaForm)
{
	var Dis=eval(DaForm);
	//Dis.Contrat__Date_prise_effet.value
}
//----------------------------