// Variables globales
	var cptdel = 0;
	var cptins = 0;
	var cptupd = 0;
	var cptdirty = 0;
	var fen = null;
	var fenM = null;
	var fenS = null;

//=======================
// Liste des fonctions
//========================
// - AlertAndBack
// - CheckDate
// - CheckDecimal
// - CheckDecimals
// - CheckMandatory
// - CheckNumeric
// - CheckNumerics
// - CheckRadio
// - CheckQuery
// - CheckUnicite
// - CptReset
// - GetDateFormat
// - UpdDel
// - UpdRs
// - UpdRun


//=====================================
// 	UpdRun
//=====================================
function UpdRun(page,actualisation,confirmation)
{
	var nom;
	var valeur;
	var ligne;
	var champs_simples = false;
	if(fen != null) {
		if(!fen.closed) {
			alert('Please wait (in progress) ....');
			if(!fen.closed) {
				fen.focus();
			}
			return;
		}
	}
	if(document.forms[0].form_RS) {
		champs_simples = true;
	}
	if((cptdel+cptins+cptupd+cptdirty) == 0) {
		return;
	}
	if((confirmation != null) && (confirmation != '') && (cptdel > 0)) {
		message = cptdel + ' ' + confirmation;
		ret = confirm(message);
		if(ret == false) {
			if(champs_simples == true) {
				document.forms[0].form_RS.value = parseInt(document.forms[0].form_RS.value) - 10;
				cptdel--;
			}
			return;
		}
	}
	fen = window.open('','updRun','titlebar=no,width=500,height=10,toolbar=no,scrollbars=no,status=no');
	//fen = window.open('','updRun','fullscreen=yes');
	//fen.resizeTo(500,10);
	//fen.moveTo(20,30);
	//this.onunload = fen.close;
	document.forms[0].action = page;
	fen.document.write('<HTML><BODY>');
	fen.document.write('<BR><H2><CENTER>' + actualisation + '</CENTER></H2>');
	fen.document.write('</BODY></HTML>');
	document.forms[0].submit();
}

//=====================================
// 	UpdRun
//=====================================
function UpdRunM(formulaire,page,actualisation,confirmation)
{
	var champs_simples = false;
	if(fenM != null) {
		if(!fenM.closed) {
			alert('Please wait (in progress) ....');
			if(!fenM.closed) {
				fenM.focus();
			}
			return;
		}
	}
	if(document.forms[formulaire].form_RS) {
		champs_simples = true;
	}
	if((cptdel+cptins+cptupd+cptdirty) == 0) {
		return;
	}
	if((confirmation != null) && (confirmation != '') && (cptdel > 0)) {
		message = cptdel + ' ' + confirmation;
		ret = confirm(message);
		if(ret == false) {
			if(champs_simples == true) {
				document.forms[formulaire].form_RS.value = parseInt(document.forms[formulaire].form_RS.value) - 10;
				cptdel--;
			}
			return;
		}
	}
	fenM = window.open('','updRunM','titlebar=no,width=500,height=10,toolbar=no,scrollbars=no,status=no');
	//fen = window.open('','updRun','fullscreen=yes');
	//fen.resizeTo(500,10);
	//fen.moveTo(20,30);
	//this.onunload = fen.close;
	document.forms[formulaire].action = page;
	fenM.document.write('<HTML><BODY>');
	fenM.document.write('<BR><H2><CENTER>' + actualisation + '</CENTER></H2>');
	fenM.document.write('</BODY></HTML>');
	document.forms[formulaire].submit();
}

//=====================================
// 	UpdRunS
//=====================================
function UpdRunS(page,actualisation,confirmation)
{
    if(fenS != null) {
            if(!fenS.closed) {
                    alert('Please wait (in progress) ....');
                    if(!fenS.closed) {
                            fenS.focus();
                    }
                    return;
            }
    }
    fenS = window.open('','updRunS','titlebar=no,width=500,height=10,toolbar=no,scrollbars=no,status=no');
    document.forms[0].action = page;
    fenS.document.write('<HTML><BODY>');
    fenS.document.write('<BR><H2><CENTER>' + actualisation + '</CENTER></H2>');
    fenS.document.write('</BODY></HTML>');
    document.forms[0].submit();
}

