/* auteur: Graphedeal */
/* Date de création: 13/06/2003 */
function recherche(niveau,planAbsent,baseDocPresent){
if (niveau==1) ajout="../images/";
else ajout="images/";
if (niveau==1) ajout2="../";
else ajout2="";
blocrecherche='';
blocrecherche+='<td width="200" class="recherche" valign="top">';
blocrecherche+='<img src="'+ajout+'pixel.gif" border="0" width="1" height="5" alt=""><br>';
blocrecherche+='<img src="'+ajout+'b_loupe.gif" border="0" width="200" height="34" alt="">';
blocrecherche+='<table width="100%" border="0" cellpadding="0" cellspacing="0" ><tr>';
blocrecherche+='	<form marginheight="0" marginwidth="0" leftmargin="0" rightmargin="0" topmargin="0" name="search" method="post" action="'+ ajout2 + 'recherche/recherche.asp">';
blocrecherche+='	<td align="center"><input type="text" name="search" size="20" maxlength="256"></TD>';
blocrecherche+='	<TD align="center">&nbsp;<input type="image" src="'+ajout+'b_OK-Recherche.gif"></TD></form>';
blocrecherche+='</TABLE>';
blocrecherche+='<table cellpadding="0" cellspacing="0" border="0" width=100%>';
blocrecherche+='	<td class="menu" align="center"><a href="'+ ajout2 + 'recherche/recherche.asp" class="lienbl"> Recherche avancée</A></TD>';
blocrecherche+='</TABLE>';
blocrecherche+='<img src="'+ajout+'pixel.gif" border="0" width="1" height="7" alt="">';
if (!planAbsent){
blocrecherche+='<table cellpadding="0" cellspacing="0" border="0" width="100%" >';
blocrecherche+='	<td class="menu" align="center">';
blocrecherche+='	<img src="images/separateur de rubrique.gif" border="0" width="200" height="4" alt=""><br>';
blocrecherche+='	<A href="'+ ajout2 + 'informations/presentation_plan.asp"><img src="'+ajout+'b_PlanSite.gif" border="0" width="200" height="34" alt=""></A><br>';
blocrecherche+='	</TD>';
blocrecherche+='</TABLE>';
}
if (!baseDocPresent)
{
blocrecherche+='<table cellpadding="0" cellspacing="0" border="0" width="100%" >';
blocrecherche+='	<form  marginheight="0" marginwidth="0" leftmargin="0" rightmargin="0" topmargin="0" method="POST" name="login" action="http://v1-prod.esquif.net/GMPADEV/loginDirect.asp" target="_blank">';
blocrecherche+='	<td class="menu" align="center">';
blocrecherche+='	<img src="images/separateur de rubrique.gif" border="0" width="200" height="4" alt=""><br>';
blocrecherche+='	<input type="hidden" name="txt_req_login" value="visiteur"><input type="hidden" name="txt_req_password" value="invite"><A href="'+ ajout2 + 'Fichier/Default.asp"><img src="'+ajout+'b_espacedoc.gif" border="0" width="200" height="34" alt=""></A><br><img src="images/separateur de rubrique.gif" border="0" width="200" height="4" alt=""><br>';
blocrecherche+='	</TD>';
blocrecherche+='</form>';
blocrecherche+='</TABLE>';

}
return (blocrecherche);
}
function rechercheAdm(niveau){
if (niveau==1) ajout="../images/";
else ajout="images/";
if (niveau==1) ajout2="../";
else ajout2="";
blocrecherche='';
blocrecherche+='<td width="200" valign="top">';
blocrecherche+='<img src="'+ajout+'pixel.gif" border="0" width="1" height="5" alt=""><br>';
blocrecherche+='<img src="'+ajout+'b_loupe.gif" border="0" width="200" height="34" alt="">';
blocrecherche+='<table width="100%" border="0" cellpadding="0" cellspacing="0" ><tr>';
blocrecherche+='	<form marginheight="0" marginwidth="0" leftmargin="0" rightmargin="0" topmargin="0" name="search" method="post" action="'+ ajout2 + 'recherche/recherche.asp">';
blocrecherche+='	<td align="center"><input type="text" name="search" size="20" maxlength="256" disabled></TD>';
blocrecherche+='	<TD align="center">&nbsp;<img src="'+ajout+'b_OK-Recherche.gif"></TD></form>';
blocrecherche+='</TABLE>';
blocrecherche+='<table cellpadding="0" cellspacing="0" border="0" width=100%>';
blocrecherche+='	<td class="menu" align="center"><a href="admin/admin.asp" class="lienbl"> Recherche avancée</A></TD>';
blocrecherche+='</TABLE>';
blocrecherche+='<img src="'+ajout+'pixel.gif" border="0" width="1" height="7" alt="">';
blocrecherche+='<table cellpadding="0" cellspacing="0" border="0" width="100%" >';
blocrecherche+='	<td class="menu" align="center">';
blocrecherche+='	<img src="images/separateur de rubrique.gif" border="0" width="200" height="4" alt=""><br>';
blocrecherche+='	<A href="#"><img src="'+ajout+'b_PlanSite.gif" border="0" width="200" height="34" alt=""></A><br><img src="images/separateur de rubrique.gif" border="0" width="200" height="4" alt=""><br>';
blocrecherche+='	</TD>';
blocrecherche+='</TABLE>';
blocrecherche+='<table cellpadding="0" cellspacing="0" border="0" width="100%" >';
blocrecherche+='	<form  marginheight="0" marginwidth="0" leftmargin="0" rightmargin="0" topmargin="0" method="POST" name="login" action="http://v1-prod.esquif.net/GMPADEV/loginDirect.asp" target="_blank">';
blocrecherche+='	<td class="menu" align="center">';
blocrecherche+='	<img src="images/separateur de rubrique.gif" border="0" width="200" height="4" alt=""><br>';
blocrecherche+='	<A href="admin/Fichier/Listing_Fichier.asp"><img src="'+ajout+'b_espacedoc.gif" border="0" width="200" height="34" alt=""></A>'

blocrecherche+='				<a href="admin/fichier/Listing_fichier.asp" class="lienbl">';
blocrecherche+='				Administrer l\'espace documentaire';
blocrecherche+='				</a>';
blocrecherche+='				<a href="admin/fichier/fichier.asp" class="lienbl">';
blocrecherche+='				Ajouter un élément dans la zone';
blocrecherche+='				</a>';

blocrecherche+='<img src="images/separateur de rubrique.gif" border="0" width="200" height="4" alt=""><br>';

blocrecherche+='	</TD>';
blocrecherche+='</form>';
blocrecherche+='</TABLE>';
return (blocrecherche);
}
function menudroit(niveau){
if (niveau==1) ajout="../images/";
else ajout="images/";
block='<TD class="recherche" width="200" valign="top">';
block+='<img src="'+ajout+'pixel.gif" border="0" width="1" height="7" alt="">';
block+='<table cellpadding="0" cellspacing="0" border="0" width="100%" >';
block+='	<td class="menu"align="center">';
block+='	<img src="images/separateur de rubrique.gif" border="0" width="200" height="4" alt=""><br>';
block+='	<A href="/Fichier/Default.asp"><img src="'+ajout+'b_espacedoc.gif" border="0" width="200" height="34" alt=""></A><br><img src="images/separateur de rubrique.gif" border="0" width="200" height="4" alt=""><br>';
block+='</TABLE>';
return (block);
}
function info(couleur,dossier,texte,vignette,orientation,largeur,niveau){
if(niveau==1)ajout='../';
else ajout='';
adr=ajout+'images/'+dossier
if(vignette!=''){
portionvignette='<TD valign="top"  width=50><img src="'+vignette+'" border="0" width="50" height="50" alt=""></TD>';
}else
{portionvignette=''}
portiontexte='<TD valign="top" width=450><font class="texte">'+texte+'</font></TD>';
separateur='<TD>&nbsp;</TD>';
element='<table border="0" cellpadding="0" cellspacing="0">';
element+='<tr><td><img src="'+adr+'/cadre_hg.gif" width="15" height="15"></td><td><img src="'+adr+'/cadre_h.gif" width="'+largeur+'" height="15"></td><td><img src="'+adr+'/cadre_hd.gif" width="15" height="15"></td></tr><tr><td background="'+ajout+'images/'+dossier+'/cadreg.gif"><img src="images/pixel.gif" border="0" width="15" height="1" alt=""></td><td  bgcolor="'+couleur+'"><table>';
if (orientation==1)element+=portionvignette+separateur+portiontexte;
else element+=portiontexte+separateur+portionvignette;
element+='</TABLE></td><td background="'+ajout+'images/'+dossier+'/cadred.gif"width=15><img src="images/pixel.gif" border="0" width="15" height="1" alt=""></tr><tr><td><img src="'+adr+'/cadre_bg.gif" width="15" height="15"></td><td><img src="'+adr+'/cadre_b.gif" width="'+largeur+'" height="15"></td><td><img src="'+adr+'/cadre_bd.gif" width="15" height="15"></td></tr></table>';
return(element);
}

