<!--
// Ajoute la fonction trim comme méthode de l'objet String.
String.prototype.trim = function()
{ return this.replace(/(^\s*)|(\s*$)/g, ""); }

// Ajoute la fonction string comme méthode de l'objet String.
String.prototype.string = function(nb)
{ var tmp=""; for(var i=1;i<=nb;i++) tmp+=this; return tmp; }

var adresse = new String ("");
var details = new String("");
var largeur = new String("");
var hauteur = new String("");

var leftpos = 0;
var toppos = 0;

function ouvre (adresse,largeur, hauteur) {

//Calcul position fenêtre
/*
//Avec paramètres propres à chaque navigateur
if (ns4) {
winW = window.innerWidth;
winH = window.innerHeight;
  }
  else if (ie4) {
  winW = document.body.scrollWidth;
  winH = document.body.scrollHeight;
  }
  else if (ns6) {
  }
//Avec calcul sur l'écran standard

leftpos = (winW - largeur) / 2;
toppos = (winH - hauteur) / 2;

leftpos =(screen.width)?(screen.width-largeur)/2:100;
toppos =(screen.height)?(screen.height-hauteur)/2:100;
*/

leftpos = (screen.width - largeur) / 2;
toppos = (screen.height - hauteur) / 2;

leftpos = parseInt(leftpos,10);
toppos = parseInt(toppos,10);

if (leftpos < 0) {leftpos = 0};
if (toppos < 0) {toppos = 0};

details = ",status=no,resizable=yes,scrollbars=yes";
details = details + ",width=" + largeur + ",height=" + hauteur + ",top=" + toppos + ",left=" + leftpos;

var fenetre = window.open (adresse,'',details);
fenetre.focus();
}

function ouvre_sans (adresse, largeur, hauteur) {

leftpos = (screen.width - largeur) / 2;
toppos = (screen.height - hauteur) / 2;

leftpos = parseInt(leftpos,10);
toppos = parseInt(toppos,10);

if (leftpos < 0) {leftpos = 0};
if (toppos < 0) {toppos = 0};

details = ",status=no,resizable=yes";
details = details + ",width=" + largeur + ",height=" + hauteur + ",top=" + toppos + ",left=" + leftpos;

var fenetre = window.open (adresse,'',details);
fenetre.focus();
}

function photo (adresse,largeur, hauteur) {

//Calcul position fenêtre
/*
leftpos =(screen.width)?(screen.width-largeur)/2:100;
toppos =(screen.height)?(screen.height-hauteur)/2:100;
*/

leftpos = (screen.width - largeur) / 2;
toppos = (screen.height - hauteur) / 2;

leftpos = parseInt(leftpos,10);
toppos = parseInt(toppos,10);

if (leftpos < 0) {leftpos = 0};
if (toppos < 0) {toppos = 0};

details = ",status=no,resizable=yes";
details = details + ",width=" + largeur + ",height=" + hauteur + ",top=" + toppos + ",left=" + leftpos;

var fenetre = window.open(adresse,'',details);
fenetre.focus();
}


var indexS = 0;
var strChoix = new String ("");
var Nombre = 0;
var Debut = 0;
var Total = 0;
var Fin = 0;

function change(formulaire){
	indexS = formulaire.choix.options.selectedIndex;
	strChoix = formulaire.choix.options[indexS].value;
	formulaire.nom.value = strChoix;
	formulaire.index.value = indexS;
	formulaire.action = formulaire.nomfichier.value;
	formulaire.submit();
return true;
}

function change_direction(formulaire){
	indexS = formulaire.choix.options.selectedIndex;
	strChoix = formulaire.choix.options[indexS].value;
	formulaire.direction.value = strChoix;
	formulaire.index.value = indexS;
	formulaire.action = formulaire.nomfichier.value;
	formulaire.submit();
return true;
}

