
var errfound=false;
var k_intOk=0;
var k_intLngInvalide=1;
var k_intSaisieOblg=2;
var k_intCarNonAutorise=3;
var k_intStructureEmailInvalide=4;
var k_intNumInvalide=5;
var k_intValNonNum=6;
var k_intStructureDateInvalide=7;
var k_intDateInvalide=8;
var k_intSelectionOblg=9;
var k_intQuestion=10;
var k_intDateType=12;
var k_intChampSeq=13;
var k_intChampPasSlash=14;
var k_intNonCoche=15;

var k_strlng_Fr="Fr";
var k_strlng_En="En";

//***************************************
// Valide qu'un checkbox est coché
//
// ??/??/???? - ETE : Création
// 03/05/2005 - SMN : Mise en lib
// 19/07/2005 - ETE : Rajout test checkbox seul!!!
//***************************************
function ValidRadioChecked( objCheckbox )
{
		for (var intX=0 ;  intX < objCheckbox.length ; intX++)
		{
			if (objCheckbox[intX].checked == true)
			{ 
				return k_intOk;
				break;
			}
		}

		// MODIF pour checkbox seul
		if (objCheckbox.length > 1 ){
			return k_intSelectionOblg;
		} else {
			if (objCheckbox.checked == true){
			 	return k_intOk;
			} else {
				return k_intSelectionOblg;
			}
		}
}


//***************************************
// Affiche les erreurs
//
// ??/??/???? - ??? : Création
//***************************************
function AffErr (CodeLangue,CodeErreur) {
	var g_strMesgErr;
	switch (CodeLangue.toLowerCase()) {
		case "fr" :
			switch (CodeErreur) {
				case 1 :
					g_strMesgErr="La longueur de champ est invalide";
					break;
				case 2 :
					g_strMesgErr="La saisie de ce champ est obligatoire";
					break;
				case 3 :
					g_strMesgErr="Caractère(s) non autorisé(s)";
					break;
				case 4 :
					g_strMesgErr="Structure invalide (ex : j.dupondt@domain.fr)";
					break;
				case 5 :
					g_strMesgErr="Numéro invalide";
					break;
				case 6 :
					g_strMesgErr="Valeur non numérique";
					break;
				case 7 :
					g_strMesgErr="Structure invalide (ex : 01/01/1998)";
					break;
				case 8 :
					g_strMesgErr="Date invalide";
					break;
				case 9 :
					g_strMesgErr="Sélectionnez un élément dans la liste";
					break;			
				case 10 :
					g_strMesgErr="En êtes-vous sûr ?"
					break;							
				case 11 :
					g_strMesgErr="La date de debut ne peut être supérieure à la date de fin";
					break;
				case 12 :
					g_strMesgErr="Le filtre ne s'applique que sur un type de date";
					break;							
				case 13 :
					g_strMesgErr="Les champs doivent être saisis de manière séquentielle";
					break;
				case 14 : 
					g_strMesgErr="Le caractère '\\' est interdit";
					break;
				case 15 : 
					g_strMesgErr="Tous les boutons radios ne sont pas sélectionnés";
					break;
				case 16 : 
					g_strMesgErr="Valeur non autorisée";
					break;					
				default :
					g_strMesgErr="Erreur Générale";
					break;
				}
			break;
		default :
			switch (CodeErreur) {
				case 1 :
					g_strMesgErr="Invalid length";
					break;
				case 2 :
					g_strMesgErr="data entry required";
					break;					
				case 3 :
					g_strMesgErr="characters forbidden";
					break;
				case 4 :
					g_strMesgErr="Invalid email structure (ex : j.dupont@domain.fr)";
					break;
				case 5 :
					g_strMesgErr="Invalid number";
					break;
				case 6 :
					g_strMesgErr="Numeric only";
					break;
				case 7 :
					g_strMesgErr="Invalid date structure (ex : 01/01/1998)";
					break;
				case 8 :
					g_strMesgErr="Invalide date";
					break;
				case 9 :
					g_strMesgErr="Select an element in the list";
					break;						
				case 10 :
					g_strMesgErr="Are you sure ?"
					break;
				case 11 :
					g_strMesgErr="The date of debut can not be superior to the date of the end";
					break;	
				case 12 :
					g_strMesgErr="The filter applies only to a type of date";
					break;							
				case 13 :
					g_strMesgErr="Fields must be seized in a sequential way";
					break;
				case 14 : 
					g_strMesgErr="Character ' \\ ' is forbidden";
					break;		
				case 15 : 
					g_strMesgErr="All radio buttons are not selected";
					break;
				case 16 : 
					g_strMesgErr="Value is not allowed";
					break;										
				default :
					g_strMesgErr="General error";
					break;
			}
			break;
	}
	return g_strMesgErr;
}