function basDePage(couleur,dossier,texte,vignette,orientation,largeur,niveau){
if(niveau==1)ajout='../';
else ajout='';
adr=ajout+'images/'+dossier
if(vignette!=''){
portionvignette='<TD valign="top"  width=50><img src="'+vignette+'" border="0" width="50" height="50" alt=""></TD>';
}else
{portionvignette=''}
portiontexte='<tr><TD valign="top" align="center">'+texte+'</TD></tr>';
separateur='';
element='<table border="0" cellpadding="0" cellspacing="0" align="center">';
element+='<tr><td align="right" valign="bottom"><img src="'+adr+'/cadre_hgNouv.gif" width="6" height="6"></td><td background="'+adr+'/cadre_hNouv.gif" height="1"><img src="images/pixelBleu.gif" border="0" width="1" height="1" alt=""></td><td align="left" valign="bottom"><img src="'+adr+'/cadre_hdNouv.gif" width="6" height="6"></td></tr><tr><td background="'+ajout+'images/'+dossier+'/cadregNouv.gif"><img src="images/pixelBleu.gif" border="0" width="6" height="1" alt=""></td><td  bgcolor="'+couleur+'"><table width="100%" align="center" border="0" cellpadding="0" cellspacing="0">';
if (orientation==1)element+=portionvignette+separateur+portiontexte;
else element+=portiontexte+separateur+portionvignette;
element+='</TABLE></td><td background="'+ajout+'images/'+dossier+'/cadredNouv.gif" width=6><img src="images/pixelBleu.gif" border="0" width="6" height="1" alt=""></tr><tr><td><img src="'+adr+'/cadre_bgNouv.gif" width="6" height="6"></td><td background="'+ adr +'/cadre_bNouv.gif"></td><td><img src="'+adr+'/cadre_bdNouv.gif" width="6" height="6"></td></tr></table>';

//alert(element);
return(element);
}

