
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////:
var testresults

function checkemail(){
var invalidcheck=0;
var str=document.getElementById('mail').value
var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str)){
var tempstring=str.split("@")
tempstring=tempstring[1].split(".")
if (invalidcheck!=1)
{
	document.getElementById('mail').style.backgroundColor ='#FFFFFF';
	testresults=true
}
else{
testresults=false
}
}
else{
document.getElementById('mail').style.backgroundColor ='#FFAEAE';
testresults=false
}
return (testresults)
}



function checktel(idElement_tel){
	nbr1 = document.getElementById(idElement_tel).value
	if (nbr1.length == 10 && !isNaN(nbr1))
	{
		document.getElementById(idElement_tel).style.backgroundColor = '#FFFFFF';
		return true
	}
	else
	{
		document.getElementById(idElement_tel).style.backgroundColor = '#FFAEAE';
		return false
	}
}




var testresults

function checkemail_code(){
if(document.getElementById('code').value==""){


	
var invalidcheck=0;
var str=document.getElementById('mail_mail').value
if(str!="administrateur"){
var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str)){
var tempstring=str.split("@")
tempstring=tempstring[1].split(".")
if (invalidcheck!=1)
{
	document.getElementById('mail_mail').style.backgroundColor ='#FFFFFF';
	testresults=true
}
else{
testresults=false
}
}
else{
document.getElementById('mail_mail').style.backgroundColor ='#FFAEAE';
document.getElementById('code').style.backgroundColor ='#FFAEAE';
testresults=false
}
return (testresults)

}
else {
	document.getElementById('mail_mail').style.backgroundColor ='#FFFFFF';
	return true
}


}
else {
	document.getElementById('code').style.backgroundColor ='#fff';
	return true;
}

}







function checkTxtEmpty(idElement){
	if (document.getElementById(idElement).value != "")
	{
		document.getElementById(idElement).style.backgroundColor = '#FFFFFF';
		return true
	}
	else
	{
		document.getElementById(idElement).style.backgroundColor = '#FFAEAE';
		return false
	}
}

function checkParticipe(){
	if (document.form1.participe[0].checked || document.form1.participe[1].checked){
	   document.getElementById('c1').style.color = '#67726a'
	   document.getElementById('c2').style.color = '#67726a'
	   return true
	}
	else{
	   document.getElementById('c1').style.color = '#ff0000'
	   document.getElementById('c2').style.color = '#ff0000'
	   return false
	}
}

function checkall(){
	mail_code = checkemail_code();
	
if (!(mail_code))
{
	document.getElementById('erreursaisie').style.visibility = 'visible';
	return false ;
}
else	
	return true;
}




function checkall1(){
	nom = checkTxtEmpty('nom');
	prenom = checkTxtEmpty('prenom');
	societe = checkTxtEmpty('societe');
	participe = checkParticipe();
	
if (!(nom && prenom && societe && participe))
{
	document.getElementById('erreursaisie1').style.visibility = 'visible';
	return false ;
}
else	
	return true;
}









function chechadmin(){
	nom = checkTxtEmpty('nom');
	prenom = checkTxtEmpty('prenom');
	societe = checkTxtEmpty('societe');
	mail = checkemail();
	tel = checktel('tel');
	fax = checktel('fax');
	adresse = checkTxtEmpty('adresse');
	nom_col = checkTxtEmpty('nom_col');
	coordonnees = checkTxtEmpty('coordonnees');
	
	notes = checkTxtEmpty('notes');
	login = checkTxtEmpty('login');
	mdp = checkTxtEmpty('mdp');
	groupe = checkTxtEmpty('groupe');
	
if (!(nom && prenom && societe && mail && tel && fax && adresse && nom_col && coordonnees && notes && login && mdp && groupe))
{
	document.getElementById('erreur').style.visibility = 'visible';
	return false ;
}
else	
	return true;
}




