/*
 *	enleve les espaces
*/
function Trim(inNum){
	while (inNum.charAt(0) == ' ') {inNum = inNum.substr(1)};
	while (inNum.charAt(inNum.length-1) == ' '){inNum = inNum.substr(0, inNum.length-1)};
	return inNum;
}




/**
*	VERIFICATEUR EN COURS DE FRAPPE
*	POUR LES CHAMPS NUMERIQUES
*	OnKeyPressed="VerifyNumericValue();"
*/
function VerifyNumericValue(IntegerNumber){
	// Pour les nombre entier
	if(IntegerNumber == 'Integer'){
		if (event.keyCode < 48 || event.keyCode > 57) {
			event.returnValue = false; 
			alert('La valeur de ce champ doit être un entier');
		}
	}
	// Pour les reels (Decimal)
	else if(IntegerNumber == 'Decimal'){
		if (event.keyCode < 44 || event.keyCode > 57) {
			event.returnValue = false; 
			alert('La valeur de ce champ doit être en décimale');
		}
	}
	else{
		if (event.keyCode < 45 || event.keyCode > 57) {
			event.returnValue = false; 
			alert('La valeur de ce champ doit être numerique');
		}
	}
}
/*
	Cette fonction verifie la valeur en decimale saisie
	Syntaxe: OnBlur="CheckDecimal(this);"
*/
function CheckDecimal(Obj){
	var ResultValue = Trim(Obj.value);
	// Remplace toutes les virgules (,) par des points (.)
	re = /,/g
	ResultValue = ResultValue.replace(re, ".");
	// Enleve la valeur 0 devant le(s) chiffre(s)
	while (ResultValue.charAt(0) == '0') {ResultValue = ResultValue.substr(1)};
	if(ResultValue == '') ResultValue = '0';
	// Verifie la valeur saisie
	var DecValue = ResultValue.split(".");
	if(DecValue.length == 0) ResultValue = '0.00';
	else if(DecValue.length > 2){
		alert("Cette valeur est invalide");
		Obj.focus();
	}
	else if(DecValue.length == 2){
		if(DecValue[0] == '') ResultValue = '0.' + DecValue[1];
		if(DecValue[1] == '') ResultValue = DecValue[0] + '.00';
	}
	else ResultValue += '.00';
	Obj.value = ResultValue;
}


/* **************************************
		POUR LES MENUS
* ***************************************/
function Class(Obj, InOut){
	if(InOut){
		Obj.className="SubMenuHover";
		Obj.style.cursor='hand';
	}
	else{
		Obj.className="MenuContent";
		Obj.style.cursor='';
	}
	return true;
}

/* **************************************
		POUR LES LISTES
* ***************************************/
//initialisation
var LineSelected = null;
var IdRecordSelected = null;

//config display
var LineSelectedColor = '#6365DC';
var LineUnselectedColor = '#E0F1FF';
var FontSelectedColor = '#FFFFFF';
var FontUnselectedColor = '#000000';

var BgListPairColor = '#D7F2FF';
var BgListImpairColor = '#E8F8FF';

function row_OnClick(TableId){
  
	var LineClicked = window.event.srcElement ;
		//alert(LineClicked.tagName);
		
	if(LineClicked.tagName == "INPUT" || LineClicked.tagName == "TEXTAREA"){
		return false;
	}
	if(LineClicked.tagName == "TABLE"){
		return false;
	}
	
	
	while(LineClicked.tagName != "TR" && LineClicked.tagName != "BODY") LineClicked = LineClicked.parentElement;
	if(LineClicked.tagName == "BODY"){ exit;}
	
	if(LineSelected == LineClicked) {
		//désélection de la ligne sélectionnée
		//LineClicked.style.backgroundColor = LineUnselectedColor;
		LineClicked.style.backgroundColor = ((LineClicked.rowIndex % 2) != 0 ? BgListPairColor : BgListImpairColor);
		LineClicked.style.color = FontUnselectedColor;
		LineSelected = null;
		IdRecordSelected = null;
	}
	else{
		if(LineSelected){
			//désélection de la ligne précédament sélectionnée
			//LineSelected.style.backgroundColor = LineUnselectedColor;
			LineSelected.style.backgroundColor = ((LineSelected.rowIndex % 2) != 0 ? BgListPairColor : BgListImpairColor);
			LineSelected.style.color = FontUnselectedColor;
			LineSelected = null;
			IdRecordSelected = null;
		}
		//sélection de la ligne
		LineClicked.style.backgroundColor =  LineSelectedColor;
		LineClicked.style.color = FontSelectedColor;
		LineSelected = LineClicked;
		IdRecordSelected = TableId.rows(LineSelected.rowIndex).cells(0).children(0).value;
		//IdRecordSelected =1;
	}
	//alert('IdRecordSelected ' + IdRecordSelected);
}