function nouveaute(couleur,dossier,texte,vignette,orientation,largeur,niveau){
if(niveau==1)ajout='../';
else ajout='';
adr=ajout+'images/'+dossier
if(vignette!=''){
portionvignette='<TD valign="top"  width=50><img src="'+vignette+'" border="0" width="50" height="50" alt=""></TD>';
}else
{portionvignette=''}
portiontexte='<TD valign="top" width=600><font class="texte">'+texte+'</font></TD>';
separateur='<TD>&nbsp;</TD>';
element='<table border="0" cellpadding="0" cellspacing="0">';
element+='<tr><td><img src="'+adr+'/cadre_hgNouv2.gif" width="12" height="15"></td><td><img src="'+adr+'/cadre_hNouv2.gif" width="'+largeur+'" height="15"></td><td><img src="'+adr+'/cadre_hdNouv2.gif" width="15" height="15"></td></tr><tr><td background="'+ajout+'images/'+dossier+'/cadregNouv2.gif"><img src="images/pixel.gif" border="0" width="1" height="1" alt=""></td><td  bgcolor="'+couleur+'"><table>';
if (orientation==1)element+=portionvignette+separateur+portiontexte;
else element+=portiontexte+separateur+portionvignette;
element+='</TABLE></td><td background="'+ajout+'images/'+dossier+'/cadredNouv2.gif"width=15><img src="images/pixel.gif" border="0" width="15" height="1" alt=""></tr><tr><td><img src="'+adr+'/cadre_bgNouv2.gif" width="12" height="15"></td><td><img src="'+adr+'/cadre_bNouv2.gif" width="'+largeur+'" height="15"></td><td><img src="'+adr+'/cadre_bdNouv2.gif" width="15" height="15"></td></tr></table>';
return(element);
}

function startpage(URL, largeur, hauteur) {
	
preview = startpagenamed(URL, largeur, hauteur,"preview");
 return;
}

