function Afficherg(sem_mois)
{
	if (document.formgrp.optrisk[1].checked){
	document.formgrp.rgdd.selectedIndex = document.formgrp.depdd.selectedIndex;
	document.formgrp.rgdm.selectedIndex = document.formgrp.depmm.selectedIndex;
	document.formgrp.rgdy.value = document.formgrp.depyy.value;

	document.formgrp.rgrd.selectedIndex = document.formgrp.retdd.selectedIndex;
	document.formgrp.rgrm.selectedIndex = document.formgrp.retmm.selectedIndex;
	document.formgrp.rgry.value = document.formgrp.retyy.value;

 tmp_rg(sem_mois);
 }
}


//function Afficherg(sem_mois)
//{
//	if (document.formgrp.optrisk(1).checked){
//date_rg(sem_mois);
//document.getElementById("rgd").style.visibility='visible';
//document.getElementById("rgr").style.visibility='visible';}
//else{document.getElementById("rgd").style.visibility='hidden';
//document.getElementById("rgr").style.visibility='hidden';}
//}

function verif_rg()
{
dep=(document.formgrp.depyy.value*10000)+((document.formgrp.depmm.value-1)*100)+(Math.round(document.formgrp.depdd.value));
ret=(document.formgrp.retyy.value*10000)+((document.formgrp.retmm.value-1)*100)+(Math.round(document.formgrp.retdd.value));

deprg=(document.formgrp.rgdy.value*10000)+((document.formgrp.rgdm.value-1)*100)+(Math.round(document.formgrp.rgdd.value));
retrg=(document.formgrp.rgry.value*10000)+((document.formgrp.rgrm.value-1)*100)+(Math.round(document.formgrp.rgrd.value));

if(dep>deprg || ret<deprg){
alert("Erreur: Date debut assurance supérieure à la date option");
document.formgrp.rgdd.selectedIndex=document.formgrp.depdd.selectedIndex;
document.formgrp.rgdm.selectedIndex=document.formgrp.depmm.selectedIndex;
document.formgrp.rgdy.value=document.formgrp.depyy.value;}

if(ret<retrg || dep>retrg){
alert("Erreur: Date fin assurance inférieure à la date option");
document.formgrp.rgrd.selectedIndex=document.formgrp.retdd.selectedIndex;
document.formgrp.rgrm.selectedIndex=document.formgrp.retmm.selectedIndex;
document.formgrp.rgry.value=document.formgrp.retyy.value;}
}

function tmp_rg(sem_mois)
{

date1 = new Date(document.formgrp.rgdy.value,(document.formgrp.rgdm.value-1),document.formgrp.rgdd.value,0,0,0,0);
date2 = new Date(document.formgrp.rgry.value,(document.formgrp.rgrm.value-1),document.formgrp.rgrd.value,0,0,0,0);

if (sem_mois==1){laps = nbsemaines(date1, date2);}else{laps = nbmois(date1, date2);}
document.formgrp.nbrg.value=laps;
}