function row_OnClick_none(TableId){
	return true;
}




function row_OnKeyDown(){
	 var cell = window.event.srcElement;	
	 // <TAB> a ete presse 
	if(window.event.keyCode == 9){
		// rechercher la cellue concernee
		while(cell.tagName != "TD" && cell.tagName != "BODY") cell = cell.parentElement;
		// Si c'est la derniere cellule du tableau, ajouter une ligne
		if(cell == myTableData.rows(myTableData.rows.length-1).cells(myTableData.rows(myTableData.rows.length-1).cells.length-1)){
			//au préalable désélectionné la ligne sélectionnée
			if(lineSelected){
				lineSelected.style.backgroundColor=unselectedColor;
				lineSelected = null ;
			}
		}
	}
}
	
function GetAction(Bouton, Form, Path){
	var submitOk = false;
	var Doc = eval('document.' + Form);
	if(IdRecordSelected != null){
		if(Bouton == '0'){ // Autres cas
			Doc.action = Path;
			submitOk = true;
		}
		// Cas d'une validation d'un formulaire sans precision du nom de IdRecordSelected
		else if(Bouton == '1'){ 
			Doc.action = Path + '&IdRecordSelected=' + IdRecordSelected;
			submitOk = true;
		}
		// Cas d'une suppression
		else if(Bouton == '2'){ 
			if(confirm('Voulez vous-supprimer cet enregistrement?')){
				Doc.action = Path + '&IdRecordSelected=' + IdRecordSelected + '&Action=Supprimer';
				submitOk = true;
			}
		}
		// Avec precision du nom de champ pour affecter IdRecordSelected a la fin du chemin
		else if(Bouton == '3'){ 
			Doc.action = Path + IdRecordSelected;
			submitOk = true;
		}
		// Cas d'une suppression avec precision du nom de champ pour affecter IdRecordSelected a la fin du chemin
		else if(Bouton == '4'){ 
			if(confirm('Voulez vous-supprimer cet enregistrement?')){
				Doc.action = Path + IdRecordSelected + '&Action=Supprimer';
				submitOk = true;
			}
		}
		if(submitOk) Doc.submit();
	}
	else{
		if(Bouton == '0'){ // Autres cas
			Doc.action = Path;
			Doc.submit();
			
		}
		else{ alert('Veuillez selectionner un enregistrement');
			event.returnValue = false;
			}
	}
}