//=====================================
// 					CptReset
//=====================================
function CptReset() {
	cptdel = 0;
	cptins = 0;
	cptupd = 0;
	cptdirty = 0;
}

//=====================================
// 					GetDateFormat
//=====================================
function GetDateFormat(ObjectDate, Format)
{
	var maDate = new String(ObjectDate.value);

	// Controle des parametres
	if(maDate.length == 0)
	{
		return maDate;
	}
	if(maDate.length > 4)
	{
		return maDate;
	}
	if(isNaN(maDate))
	{
		return '';
	}

	if(maDate.length == 1 || maDate.length == 3)
	{
		maDate = '0' + maDate;
	}

	if(!Format)
	{
		Format = 'dd.MM.yyyy';
	}

	// Decoupage de la date
	actuel = new Date();

	if(maDate.length == 2)
	{
		jour = maDate.substr(0, 2);
		mois = actuel.getMonth() + 1;
		annee = actuel.getYear();
	}
	if(maDate.length == 4)
	{
		jour = maDate.substr(0, 2);
		mois = maDate.substr(2, 2);
		annee = actuel.getYear();
	}

   var d = new Date(annee, mois-1, jour, 0, 0, 0);
   resultat = formatDate(d, Format);

	// Affichage de la date formatee
	return resultat;
}

//=====================================
// 					UpdRs
//=====================================
function UpdRs(champ)
{
	if((champ.value == 0)||	(champ.value == 10)) {
		val = parseInt(champ.value) + 1;
		if(val == 1) {
			cptins++;
		}
		champ.value = val;
	}
	if((champ.value == 2)||	(champ.value == 12)) {
		val = parseInt(champ.value) + 1;
		if(val == 3) {
			cptupd++;
		}
		champ.value = val;
	}
}

//=====================================
// 					UpdRs
//=====================================
function UpdRs2(champ)
{
    alert(champ.value);
	if((champ.value == 0)||	(champ.value == 10)) {
		val = parseInt(champ.value) + 1;
		if(val == 1) {
			cptins++;
		}
		champ.value = val;
	}
	if((champ.value == 2)||	(champ.value == 12)) {
		val = parseInt(champ.value) + 1;
		if(val == 3) {
			cptupd++;
		}
		champ.value = val;
	}
}

//=====================================
// 					UpdRsM
//=====================================
function UpdRsM(formulaire,champ)
{
    if ((document.forms[formulaire].elements[champ].value == 0) || (document.forms[formulaire].elements[champ].value == 10))
    {
        val = parseInt(document.forms[formulaire].elements[champ].value) + 1;
        if (val == 1)
            cptins++;
        document.forms[formulaire].elements[champ].value = val;
    }
    if ((document.forms[formulaire].elements[champ].value == 2) || (document.forms[formulaire].elements[champ].value == 12))
    {
        val = parseInt(document.forms[formulaire].elements[champ].value) + 1;
        if (val == 3)
            cptupd++;
        document.forms[formulaire].elements[champ].value = val;
    }
}

//=====================================
// 					UpdDel
//=====================================
function UpdDel(champ)
{
	if(champ.value < 10) {
		val = parseInt(champ.value) + 10;
		switch(val) {
			case 10:
				cptdirty++;
				break;
			case 11:
				cptdirty++;
				cptins--;
				break;
			case 12:
				cptdel++;
				break;
			case 13:
				cptdel++;
				cptupd--;
				break;
		}
		champ.value = val;
	} else {
		val = parseInt(champ.value) - 10;
		switch(val) {
			case 0:
				cptdirty--;
				break;
			case 1:
				cptdirty--;
				cptins++;
				break;
			case 2:
				cptdel--;
				break;
			case 3:
				cptdel--;
				cptupd++;
				break;
		}
		champ.value = val;
	}
}