function precedent(formulaire){
	var	nombre = formulaire.nb_enreg.value;
	var	debut = formulaire.nb_debut.value;
	var	total = formulaire.nb_total.value;
	var temp = debut - nombre;
	if (temp <= 0) { debut = 0;
	} else { debut = temp; }
	formulaire.nb_debut.value = debut;
	formulaire.action = formulaire.nomfichier.value;
	formulaire.submit();
return true;
}

function suivant(formulaire){
	var	nombre = formulaire.nb_enreg.value;
	var	debut = formulaire.nb_debut.value;
	var	total = formulaire.nb_total.value;
	var temp = debut + nombre;
	if (temp >= total) { debut = (total - nombre);
	} else { debut = temp; }
	formulaire.nb_debut.value = debut;
	formulaire.action = formulaire.nomfichier.value;
	formulaire.submit();
return true;
}

var index1 = 0;
var index2 = 0;
var strChoix1 = new String ("");
var strChoix2 = new String ("");

function change2(formulaire){
	index1 = formulaire.choix1.options.selectedIndex;
	index2 = formulaire.choix2.options.selectedIndex;
	strChoix1 = formulaire.choix1.options[index1].value;
	strChoix2 = formulaire.choix2.options[index2].value;
	formulaire.mois.value = strChoix1;
	formulaire.annee.value = strChoix2;	
	formulaire.index1.value = index1;
	formulaire.index2.value = index2;	
	formulaire.action = formulaire.nomfichier.value;
	formulaire.submit();
return true;
}

function fn_change_cat(formulaire){
	indexS = formulaire.choix_cat.options.selectedIndex;
	strChoix1 = formulaire.choix_cat.options[indexS].value;
	strChoix2 = formulaire.choix_cat.options[indexS].text;
	formulaire.codcat.value = strChoix1;
	formulaire.categorie.value = strChoix2;
	return true;
}

function fn_change_ville(formulaire){
	indexS = formulaire.choix_ville.options.selectedIndex;
	strChoix1 = formulaire.choix_ville.options[indexS].value;
	strChoix2 = formulaire.choix_ville.options[indexS].text;
	formulaire.codville.value = strChoix1;
	formulaire.nomville.value = strChoix2;
	return true;
}

function fn_change_sport(formulaire){
	indexS = formulaire.choix_sport.options.selectedIndex;
	strChoix1 = formulaire.choix_sport.options[indexS].value;
	strChoix2 = formulaire.choix_sport.options[indexS].text;
	formulaire.codsport.value = strChoix1;
	formulaire.categorieSport.value = strChoix2;
	return true;
}

function fn_change_assoc(formulaire){
	indexS = formulaire.choix_assoc.options.selectedIndex;
	strChoix1 = formulaire.choix_assoc.options[indexS].value;
	strChoix2 = formulaire.choix_assoc.options[indexS].text;
	formulaire.codAssoc.value = strChoix1;
	formulaire.themeAssoc.value = strChoix2;
	return true;
}

function fn_change_mois(formulaire){
	indexS = formulaire.choix_mois.options.selectedIndex;
	strChoix = formulaire.choix_mois.options[indexS].value;
	formulaire.nommois.value = strChoix;
	return true;
}

function fn_change_annee(formulaire){
	indexS = formulaire.choix_annee.options.selectedIndex;
	strChoix = formulaire.choix_annee.options[indexS].value;
	formulaire.nomannee.value = strChoix;
	return true;
}

function fn_change_couleur(formulaire){
	indexS = formulaire.choix_couleur.options.selectedIndex;
	strChoix = formulaire.choix_couleur.options[indexS].value;
	//alert ("Choix couleur fond titre : " + strChoix);
	formulaire.fond_titre.value = strChoix;
	return true;
}

function fn_checkbox(tcheckbox){
var valeur = 0;
	if (tcheckbox.checked == true) {
		valeur = 1;
		}
		else {
		valeur = 0;
		}
	return valeur;
}

function nouveau(formulaire){
	formulaire.sCache.value = "Nouveau";
	return true;
}

