function loaded() {
	if (extractQueryParams().confirm) {
		var l_props = defaultProps +
						'resizable=no,' +	//redimensionnement
						'width=510,' +
						'height=330,' +
						'screenX=200,' +		//position horizontale (NS, ne fonctionne pas sur IE)
						'screenY=150,' +
						'left=200,' +		//position horizontale (IE, ne fonctionne pas sur NS)
						'top=150' +
						'scrollbars=no'		//ascenseurs
		var theWindow = window.open("confirmation.htm", "confirmation", l_props); 
	
		if (theWindow) {
			theWindow.focus();
		} else {
			alert('Merci de votre intérêt.\nVous allez recevoir notre documentation par mail');
		}
	}
	// on récupère le formulaire
	var l_form = xbGetElementById("contact");
	
	// on spécifie l'url de retour, en utilisant l'url courante
	var l_loc = window.location.href;
	l_form._nextpage.value = l_loc + '?confirm=yes';
}

var _OBLIG = ['a01__Nom', 'a02__Prenom', 
		'a05__Email', 'a06__Telephone_principal', 'a08__Adresse_1', 'a10__Code_postal', 'a11__Ville', 'a12__Pays',
		'a13__Budget_personne', 'a19__Nombre_invites'];
var _LIB = ['nom', 'nom', 
		'mail', 'telephone', 'adresse', 'ville', 'ville', 'pays',
		'budget', 'invites'];


/**
 * Renvoie true si la chaîne passée est vide ou ne contient que des 'blancs'
 * @param  s chaîne à tester
 * @return true si chaîne 'vide'
 */
function isBlank(s) {
	if ((s == null) || (s == "")) {
		return true;
	}
	var c;
	for (var i = 0; i < s.length; i++) {
		c = s.charAt(i);
		if ((c != ' ') && (c != '\n') && (c != '')) return false;
	}
	return true;
}

/**
 * Renvoie true si la chaîne passée a bien 'une tête de' mail.
 * @param a_strEmail  chaîne à tester
 * @return true si 'tête de' mail
 */
function isValidEmail(a_strEmail){
  var l_validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
  if (a_strEmail.search(l_validRegExp) == -1) {
      return false;
  } 
  return true; 
}

function validateContact() {
	var l_form = xbGetElementById("contact");
	var l_ok = true;
	for (var i = 0; i < _OBLIG.length; i++) {
		if (isBlank(l_form[_OBLIG[i]].value)) {
			// on change la css du libellé associé
			xbGetElementById(_LIB[i]).style.color = '#FF0000';
			l_ok = false;
		}
	}
	if (!l_ok) {
		// on modifie la couleur de la légende
		xbGetElementById('leg').style.color = '#FF0000';
		// on avertit l'utilisateur
		alert('Les champs suivis du signe * sont obligatoires');
	}
	// on vérifie le mail
	if (l_ok && !isValidEmail(l_form[_OBLIG[2]].value)) {
		// on change la css du libellé associé
		xbGetElementById(_LIB[4]).style.color = '#FF0000';
		// on avertit l'utilisateur
		alert('Le mail n\'est pas valide');
		l_ok = false;
	}
	
	return l_ok;
}