//=====================================
// 				CheckNumerics
//=====================================
function CheckNumerics()
{
	var OkChamp = true;
	var NomChamp;

	for(i = 0; i < CheckNumerics.arguments.length; i += 1)
	{
		var CptPoint = 0;

		NomChamp = CheckNumerics.arguments[i].name;
		var str = document.forms[0].elements[NomChamp].value;

		// On retourne FALSE si un des caracteres n'est egal a
		// un chiffre compris entre 0 et 9.
		for (var j = 0; j < str.length; j++)
		{
			var ch = str.substring(j, j + 1);
			if ((ch < "0" || "9" < ch) && ch != '.' && ch != '-' && ch != '+')
			{
				document.forms[0].elements[NomChamp].focus();
				OkChamp = false;
			}
			if ((ch == '-' || ch == '+') && (j > 0)) {
				document.forms[0].elements[NomChamp].focus();
				OkChamp = false;
			}
			if (ch == '.')
			{
				CptPoint++;
			}
		}
		if (CptPoint > 1 )
		{
			document.forms[0].elements[NomChamp].focus();
			OkChamp = false;
		}
	}

	if (OkChamp == true) {
		return true;
	}
	else {
		// alert('Ce champ doit etre numerique !');
		return false;
	}
}

//=====================================
// 				CheckNumeric
//=====================================
function CheckNumeric(theObject)
{
   var CptPoint = 0;
   var str = theObject.value;
   if (str == "")
   // Modif Phl le 31/07/2001
   		 {return true;}
   //     {return false;}
   // Return false if characters are not '0-9' or '.' or '-' or '+' .
   for (var i = 0; i < str.length; i++)
   {
      var ch = str.substring(i, i + 1);
      if ((ch < "0" || "9" < ch) && ch != '.' && ch != '-' && ch != '+')
      {
         // alert('Ce champ doit etre numerique !');
	 theObject.focus();
         return false;
      }
      if ((ch == '-' || ch == '+') && (i > 0))
      {
	 theObject.focus();
         return false;
      }
      if (ch == '.')
      {
         CptPoint++;
      }
   }

   if (CptPoint > 1 )
   {
	 theObject.focus();
         return false;
   }

   return true;
}