function startpagenamed(URL, largeur, hauteur,name) {
windowprops = "left=50,top=50,width=" + largeur + ",height=" + hauteur+",scrollbars=yes,status=yes";
wndName = window.open(URL, name, windowprops);
return wndName;
}
function ChampAnnee(Name_form, Name_Elt, Nbr, LimitMin, LimitMax)
{	

	if (isNaN(document.forms[Name_form].elements[Name_Elt].value))
	{
		alert ("Ce champ doit être de type entier");
		document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
		document.forms[Name_form].elements[Name_Elt].focus();
		return false;
	}
	else
	{
		if (document.forms[Name_form].elements[Name_Elt].value.length != Nbr)
		{ 
			alert('Ce champ doit contenir 4 caractères');
			document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
			document.forms[Name_form].elements[Name_Elt].focus();
			return false;
		}
		else
		{	
			d = new Date();
			Annee = d.getYear();
		
			if ((Annee - document.forms[Name_form].elements[Name_Elt].value) < LimitMin)
			{ 

				if (Annee < document.forms[Name_form].elements[Name_Elt].value)
				{
					alert('L\'année saisie est incohérente.');
				}
				else
				{
					alert('Les personnes de moins de ' + LimitMin + ' ans ne peuvent souscrire au regime.');
				}
				
				document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
				document.forms[Name_form].elements[Name_Elt].focus();
				return false;
			}
			else
			{	
				if ((Annee - document.forms[Name_form].elements[Name_Elt].value) > LimitMax)
				{ 
					//alert('Les personnes de plus de ' + LimitMax + ' ans ne peuvent soucrire au regime.');
					
					document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
					document.forms[Name_form].elements[Name_Elt].focus();
					
					//if (confirm('Vous dépassez la limite d\'âge pour ce type de contrat.Vous devez souscrire un "Préfa".\nAller vers le simulateur "PREFA"?'))
					//if (confirm('Au-delà de '+ LimitMax + ' ans vous pouvez souscrire un contrat PREFA\nà la condition d\'être déjà adhérent au GMPA\n\nEtes vous adhérent?'))
					//{
					//document.location.href="Question_PREFA1.asp"
					//startpagenamed('Question_PREFA1.asp','518','260','question1');
					startpagenamed('Question_CAPIC.asp','518','260','question1');
					window.close();
					
					//}
					//else
					//return false;
				}
				else
				{	
					return true;
				}
			}
		}
	}
}

function ChampAnneePREFA(Name_form, Name_Elt, Nbr, LimitMin, LimitMax, LimitMaxMax)
{	

	if (isNaN(document.forms[Name_form].elements[Name_Elt].value))
	{
		alert ("Ce champ doit être de type entier");
		document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
		document.forms[Name_form].elements[Name_Elt].focus();
		return false;
	}
	else
	{
		if (document.forms[Name_form].elements[Name_Elt].value.length != Nbr)
		{ 
			alert('Ce champ doit contenir 4 caractères');
			document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
			document.forms[Name_form].elements[Name_Elt].focus();
			return false;
		}
		else
		{	
			d = new Date();
			Annee = d.getYear();
		
			if ((Annee - document.forms[Name_form].elements[Name_Elt].value) < LimitMin)
			{ 
				alert('Les personnes de moins de ' + LimitMin + ' ans ne peuvent souscrire au regime.');
				
				document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
				document.forms[Name_form].elements[Name_Elt].focus();
				return false;
			}
			else
			{	
				if ((Annee - document.forms[Name_form].elements[Name_Elt].value) > LimitMaxMax)
				{
					alert('Les personnes de plus de ' + LimitMaxMax + ' ans ne peuvent soucrire au regime.');
       				document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
       				document.forms[Name_form].elements[Name_Elt].focus();
       				return false;
				}
				else
				{
      				if ((Annee - document.forms[Name_form].elements[Name_Elt].value) > LimitMax)
      				{ 
      					//alert('Les personnes de plus de ' + LimitMax + ' ans ne peuvent soucrire au regime.');
      					val = document.forms[Name_form].elements[Name_Elt].value;
      					document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
      					document.forms[Name_form].elements[Name_Elt].focus();
      					
      					//if (confirm('Vous dépassez la limite d\'âge pour ce type de contrat.Vous devez souscrire un "Préfa".\nAller vers le simulateur "PREFA"?'))
      					//if (confirm('Au-delà de '+ LimitMax + ' ans vous pouvez souscrire un contrat PREFA\nà la condition d\'être déjà adhérent au GMPA\n\nEtes vous adhérent?'))
      					//{
      					//document.location.href="Question_PREFA1.asp"
      					startpagenamed('Question_PREFA1b.asp?annee='+ val,'518','260','question1b');
      					window.close();
      					
      					//}
      					//else
      					//return false;
      				}
      				else
      				{	
      					return true;
      				}
				}
			}
		}
	}
}



