function openWin(URL, nomWin) {
		window.open(URL, nomWin,"directories=no, location=no, menubar=no, resizable=yes,scrollbars=yes, status=yes, toolbar=no, width=550, height=545");
	}







//-----------------------------------------User verif-----------------------------------------------

function verifUser(formName)
{
	var theForm = document.forms[formName];
	if(!theForm)
		return true;
		
		
	var email = verifEmail(theForm.EMAIL_FIELD);
	if(email)
	{
	 	alert(email);
		return true;
	}
	
	var emailConfirmation = verifEmailConfirmation(theForm.EMAIL_FIELD,theForm.CONF_EMAIL_FIELD);
	if(emailConfirmation)
	{
		alert(emailConfirmation);
		return true;
	}	
		
	var lastName = verifLastName(theForm.LASTNAME_FIELD);
	if(lastName)
	{
		alert(lastName);
		return true;
	}
		
	var firstName = verifFirstName(theForm.FIRSTNAME_FIELD);
	if(firstName)
	{
		alert(firstName);
		return true;	
	}
	
	
	var gender = verifGender(theForm.GENDER_FIELD);
	if(gender)
	{
		alert(gender);
		return true;
	}
	
	var country = verifCountry(theForm.COUNTRY_FIELD);
	if(country)
	{
		alert(country);
		return true;
	}
	
	theForm.submit();		
	return false;	
}


function verifEmail(email)
{
	var re= new RegExp("^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,3}$");
	if(!re.test(email.value))
		return "Veuillez entrer une adresse email valide.";
	else
		return false;
}

function verifEmailConfirmation(email,confirmEmail)
{
	if(email.value == confirmEmail.value)
		return false;
	else
		return "Veuillez confirmer votre adresse email.";
}

function verifFirstName(firstName)
{
	if(firstName.value.length ==0)
		return "Veuillez indiquer votre Pr\351nom.";
	if(firstName.value.length >40)
		return "Le champ pr\351nom ne doit pas exc\351der 40 caract\350res.";
	
	return false;
}

function verifLastName(lastName)
{
	if(lastName.value.length ==0)
		return "Veuillez indiquer votre nom.";
	if(lastName.value.length >60)
		return "Le champ nom de doit pas exc\351der 60 caract\350res.";
	
	return false;
}


function verifGender(gender)
{
	for(var i=0;i<gender.length;i++)
	{
		if(gender[i].checked == true && (gender[i].value == 'm' || gender[i].value=='f'))
			return false;
			
	}
	
	return "Veuillez sp\351cifier votre sexe.";
}


function verifCountry(country)
{
	if(country.options.selectedIndex == 0)
		return "Veuillez choisir un pays.";
	
	return false;
}





// Verif inscription etape 2-----------------

function verifInscription2(formName)
{
	var theForm = document.forms[formName];
	if(!theForm)
		return true;
		
	var conditions = verifConditions(theForm.optin);
	if(conditions)
	{
		alert(conditions);
		return true;
	}
		
	theForm.submit();
	return false;

}


function verifConditions(optin)
{
	if(!optin)
		return true;
		
	if(optin.checked == false)
		return "Veuillez accepter le r\350glement.";
		
	return false;

}


//------------------------------------------




//------------Verifs jeu------------------

function verifJeu(formName)
{
	var theForm = document.forms['answer_f'];
	if(!theForm)
		return true;
		

	var answers = verifCheckedAnswer(theForm.answer);
	if(answers)
	{
		alert(answers);
		return true;
	}
		
	theForm.submit();
	return false;
	
}

function verifCheckedAnswer(answers)
{
	if(!answers)
		return true;
		

	for(var i=0;i<answers.length;i++)
	{
		if(answers[i].checked == true)
			return false;
	}
	
	return "Veuillez choisir une question";
}



//----------Verifs parrainage------------------

function verifParrainage(formName)
{
	var theForm = document.forms[formName];
	if(!theForm)
		return true;
		
		
	var firstName = verifFirstName(theForm.fname);
	if(firstName)
	{
		alert(firstName);
		return true;
	}
	
	var email = verifEmail(theForm.femail);
	if(email)
	{
		alert(email);
		return true;
	}
	
	theForm.submit();
	return false;

}