//=====================================
// 				CheckDate
//=====================================
function CheckDate()
{
   var err = 0;
	var psj = 0;
	var maDate = '';
	var maDateNow = '';
	var maComparaison = '';
	var monHeure = '';
	var monParam = '';
	var monFormat = '';
	var s;
	var maChaine = '';

	//============= Affectation des parametres =============
	for(var i = 0; i < CheckDate.arguments.length; i += 1)
	{
		if(i == 0)
		{
			maDate = CheckDate.arguments[i];
		}
		if(i == 1)
		{
			monParam = CheckDate.arguments[i];
		}
		if(i == 2)
		{
			monFormat = CheckDate.arguments[i];
		}
		if(i == 3)
		{
			maComparaison = CheckDate.arguments[i];
		}
	}

	//============= Decoupage en DATE et HEURE =============
	var a = new String(maDate);
	s = a.split(" ");
	maDate = s[0];
	monHeure = s[1];

	//============= Controles des parametres DATE =============
	var a = new String(maDate);
   if (a.length == 0)
	{
		return true;
	}

	// Decoupage de la date
	s = a.split("/");
	if(s == maDate)
	{
		s = a.split(".");
	}
	if(s == maDate)
	{
		s = a.split("-");
	}

	// Date sans separateur
	if(s == maDate)
	{
		// Format US
		if(monFormat == 'US')
		{
			b = a.substr(2, 2) // day
	     	d = a.substr(0, 2) // month
	     	f = a.substr(4) // year
		}
		// Format INTERNATIONAL
		else if(monFormat == 'IN')
		{
			if(a.length == 6)
			{
				b = a.substr(4, 2) // day
		     	d = a.substr(2, 2) // month
		     	f = a.substr(0, 2) // year
			}
			else
			{
				b = a.substr(6, 2) // day
		     	d = a.substr(4, 2) // month
		     	f = a.substr(0, 4) // year
			}
		}
		// Format FR
		else
		{
			b = a.substr(0, 2) // day
	     	d = a.substr(2, 2) // month
	     	f = a.substr(4) // year
		}
	}

	else
	// Date separee par [/.-]
	{
		// Format US
		if(monFormat == 'US')
		{
			b = s[1] // day
	     	d = s[0] // month
	     	f = s[2] // year
		}
		// Format INTERNATIONAL
		else if(monFormat == 'IN')
		{
			b = s[2] // day
	     	d = s[1] // month
	     	f = s[0] // year
		}
		// Format FR
		else
		{
			b = s[0] // day
	     	d = s[1] // month
	     	f = s[2] // year
		}
	}

	// basic error checking
	if (b<1 || b>31 || isNaN(b)) err = 1
	if (d<1 || d>12 || isNaN(d)) err = 1
	if (isNaN(f)) err=1
	f = parseInt(f);

	// months with 30 days
	if (d==4 || d==6 || d==9 || d==11){
	       if (b==31) err=1
	}

	// february, leap year
	if (d==2)
	{
		// feb
		var g=parseInt(f/4)
		if (isNaN(g)) {
		      err=1
		}

		if (b>29) err=1
		if (b==29 && ((f/4)!=parseInt(f/4))) err=1
	}

	//============= Controles des parametres HEURE =============
	if(monHeure)
	{
		var a = new String(monHeure);

		// Decoupage de l'heure
		s = a.split(":");
		hour = s[0];
	  	min = s[1];
	  	sec = s[2];

		// Controle
		if (hour<0 || hour>23 || isNaN(hour)) err = 1;
		if (min<0 || min>59 || isNaN(min)) err = 1;
		if (sec<0 || sec>59 || isNaN(sec)) err = 1;
	}

	//============= Controles des autres parametres  =============
	if(monParam != '' && monParam != '>' && monParam != '<' && monParam != '>=' && monParam != '<=')
	{
		err=1
	}
	if(monFormat != '' && monFormat != 'US' && monFormat != 'IN')
	{
		err=1
	}

	// Verif si les controles sont corrects
	if(err==1)
	{
		return false;
	}

	//============= Controle avec la date actuelle ou une autre date =============
	if (monParam == '')
	{
		return true;
	}

	// Si annee<1000 alors annee=annee+2000
	if (f < 1000)
	{
		f = f + 2000;
	}
	maDateSaisie = f + d + b;

	// Date de comparaison renseignee
	if (maComparaison != '')
	{
		// Decoupage en DATE et HEURE
		var a = new String(maComparaison);
		s = a.split(" ");
		maDate = s[0];
		monHeure = s[1];

		// Controles des parametres DATE
		var a = new String(maDate);
	   if (a.length == 0)
		{
			return true;
		}

		// Decoupage de la date
		s = a.split("/");
		if(s == maDate)
		{
			s = a.split(".");
		}
		if(s == maDate)
		{
			s = a.split("-");
		}

		// Date sans separateur
		if(s == maDate)
		{
			// Format US
			if(monFormat == 'US')
			{
				b = a.substr(2, 2) // day
		     	d = a.substr(0, 2) // month
		     	f = a.substr(4) // year
			}
			// Format INTERNATIONAL
			else if(monFormat == 'IN')
			{
				if(a.length == 6)
				{
					b = a.substr(4, 2) // day
			     	d = a.substr(2, 2) // month
			     	f = a.substr(0, 2) // year
				}
				else
				{
					b = a.substr(6, 2) // day
			     	d = a.substr(4, 2) // month
			     	f = a.substr(0, 4) // year
				}
			}
			// Format FR
			else
			{
				b = a.substr(0, 2) // day
		     	d = a.substr(2, 2) // month
		     	f = a.substr(4) // year
			}
		}

		else
		// Date separee par [/.-]
		{
			// Format US
			if(monFormat == 'US')
			{
				b = s[1] // day
		     	d = s[0] // month
		     	f = s[2] // year
			}
			// Format INTERNATIONAL
			else if(monFormat == 'IN')
			{
				b = s[2] // day
		     	d = s[1] // month
		     	f = s[0] // year
			}
			// Format FR
			else
			{
				b = s[0] // day
		     	d = s[1] // month
		     	f = s[2] // year
			}
		}

		// basic error checking
		if (b<1 || b>31 || isNaN(b)) err = 1
		if (d<1 || d>12 || isNaN(d)) err = 1
		if (isNaN(f)) err=1
		f = parseInt(f);

		// months with 30 days
		if (d==4 || d==6 || d==9 || d==11){
		       if (b==31) err=1
		}

		// february, leap year
		if (d==2)
		{
			// feb
			var g=parseInt(f/4)
			if (isNaN(g)) {
			      err=1
			}

			if (b>29) err=1
			if (b==29 && ((f/4)!=parseInt(f/4))) err=1
		}

		// Controles des parametres HEURE
		if(monHeure)
		{
			var a = new String(monHeure);

			// Decoupage de l'heure
			s = a.split(":");
			hour = s[0];
		  	min = s[1];
		  	sec = s[2];

			// Controle
			if (hour<0 || hour>23 || isNaN(hour)) err = 1;
			if (min<0 || min>59 || isNaN(min)) err = 1;
			if (sec<0 || sec>59 || isNaN(sec)) err = 1;
		}

		// Verif si les controles sont corrects
		if(err==1)
		{
			return false;
		}

		// Si annee<1000 alors annee=annee+2000
		if(f < 1000)
		{
			f = f + 2000;
		}
		maDateNow = f + d + b;
	}

	else
	// Date en cours
	{
		actuel = new Date();

		maDateNowY = actuel.getYear();
		if(maDateNowY < 200)
		{
			maDateNowY += 1900;
		}
		maDateNowM = (actuel.getMonth() + 1);
		maDateNowD = actuel.getDate();
		maDateNow += maDateNowY;
		if (maDateNowM <= 9)
		{
			maDateNow += '0';
		}
		maDateNow += maDateNowM;

		if (maDateNowD <= 9)
		{
			maDateNow += '0';
		}
		maDateNow += maDateNowD;
	}

	// Controle des dates
	maChaine = 'ret = ' + maDateSaisie + monParam + maDateNow;

   eval (maChaine);
	if (!ret)
	{
		return false;
	}

	//============= Retour =============
	return true;
}


