function valider(formid, champs, types, langue) {

array_champs = champs.split(",");

array_types = types.split(",");

//alert(array_champs[0]);

//dictionnaire

switch (langue) {

case "fr" :

alert_filled = "Les élements en gras sont obligatoires.";

alert_match = "Les mots de passe ne correspondent pas.";

alert_blank =  "Le mot de passe ne peut pas etre blanc.";

break;



case "en" :

alert_filled = "Items in bold are required.";

alert_match = "Passwords don\'t match.";

alert_blank =  "Please enter a non-blank password.";

break;



default : 

break;

}





regform = document.getElementById(formid);

for (i=0; i<array_champs.length; i++) {



champ =  document.getElementById(array_champs[i]);

//alert(array_champs[i]);



switch(array_types[i]) {

	default : cvalue = champ.value; break;

	case "liste" : cvalue = champ[champ.selectedIndex].value;  break;

	case "fichier" :

	case "vignette" :

	if (champ.value == "") {

	champ_ok =  document.getElementById(array_champs[i] + "_ok");

	if (champ_ok) cvalue= champ_ok.value;

	else cvalue = "";

	}

	else cvalue = champ.value;

	break;

	case "checkbox":

	if (champ.checked == true) cvalue = champ.value;

	else cvalue = "";

	break;



}

//verifier le remplissage des champs

		if (cvalue == "" && array_types[i] != "nouveaumotdepasse")

		{ 

		alert(alert_filled);

		champ.focus();

		return false;

		}

		

		if (array_types[i] == "nouveaumotdepasse") {

champ_bis = document.getElementById(array_champs[i] + "_bis"); 

if (champ_bis.value != champ.value) {

alert(alert_match);

champ.focus();

return false;	

}

if (champ_bis.value == "" || champ.value == "") {

alert(alert_blank);

champ.focus();

return false;	

}

			

		//traitement mot de passe	

}



		

}//end for



chargement();

return true;



}



function chargement() {

	bouton = document.getElementById('Submit');

	bouton.disabled = true;

}



function chargerCSS(fichier){

   var headID = document.getElementsByTagName("head")[0];  

   var cssNode = document.createElement('link');  

   //if(headID.getElementsBySelector('[href="'+fichier+'"]').size()==0){  

      cssNode.type = 'text/css';  

      cssNode.rel = 'stylesheet';  

      cssNode.href = fichier;  

      cssNode.media = 'screen';

	  headID.appendChild(cssNode);

  // }

} 



function rediriger($url) {

window.location.replace($url);

}



function limitText(el,  limitNum) {

if (el.value.length > limitNum) {

		el.value = el.value.substring(0, limitNum);

	} else {

		//limitCount.value = limitNum - limitField.value.length;

	}

	

}



function confirmer($texte) {

return confirm($texte);	

}