// AFFECTATION DES DROITS
function move(fbox, tbox) {

	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	
	for (i = 0; i < tbox.options.length; i++) {
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	
	var fLength = 0;
	var tLength = arrTbox.length;
	
	for(i = 0; i < fbox.options.length; i++) {
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if (fbox.options[i].selected && fbox.options[i].value != "") {
				arrTbox[tLength] = fbox.options[i].text;
				tLength++;
		}
		else {
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
   		}
	}
	
	fbox.length = 0;
	tbox.length = 0;
	var c;
	
	for(c = 0; c < arrFbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}
	
	for(c = 0; c < arrTbox.length; c++) {
	var no = new Option();
	no.value = arrLookup[arrTbox[c]];
	no.text = arrTbox[c];
	tbox[c] = no;
   }
}

function moveAll(fbox, tbox) {

	var arrFbox = new Array();
	var arrTbox = new Array();
	var arrLookup = new Array();
	var i;
	
	for (i = 0; i < tbox.options.length; i++) {
		arrLookup[tbox.options[i].text] = tbox.options[i].value;
		arrTbox[i] = tbox.options[i].text;
	}
	
	var fLength = 0;
	var tLength = arrTbox.length;
	
	for(i = 0; i < fbox.options.length; i++) {
		arrLookup[fbox.options[i].text] = fbox.options[i].value;
		if (fbox.options[i].value != "") {
				arrTbox[tLength] = fbox.options[i].text;
				tLength++;
		}
		else {
			arrFbox[fLength] = fbox.options[i].text;
			fLength++;
   		}
	}

	fbox.length = 0;
	tbox.length = 0;
	var c;
	
	for(c = 0; c < arrFbox.length; c++) {
		var no = new Option();
		no.value = arrLookup[arrFbox[c]];
		no.text = arrFbox[c];
		fbox[c] = no;
	}
	
	for(c = 0; c < arrTbox.length; c++) {
	var no = new Option();
	no.value = arrLookup[arrTbox[c]];
	no.text = arrTbox[c];
	tbox[c] = no;
   }
}

function GetPermissions(box, ObjHidden){
	var ListValeur = '';
	for(i = 0; i < box.options.length; i++) {
		ListValeur += ListValeur == '' ? box.options[i].value : '#' + box.options[i].value;
	}
	ObjHidden.value = ListValeur;
}

// Detection des click
/* ***************************************
		POUR TOUTES LES PAGES
		form: nom du formulaire
		ListChamps: Liste des champs obligatoires
			Ex: ListChamps="TxtNom, TxtPrenom, TxtPwd, TxtCode"
		Action: Action du formulaire form
* ****************************************/
function GetValidation(form, ListChamps1,NameChamps, Action){
	var submitOk = true;
	var NbrChamp = 0, Msg = '';
	var NomChamp = '';
	
	var Doc = eval("document."+form);
		

	ListChamps = ListChamps1.split(",");
	NameChamps = NameChamps.split(",");

		
	for(i=0; i < ListChamps.length; i++){
		var Champs = Trim(ListChamps[i]); // IsEmailValid(EmailPlayer)
			Champs_name = NameChamps[i];
			Champs = Doc.elements[Champs];
			
			if((Champs.value == null)||(Trim(Champs.value) == '')) NomChamp= NomChamp + Champs_name+"\n";
		
	}
	if(NomChamp!= '') {
		alert("Le(s) champ(s) suivant(s) est(sont) obligatoire(s) : \n"+ NomChamp);
		submitOk = false;
	}
		
	if(submitOk) Doc.submit();
	
}
/*   *************************************
		Ouverture de fenetre en PopUP
*****************************************/
function pop(url,titre,w,h){ 
	    if (!w){
			w= 800;
	    }
		if (!h)
		{
			h=540;
		}
		
		var w=window.open(url,titre,"toolbar=no,menubar=no,scrollbars=no,status=no,resizable=yes,width="+w+",height="+h);
	   
		var windowX=(screen.width/2)-(800/2);
    	var windowY=(screen.height/2)-(450/2);
		
		w.moveTo(windowX,windowY);	
		
}

/****************************************************
			VERIFICATEUR DE MAIL
*****************************************************/
function IsEmailValid (TxtMail){
	var Msg = '';
	if (TxtMail != ""){
		var checkTLD = 1;
		var knownDomsPat = /^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum|mg)$/;
		var emailPat = /^(.+)@(.+)$/;
		var specialChars = "\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		var validChars = "\[^\\s" + specialChars + "\]";
		var quotedUser = "(\"[^\"]*\")";
		var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		var atom = validChars + '+';
		var word = "(" + atom + "|" + quotedUser + ")";
		var userPat = new RegExp("^" + word + "(\\." + word + ")*$");
		var domainPat = new RegExp("^" + atom + "(\\." + atom +")*$");
		var matchArray = TxtMail.match(emailPat);
		if (matchArray == null) {
			alert("L'adresse E-mail est incorrect (vérifiez @ et .'s)");
			return false;
		}
		var user = matchArray[1];
		var domain = matchArray[2];
		for (i=0; i<user.length; i++) {
			if (user.charCodeAt(i)>127) {
				alert("Le nom de l'utilisateur contient un ou des characters interdits.");
				return false;
			}
		}
		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i)>127) {
				alert("Le nom de domaine contient un ou des characters interdits.");
				return false;
			}
		}
		
		if (user.match(userPat) == null) {
		
		alert("Le nom de l'utilisateur n'est pas valide.");
			return false;
		}
		
		var IPArray = domain.match(ipDomainPat);
		if (IPArray != null) {
			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					alert("L'adresse IP de destination est invalide!");
					return false;
				}
			}
			return true;
		}
		
		var atomPat = new RegExp("^" + atom + "$");
		var domArr = domain.split(".");
		var len = domArr.length;
		for (i=0; i<len; i++) {
			if (domArr[i].search(atomPat) == -1) {
				alert("Le nom de domaine n'est pas valide.");
				return false;
			}
		}
		
		if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
			alert("L'adresse doit avoir terminé par un domaine précis ou deux lettres " + "pays.");
			return false;
		}
		
		if (len<2) {
			alert("L'adresse ne contient pas de hostname!");
			return false;
		}
		
		return true;
	}
	else{
		alert("L'adresse e-mail est obligatoire.");
		return false;
	}
}