//=====================================
// 				CheckDecimals
//=====================================
function CheckDecimals()
{
	var OkChamp = true;
	var NomChamp;

	var Decimal = CheckDecimals.arguments[CheckDecimals.arguments.length - 1];
	for(i = 0; i < CheckDecimals.arguments.length -1; i += 1)
	{
		var CptPoint = 0;
		var PosDecimal = false;
		var CptDecimal = 0;

		NomChamp = CheckDecimals.arguments[i].name;
		var str = document.forms[0].elements[NomChamp].value;

		// Controle un element
		for (var j = 0; j < str.length; j++)
		{
			var ch = str.substring(j, j + 1);
			// Return false if characters are not '0-9' or '.' or '-' or '+' .
			if ((ch < "0" || "9" < ch) && ch != '.' && ch != '-' && ch != '+')
			{
				document.forms[0].elements[NomChamp].focus();
				OkChamp = false;
			}
			// Return false si caracteres '-' or '+' pas en premiere position.
			if ((ch == '-' || ch == '+') && (j > 0)) {
				document.forms[0].elements[NomChamp].focus();
				OkChamp = false;
			}
			// Compte le nombre de '.' et positionne PosDecimal
			if (ch == '.')
			{
				CptPoint++;
			        PosDecimal = true;
			}
     			 // Compte le nombre de decimales
     		 	if ((PosDecimal) && (ch >= '0' && ch <= '9'))
     			{
			 	CptDecimal++;
      			}
		}

		// Controle du nombre de '.'
		if (CptPoint > 1 )
		{
			document.forms[0].elements[NomChamp].focus();
			OkChamp = false;
		}
		// Controle le nombre de decimales
   		if (CptDecimal > Decimal )
   		{
			document.forms[0].elements[NomChamp].focus();
			OkChamp = false;
   		}
	}

	if (OkChamp == true) {
		return true;
	}
	else {
		return false;
	}
}