function ChampAnneeCE(Name_form, Name_Elt, Nbr, LimitMin, LimitMax, LimitMaxMax)
{	

	if (isNaN(document.forms[Name_form].elements[Name_Elt].value))
	{
		alert ("Ce champ doit être de type entier");
		document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
		document.forms[Name_form].elements[Name_Elt].focus();
		return false;
	}
	else
	{
		if (document.forms[Name_form].elements[Name_Elt].value.length != Nbr)
		{ 
			alert('Ce champ doit contenir 4 caractères');
			document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
			document.forms[Name_form].elements[Name_Elt].focus();
			return false;
		}
		else
		{	
			d = new Date();
			Annee = d.getYear();
		
			if ((Annee - document.forms[Name_form].elements[Name_Elt].value) < LimitMin)
			{ 
				alert('Les personnes de moins de ' + LimitMin + ' ans ne peuvent souscrire au regime.');
				
				document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
				document.forms[Name_form].elements[Name_Elt].focus();
				return false;
			}
			else
			{	

				if ((Annee - document.forms[Name_form].elements[Name_Elt].value) > LimitMaxMax)
				{
					alert('Les personnes de plus de ' + LimitMaxMax + ' ans ne peuvent soucrire au regime.');
       				document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
       				document.forms[Name_form].elements[Name_Elt].focus();
       				return false;
				}
				else
				{

      				if ((Annee - document.forms[Name_form].elements[Name_Elt].value) > LimitMax)
      				{ 
      					//alert('Les personnes de plus de ' + LimitMax + ' ans ne peuvent soucrire au regime.');
      					val = document.forms[Name_form].elements[Name_Elt].value;
      					document.forms[Name_form].elements[Name_Elt].value = document.forms[Name_form].elements[Name_Elt].defaultValue;
      					document.forms[Name_form].elements[Name_Elt].focus();
      					
      					
      					//if (confirm('Au-delà de '+ LimitMax + ' ans vous pouvez assurer votre emprunt à l\'aide\nd\'un contrat PREFA à la condition d\'être déjà adhérent au GMPA\n\nEtes vous adhérent?'))
      					//{
      					//document.location.href="Simulation_PREFA.asp"
      					//}
      					//else
      					//return false;
      					
      					startpagenamed('Question_PREFA2.asp?annee='+ val ,'518','260','question2');
      					window.close();
      				}
      				else
      				{	
      					return true;
      				}
				}
			}
		}
	}
}

// Determine si une valeur limite est depassé, affiche l'alerte correspondant
// et annule l'action sur le radio bouton
// Already_Tested, par defaut en entree = false
// Renvoie True
		
function LimitValue(MaxValue, Form_Value_Name, Elmt_Value_Name, AlertText, Already_Tested)
{	
	d = new Date();
	Annee = d.getYear();
	if ((Annee - document.forms[Form_Value_Name].elements[Elmt_Value_Name].value) > MaxValue)
	{	
		if (!(Already_Tested))
		{	
			if (AlertText!='')
			alert(AlertText);
		}
	}
	return true;
}

// Reactive la valeur par defaut d'un radio bouton

function DefaultCheckRadio(Form_Radio_Name, Elmt_Radio_Name)
{
	for (var i = 0; i < document.forms[Form_Radio_Name].elements[Elmt_Radio_Name].length; i ++)
		{ if (document.forms[Form_Radio_Name].elements[Elmt_Radio_Name][i].defaultChecked)
			{
				document.forms[Form_Radio_Name].elements[Elmt_Radio_Name][i].click();
			}
		}
}
function minMaxNum(caseValeur,valeurMin,valeurMax)
{
	
	if (isNaN(parseInt(caseValeur.value)))
	{
	alert('Cette valeur doit être numérique');
	caseValeur.value=0;
	//return false;
	}
	
	if (caseValeur.value>valeurMax){
	alert('Cette valeur ne peut être supérieure à '+ valeurMax);
	caseValeur.value=valeurMax;
	caseValeur.select();
	//return false;
	}
	
	if (caseValeur.value<valeurMin){
	alert('Cette valeur ne peut être inférieure à '+ valeurMin);
	caseValeur.value=valeurMin;
	caseValeur.select();	
	//return false;
	}

	return true;
}