var ImageLoader=new Image;
ImageLoader.src="img/index/ez/v2/bouton_rencontre_loading.gif";

function loading()
{
	document.getElementById('bouton_submit').src=ImageLoader.src;
}

function aff_user(id) { 
	var div;
 	div='fic'+document.getElementById('curfic').value;
	document.getElementById(div).style.display='none'
	document.getElementById('curfic').value=id;
	div='fic'+id;
	document.getElementById(div).style.display='block';
	}

function inscrit(){
	var dp;
	var tsex;
	var sex;
	var pos;
	var chn;
	var chi;
	var cod;
	var mel;
	var arob='@';
	var intdt='_,;!&? éèàùûôâîïëä%#<>[]\/£€\"\'\$µ*:';
	var charok='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
	var lettres='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

	chn=document.jv.pseudo.value; 
	if(chn.length<3)
	{
		window.alert('Pseudo trop court'); 
		return false;
	}
	
	chi=chn.substr(0,1);
	pos=lettres.indexOf(chi);
	if (pos ==-1)
	{
		window.alert('Votre pseudo doit commencer par une lettre.\n ...il serait bien qu\'il soit également intelligible pour les autres utilisateurs.\n Merci');
		return false;	
	}
	for (i=0; i < chn.length ; i++)
	{
		chi=chn.substr(i,1);
		pos=charok.indexOf(chi);
		if (pos ==-1)
		{
			window.alert('Pseudo : le caractère \"'+chi+'\" est interdit');
			return false;
			}
		}
	
	cod=document.jv.code.value; 
	if (document.jv.code.value.length <3)
	{
		window.alert('Code trop court'); 
		return false;
	}
	
	dp=document.jv.dpt.value; pos=dp.indexOf('-');
	if (pos!=-1) 
	{
		window.alert('Vous devez choisir un département'); 
		return false;
	}
	
	if(!document.jv.CGU.checked)
	{
		window.alert('Vous devez accepter les CGU (Conditions générales d\'utlisation)'); 
		return false;
	}
	
	an=document.jv.annee.value; pos=an.indexOf('-');
	if (pos!=-1)
	{
		window.alert('Vous devez choisir une année de naissance');
		return false;
	}
	
	an=document.jv.sexe.value; pos=an.indexOf('-');
	if (pos!=-1)
	{
		window.alert('Vous devez indiquer votre sexe. Merci.'); 
		return false;
	}
	
	mel=document.jv.mail.value; 
	if (mel.length <7) 
	{	
		window.alert('Email trop court'); 
		return false;
	}
	if (mel.length > 255)
	{
		window.alert('Email trop long');
		return false;
	}
	
	pos=mel.indexOf(arob);if(pos==-1) {window.alert('Mail non conforme');return false;}
	pos=mel.indexOf('.');if (pos==-1) {window.alert('Mail non conforme');return false;}
	pos=mel.indexOf('..');if (pos!=-1) {window.alert('Mail non conforme');return false;}
	pos=mel.indexOf('@.');if (pos!=-1) {window.alert('Mail non conforme');return false;}
	for (i=0; i < intdt.length ; i++) 
	{
		chi=intdt.substr(i,1);
		pos=mel.indexOf(chi);
		if (pos !=-1)
		{	
			window.alert('Email: le caractère \"'+chi+'\" est interdit');
			return false;
		}
	}
	for (i=0; i < cod.length ; i++) 
	{
		chi=cod.substr(i,1);
		pos=charok.indexOf(chi);
		if (pos ==-1)
		{
			window.alert('Code : le caractère \"'+chi+'\" est interdit');
			return false;
		}
	}
	loading();
	return true;
	
}

function aff_liste()
{ 
	var url; url='liste.php';
	window.centre.location.href=url;
}

function ChangeMessage(message,champ) 
{
	if(document.getElementById) document.getElementById(champ).innerHTML = message;
}
	
function pop_up(page,qcid,qpse)
{
	window.open(page + '?qcid=' + qcid + '&qpse=' + qpse ,'_blank','width=485, height=500, scrollbars=yes');
	return false;	
}