function OpenWindow(url, nom) {
	var taille_w = 800;
	var taille_h = 600;
	var top_w    = 0;
	var top_h    = 0;
	if (screen.height > taille_h)
	{
		top_h = (screen.height - taille_h) / 2;
	} 
	if (screen.width > taille_w)
	{
		top_w = (screen.width - taille_w) / 2;
	}
	window.winref=window.open(url, nom, "top="+top_h+",left="+top_w+",width="+taille_w+",height="+taille_h+",scrollbars=yes,resizeble=0");
	window.winref.focus();
}

function OpenWindowP(url, nom) {
	var taille_w = 700;
	var taille_h = 400;
	var top_w    = 0;
	var top_h    = 0;
	if (screen.height > taille_h)
	{
		top_h = (screen.height - taille_h) / 2;
	} 
	if (screen.width > taille_w)
	{
		top_w = (screen.width - taille_w) / 2;
	}
	window.winref= window.open(url, nom, "top="+top_h+",left="+top_w+",width="+taille_w+",height="+taille_h+",scrollbars=yes,resizeble=0");
	window.winref.focus();
}
var regExpBeginning = /^\s+/;
var regExpEnd = /\s+$/;  

// Supprime les espaces inutiles en début et fin de la chaîne passée en paramètre.
function trim(aString) {
    return aString.replace(regExpBeginning, "").replace(regExpEnd, "");
}

// Supprime les espaces inutiles en début de la chaîne passée en paramètre.
function ltrim(aString) {
    return aString.replace(regExpBeginning, "");
}

// Supprime les espaces inutiles en fin de la chaîne passée en paramètre.
function rtrim(aString) {

    return aString.replace(regExpEnd, "");
}

var FormatEmail = /^[\w\-]+(\.[\w\-]+)*@[\w\-]+(\.[\w\-]+)*\.[\w\-]{2,}$/;
function estCeUnMail(Email) {
    reponse=FormatEmail.test(Email)
    if (reponse) {
		return true;
	}
    else {
		return false;
	}
}

function Rafraich(Url) {
   window.opener.location=Url;
//   window.opener.reload();
   window.close();
}

// Fonction pour limiter la saisie dans un text-area
function getLength(texte,Max){
	var root = frmIB.formulaire;
	if (texte.length > Max){
		texte = texte.substring(0,max);
		document.frmIB.Message.value = texte;
	}
}

// Fonction pour changer de rubrique (bandeau)
function ChangerRub(CodeType,CodeLangue) {
	document.frmIB.CodeType.value = CodeType;
	document.frmIB.action=CodeLangue+'Impulse.php';
	document.frmIB.submit();
}



