
////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////   Fonction pour les calques déroulants  ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////   Fonctions générées par Dreamweaver ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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 testDate(theField)
{


var jour;
  var mois;
  var annee;
  var splitDate;
  var theDate;
  
  theDate=new String(theField.value);
  splitDate=theDate.split("/");
  jour=new String(splitDate[0]);
  mois=new String(splitDate[1]);
  annee=new String(splitDate[2]);
  if ((theDate.length!=10) || (jour.length!=2) || (mois.length!=2) || (annee.length!=4) || (jour>"31") || (mois>"12")){
    alert("Le format de la date n\'est pas correct.\nVous devez la saisir au format : JJ/MM/AAAA");
 return false;
  }
  if (jour>"30"){
    if ((mois=="02") || (mois=="04") || (mois=="06") || (mois=="09") || (mois=="11")){
   alert("La date n\'est pas valide, ce mois ne comporte pas plus de 30 jours.")
   return false;
 }
  }
  if ((jour>"29") && (mois=="02")){
    alert("La date n\'est pas valide, le mois de février ne comporte pas plus de 29 jours.")
 return false;
  }
  if ((jour=="29") && (mois=="02")){
    if ((((annee%4==0) && (annee%100!=0)) || (annee%400==0))==false){
      alert("La date n\'est pas valide, "+annee+" n\'est pas une année bissextile.");
   return false;
    }
  }
  return true;
}

// ChangerStyle
// args : string id_element, string nom_style
// return : none
// Applique le style (classe CSS) "nom_style" à l'élément HTML d'ID "id_element"
function ChangerStyle(id_element, nom_style)
{
	if (id_element == "") return;
	var mon_element = document.getElementById(id_element);
	if (!mon_element) return;
	
	if (nom_style == "") return;
	
	mon_element.className = nom_style;
}

// OuvrirNiveauInf
// string id_menu
// return: none;
// Ouvre les sous-menus de "id_menu"
function OuvrirNiveauInf(id_menu, str_cle)
{
	if (id_menu == "") return;
	var menu = document.getElementById(id_menu);
	if (!menu) return;
	
	var liste_sous_menu = menu.getElementsByTagName("DIV");

	var cle = "menu" + str_cle + "_";
	
	for (i = 0; i < liste_sous_menu.length; i++)
	{
		if ( liste_sous_menu[i].id.indexOf(cle) >= 0)
			liste_sous_menu[i].style.display = "block";
	}
}

// MasquerMenu
// args : string prefixe_menu
// return : none
// Masque tous les éléments de menu préfixe "prefixe_menu"
function MasquerMenu(prefixe_menu)
{
	//alert("masquage");
	if (prefixe_menu == "") return;
	var liste_div = document.getElementsByTagName("DIV");
	for (i = 0; i < liste_div.length; i++)
	{
		if (liste_div[i].id.substr(0, prefixe_menu.length) == prefixe_menu)
		{
			liste_div[i].style.display = "none";
		}
	}
}

// InitialiserMenu
// args : string id_menu, string nom_style
// return : none
// Masque les éléments d'ID "id_menu"
function InitialiserMenu(id_menu_parent, nom_style, str_cle)
{
	if (id_menu_parent == "") return;
	var div_menu_parent = document.getElementById(id_menu_parent);
	if (!div_menu_parent) return;

	var liste_div = div_menu_parent.getElementsByTagName("DIV");	

	if (nom_style == "") return;

	var cle = "menu" + str_cle + "_";

	//alert(div_menu_parent.id + "--->" + liste_div[i].parent.id);

	for (i = 0; i < liste_div.length; i++)
	{		
		if ( liste_div[i].id.indexOf(cle) > 0)
			liste_div[i].className = nom_style;		
	}
}

//-->
