// ------ Scrolling Layer ---------------------------------------------------------------------------------------------------
// ------ Initialisation des calques ------
//scrollInit(lName, posX, posY, tX, tY, indZ, lStyle, stepX, delay, innerText)
// lName		: new layer namer
// posX		: absolute left position of the new layer
// posY		: absolute top position of the new layer
// tX		: new layer width
// tY		: new layer height
// indZ 		: z-idex of the new layer
// lStyle		: CSS style of the new layer
// stepX		: shift definition for the new layer

// delay		: time between two shifts
// innerText	: displayed html in the new layer

function scrollInit(lName, posX, posY, tX, tY, indZ, lStyle, stepX, delay, innerText){
	// ------ Création des calques ------
	document.write('<DIV ID="'+lName+'A" STYLE="position:absolute; left:'+posX+'px; top:'+posY+'px; width:'+tX+'px; height:'+tY+'px; z-index:'+indZ+'; visibility: visible;" CLASS="'+lStyle+'">');
	document.write(innerText);
	document.write('</DIV>');	
	document.write('<DIV ID="'+lName+'B" STYLE="position:absolute; left:'+(posX+tX)+'px; top:'+posY+'px; width:'+tX+'px; height:'+tY+'px; z-index:'+indZ+'; visibility: visible;" CLASS="'+lStyle+'">');
	document.write(innerText);
	document.write('</DIV>');
	// ------ Appel de la fonction de scrolling ------
	scrolLay(lName+"A", stepX, delay);
	scrolLay(lName+"B", stepX, delay);
}

// ------ Scrolling des calques ------
//scrollInit(lName, posX, posY, tX, tY, indZ, lStyle, stepX, delay, innerText)
// lName		: new layer namer
// stepX		: shift definition for the new layer
// delay		: time between two shifts
function scrolLay(Lname, stepX, delay){
	ShortL=document.all[Lname].style;
	maxX=ShortL.width;	
	maxX=Number(maxX.slice(0,maxX.length-2));
	minX=-1*maxX;
	if(ShortL.pixelLeft-stepX>minX){
		ShortL.pixelLeft-=stepX;	
	}
	else{
		ShortL.pixelLeft=maxX;
	}
	setTimeout("scrolLay('"+Lname+"',"+stepX+","+delay+")",delay);
}

//----- Outils pour Formulaire --------- ©Supernick 2001---------------------------------//
//----- Vérifie si les champs du formulaire on bien été remplis -----//
// syntaxe : veriForm(nomForm, messBase, typChamp0, noChamp0, messChamp0, typChamp1, noChamp1, messChamp1....... typChampX, noChampX, messChampX)

// nomForm : nom du formulaire à vérifier
// mesBase : base du message d'alerte 
// typ champ : "s" = champ simple
//			"i|" = interval dans lequel une valeur au moins doit être cochée
//			"i&" = interval dans lequel toutes les valeurs doivent être cochées pour le même message d'erreur
//			"c" = conditionnel : si premier champ rempli alors verifie si deuxieme champ rempli
// noChamp :	si "s" alors simple n° du champ
//			si "i|" alors n°debut-n°fin interval ex. : 20-30
//			si "i&" alors n°debut-n°fin interval ex. : 11-17
//			si "c" : alors n°premmier champ, si validé verifie n° deuxieme champ ex. : 20-30
//// messChamp : message d'alerte pour le champ simple ou l'interval

function veriForm(){
	var noError=true;
	var nomForm=veriForm.arguments[0];
	var mesBase=veriForm.arguments[1];
	form=document.forms[nomForm];		
	for(i=2;i<veriForm.arguments.length-2;i=i+3){
		var typChamp = veriForm.arguments[i];
		var messChamp = veriForm.arguments[i+2];		
		var selected=true;		
		if(typChamp=="s"){
			var noChamp=parseInt(veriForm.arguments[i+1]);			
			if(form.elements[noChamp].value==""){selected=false;}
		} else {
			if(typChamp=="d"){
				var noChamp=parseInt(veriForm.arguments[i+1]);
				var checkStr=form.elements[noChamp].value;
				var checkOK="0123456789-";
				var allValid=true;
				for(k=0;k<checkStr.length;k++){
					ch=checkStr.charAt(k);
					for(j=0;j<checkOK.length;j++){if(ch==checkOK.charAt(j)){break;}}
					if(j==checkOK.length){
						allValid=false;
						break;
					}
				}
				if(!allValid){selected=false;}
			} else {
				noChamp=veriForm.arguments[i+1];
				cutpos=noChamp.lastIndexOf("-");
				indexDeb=parseInt(noChamp.slice(0,cutpos));
				indexFin=parseInt(noChamp.slice(cutpos+1,noChamp.length));
			}
		}
		if(typChamp=="i|"){
			var good=false;
			for(j=indexDeb;j<=indexFin;j++){
				if (form.elements[j].value!=""){good=true;}
				selected=good;
			}
		}		
		if (typChamp=="i&"){
			for(j=indexDeb;j<=indexFin;j++){
				if(form.elements[j].value==""){selected=false;}
			}
		}										
		if(typChamp=="c"){
			if(form.elements[indexDeb].value!=""){
				if(form.elements[indexFin].value==""){selected=false;}
			}
		}
		if(!selected){
			mesBase+=messChamp+"\n";
			noError=false;
		}
	}
	if(!noError){alert(mesBase);}	
	return(noError);
}