function Ouvre_Fenetre(Url, Nom_Fenetre, largeur, hauteur)
{
var proprietes = "";

proprietes = proprietes + "location=no";
proprietes = proprietes + ",directories=no";
proprietes = proprietes + ",status=no";
proprietes = proprietes + ",toolbar=no";
proprietes = proprietes + ",menubar=no";
proprietes = proprietes + ",scrollbars=no";
proprietes = proprietes + ",resizable=no";
proprietes = proprietes + ",width=" + largeur;
proprietes = proprietes + ",height=" + hauteur;


var w=window.open(Url,Nom_Fenetre,proprietes);
w.window.focus();
}



function Ouvre_Fenetre_Scroll(Url, Nom_Fenetre, largeur, hauteur)
{
var proprietes = "";

proprietes = proprietes + "location=no";
proprietes = proprietes + ",directories=no";
proprietes = proprietes + ",status=no";
proprietes = proprietes + ",toolbar=no";
proprietes = proprietes + ",menubar=no";
proprietes = proprietes + ",scrollbars=yes";
proprietes = proprietes + ",resizable=yes";
proprietes = proprietes + ",width=" + largeur;
proprietes = proprietes + ",height=" + hauteur;

var w=window.open(Url,Nom_Fenetre,proprietes);
w.window.focus();
}


function Ouvre_Navigateur(Url, Nom_Fenetre)
{
	var w=window.open(Url,Nom_Fenetre);
	w.window.focus();
}


function Change_Page(URL_Tetiere, URL_PagePrincipale)
{
	//alert('Avant');
	parent.Frame_Tetiere.location = URL_Tetiere;
	parent.Frame_Principale.location = URL_PagePrincipale;
	//alert('Après');
}





function Verif_Format_Email(adresse)
{
	var res = false;
	var pos_arrobase = adresse.indexOf("@");
	var pos_point = adresse.lastIndexOf(".");


	if ((pos_arrobase > 0)&&(adresse.length >4)&&(pos_point > pos_arrobase+1)&&(pos_point < adresse.length-1))
	{
		res = true;
	}
	else
	{
		alert('Entrez une adresse e-mail valide !!');
	}

	return res;
}




/*
####################################################################################################
## FONCTION : Permet d'ajouter des balises personnalisées autour du texte sélectionné
##			  Utilisé pour le Panneau de mise en forme du texte des champs de saisie de type MEMO_HTML
##			  Balises de type [balise=val]...[/balise]
##
## ENTREE ->  balise  : type de balise (ex. : doc, url, page,...)
## 			  val  : valeur de la balise (ex. : doc, url, page,...)
##
## SORTIE ->  Chaine de caractères avec la balise personnalisée encodée
## 
####################################################################################################*/
function Ajout_Balise(balise,val)
{
		theSelection = document.selection.createRange().text; // Get text selection
		if (theSelection) {
			// Add tags around selection
			document.selection.createRange().text = '['+balise+'='+val+']' + theSelection + '[/'+balise+']';
			theSelection = '';
			return;
		}
}
//=======================================================================================


/*
####################################################################################################
## FONCTION : Permet d'ajouter des balises HTML autour du texte sélectionné
##			  Utilisé pour le Panneau de mise en forme du texte des champs de saisie de type MEMO_HTML
##			  Balises de type <balise>...</balise>
##
## ENTREE ->  balise  : type de balise (ex. : strong, b, ...)
##
## SORTIE ->  Chaine de caractères avec la balise HTML
## 
####################################################################################################*/
function Ajout_Balise_HTML(balise)
{
		theSelection = document.selection.createRange().text; // Get text selection
		balise = balise.split(" ");
		nom_balise = balise[0];
		param_balise = balise[1];
		if (param_balise == null)
			param_balise = '';

		//alert(param_balise);

		if (theSelection) {
			// Ajout Balises autour de la selection
			document.selection.createRange().text = '<'+nom_balise+' '+param_balise+'>' + theSelection + '</'+nom_balise+'>';
			theSelection = '';
			return;
		}
}
//=======================================================================================


/*
####################################################################################################
## FONCTION : Permet d'afficher/masquer un element HTML à partir de son ID 
##			  (ex. : <div id="baliseId">...</div>)
##
## ENTREE ->  baliseId  : Identifiant de la balise
##
## SORTIE ->  Action
## 
####################################################################################################*/
function AfficherMasquer_Element(baliseId,action) 
{
  switch (action)
  {
   case 'inv':
   		if (baliseId.style.visibility=='hidden')
	    {
	      baliseId.style.visibility='visible';
	      baliseId.style.display='block';
	    }
	    else
	    {
	      baliseId.style.visibility='hidden';
	      baliseId.style.display='none';
	    }
	    break;


   case 'on':
	    baliseId.style.visibility='visible';
	    baliseId.style.display='block';
	    break;

   case 'off':
	    baliseId.style.visibility='hidden';
	    baliseId.style.display='none';
	    break;

  }
}
//=======================================================================================




/*
####################################################################################################
## FONCTION : Permet de cocher/décocher un ensemble de cases à cocher à partir de son nom 
##
## ENTREE ->  baliseId  : Identifiant de la balise
##
## SORTIE ->  Action
## 
####################################################################################################*/
function Checkbox_SelectAll(nom_element,val)
{
	for (var i=0; i<nom_element.length; i++) 
		nom_element[i].selected = nom_element[i].checked = val;
}
//=======================================================================================












function Ajout_Balise2()
{

// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);


	if ((clientVer >= 4) && is_ie && is_win)
	{
		theSelection = document.selection.createRange().text; // Get text selection
		if (theSelection) {
			// Add tags around selection
			document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
			txtarea.focus();
			theSelection = '';
			return;
		}
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
		return;
	}

}

function preg_replace (array_pattern, array_pattern_replace, my_string)
{
	var new_string = String (my_string);
	for (i=0; i<array_pattern.length; i++)
	{
		var reg_exp= RegExp(array_pattern[i], "gi");
		var val_to_replace = array_pattern_replace[i];
		new_string = new_string.replace (reg_exp, val_to_replace);
	}
	return new_string;
}


function supprime_balises()
{
		theSelection = document.selection.createRange().text; // Get text selection
		if (theSelection) {
			// Add tags around selection
			document.selection.createRange().text = preg_replace( "/\[url=(.*?)\](.*?)\[\/url\]/i" , "\${2}" , theSelection);
			theSelection = '';
			return;
		};
}