function emailCheck (emailStr,id_msg) {
	if (!id_msg)
	{
		id_msg = "msg_erreur";
	}
	emailStr = emailStr.toLowerCase();
	if ((emailStr != "")&&(emailStr != null)){
		/* The following variable tells the rest of the function whether or not
		to verify that the address ends in a two-letter country or well-known
		TLD.  1 means check it, 0 means don't. */
		var checkTLD=1;
		/* The following is the list of known TLDs that an e-mail address must end with. */
		var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
		/* The following pattern is used to check if the entered e-mail address
		fits the user@domain format.  It also is used to separate the username
		from the domain. */
		var emailPat=/^(.+)@(.+)$/;
		/* The following string represents the pattern for matching all special
		characters.  We don't want to allow special characters in the address. 
		These characters include ( ) < > @ , ; : \ " . [ ] */
		var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
		/* The following string represents the range of characters allowed in a 
		username or domainname.  It really states which chars aren't allowed.*/
		var validChars="\[^\\s" + specialChars + "\]";
		/* The following pattern applies if the "user" is a quoted string (in
		which case, there are no rules about which characters are allowed
		and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
		is a legal e-mail address. */
		var quotedUser="(\"[^\"]*\")";
		/* The following pattern applies for domains that are IP addresses,
		rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
		e-mail address. NOTE: The square brackets are required. */
		var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
		/* The following string represents an atom (basically a series of non-special characters.) */
		var atom=validChars + '+';
		/* The following string represents one word in the typical username.
		For example, in john.doe@somewhere.com, john and doe are words.
		Basically, a word is either an atom or quoted string. */
		var word="(" + atom + "|" + quotedUser + ")";
		// The following pattern describes the structure of the user
		var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
		/* The following pattern describes the structure of a normal symbolic
		domain, as opposed to ipDomainPat, shown above. */
		var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
		/* Finally, let's start trying to figure out if the supplied address is valid. */
		/* Begin with the coarse pattern to simply break up user@domain into
		different pieces that are easy to analyze. */
		var matchArray=emailStr.match(emailPat);
		if (matchArray==null) {
			/* Too many/few @'s or something; basically, this address doesn't
			even fit the general mould of a valid e-mail address. */
			//alert("L'adresse E-mail est incorrect (vérifiez @ et .'s)");
			setText(id_msg, "L'adresse E-mail est incorrecte (vérifiez @ et .'s)");	
			//ChangeColor(id_msg, "FFFFFF", false);
			return false;
		}
		var user=matchArray[1];
		var domain=matchArray[2];
		// Start by checking that only basic ASCII characters are in the strings (0-127).
		for (i=0; i<user.length; i++) {
			if (user.charCodeAt(i)>127) {
				//alert("Le username contient un ou des characters interdits.");
				setText(id_msg, "Le username contient un ou des characters interdits.");	
				//ChangeColor(id_msg, "FFFFFF", false);
				return false;
			}
		}
		for (i=0; i<domain.length; i++) {
			if (domain.charCodeAt(i)>127) {
				//alert("Le nom de domaine contient un ou des characters interdits.");
				setText(id_msg, "Le nom de domaine contient un ou des characters interdits.");	
				//ChangeColor(id_msg, "FFFFFF", false);
				return false;
			}
		}
		
		// See if "user" is valid 
		
		if (user.match(userPat)==null) {
		
		// user is not valid
		
			//alert("Le username n'est pas valide.");
			setText(id_msg, "Le username n'est pas valide.");	
			//ChangeColor(id_msg, "FFFFFF", false);
			return false;
		}
		
		/* if the e-mail address is at an IP address (as opposed to a symbolic
		host name) make sure the IP address is valid. */
		
		var IPArray=domain.match(ipDomainPat);
		if (IPArray!=null) {
			// this is an IP address
			for (var i=1;i<=4;i++) {
				if (IPArray[i]>255) {
					//alert("L'adresse IP de destination est invalide!");
					setText(id_msg, "L'adresse IP de destination est invalide!");	
					//ChangeColor(id_msg, "FFFFFF", false);
					return false;
				}
			}
			return true;
		}
		
		// Domain is symbolic name.  Check if it's valid.
		 
		var atomPat=new RegExp("^" + atom + "$");
		var domArr=domain.split(".");
		var len=domArr.length;
		for (i=0;i<len;i++) {
			if (domArr[i].search(atomPat)==-1) {
				//alert("Le nom de domaine n'est pas valide.");
				setText(id_msg, "Le nom de domaine n'est pas valide.");	
				//ChangeColor(id_msg, "FFFFFF", false);
				return false;
			}
		}
		
		/* domain name seems valid, but now make sure that it ends in a
		known top-level domain (like com, edu, gov) or a two-letter word,
		representing country (uk, nl), and that there's a hostname preceding 
		the domain or country. */
		
		if (checkTLD && domArr[domArr.length-1].length!=2 && 
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
			//alert("L'adresse doit avoir terminé par un domaine précis ou deux lettres " + "pays.");
			setText(id_msg, "L'adresse doit avoir terminé par un domaine précis ou deux lettres " + "pays.");	
			//ChangeColor(id_msg, "FFFFFF", false);
			return false;
		}
		
		// Make sure there's a host name preceding the domain.
		if (len<2) {
			//alert("L'adresse ne contient pas de hostname!");
			setText(id_msg, "L'adresse ne contient pas de hostname!");	
			//ChangeColor(id_msg, "FFFFFF", false);
			return false;
		}
		
		// If we've gotten this far, everything's valid!
		return true;
	}	
}


