// JavaScript Document
function popupCentre(txtPage,nbLargeur,nbHauteur,txtOption){
var nbHaut=(screen.height-nbHauteur)/2;
var nbGauche=(screen.width-nbLargeur)/2;
var winPopup=window.open(txtPage,"","top="+nbHaut+",left="+nbGauche+",width="+nbLargeur+",height="+nbHauteur+","+txtOption);
if(winPopup) {
	winPopup.focus();	
} else {
	alert("Ouverture boquée par l'anti-popup du navigateur \n Autoriser les popup dans les préférences")
}
}

function popupHautGauche(txtPage,nbLargeur,nbHauteur,txtOption){

var winPopup=window.open(txtPage,"","top=0,left=0,width="+nbLargeur+",height="+nbHauteur+","+txtOption);
if(winPopup) {
	winPopup.focus();	
} else {
	alert("Ouverture boquée par l'anti-popup du navigateur \n Autoriser les popup dans les préférences")
}
}
function lienOver(lien)
{
	lien.style.color="#FF0000";
	lien.style.backgroundColor="#009F3C";
}
function lienOut (lien)
{
	lien.style.color="#666666";
	lien.style.backgroundColor="#FFFFFF";
}

function setCookie(name, value, expires, path, domain, secure) {
	document.cookie=name+"="+escape(value)+
		((expires==undefined) ? "" : ("; expires="+expires.toGMTString()))+
		((path==undefined) ? "" : ("; path="+path))+
		((domain==undefined) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}
function getCookie(name) {
	if (document.cookie.length==0) { return null; }
	var regCookies=new RegExp("(; )","g");
	var cookies=document.cookie.split(regCookies);
	for (var i=0; i<cookies.length ; i++) {
		var regInfo=new RegExp("=","g");
		var infos=cookies[i].split(regInfo);
		if (infos[0]==name) {
			return unescape(infos[1]);
		}
	}
	return null;
}
function PopupImage(img,legende) { 
titre="Agrandissement";
w=open("",'image','width=400,height=200,toolbar=no,scrollbars=no,resizable=no');
w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
w.document.write("<SCRIPT language=javascript>function checksize() { if (document.images[0].complete) { window.resizeTo(document.images[0].width+150,document.images[0].height+200); window.moveTo(0, 0); window.focus();} else { setTimeout('checksize()',250) } }</"+"SCRIPT>")
w.document.write("<BODY bgcolor='#000000' onload='checksize()' onblur='window.close()' onclick='window.close()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");
w.document.write("<TABLE width='100%' border='0' cellspacing='0' cellpadding='0' height='100%'><TR>");
w.document.write("<TD valign='middle' align='center'><br/><IMG src='"+img+"' border='0' ><br/><br/><font size='2'><span style='color: rgb(255, 255, 255); font-family: verdana,arial,helvetica,sans-serif;'>"+legende);
w.document.write("</TD></TR></TABLE>");
w.document.write("</BODY></HTML>");
w.document.close();
} 
function alert_forum()
{
alert("Je suis en train de travailler sur cette page \n Certaines fonctions risquent de ne pas être utilisables \n J'espère que tout rentrera dans l'ordre bientôt \n Armand, depuis Clermont Ferrand ;-)");	
}

function initBulle()
{
	if(document.getElementById) {
		document.write("<div id=\"divBulle\"></div>");
	}
}

function infoBulle(text)
{
	if(document.getElementById) 
	{
		var div=document.getElementById("divBulle");
		div.innerHTML=text;
		div.style.visibility="visible";
		var X=posX;
		if(X<0) X=0;
		var Y=posY+20;
		div.style.top=Y+"px";
		div.style.left=X+"px";
	}
}

function fermerBulle()
{
	if(document.getElementById) 
	{
		document.getElementById("divBulle").style.visibility="hidden";
	}
}

var posX=0, posY=0;
document.onmousemove=getMousePos;
function getMousePos(e)
{
	if(document.all)
	{
		posX=event.x+document.body.scrollLeft;
		posY=event.y+document.body.scrollTop;
	}
	else
	{
		posX=e.pageX;
		posY=e.pageY;
	}
}

function isMail(txtMail)
{
	var regMail=new RegExp("^[0-9a-z._-]+@{1}[0-9a-z. -]{2,}[.]{1}[a-z]{2,5}$","i");
	return regMail.test(txtMail);
}

function valider(f)

{
	if (f.nom.value.length<3){
		alert("Merci d'indiquer votre nom");
		f.nom.focus();
		return false;
	}
	if (f.prenom.value.length<3){
		alert("Merci d'indiquer votre prénom");
		f.nom.focus();
		return false;
	}
	if(!isMail(f.mail.value)){
			alert("Merci d'indiquer une adresse valide pour que nous puissions vous répondre");
			return false;
	}
	if (f.date.value=""){
		alert("Tu as oublié la date !");
		f.date.focus();
		return false;
	}
	f.submit();
}
function valider_mail(f)

{
	if(!isMail(f.mail.value)){
			alert("Merci d'indiquer une adresse valide pour que nous puissions vous effacer de la liste");
			return false;
	}
	f.submit();
}

function valider_pv(f) 
{
	if (f.date.value.length<7){
		alert("Tu as oublié la date !\n Sers-toi du calendrier qui va apparaître");
		f.date.focus();
		return false;
	}
	
	f.submit();
}
function valider_diffusion(f)

{
	if (f.nom.value.length<3){
		alert("Merci d'indiquer un nom");
		f.nom.focus();
		return false;
	}
	if (f.prenom.value.length<3){
		alert("Merci d'indiquer un prénom");
		f.nom.focus();
		return false;
	}
	if(!isMail(f.mail.value) || f.mail.value.length<3){
			alert("L'adresse n\'est pas valide");
			return false;
	}
	
	f.submit();
}

function vaEtVient1() /* sans jeux de mot, difficile d'éviter les anglicismes ;) */
{
if(document.getElementById('arvind').style.display == 'none')
{
document.getElementById('muriel').style.display = 'none';
document.getElementById('vero').style.display = 'none';
document.getElementById('arvind').style.display = 'block';
}
else
{
document.getElementById('arvind').style.display = 'none';
}
}
function vaEtVient2() /* sans jeux de mot, difficile d'éviter les anglicismes ;) */
{
if(document.getElementById('muriel').style.display == 'none')
{
document.getElementById('arvind').style.display = 'none';
document.getElementById('vero').style.display = 'none';
document.getElementById('muriel').style.display = 'block';
}
else
{
document.getElementById('muriel').style.display = 'none';
}
}
function vaEtVient3() /* sans jeux de mot, difficile d'éviter les anglicismes ;) */
{
if(document.getElementById('vero').style.display == 'none')
{
document.getElementById('arvind').style.display = 'none';
document.getElementById('muriel').style.display = 'none';
document.getElementById('vero').style.display = 'block';
}
else
{
document.getElementById('vero').style.display = 'none';
}
}