function verif_email(formulaire, email){
var modele_email = "^([a-zA-Z0-9]+(([\.\-\_]?[a-zA-Z0-9]+)+)?)\@(([a-zA-Z0-9]+[\.\-\_])+[a-zA-Z]{2,4})$";
	formulaire.sCache.value = "Nouveau";
	return true;
}

function affiche_courriel(texte1,texte,nom,prestataire,style)
{
var tg="<";
var arob="@";
document.write(texte1+tg+"a hr"+"ef=mai"+"lto:"+nom);
document.write(arob+prestataire+" class=" + style + ">"+texte+tg+"/a><br />");
}

function clickOnItem(lienItem, texteItem) 
{ 
/*window.location.href=indexItem;  */
document.write('<a href="' + lienItem + '" target="_blank" rel="noindex,nofollow">' + texteItem + '</a> ');
}

/*
<%
patrn="^([a-zA-Z0-9]+(([\.\-\_]?[a-zA-Z0-9]+)+)?)\@(([a-zA-Z0-9]+[\.\-\_])+[a-zA-Z]{2,4})$"

strng=Request.Form("mail")              
If test(patrn,strng) = False Then
message="<font class=averto>Erreur : L'adresse email " & strng & " n'est pas valide !</font>" 

Function test(patrn, strng) 

Dim regEx                                   ' Crée la variable.
Set regEx = New RegExp      ' Crée une expression régulière.
        regEx.Pattern = patrn       ' Définit les critères.
        regEx.IgnoreCase = False        ' Teste la casse
        regEx.Global = True     ' Définit le champ d'application.
test = regEx.test(strng)               ' Contrôle de la chaîne
    
End Function
%>
*/