//***************************************
// Permet de masquer une adresse mail
//
// ??/??/???? - ??? : Création
//***************************************
function SendMail(a_strNomAffiche, a_strNom, a_strDomaine, a_style) {
	var lienMailTo;
	lienMailTo = '<a href=\"mailto:' + a_strNom + '@' + a_strDomaine + '"';
	if ( a_style != "" ) { lienMailTo = lienMailTo + ' class=\"' + a_style + '\"' }
	lienMailTo = lienMailTo +'\>'
	if ( a_strNomAffiche == "" ){ lienMailTo = lienMailTo + a_strNom + '@' + a_strDomaine; }
	else { lienMailTo = lienMailTo + a_strNomAffiche;	}
	lienMailTo = lienMailTo + '</a>';
	
	document.write ( lienMailTo );
}

//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ValidLength(a_strChaine, a_intLongueurSouhaitee)
{
	if (a_strChaine.length != a_intLongueurSouhaitee)
		return k_intLngInvalide;
	
	return k_intOk;
}


//***************************************
// Affiche les erreurs
//
// ??/??/???? - ??? : Création
//***************************************
function ValidLengthMinMax(a_strChaine, a_intLongueurMin, a_intLongueurMax)
{
	if ((a_strChaine.length<a_intLongueurMin) || (a_strChaine.length>a_intLongueurMax))
		return k_intLngInvalide;
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ValidLengthDiff(a_strChaine, a_intLongueurOne, a_intLongueurTwo)
{
	if ((a_strChaine.length!=a_intLongueurOne) && (a_strChaine.length!=a_intLongueurTwo))
		return k_intLngInvalide;
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ValidLenghtForBoth(a_strChaineOne,a_strChaineTwo)
{
	if ( (a_strChaineOne.length==0)&&(a_strChaineTwo==0) )
		return k_intSaisieOblg;
	
	if ((a_strChaineOne.length > 0)&&(a_strChaineTwo > 0))
		return k_intFiltreType;	
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function Valid(a_strChaine)
{
	if (a_strChaine.length==0)
		return k_intSaisieOblg;
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ValidSelection (a_strListe)
{
	if (a_strListe.selectedIndex<=0)
		return k_intSelectionOblg;
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ValidSelectionItem(a_strItemSelected,a_strItem)
{
	if ( a_strItemSelected[a_strItemSelected.selectedIndex].value==a_strItem)
		return k_intOk;
	return k_intNo;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ValidSelectObligatoire (a_strListe)
{
	if (a_strListe.value=="False")
		return k_intSelectionImpossible;
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ValidMinSelection (a_strListe)
{
	if (a_strListe.length<1)
		return k_intUnAttributMin;
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ValidNum(a_strChaine) 
{
	if (a_strChaine.length>0)
	{
		for (var c=0;c<a_strChaine.length;c++) 
			if ((a_strChaine.charAt(c)<'0') || (a_strChaine.charAt(c)>'9'))
				return k_intValNonNum;
	}
	else
		return k_intSaisieOblg;
		
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function Error (a_element,a_strMessage,Check)
{
	if (errfound) return;
	window.alert (a_strMessage);
	if (Check==1)
	{
		a_element.select ();
		a_element.focus();
	}
	errfound=true;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function IsDate (a_strDate,a_strCodelangue) 
{
	var jour=0;
	var mois=0;
	var annee=0;
	var Dsiecle=0;
	var Fsiecle=0;
	var result=0;
	var arrondit=0;
	var DateCourante=new Date();
	var JourCourant=DateCourante.getDate();
	var MoisCourant=1+DateCourante.getMonth();
	var AnneeCourante=1900 + DateCourante.getYear();	
	for (var i = 0; (i<a_strDate.length); i++)
		if ( ((a_strDate.charAt(i)<"0") || (a_strDate.charAt(i)>"9")) && a_strDate.charAt(i)!="/")
			return k_intStructureDateInvalide;
	if ( (ValidLength(a_strDate,10)!=k_intOk) || (a_strDate.charAt(2)!='/') || (a_strDate.charAt(5)!='/'))
		return k_intStructureDateInvalide;

	switch (a_strCodelangue)
	{
		case "Fr" : case "fr" :
			jour=parseInt(a_strDate.substring(0,2),10);
			mois=parseInt(a_strDate.substring(3,5),10);
			break;
		default :
			mois=parseInt(a_strDate.substring(0,2),10);
			jour=parseInt(a_strDate.substring(3,5),10);
			break;
	}
	annee=parseInt(a_strDate.substring(6,10),10);

	if ( (jour<1) || (jour>31) || (mois<1) || (mois>12) )
		return k_intDateInvalide;
	if ( ( (mois==4) || (mois==6) || (mois==9) || (mois==11)) && (jour==31) )
		return k_intDateInvalide;
	if ( (mois==2) && (jour>29) )
		return k_intDateInvalide;
	if ( (mois==2) && (jour==29) ) {
		Dsiecle=parseInt(a_strDate.substring(6,8));
		Fsiecle=parseInt(a_strDate.substring(8,10));		
		if (Fsiecle==0)
			result=(Dsiecle/4);
		else
			result=(annee/4);
		arrondit = Math.round(result);
		if ( ((result-arrondit)!=0) && ((result-arrondit)!=1))
			return k_intDateInvalide;
	}
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ValidEmail (a_strEmail)
{
	var FindCar;
	var PtrStrOrigine;
	var g_intPositionAt=0;
	var g_intPositionLastAt=0;
	var g_intPositionLastPoint=0;
	var g_strCarAutorise="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@.-_";
	if (a_strEmail.length < 5 )
		return k_intLngInvalide;
	for (FindCar=0, ptrStrOrigine = 0; (ptrStrOrigine < a_strEmail.length) && (FindCar!=-1) ;ptrStrOrigine++)
		FindCar=g_strCarAutorise.indexOf(a_strEmail.charAt(ptrStrOrigine));
	if (FindCar==-1)
		return k_intCarNonAutorise;
	g_intPositionAt = a_strEmail.indexOf("@");
	g_intPositionLastAt = a_strEmail.lastIndexOf("@");
	if ( (g_intPositionAt==-1) || (g_intPositionLastAt!=g_intPositionAt) || (g_intPositionAt<2) )
		return k_intStructureEmailInvalide;

	g_intPositionLastPoint = a_strEmail.lastIndexOf(".");
	if ( (g_intPositionLastPoint==-1) || ((a_strEmail.length - g_intPositionLastPoint)>4))
		return k_intStructureEmailInvalide;

	if (g_intPositionLastPoint<g_intPositionAt+2)
		return k_intStructureEmailInvalide;
	
	return k_intOk;
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function display_day(strLangue,strType)
{
	var date=new Date();
	var monthName;
	var dayName;
	var arDate;
	if (strLangue==k_strlng_Fr)
	{
		dayName=new Array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi');
		switch (strType)
		{
			case 'full' :
				monthName= new Array('Janvier', 'Février', 'Mars', 'Avril', 'Mai','Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre');
				document.write(dayName[date.getDay()] + " " + date.getDate() + " " + monthName[date.getMonth()] + " " + date.getFullYear());
				break;
			case 'medium' :
				document.write(dayName[date.getDay()] + " " + date.getDate() + "/" + (date.getMonth()+1) + "/" + date.getFullYear());
				break;
		}
	}
	else
	{
	    dayName=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
		switch (strType)
		{
			case 'full' :
				monthName= new Array('January', 'February', 'March', 'April', 'May', 'June','July', 'August', 'September', 'October', 'November', 'December');
				arDate = new Array("0th","1st","2nd","3rd","4th","5th","6th","7th","8th","9th","10th","11th","12th","13th","14th","15th","16th","17th","18th","19th","20th","21st","22nd","23rd","24th","25th","26th","27th","28th","29th","30th","31st");
				document.write(dayName[date.getDay()] + ", " + monthName[date.getMonth()] + " " + arDate[date.getDate()] + ", " + date.getFullYear());
				break;
			case 'medium' :
				document.write(dayName[date.getDay()] + " " + (date.getMonth()+1) + "/" +  date.getDate() + "/" + date.getFullYear());
				break;
		}

	}
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function servicepopup(strUrl,strId)
{
	newwin=window.open(strUrl,strId,"toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=yes,directories=no,width=750,height=500");
}		 


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function popup(strUrl,strId)
{
	newwin=window.open(strUrl,strId,"toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,directories=no,width=650,height=400");
}		 


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function popupWithSize(strUrl,strId, width, height)
{
	newwin=window.open(strUrl,strId,"toolbar=no,menubar=no,location=no,status=no,scrollbars=yes,resizable=yes,directories=no,width=" + width + ",height=" + height );
}


function OpenerDirection(strChemin)
{
	if (window.opener == null || window.opener.closed )
	{
		window.location.href = strChemin ;
	}
	else
	{
		window.opener.location.href = strChemin ;
		window.close() ;
	}
}
//***************************************
// ferme la fenetre courante si la fenetre opener est tjs ouverte
//
// 16/06/2005 - PGU : Création
//***************************************
function OpenerClose(strChemin)
{
	if (!(window.opener == null || window.opener.closed ))
	{
		window.opener.location.reload();
		window.close() ;
	}
}

//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function SendMail(a_strNomAffiche, a_strNom, a_strDomaine, a_style)
{
	var lienMailTo;
	lienMailTo = '<a href=\"mailto:' + a_strNom + '@' + a_strDomaine + '"';
	if ( a_style != "" )
	{
		lienMailTo = lienMailTo + ' class=\"' + a_style + '\"';
	}
	lienMailTo = lienMailTo +'\>';
	if ( a_strNomAffiche == "" )
	{
		lienMailTo = lienMailTo + a_strNom + '@' + a_strDomaine;
	}
	else
	{
		lienMailTo = lienMailTo + a_strNomAffiche;
	}
	lienMailTo = lienMailTo + '</a>';

	document.write ( lienMailTo );
}


//***************************************
// Permet de masquer une adresse mail avec un lien sur une image
//
// 18/01/2006 - SMN : Création
//***************************************
function SendMailSurImage(a_strUrlImage, a_strNom, a_strDomaine, a_strAlt) {
	var lienMailTo;
	lienMailTo = '<a title=\"' + a_strAlt + '\" href=\"mailto:' + a_strNom + '@' + a_strDomaine + '"';
	lienMailTo = lienMailTo + '><img alt=\"' + a_strAlt + '\" src=\"' + a_strUrlImage + '\" border=\"0\"></a>';
	document.write ( lienMailTo );
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ftcoOpt(t,v)
{
	oOpt1 = new Option(t, v);
	document.forms[0].LstCont.options[document.forms[0].LstCont.options.length] = new Option(t, v);
	document.forms[0].LstOrg.options[document.forms[0].LstOrg.options.length] = new Option(t, v);
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function verif()
{ 
	if(document.forms[0].datedeb.value == "" && document.forms[0].datefin.value == "" || document.forms[0].datedeb.value == "" && document.forms[0].datefin.value != "" || document.forms[0].titre.value == "")
		alert('Vous n\'avez pas remplis tous les champs obligatoires');
	else
		document.forms[0].submit();
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ftcRecharge(strChemin)
{
	self.location = strChemin ; 
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ftcRechargeParent()
{
  self.location = "indexparent.asp" ; 
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ftcRechargeActu(idx)
{
  self.location = "indexactu.asp?IdxRubriqueparent=" + idx; 
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function ftcRechargeParentActu()
{
  self.location = "indexparent.asp" ; 
  parent.bottom.location = "../vide.htm" 
}


//***************************************
// ???
//
// ??/??/???? - ??? : Création
//***************************************
function AvertirThesaurus(strUrl)
{
	var strUrlAlerte;
	strUrlAlerte = '/01-Bibliotheque/0G-Thesaurus-cancerologie/avertissement-thesaurus.asp?strUrl=' + strUrl;
	window.open(strUrlAlerte,"new_window", 'scrollbars=yes,resizable=yes,width=500,height=330');
}


// Check browser version
var isNav4 = false, isNav5 = false, isIE4 = false
var strSeperator = "/"; 
// If you are using any Java validation on the back side you will want to use the / because 
// Java date validations do not recognize the dash as a valid date separator.
var vDateType = 1; // Global value for type of date format
//                1 = mm/dd/yyyy
//                2 = yyyy/dd/mm  (Unable to do date check at this time)
//                3 = dd/mm/yyyy
var vYearType = 4; //Set to 2 or 4 for number of digits in the year for Netscape
var vYearLength = 2; // Set to 4 if you want to force the user to enter 4 digits for the year before validating.
var err = 0; // Set the error code to a default of zero
if(navigator.appName == "Netscape")
{
	if (navigator.appVersion < "5")
	{
		isNav4 = true;
		isNav5 = false;
	}
	else
	{
		if (navigator.appVersion > "4")
		{
			isNav4 = false;
			isNav5 = true;
		}
	}
}
else
{
	isIE4 = true;
}

//*********************************************************
// Fonction qui gère un window.open avec un focus
//
// 15/10/2004 - GBD : Creation
//********************************************************* 
function MM_openBrWindow(theURL,winName,features) { //v2.0
  var w;
  w=window.open(theURL,winName,features);
  w.focus();
}


//*********************************************************
// GotoURL
//
// 15/10/2004 - GBD : Creation
//********************************************************* 
function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}


//*********************************************************
// MM_validateForm
//
// ??/??/???? - ??? : Creation
//********************************************************* 
function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}


//*********************************************************
// MM_validateForm
//
// ??/??/???? - ??? : Creation
//********************************************************* 
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+' must contain an e-mail address.\n';
      } else if (test!='R') {
        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 (val<min || max<val) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } 
  if (errors) {
  alert('Les champs ne sont pas correctement remplis');
  document.MM_returnValue = false; 
  }
  else
  {
  //document.annuaire.submit();
  document.MM_returnValue = true; 
  }
}
//comparaison de date si date 1>date2 renvoie 1, si date1=date2 renvoie 0, si date1<date2 renvoie -1
function CompareDate(a_date1, a_date2)
{

//mois de 0 à 11
var date1 = new Date(Year(a_date1), Month(a_date1)-1, Day(a_date1));
var date2 = new Date(Year(a_date2), Month(a_date2)-1, Day(a_date2));

if (date1 > date2)
	{   return 1; }
if (date2 > date1)
	{   return -1; }
if (date1 = date2)
	{   return 0; }		
}
// extrait l annee dune  date jj/mm/yyyy
function Year(a_date)
{
	return a_date.substring(6,10)
}
// extrait le mois dune  date jj/mm/yyyy
function Month(a_date)
{
	return a_date.substring(3,5)
}
// extrait le jour dune  date jj/mm/yyyy
function Day(a_date)
{
	return a_date.substring(0,2)
}
function setFocus() {

	focus();

}

function findInPage(str) {
	var txt, i, found;
	if (str == "") { return false; }
	if (NS4) {
		if (!win.find(str)) {
			while(win.find(str, false, true)) {
				n++;
			}
		} else {
			n++;
		}
		if (n == 0) { alert(str + " n\'a pas été trouvé sur la page."); }
	}
	if (IE4) {
		txt = win.parent.contenu.document.body.createTextRange();
		for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
			txt.moveStart("character", 1);
			txt.moveEnd("textedit");
		}
		if (found) {
			txt.moveStart("character", -1);
			txt.findText(str);
			txt.select();
			txt.scrollIntoView();
			n++;
		} else {
			if (n > 0) {
				n = 0;
				findInPage(str);
			} else {
 				alert(str + " n\'a pas été trouvé sur la page.");
			}
		}
	}
	return false;
}

function findInPageLocal(str) {

	var txt, i, found;
	if (str == "") { return false; }
	if (NS4) {
		if (!win.find(str)) {
			while(win.find(str, false, true)) {
				n++;
			}
		} else {
			n++;
		}
		if (n == 0) { alert(str + " n\'a pas été trouvé sur la page."); }
	}
	if (IE4) {
		txt = win.document.body.createTextRange();
		for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
			txt.moveStart("character", 1);
			txt.moveEnd("textedit");
		}
		if (found) {
			txt.moveStart("character", -1);
			txt.findText(str);
			txt.select();
			txt.scrollIntoView();
			n++;
		} else {
			if (n > 0) {
				n = 0;
				findInPage(str);
			} else {
 				alert(str + " n\'a pas été trouvé sur la page.");
			}
		}
	}
	return false;
}
function fragmentString(string,size){
var output=new Array();
	if(!size){return output};
	if(string.length<=size){
		output.length++;output[0]=string;
		return output;};
var pieces=((string.length%size))?
	parseInt((string.length/size)+1):(string.length/size);
	var grabPoint=-size;
	var correctSize=0;
	for(var i=0;i < pieces;i++){
	correctSize+=((grabPoint+size)>(string.length+1))?
	(string.length):size;
	grabPoint+=size;
	output[(++output.length)-1]=string.substring(grabPoint,correctSize);
	}
	return output;
} 
//*********************************************************
// Get_Cookie
//
// ??/??/???? - ??? : Creation
//********************************************************* 
function Get_Cookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && 
	( name != document.cookie.substring( 0, name.length ) ) )
	{
	return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
//*********************************************************
// Set_Cookie
//
// ??/??/???? - ??? : Creation
//********************************************************* 
function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );
	
	/*
	if the expires variable is set, make the correct 
	expires time, the current script below will set 
	it for x number of days, to make it for hours, 
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}
//*********************************************************
// Delete_Cookie
//
// ??/??/???? - ??? : Creation
// 01/12/2005 - GBE : Attention cette fonction ne fait pas la même chose sous IE et Firefox
// Sous IE : le cookie est mis à la valeur null
// Sous Firefox : le cookie est mis à la valeur ""
//********************************************************* 
function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
	( ( path ) ? ";path=" + path : "") +
	( ( domain ) ? ";domain=" + domain : "" ) +
	";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

//*********************************************************
// Permet de récupérer la valeur d'un objet FCKEditor
// instanceName est le nom de l'objet créé
//
// 21/07/2005 - ELS : Creation
//********************************************************* 
function getEditorValue( instanceName ) 
{  
  // Get the editor instance that we want to interact with.
  var oEditor = FCKeditorAPI.GetInstance( instanceName ) ;
  
  // Get the editor contents as XHTML.
  return oEditor.GetXHTML( true ) ;  // "true" means you want it formatted.
}  
//*********************************************************
// Equivalent au trim vb
//
// 03/08/2005 - PGU : Creation (repompage)
// 11/10/2005 - MBE : Il vaut mieux remplacer ce code par une RegExp
//********************************************************* 
function trim(s) {
  /*
  while (s.substring(0,1) == ' ') {
    s = s.substring(1,s.length);
  }
  while (s.substring(s.length-1,s.length) == ' ') {
    s = s.substring(0,s.length-1);
  }
  return s;
  */
  return s.replace(/^\s*|\s*$/g, "");
}