/**
 diverse fonctions utilitaires
*/

/**
Taille de polices 
*/
function changePoliceSize(p_action) {
	var obj = document.getElementById("ctn_tozoom");
	
	if (obj) {
		if (obj.style.fontSize == '')
			obj.style.fontSize = "11%";
		
		
		if (p_action == '+') {
			if (parseInt(obj.style.fontSize) < 17)
				obj.style.fontSize = (parseInt(obj.style.fontSize) + 2)+'px';
		} else {
			if (parseInt(obj.style.fontSize) > 7)
				obj.style.fontSize = (parseInt(obj.style.fontSize) - 2)+'px';
		}
	}
	return false;
}

/**
Impression
*/
function impression() {
	window.print();
}

function ouvrirImpression() {
	if (window.isListeQC) impression();
	else {
		var u = window.location.href;
		if (u.indexOf('?') == -1) window.open(u+'?impression=oui');
		else window.open(u+'&impression=oui');
	}
}

function switchImpression(nb) {
	var u = window.location.href;
	var p = u.indexOf('impression=');
	if (p == -1) return;
	window.location.replace(u.substring(0,p)+'impression='+nb);
}

/**
Contrôles
*/
function is_email_ok(p_mail) {
	var atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';
	var domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)';
	var expr = '^' + atom + '+';
	expr 	+= '(\.' + atom + '+)*';			
												
	expr 	+= '@';	
	expr 	+= '(' + domain + '{1,63}\.)+';
	expr 	+= domain + '{2,63}$';
	expression = new RegExp(expr);
	return (expression.exec(p_mail) != null);
}

/**
Champs de saisie
*/
function ClearField(form,champ){ 
     eval (that=window.document [form] [champ]); 
     if(form='recherche' && that.value=='Saisissez un mot')that.value='';
	 if(form='identification' && that.value=='motpasse')that.value='';
	 if(form='identification' && that.value=='Votre identifiant')that.value='';
	 if(form='recevoir' && that.value=='Saisissez votre adresse électronique')that.value='';
}

function initField(form,champ,v) {
	var f = window.document[form];
	if (f == null) return;
	var c = f.elements[champ];
	if (c == null) return;
	c.value=v;
}

/**
Tracking newsletter
*/
function trackNewsSignIn(p_mail){
	if (is_email_ok(p_mail)){
		pageTracker._trackEvent(" Newsletter", "Clic", " Inscription Newsletter ", " " );
		return true;
	}
	else{
		//alert("Vous devez indiquer une adresse e-mail valide");
		return false;
	}
}