function cleanHTML(unclean) 
{ 
/* Armoise 27 05 2003 PM */
unclean = unclean.replace(/^\s/i, ''); //Removes Spaces on the beginning 
unclean = unclean.replace(/\s$/i, ''); //Removes Spaces on the end 
unclean = unclean.replace(/^<P>/i, ''); //Removes beginning <P> 
unclean = unclean.replace(/<P>$/i, ''); //Removes last <P> 
unclean = unclean.replace(/<\/P>$/i, ''); //Removes last <P> 
unclean = unclean.replace(/<P>/gi, '<br>');	//Replace opening <P> by <br>
unclean = unclean.replace(/<\/P>/gi, '<br>'); //Replace closing </P> by <br>
unclean = unclean.replace(/à/gi, '\&agrave\;'); //Replace à by &agrave;
unclean = unclean.replace(/á/gi, '\&aacute\;'); //Replace á by &aacute;
unclean = unclean.replace(/â/gi, '\&acirc\;'); //Replace â by &acirc;
unclean = unclean.replace(/ã/gi, '\&atilde\;'); //Replace ã by &atilde;
unclean = unclean.replace(/ä/gi, '\&auml\;'); //Replace ä by &auml;
unclean = unclean.replace(/æ/gi, '\&aelig\;'); //Replace æ by &aelig;
unclean = unclean.replace(/é/gi, '\&eacute\;'); //Replace é by &eacute;
unclean = unclean.replace(/è/gi, '\&egrave\;'); //Replace è by &egrave;
unclean = unclean.replace(/ê/gi, '\&ecirc\;'); //Replace è by &ecirc;
unclean = unclean.replace(/ë/gi, '\&euml\;'); //Replace ë by &euml;
unclean = unclean.replace(/î/gi, '\&icirc\;'); //Replace î by &icirc;
unclean = unclean.replace(/ï/gi, '\&iuml\;'); //Replace ï by &iuml;
unclean = unclean.replace(/ô/gi, '\&ocirc\;'); //Replace ô by &ocirc;
unclean = unclean.replace(/ö/gi, '\&ouml\;'); //Replace ö by &ouml;
unclean = unclean.replace(/ù/gi, '\&ugrave\;'); //Replace ù by &ugrave;
unclean = unclean.replace(/ü/gi, '\&uuml\;'); //Replace ü by &uuml;
unclean = unclean.replace(/ú/gi, '\&uacute\;'); //Replace ú by &uacute;
unclean = unclean.replace(/û/gi, '\&ucirc\;'); //Replace û by &ucirc;
unclean = unclean.replace(/ÿ/gi, '\&yuml\;'); //Replace ÿ by &yuml;
unclean = unclean.replace(/ç/gi, '\&ccedil\;'); //Replace ç by &ccedil;
unclean = unclean.replace(/Ç/gi, '\&Ccedil\;'); //Replace Ç by &Ccedil;
unclean = unclean.replace(/’/gi, '\&acute\;'); //Replace ’ by &acute; Apostrophe type Word
unclean = unclean.replace(/À/gi, '\&Agrave\;'); //Replace À by &Agrave;
unclean = unclean.replace(/Á/gi, '\&Aacute\;'); //Replace Á by &Aacute;
unclean = unclean.replace(/Â/gi, '\&Acirc\;'); //Replace Â by &Acirc;
unclean = unclean.replace(/Ä/gi, '\&Auml\;'); //Replace Ä by &Auml;
unclean = unclean.replace(/Ã/gi, '\&Atilde\;'); //Replace Ã by &Atilde;
unclean = unclean.replace(/È/gi, '\&Egrave\;'); //Replace È by &Egrave;
unclean = unclean.replace(/É/gi, '\&Eacute\;'); //Replace É by &Eacute;
unclean = unclean.replace(/Ê/gi, '\&Ecirc\;'); //Replace Ê by &Ecirc;
unclean = unclean.replace(/Ë/gi, '\&Euml\;'); //Replace Ë by &Euml;
unclean = unclean.replace(/Ú/gi, '\&Uuml\;'); //Replace Ü by &Uuml;
unclean = unclean.replace(/®/gi, '\&reg\;'); //Replace ® by &reg;
unclean = unclean.replace(/°/gi, '\&deg\;'); //Replace ° by &deg;
unclean = unclean.replace(/²/gi, '\&sup2\;'); //Replace ² by &sup2;
unclean = unclean.replace(/³/gi, '\&sup3\;'); //Replace ³ by &sup3;
unclean = unclean.replace(/½/gi, '\&frac12\;'); //Replace ½ by &frac12;
unclean = unclean.replace(/¼/gi, '\&frac14\;'); //Replace ¼ by &frac14;
unclean = unclean.replace(/¾/gi, '\&frac34\;'); //Replace ¾ by &frac34;
unclean = unclean.replace(/¦/gi, '\&brvbar\;'); //Replace ¦ by &brvbar;
unclean = unclean.replace(/«/gi, '\&laquo\;'); //Replace « by &laquo;
unclean = unclean.replace(/»/gi, '\&raquo\;'); //Replace » by &raquo;
unclean = unclean.replace(/€/gi, '\&euro\;'); //Replace € by &euro; Euro
unclean = unclean.replace(/©/gi, '\&copy\;'); //Replace © by &copy; Copyright
unclean = unclean.replace(/§/gi, '\&sect\;'); //Replace § by &sect;
/*
// Caractères spéciaux de mise en forme HTML
unclean = unclean.replace(/&/gi, '\&amp\;'); //Replace & by &amp;
unclean = unclean.replace(/</gi, '\&lt\;'); //Replace < by &lt;
unclean = unclean.replace(/>/gi, '\&gt\;'); //Replace > by &gt;
unclean = unclean.replace(/"/gi, '\&quot\;'); //Replace " by &quot;
*/
/* Fin Armoise 27 05 2003 PM */

unclean = unclean.replace(/<(\/)?strong>/ig, '<$1B> '); //replaces <STRONG> with <B>
//unclean = unclean.replace(/<(\/)?em>/ig, '<$1I> '); //replaces <EM> with <I>
//unclean = unclean.replace(/<P class=[^>]*>/gi, '<P>');
//First, we make the code a single line
unclean = unclean.replace(/\r\n/g, '');
unclean = unclean.replace(/\n/g, '');
unclean = unclean.replace(/\r/g, '');

return unclean; 
} 

//--> 
