// JavaScript Document
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function verifmail2(nom)
{
var expression = /\w+@\w+.\w+./;

if ((!expression.exec(eval(nom).value)) && (!eval(nom).value == ""))
{
window.alert('Il y a une erreur dans votre adresse mail');
eval(nom).focus();
eval(nom).value="";
}
}

function verifmail(nom, direction)
{
var expression = /\w+@\w+.\w+./;

if ((!expression.exec(eval(nom).value)) && (!eval(nom).value == ""))
{
window.alert('Il y a une erreur dans votre adresse mail');
eval(nom).focus();
eval(nom).value="";
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function verifmail1(champ, direction)
{
var expression = /\w+@\w+.\w+./;

if (!expression.exec(eval(champ).value))
{
window.alert('Il y a une erreur dans votre adresse mail');
eval(champ).focus();
eval(champ).value="";
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function veriftel(nom, direction)
{
var expression = /\d\d.\d\d\.\d\d.\d\d.\d\d/;

if ((!expression.exec(eval(nom).value)) && (!eval(nom).value == ""))
{
window.alert('Erreur : Le téléphone est à saisir sous la forme nn.nn.nn.nn.nn');
eval(nom).focus();
eval(nom).value="";
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function veriftel1(nom)
{
var expression = /\d\d.\d\d\.\d\d.\d\d.\d\d/;

if ((!expression.exec(eval(nom).value)) && (!eval(nom).value == ""))
{
window.alert('Erreur : Le téléphone est à saisir sous la forme nn.nn.nn.nn.nn');
eval(nom).focus();
eval(nom).value="";
}
}

function verifNb3(valeur, nom, direction)
{
var expression = /\d+/;
var expression1 = /\D.+/

if (!valeur == "")
{
if (!expression.exec(valeur) || expression1.exec(valeur))
{
window.alert('Erreur vous devez saisir un nombre dans ce champ');
eval(nom).focus();
eval(nom).value="";
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}
}

function verifNb1(origine, valeur, nom, direction)
{
var expression = /\d+/;

if ((!expression.exec(valeur)) && (eval(origine).checked))
{
rep = window.confirm('Annuler pour saisir un nombre dans ce champ ou, OK pour décocher la case correspondante ?');

if (!rep)
{
eval(nom).focus();
eval(nom).value="";
}
else
{
eval(origine).click();
eval(direction).focus();
}
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function verifNb2(origine, valeur, nom, direction)
{
var expression = /\d+/;
var expression1 = /\D.+/;

if (((!expression.exec(valeur) || expression1.exec(valeur))) && (eval(origine).checked))
{
rep = window.confirm('Annuler pour saisir un nombre dans ce champ ou, OK pour décocher la case correspondante ?');

if (!rep)
{
eval(nom).focus();
eval(nom).value="";
}
else
{
eval(origine).click();
eval(direction).focus();
}
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function verifck(nom, direction)
{
if (eval(nom).checked)
{
if (!eval(direction).value)
{
eval(direction).focus();
}
}
else
{
eval(direction).value="";
}
}

function verifdate(valeur, nom, direction)
{
var expression = /\d\d-\d\d\-\d\d\d\d/;

if (!expression.exec(valeur))
{
window.alert('Erreur : La date est à saisir sous la forme jj-mm-aaaa');
eval(nom).focus();
eval(nom).value="";
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function verifdate1(valeur, nom)
{
var expression = /\d\d-\d\d\-\d\d\d\d/;

if (!expression.exec(valeur))
{
window.alert('Erreur : La date est à saisir sous la forme jj-mm-aaaa');
eval(nom).focus();
eval(nom).value="";
}
}

function verifdate2(valeur, nom, nom1)
{
var expression = /\d\d-\d\d\-\d\d\d\d/;

if (!expression.exec(valeur))
{
window.alert('Erreur : La date est à saisir sous la forme jj-mm-aaaa');
eval(nom).focus();
eval(nom).value="";
eval(nom1).value="";
}
else
{
var jour = valeur.substring(0,2);
var mois = Number(valeur.substring(3,5))-1;
var annee = valeur.substring(6,10);
var temps = new Date(annee,mois,jour);
 var absolu_maintenant = temps.getTime();
 var absolu_ensuite = absolu_maintenant + (7*24*60*60*1000);
 temps.setTime(absolu_ensuite);
 var annee = temps.getYear();
 var mois = temps.getMonth() + 1;
 if (mois < 10) {mois = "0"+mois;}
 var jour = temps.getDate();
 if (jour < 10) {jour = "0"+jour;}
 
valeur1 = jour+"-"+mois+"-"+annee;
eval(nom1).value = valeur1;
}
}

function verifTexte2(valeur, nom)
{
var expression = /\S.+/;

if (!expression.exec(valeur))
{
window.alert('Erreur vous n avez rien saisi dans ce champ');
eval(nom).focus();
eval(nom).value="";
}
}

function verifTexte(valeur, nom, direction)
{
var expression = /\S.+/;

if (!expression.exec(valeur))
{
window.alert('Erreur vous n avez rien saisi dans ce champ');
eval(nom).focus();
eval(nom).value="";
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function verifTexte1(valeur, encours, direction)
{
var expression = /\S.+/;
if (!expression.exec(valeur))
{
window.alert('Erreur vous n avez rien saisi dans ce champ');
eval(encours).focus();
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function verifNb5(valeur, nom)
{
var expression = /\d+/;
var expression1 = /\D.+/
if (!eval(nom).value == "")
{
if (!expression.exec(valeur) || expression1.exec(valeur))
{
window.alert('Erreur vous devez saisir un nombre dans ce champ');
eval(nom).focus();
eval(nom).value="";
}
}
}

function verifNb4(valeur, nom)
{
var expression = /\d+/;
var expression1 = /\D.+/

if (!expression.exec(valeur) || expression1.exec(valeur))
{
window.alert('Erreur vous devez saisir un nombre dans ce champ');
eval(nom).focus();
eval(nom).value="";
}
}

function verifNb(valeur, nom, direction)
{
var expression = /\d+/;
var expression1 = /\D.+/

if (!expression.exec(valeur) || expression1.exec(valeur))
{
window.alert('Erreur vous devez saisir un nombre dans ce champ');
eval(nom).focus();
eval(nom).value="";
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function verifliste(valeur, nom, direction)
{
var expression = /\d+/;
var expression1 = /\D.+/

if (valeur == "")
{
window.alert('Erreur vous devez sélectionner une valeur');
eval(nom).focus();
}
else
{
if (eval(direction).value == "")
{
eval(direction).focus();
}
}
}

function tableau_semaines(t1wi,t1bo,t1cels,t1celp,td1wi,t2wi,t2bo,t2cels,t2celp,td2wi,inpty,inpva,td3al,ftsi,ftfa)
{
this.td1bgcz = td1bgca;
this.td4bgcz = td4bgca;
this.semain = semaine;
this.inpnaz = inpnaa;
document.write("<table width="+'"'+t1wi+'"'+" border="+'"'+t1bo+'"'+" cellspacing="+'"'+t1cels+'"'+" cellpadding="+'"'+t1celp+'"'+">");
for (i=0; i<semain.length; i++)
{
document.write("    <tr>");
document.write("         <td width="+'"'+td1wi+'"'+" bgcolor="+'"'+td1bgca[i]+'"'+"><table width="+'"'+t2wi+'"'+" border="+'"'+t2bo+'"'+" cellspacing="+'"'+t2cels+'"'+" cellpadding="+'"'+t2celp+'"'+">");
document.write("               <tr>"); 
document.write("                    <td width="+'"'+td2wi+'"'+"><input type="+'"'+inpty+'"'+" name="+'"'+inpnaa[i]+'"'+" value="+'"'+inpva+'"'+"></td>");
document.write("                    <td><div align="+'"'+td3al+'"'+"><font size="+'"'+ftsi+'"'+" face="+'"'+ftfa+'"'+">"+semain[i]+"</font></div></td>");
document.write("               </tr>");
document.write("          </table></td>");
document.write("       <td width="+'"'+"15"+'"'+" bgcolor="+'"'+td4bgca[i]+'"'+">&nbsp;</td>");
document.write("    </tr>");
}
document.write("</table>");
}

function MM_findObj(n, d) { //v4.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' doit contenir une adresse E-Mail.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' doit contenir un chiffre compris entre '+min+' et '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+'\n'; }
  } if (errors) alert('Veuillez remplir les champs manquants:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function quelReso() {
	return sW = screen.width;
}

var TabAlpha=new Array();
ta=9;
TabAlpha.length=ta+1;		// 5 images alpha A MODIFIER SI PLUS D'IMAGES
for (var alphaI=0;alphaI<TabAlpha.length;alphaI++) {
	TabAlpha[alphaI]=-1;
}

function ModifAlpha(no,alpha){
	//si on parvient a selectionner limage
	if (document.images["img"+no]) {
		//si on peut appliquer un filtre a limage
		if (document.images["img"+no].filters) {
			//dans le tablo TabAlpha
			//lindice no (argument de la fonction)fait reference a image1...
			//devient alpha (argument de la fonction)
			TabAlpha[no]=alpha;
			//si tjstimer vaut 0
			//on attend 30(x)millisecondes
			//et on execute la fonction tjstimerAlpha()
			if (tjstimer==0) {setTimeout("tjstimerAlpha()",30)}
		}
	}
}

var tjstimer=0;

function tjstimerAlpha() {
	var opacity=0;
	for (var alphaI=0;alphaI<TabAlpha.length;alphaI++) {
		if (TabAlpha[alphaI]!=-1) {
			opacity =TabAlpha[alphaI] - document.images["img"+alphaI].filters.alpha.opacity;
			if (opacity!=0) {
				tjstimer=1;
				document.images["img"+alphaI].filters.alpha.opacity+=Math.abs(opacity)/opacity * 10;		
			} else {
				TabAlpha[alphaI]=-1
			}
		}
	}
	if (tjstimer==1) {setTimeout("tjstimerAlpha()",30);} else {tjstimer=0}
}

// PARAMETRAGE DU SCRIPT
var tjs_delai=20;
var tjs_max=20;
var tjs_mode=1; // 0 - calque toujours en haut de page / 1 - calque en bas
// LE RESTE NE CHANGE PAS
var tjs_hauteur=0;

function PrintCalque(left,top,width,height,contenu) {
	tjs_hauteur=height;
	if ((document.all)||(document.getElementById)) {
		var Z="<DIV id='tomber' style='position:absolute;left:"+left+";top:"+top+";width:"+width+";height:"+height+"'>"+contenu+"</DIV>";
	} else {
		var Z="<LAYER name='tomber' left="+left+" top="+top+" width="+width+" height="+height+">"+contenu+"</LAYER>";
	}
	document.write(Z);
	setTimeout("Start()",tjs_delai);
}

function Start() {
	MoveLayer("tomber",GetTop("tomber"));
	setTimeout("Start()",tjs_delai);
}

function Debug() {
	var obj=document.body
	var Z="";
	for (var i in obj) {
		Z+=i+"="+obj[i]+"\n";
	}
	alert(Z);
}

function MoveLayer(nom,top) {
	if (document.getElementById) { //IE5 et NS6
		document.getElementById(nom).style.top=top;
	}
	if ((document.all)&&(!document.getElementById)) { //IE4 seul
		document.all[nom].style.top=top;
	}
	if (document.layers) { //NS4.X seul
		document.layers[nom].top=top;
	}
}

function GetTop(nom) {
	// Partie 1 : Récupération de la position du calque et de la page
	if (document.getElementById) { //IE5 
		var pos=parseInt(document.getElementById(nom).style.top);
		var wintop=parseInt(document.body.scrollTop);
		var avail=document.body.clientHeight;
	}
	if ((document.getElementById)&&(!document.all)) { //NS6
		var pos=parseInt(document.getElementById(nom).style.top);
		var wintop=parseInt(window.pageYOffset);
		var avail=window.innerHeight;
	}
	if ((document.all)&&(!document.getElementById)) { //IE4 seul
		var pos=parseInt(document.all[nom].style.top);
		var wintop=parseInt(document.body.scrollTop);
		var avail=document.body.clientHeight;
	}
	if (document.layers) { //NS4.X seul
		var pos=parseInt(document.layers[nom].top);
		var wintop=parseInt(window.pageYOffset);
		var avail=window.innerHeight;
	}

	// Partie 2 : Traitement de la position
	if (tjs_mode==0) { // toujours en haut
		var delta=Math.ceil((pos-wintop)/3);
		if (delta>tjs_max) {delta=tjs_max;}
		if (delta<-1*tjs_max) {delta=-1*tjs_max;}
		var top=pos-delta;
	}
	if (tjs_mode==1) {// toujours en bas
		var delta=Math.ceil((pos-(wintop+avail-tjs_hauteur)));
		if (delta>tjs_max) {delta=tjs_max;}
		if (delta<-1*tjs_max) {delta=-1*tjs_max;}
		var top=pos-delta;
	}
	return top;
}

function menu(ta)
{
document.write("<table width="+'"'+"100%"+'"'+" border="+'"'+"0"+'"'+" cellspacing="+'"'+"0"+'"'+" cellpadding="+'"'+"0"+'"'+">");
for (i=1;i<ta;i++)
{
if (i==1)
{
document.write("              <tr>"); 
document.write("                <td height="+'"'+"40"+'"'+" valign="+'"'+"top"+'"'+"> <A href="+'"'+"../../index.php"+'"'+" onmouseover="+'"'+"ModifAlpha("+i+",60)"+'"'+" onmouseout="+'"'+"ModifAlpha("+i+",100)"+'"'+">"); 
document.write("                  <img src="+'"'+"imagesgif/Img"+i+".gif"+'"'+" width="+'"'+"100"+'"'+" height="+'"'+"40"+'"'+" border="+'"'+"0"+'"'+" name="+"'"+"img"+i+"'"+" style="+'"'+"filter:alpha(opacity=100)"+'"'+"></a></td>");
document.write("              </tr>");
}
else
{
document.write("              <tr>"); 
document.write("                <td height="+'"'+"40"+'"'+" valign="+'"'+"top"+'"'+"> <A href="+'"'+"../page"+i+".php"+'"'+" onmouseover="+'"'+"ModifAlpha("+i+",60)"+'"'+" onmouseout="+'"'+"ModifAlpha("+i+",100)"+'"'+">"); 
document.write("                  <img src="+'"'+"imagesgif/Img"+i+".gif"+'"'+" width="+'"'+"100"+'"'+" height="+'"'+"40"+'"'+" border="+'"'+"0"+'"'+" name="+"'"+"img"+i+"'"+" style="+'"'+"filter:alpha(opacity=100)"+'"'+"></a></td>");
document.write("              </tr>");
}
}
document.write("            </table>");
			}