<!--
////////////////////////////////////////////////////
function Suivant(Target,taille,apres) 
{
	StrLen = Target.value.length
	if (StrLen > taille-1)
	{
		apres.focus();
	}
}

////////////////////////////////////////////////////
var dragapproved=false
var z,x,y
function move(){
	if (event.button==1&&dragapproved){
	z.style.pixelLeft=temp1+event.clientX-x
	z.style.pixelTop=temp2+event.clientY-y
	return false
	}
}

////////////////////////////////////////////////////
function drags(){
if (!document.all)
return
if (event.srcElement.className=="drag"){
dragapproved=true
z=event.srcElement
temp1=z.style.pixelLeft
temp2=z.style.pixelTop
x=event.clientX
y=event.clientY
document.onmousemove=move
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")

////////////////////////////////////////////////////
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_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_findObj(n, d) { //v3.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); return x;
}

////////////////////////////////////////////////////
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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

////////////////////////////////////////////////////
function CheckLen(Target,taille) 
{
	StrLen = Target.value.length
	if (StrLen > taille)
	{
		Target.value=Target.value.substr(0,taille);
		alert("Vous avez atteint le nombre de caractères maximum autorisé. ("+taille+" caractères)");
	}
	StrLen = Target.value.length
	CharsLeft = taille-StrLen;
	
	if (document.forms[0].nbCar1)
	{
		document.forms[0].aff_char.style.display = 'block';
		document.forms[0].nbCar1.value = CharsLeft;
	}
	
 }
 
////////////////////////////////////////////////////
function CheckLen2(Target,taille,chx) 
{
	StrLen = Target.value.length
	if (StrLen > taille)
	{
		Target.value=Target.value.substr(0,taille);
		alert("Vous avez atteint le nombre de caractères maximum autorisé. ("+taille+" caractères)");
	}
	StrLen = Target.value.length
	CharsLeft = taille-StrLen;
	
	if (document.forms[0].nbCar2)
	{
		document.forms[0].aff_char2.style.display = 'block';
		document.forms[0].nbCar2.value = CharsLeft;
	}
	
 }
////////////////////////////////////////////////////

///////// Fonction controle des E-mails/////////////
function controlemail(valeur)
{
valeur.value = valeur.value.toLowerCase();
var ok=true
var mail=valeur.value
var arobase=mail.indexOf("@")
if (valeur.value!="")
	{
	if (arobase<1 || (arobase)==((mail.length)-1))
	{
	ok=false
	}
	else
		{
		var serveur=mail.substring(arobase+1,mail.length-1)
		var point=serveur.indexOf(".")
			if (point<1 || point==serveur.length-1)
			{
			ok=false
			}
		}
		
	if (!ok)
		{
		window.alert("L'adresse e-mail n'est pas correcte.")
		valeur.select()
		valeur.focus()
		return false
		}
		return true
	}
	return true
}

///Fonction controle les chiffres dans un champs ///////////
function validchiffres(valeur,caract,champs)
{
  var checkOK = "0123456789" + caract + "";
  var checkStr = valeur.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert(champs + ' ne peux contenir que des chiffres.');	
	valeur.select();
	valeur.focus();
	//valeur.value=""
	return false
  }
return true
}

///Fonction controle qu'il n'y ait que des Lettres dans un champ ///////////
function validCaract(valeur)
{
  var checkOK = "azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN -'âÂêéèÉÈÊïÏäÄöÖ";
  var checkStr = valeur.value;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Saisissez uniquement des Lettres dans ce champs.");
	valeur.focus();
	valeur.value=""
	return false
  }
return true
}