//=====================================
// 				CheckDecimal
//=====================================
function CheckDecimal(theObject, Decimal)
{
   var CptPoint = 0;
   var PosDecimal = false;
   var CptDecimal = 0;
   var str = theObject.value;

   if (str == "")
   		 {return true;}

   for (var i = 0; i < str.length; i++)
   {
      var ch = str.substring(i, i + 1);
      // Return false if characters are not '0-9' or '.' or '-' or '+' .
      if ((ch < "0" || "9" < ch) && ch != '.' && ch != '-' && ch != '+')
      {
	 theObject.focus();
         return false;
      }
      // Return false si caracteres '-' or '+' pas en premiere position.
      if ((ch == '-' || ch == '+') && (i > 0))
      {
	 theObject.focus();
         return false;
      }
      // Compte le nombre de '.' et positionne PosDecimal
      if (ch == '.')
      {
         CptPoint++;
         PosDecimal = true;
      }
      // Compte le nombre de decimales
      if ((PosDecimal) && (ch >= '0' && ch <= '9'))
      {
	 CptDecimal++;
      }
   }

   // Controle le nombre de '.'
   if (CptPoint > 1 )
   {
	 theObject.focus();
         return false;
   }

   // Controle le nombre de decimales
   if (CptDecimal > Decimal )
   {
	 theObject.focus();
         return false;
   }

   return true;
}

//=====================================
// 				CheckQuery
//=====================================
function CheckQuery()
{
   var Critere = false;
   var NomCritere;
   for(i = 0; i < CheckQuery.arguments.length; i += 1){
     NomCritere = CheckQuery.arguments[i].name;
     if ((document.forms[0].elements[NomCritere].value != '')
   &&
     (document.forms[0].elements[NomCritere].value != '%'))
       Critere = true;
   }
   if (Critere == true) {
     return true;}
   else {
     //alert ('Vous devez renseigner un critere de selection !');
     NomCritere = CheckQuery.arguments[0].name;
     document.forms[0].elements[NomCritere].focus();
     return false; }
}

//=====================================
// 				CheckMandatory
//=====================================
function CheckMandatory()
{
   var OkLibelle = true;
   var NomLibelle;
   for(i = 0; i < CheckMandatory.arguments.length; i += 1)
   {
     NomLibelle = CheckMandatory.arguments[i].name;

     var strText = CheckMandatory.arguments[i];

     if((strText.type == 'text') || (strText.type == 'textarea'))
     {
		  while (strText.value.substring(strText.value.length-1,strText.value.length) == ' ')
		  {
	     	   strText.value = strText.value.substring(0, strText.value.length-1);
		  }
     }
     if(strText.value == '')
     {
       document.forms[0].elements[NomLibelle].focus();
       OkLibelle = false;
     }
   }

   if (OkLibelle == true)
   {
     return true;
   }
   else
   {
     return false;
   }
}

//=====================================
// 				CheckRadio
//=====================================
function CheckRadio()
{
   var OkChecked = false;
   var j;

   for(i = 0; i < CheckRadio.arguments.length; i += 1)
   {
      	OkChecked = false;
      	j=0;
      	while(arguments[i][j] != null)
	{
		if(arguments[i][j].checked == true)
		{
         		OkChecked = true;
         		break;
		}
		j++;
	}
      	if(OkChecked == false)
      	{
     	 	return false;
      	}
   }
   return true;
}