function verifieVide(form, ListChamps1,NameChamps){

	var submitOk = true;

	var NbrChamp = 0, Msg = '';

	var NomChamp = '';
	
	var Doc = eval("document."+form);

		

	ListChamps = ListChamps1.split(",");

	NameChamps = NameChamps.split(",");

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

		var Champs = Trim(ListChamps[i]); // IsEmailValid(EmailPlayer)

			Champs_name = NameChamps[i];
			Champs = Doc.elements[Champs];
			
			if((Champs.value == null)||(Trim(Champs.value) == '')) NomChamp= NomChamp + Champs_name+"\n";

		
	}

	if(NomChamp!= '') {

		alert("Le(s) champ(s) suivant(s) est(sont) obligatoire(s) : \n"+ NomChamp);

		submitOk = false;

	}

		
	return submitOk;

}

function _compare(inP1,inP2){
	return (inP1 == inP2);
}

function msgCompare(inP1,inP2,inP1Name,inP2Name,id_msg){
	if (!id_msg)
	{
		id_msg = "msg_erreur";
	}
   if (!_compare(inP1,inP2)){ 
	   setText(id_msg,inP1Name + " et "+inP2Name+" ne sont pas égaux");
	   return false;
   }
   return true;
   
}

/**
* verify la vide
*/
function isNotEmpty(tagname,taglabel,nameForm,tagvalue,id_error){
	if (!id_error){
		id_error ="msg_erreur";
	}
	ok = true;
	myForm = eval('document.'+nameForm);
	
	tab_tagname = tagname.split(";");
	tab_taglabel = taglabel.split(";");
	if (tagvalue!="") tab_tagvalue = tagvalue.split(";");
	 
	if (tab_tagname.length==tab_taglabel.length){
		
		i=0;
		while (ok && i<tab_tagname.length){	
			    
				if (!myForm.elements[tab_tagname[i]].value){
					ok = false;
					setText (id_error,""+tab_taglabel[i]+" est obligatoire");
					myForm.elements[tab_tagname[i]].focus();
				}else if (tagvalue!="" && tab_tagname.length==tab_tagvalue.length){
					
					if (myForm.elements[tab_tagname[i]].value==tab_tagvalue[i]){
						ok = false;
						setText (id_error,""+tab_taglabel[i]+" doit être modifié");
						myForm.elements[tab_tagname[i]].focus();
					}
				}
			i++;
		}
	}
	
	return ok;
}

