<!--
////////////////////////////////////////////////////
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 win(page) {
var ow;
ow=window.open(page,"qsqsqs","height=536,width=661,resizable=no,scrollbars=no,left=100,top=100");
}
////////////////////////////////////////////////////
function MM_openBrWindow(theURL,winName,features) {
  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;

}
//-->