//=====================================
// 				CheckUnicite
//=====================================
function CheckUnicite()
{
   // Declaration des variables
   var unique = '';
   var unique_blank = '';
   var ligne = '';
   var debut_nom_tab = '';
   var fin_nom_tab = '';
   var tab_fin_nom_tab = new Array();
   var nbUnique = 0;
   var i = 0;
   var controle = true;

   // On recupere le nom du tableau
   var tmp = CheckUnicite.arguments[0].name;

   for (i = 0; i < tmp.length; i++)
   {
      var ch = tmp.substring(i, i + 1);
      if (ch == '_')
      {
	 if(debut_nom_tab == '')
  	 {
  	    debut_nom_tab = tmp.substring(0, i );
    	 }
    	 else
    	 {
    	    fin_nom_tab = tmp.substring(i+1, tmp.length);
    	    break;
    	 }
      }
   }

   // Constitution de la cle et stockage des champs
   for(j = 0; j < CheckUnicite.arguments.length; j++)
   {
		var tmp = CheckUnicite.arguments[j].name;
      unique = unique + "|" + CheckUnicite.arguments[j].value;
      unique_blank = unique_blank  + "|";
      tab_fin_nom_tab[j] = CheckUnicite.arguments[j].name.substring(i+1, tmp.length);
   }

   // Verification si la cle est unique dans le tableau
   i =  0;
   while (true)
   {
      var result = eval("document.forms[0]." + debut_nom_tab + "_" + i + "_" + fin_nom_tab);
      if (result == null)
      {
         if (i != 0)
	 {
		// Il n'y a pas toujours de ligne 0
		break;
	 }
      }
      else
      {
         var result = eval("document.forms[0]." + debut_nom_tab + "_" + i + "_RS");
	 if (result != null)
	 {
	    if (eval("document.forms[0]." + debut_nom_tab + "_" + i + "_RS.value") < 10 )
	    {
		// Cas d'une ligne non marquee pour delete --> en tenir compte
		controle = true;
	    }
	    else
	    {
		// Cas d'une ligne marquee pour delete --> ne pas en tenir compte
		controle = false;
   	    }
	 }
	 else
	 {
	    // Cas d'une ligne sans champ _RS --> en tenir compte
	    controle = true;
	 }

	 if (controle == true)
	 {
	    ligne = '';
	    for(j = 0; j < tab_fin_nom_tab.length; j++)
	    {
		ligne = ligne + "|" + eval("document.forms[0]." + debut_nom_tab + "_" + i + "_" + tab_fin_nom_tab[j] + ".value");
	    }
	    if (ligne == unique && ligne != unique_blank)
	    {
		nbUnique++;
	    }
	 }
      }
      i++;
   }

   // Retour
   if(nbUnique > 1)
   {
 	return false;
   }
   else
   {
      return true;
   }
}

//=====================================
// 				AlertAndBack
//=====================================
function AlertAndBack(message)
{
      alert(message);
      history.back();
}

//=====================================
// 				OpenBrWindow
//=====================================
function OpenBrWindow(theURL,winName,features) { //v1.2
  newwin = window.open(theURL,winName,features);
  if (!newwin.opener) newwin.opener = self;
}

//=====================================
// 			SetValueInOpenerMain
//=====================================
function SetValueInOpenerMain(fieldName, value) {
        if (self.opener!=null) {
                for(i=0; i<self.opener.document.forms[0].elements.length; i++) {
                        if (self.opener.document.forms[0].elements[i].name==fieldName) {
                                self.opener.document.forms[0].elements[i].value=value;
                                if (self.opener.document.forms[0].pAction != null){
                                        self.opener.document.forms[0].elements[i].onchange();
                                }
                        }
                }
                self.close();
        }
}