function getElement(psID) { 
   if(document.all) { 
      return document.all[psID]; 
   } else if(document.getElementById) { 
      return document.getElementById(psID); 
   } else { 
      for (iLayer = 1; iLayer < document.layers.length; iLayer++) { 
         if(document.layers[iLayer].id == psID) 
            return document.layers[iLayer]; 
      }       
   } 
   return Null; 
} 

function setText(psID, text) { 
	var obj;
	obj = getElement(psID);
	obj.innerHTML = text;
} 

function VerifyNumericValue(IntegerNumber){
	// Pour les nombre entier
	if(IntegerNumber == 'Integer'){
		if (event.keyCode < 48 || event.keyCode > 57) {
			event.returnValue = false; 
			
		}
	}
	// Pour les reels (Decimal)
	else if(IntegerNumber == 'Decimal'){
		if (event.keyCode < 44 || event.keyCode > 57) {
			event.returnValue = false; 
			
		}
	}
	else{
		if (event.keyCode < 45 || event.keyCode > 57) {
			event.returnValue = false; 
			
		}
	}
}

/**
* Vérifie l'image jpeg ou gif
*/
function verifyImageType(image_name,image_libelle,form,id_msg){
	if (!id_msg){
		id_msg ="msg_erreur";
	}
	
	docStr = "document."+form;
	doc = eval(docStr);
	image = doc.elements[image_name].value;
	tab_image = image.split(".");	
    dern = tab_image[tab_image.length-1];

	if(dern.toLowerCase() !="jpg"){ 
		 setText(id_msg,"Le type de l'image doit être jpeg");
		 doc.elements[image_name].focus();
		 return false;
	}
	return true;
}

/**
* active et désactive les boutons fiche
*/
function enableFiche(formname){
	if (IdRecordSelected==null)  return;
	var to_eval = "document."+formname;
    doc  = eval (to_eval) ;
	to_eval  = "doc.exist_fiche"+IdRecordSelected+".value"; 
    val = eval(to_eval);
	if (val){
		doc.fiche.disabled = false;
	} else doc.fiche.disabled = true;
}

/**
* active et désactive les boutons paiement
*/
function enablePaie(formname){
	if (IdRecordSelected==null)  return;
	var to_eval = "document."+formname;
    doc  = eval (to_eval) ;
	to_eval  = "doc.exist_paiement"+IdRecordSelected+".value";
    val = eval(to_eval);
	
	if (val){
		doc.paie.disabled = false;
	} else doc.paie.disabled = true;
}