////// Mise en majuscule/////////////////////
function UpCase(myObj) 
{
 myObj.value = myObj.value.toUpperCase();
}
////// Mise en minuscule/////////////////////
function LowCase(myObj) 
{
 myObj.value = myObj.value.toLowerCase();
}
//////////Mise en majuscule de la premiere lettre////////////////////
function FirstUpCase(myObj) 
{
 myObj.value = myObj.value.substring(0,1).toUpperCase() + myObj.value.substring(1,myObj.value.length);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////// Test du format d'un doc de la rubrique presse /////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function FormatFichierPresse(valeur) 
{
       if (valeur.value != "")
       { 
 	var image=valeur.value;
   	var extension=image.substring(image.lastIndexOf("."));

	var Newextension = extension.toUpperCase()

 	 if ((Newextension != ".PDF")&&(Newextension != ".DOC")&&(Newextension != ".XLS"))
		{
		alert("Le document que vous souhaitez joindre n'a pas le bon format. \nVous devez choisir un document au format DOC,  XLS, PDF, JPG ou GIF");
		valeur.focus();
		return (false);
		}
       }
return (true);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////// Test du format d'une illustration Jointe /////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function FormatImage(illustration) 
{
       if (illustration.value != "")
       { 
 	var image=illustration.value;
   	var extension=image.substring(image.lastIndexOf("."));

	var Newextension = extension.toUpperCase()

 	 if ((Newextension != ".GIF")&&(Newextension != ".JPG"))
		{
		alert("L\'image que vous souhaitez joindre n\'a pas le bon format.\nVous devez joindre une image GIF ou JPG ");
		illustration.focus();
		return (false);
		}
       }
return(true);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////// Test du format d'un fichier Joint /////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function FormatFichier(valeur) 
{
       if (valeur.value != "")
       { 
 	var image=valeur.value;
   	var extension=image.substring(image.lastIndexOf("."));

	var Newextension = extension.toUpperCase()

 	 if ((Newextension != ".PDF")&&(Newextension != ".DOC")&&(Newextension != ".XLS"))
		{
		alert("Le document que vous souhaitez joindre n\'a pas le bon format.\nVous devez joindre une fichier XLS, PDF, ou DOC.");
		valeur.focus();
		valeur.select();
		return (false);
		}
       }
return (true);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////// Test qu'il n'y ait pas de caractères spéciaux dans le nom du fichier /////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function NomFichier(valeur)
{
var checkOK = "azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN-_1234567890";

// recupère le nom complet du fichier
var docjoint=valeur.value.substring(valeur.value.lastIndexOf("\\")+1);

// nom du fichier sans l'extension
var docjointssext=docjoint.substring(0,docjoint.lastIndexOf("."))
  
  var allValid = true;
  var allNum = "";
  for (i = 0;  i < docjointssext.length;  i++)
  {
    ch = docjointssext.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Le nom du fichier que vous souhaitez joindre ne doit pas comporter de caractères spéciaux (&é' (èçà@)]...), ni d'espaces.\n\n"+docjoint+"");
	valeur.focus();
	valeur.select();
	valeur.value=""
	return false
  }
return true
}

////////////////////////////////////////////////////
//// Test de la date ////////
/////////////////////////////////////////////////////
function testDate(champ1,champ2,champ3){
  var jour;
  var mois;
  var annee;
  var theDate;
  
	if (jour + mois + annee != '')
	{  
		
		if (champ1.value=='' && champ2.value=='' && champ3.value=='')
		{
			alert("Veuillez saisir une date");
			return false;
		}
		
		if (champ1.value=='00' && champ2.value=='00' && champ3.value=='0000')
		{
			alert("La date n\'est pas correcte");
			return false;
		}
		
		var Ma_Date = new Date();
		if (champ3.value > Ma_Date.getYear() + 50)
		{
			alert("La date n\'est pas correcte");
			return false;
		}
		

		jour=champ1.value;
		if (jour.length!=2)
		{
			jour="0"+jour+"";
		}
	
		mois=champ2.value;
		if (mois.length!=2)
		{
	   	mois="0"+mois+"";
		}
	
		annee=champ3.value;
	
		theDate=new String(""+jour+"/"+mois+"/"+annee+"");
	
		if ((theDate.length!=10) || (jour.length!=2) || (mois.length!=2) || (annee.length!=4) || (jour>31) || (mois>12)){
			//alert(theDate.length + ', ' + jour.length + ', ' + mois.length + ', ' + annee.length + ', ' + jour + ', ' + mois);
			alert("Le format de la date n\'est pas correct. Veuillez utiliser le 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 correcte, ce mois a 30 jour maximum")
	   			return false;
	 		}
		}
		if ((jour>"29") && (mois=="02"))
		{
			alert("La date n\'est pas correcte, le mois de février compte moins 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 correcte, "+annee+" n\'est pas une année bissextile.");
				return false;
			}
		}
	  	return true;
	}
	return false;
}
///////////////////////////////////////////////////////////

////////////////////////////////////////////////////
//// Test de la date  avec retour champs    ////////
/////////////////////////////////////////////////////
function testDate2(champ1,champ2,champ3){
  var jour;
  var mois;
  var annee;
  var theDate;
  
	if (champ1.value=='')
		{
			testblur = champ1.name;
			champ1.focus();
			return false;
		}
	
	if (champ2.value=='')
		{
			testblur = champ2.name;
			champ2.focus();
			return false;
		}
				
	
	if (jour + mois + annee != '')
	{  
		
		if (champ1.value=='' && champ2.value=='' && champ3.value=='')
		{
			alert("Veuillez saisir une date");
			testblur = champ1.name;
			champ1.focus();
			return false;
		}
		
		if (champ1.value=='00' && champ2.value=='00' && champ3.value=='0000')
		{
			alert("La date n\'est pas correcte");
			champ1.value = "";
			champ2.value = "";
			champ3.value = "";
			testblur = champ1.name;
			champ1.focus();
			return false;
		}
		
		var Ma_Date = new Date();
		if (champ3.value > Ma_Date.getYear() + 50)
		{
			alert("La date n\'est pas correcte");
			champ3.value = "";
			testblur = champ3.name;
			champ3.focus();
			return false;
		}
		

		jour=champ1.value;
		if (jour.length!=2)
		{
			jour="0"+jour+"";
		}
	
		mois=champ2.value;
		if (mois.length!=2)
		{
	   	mois="0"+mois+"";
		}
	
		annee=champ3.value;
	
		theDate=new String(""+jour+"/"+mois+"/"+annee+"");
	
		if ((theDate.length!=10) || (jour.length!=2) || (mois.length!=2) || (annee.length!=4) || (jour>31) || (mois>12)){
			//alert(theDate.length + ', ' + jour.length + ', ' + mois.length + ', ' + annee.length + ', ' + jour + ', ' + mois);
			alert("Le format de la date n\'est pas correct. Veuillez utiliser le format JJ/MM/AAAA");
			champ1.value = "";
			champ2.value = "";
			champ3.value = "";
			testblur = champ1.name;
			champ1.focus();
			return false;
		}
		if (jour>"30")
		{
			if ((mois=="02") || (mois=="04") || (mois=="06") || (mois=="09") || (mois=="11")){
				alert("La date n\'est pas correcte, ce mois a 30 jour maximum")
	   			champ1.value = "";
				testblur = champ1.name;
				champ1.focus();
				return false;
	 		}
		}
		if ((jour>"29") && (mois=="02"))
		{
			alert("La date n\'est pas correcte, le mois de février compte moins de 29 jours ")
	 		champ1.value = "";
			testblur = champ1.name;
			champ1.focus();
			return false;
		}
		if ((jour=="29") && (mois=="02")){
			if ((((annee%4==0) && (annee%100!=0)) || (annee%400==0))==false){
				alert("La date n\'est pas correcte, "+annee+" n\'est pas une année bissextile.");
				champ1.value = "";
				testblur = champ1.name;
				champ1.focus();
				return false;
			}
		}
	  	testblur = 0;
		return true;
	}
	return false;
}
///////////////////////////////////////////////////////////

function testURL(champs)
{
	if (champs.value != '')
	{
		strURL = String(champs.value)
		
		if (strURL.indexOf('.') != strURL.lastIndexOf('.') && strURL.lastIndexOf('.')-strURL.indexOf('.')>1)
		{
			if (strURL.substr(0, 7) != 'http://')
			{
				champs.value= 'http://' + strURL;
			}
		}else{
			alert('L\'url du site n\'est pas correcte.');
			champs.select();
			champs.focus();
		}
	}
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////// Test l'extension du fichier à uploader/////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
function TestFormatFichier(valeur, extensions) 
{
	var strExt = new String(extensions);	
	var tabExt = strExt.split(',');

	re = /,/g;
	strExt = strExt.replace(re, ', ');

    if (valeur.value != '')
    { 
 		var image=valeur.value;
   		var extension=image.substring(image.lastIndexOf("."));

		var Newextension = extension.toLowerCase();
		var blnOk = false;


		for (monExt in tabExt)
		{
			if (Newextension==tabExt[monExt]) blnOk = true;
		}
		
		if (blnOk==false)
		{
			
			alert("Le document que vous souhaitez joindre n\'a pas le bon format.\nVous devez joindre un fichier " + strExt);
			valeur.focus();
			valeur.select();
			//alert ('false');
			return false;

       	}
	}
	//alert ('true');
	return true;
}


function ouvre_open(page, largeur, hauteur) {
window.open(page, '', 'resizable=no, location=no, width=520, height=500, menubar=no, status=no, scrollbars=yes, menubar=no, left=150, top=100');
}

function afficheVignette(cheminMaxi)
{
document.write('<a href=\"javascript:afficheMaxi(\''+cheminMaxi+'\')\" title=\"cliquez ici pour voir en grand\"><img src=\"'+cheminMaxi+'\" width=\"120\" height\"93\" alt="" style=\"border-color: #FFFFFF;\"></a>');
}

function afficheVignettePHOTO(cheminMaxi)
{
document.write('<div style="float: left; width: 120px; height: 95px; padding: 8px 16px 8px 16px"><a href=\"javascript:afficheMaxi(\''+cheminMaxi+'\')\" title=\"cliquez ici pour voir en grand\"><img src=\"'+cheminMaxi+'\" width=\"120\" height=\"93\" alt="" style=\"border-color: #FFFFFF;\"></a></div>');
}

function afficheMaxi(chemin)
{
i1 = new Image;
i1.src = chemin;
html = '<html><head><title>'+chemin+'</title></head><body><img src=\"'+chemin+'\" name=image onclick=\"javascript:window.close()\"></body></html>';
popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=0');
popupImage.document.open();
popupImage.document.write(html);
popupImage.document.close();
}


// PAGE ACCUEIL - rotation des actualités
function getRotatif(rotatif, aAfficher, max, maxReel, type) {
	document.getElementById("rotatif_" + rotatif + "_load").style.visibility = "visible";
	var div = "rotatif_" + rotatif;
	var xhr = getXhr();
	xhr.onreadystatechange = function() {
		if(xhr.readyState == 4 && xhr.status == 200) {
			document.getElementById(div).innerHTML = xhr.responseText;
		}
	}

	var params = "rotatif=" + rotatif + "&aAfficher=" + aAfficher + "&max=" + max + "&maxReel=" + maxReel + "&type=" + type;

	//xhr.open("GET", "/ajax/fonctions.php?action=getRotatif&" + params + "&d="+ (new Date()).getTime(), true);
	xhr.send(null);
}

function rotatifNext(leRotatif) {
	// Le rotatif
	var rotatif = document.getElementById('rotatif_' + leRotatif + '_content');
	//rotatifActual++;
	eval('var left = rotatif_' + leRotatif + '_left;');
	eval('var max = rotatif_' + leRotatif + '_max;');
	eval('var actual = rotatif_' + leRotatif + '_actual;');
	eval('var width = rotatif_' + leRotatif + '_width;');

	eval('var auto = rotate_' + leRotatif + '_auto;');
	eval('var sens = rotate_' + leRotatif + '_sens;');

	if (max <= 1) return;

	if (auto == false) {
		if (actual == max) {
			rotatifRembobine(leRotatif);
			return;
		}
	} else if (auto == true) {
		if (actual == max) {
			sens = "prev";
			eval('rotate_' + leRotatif + '_sens = sens;');
			rotatifPrev(leRotatif);
			return;
		}
	}

	actual++;
	//alert (actual);
	eval('rotatif_' + leRotatif + '_actual = actual;');

	document.getElementById('rotatif_' + leRotatif + '_actual').innerHTML = actual;

	var leftFinal = left - width;
	eval('rotatif_' + leRotatif + '_left = leftFinal;');

	rotatif.move = function() {
		if (left > leftFinal) {
			if (left - 80 > leftFinal) left = left - 16;
			else left = left - 8;
			if (left < leftFinal) left = leftFinal;
			rotatif.style.left = left + "px";
			setTimeout(function() {
					rotatif.move();
			} , 10);

		}
	}

	rotatif.move();
}

function rotatifPrev(leRotatif) {
	// Le rotatif
	var rotatif = document.getElementById('rotatif_' + leRotatif + '_content');
	//rotatifActual++;
	eval('var left = rotatif_' + leRotatif + '_left;');
	eval('var max = rotatif_' + leRotatif + '_max;');
	eval('var actual = rotatif_' + leRotatif + '_actual;');
	eval('var width = rotatif_' + leRotatif + '_width;');

	eval('var auto = rotate_' + leRotatif + '_auto;');
	eval('var sens = rotate_' + leRotatif + '_sens;');

	if (max <= 1) return;

	if (auto == false) {
		if (actual == 1) {
			rotatifDebobine(leRotatif);
			return;
		}
	} else if (auto == true) {
		if (actual == 1) {
			sens = "next";
			eval('rotate_' + leRotatif + '_sens = sens;');
			rotatifNext(leRotatif);
			return;
		}
	}

	actual--;

	eval('rotatif_' + leRotatif + '_actual = actual;');
	document.getElementById('rotatif_' + leRotatif + '_actual').innerHTML = actual;

	var leftFinal = left + width;
	eval('rotatif_' + leRotatif + '_left = leftFinal;');

	rotatif.move = function() {
		if (left < leftFinal) {
			if (left + 80 < leftFinal) left = left + 16;
			else left = left + 8;
			if (left > leftFinal) left = leftFinal;
			rotatif.style.left = left + "px";
			setTimeout(function() {
					rotatif.move();
			} , 10);

		}
	}

	rotatif.move();
}

function rotate(rotatifId) {
	eval('var auto = rotate_' + rotatifId + '_auto;');
	eval('var sens = rotate_' + rotatifId + '_sens;');
	if (auto == true) {
		if (sens == "next") rotatifNext(rotatifId); else if (sens == "prev") rotatifPrev(rotatifId);
		setTimeout("rotate('" + rotatifId + "')", 5000);
	}
}


function init_onglets(onglet, nb_onglet) {
	var indOnglet;
	for(indOnglet=1; indOnglet <= nb_onglet; indOnglet++) {
		document.getElementById("onglet_"+indOnglet).style.display = "none";
		document.getElementById("onglet_"+indOnglet+"_content").style.display = "none";
	}
	document.getElementById(onglet).style.display = "block";
	document.getElementById(onglet+"_content").style.display = "block";
}

-->

