// JavaScript Document

//Recuperation des données


function verifNewsletter()
{
	if(get("email_news").value=="")
	{
	alert("Le champs 'Email' est obligatoire");
	get("email_news").focus();
	return false;
	}
	else
		{
			if(!verifMail2(window.document.form_newsletter))
			{
			alert("Veuillez indiquer une adresse E-mail valide");
			get("email_news").focus();
			return false;
			}
			else
				{
					return true;
					
				}
		}
}

function verifFormContactGb()
{
	
	if(get("nom").value=="")
	{
	alert("Please complete the field 'First Name' ");
	get("nom").focus();
	return false;
	//alert ("false");
	}
	else
		{
			
			if(get("prenom").value=="")
			{
			alert("Please complete the field 'Name' ");
			get("prenom").focus();
			return false;
			}
			else
				{
					if(get("cp").value=="")
					{
					alert("Please complete the field 'Postal Code' ");
					get("cp").focus();
					return false;
					}
					else
						{
							if(get("email").value=="")
							{
							alert("Please complete the field 'Email' ");
							get("email").focus();
							return false;
							}
							else
								{
									if(get("commentaire").value=="")
									{
									alert("Please complete the field 'Comments'");
									get("commentaire").focus();
									return false;	
									}
									else
										{
											if(!verifMail(window.document.form_contact))
											{
											alert("Please enter a valid e-mail address in the 'E-mail' field ");
											get("email").focus();
											return false;
											}
											else
												{
													if(get("actu").checked==true)
													{
														get("actu").value = "OUI";
														//alert(get("actu").value);
													}
													else
														{
															get("actu").value = "NON";
															//alert(get("actu").value);
														
															if(get("verif_saisie").value=="")
															{
																alert("Please enter the characters shown in the image");
																get("verif_saisie").focus();
																return false;
															}
															else
																{
																	if(get("verif_saisie").value!=get("verif_saisie2").value)
																	{
																		alert("Les caract\350res saisis, ne correspondent pas avec les caract\350res de l'image");
																		get("verif_saisie").focus();
																		return false;
																	}
																	else
																		{
																			return true;	
																		}
																}
														}
													
												}
										}
								}
								
						}
						
				}
		}
	}

function verifFormContact()
{
	
	if(get("nom").value=="")
	{
	alert("Le champs 'Nom' est obligatoire");
	get("nom").focus();
	return false;
	//alert ("false");
	}
	else
		{
			
			if(get("prenom").value=="")
			{
			alert("Le champs 'Pr\351nom' est obligatoire");
			get("prenom").focus();
			return false;
			}
			else
				{
					if(get("cp").value=="")
					{
					alert("Le champs 'Code Postal' est obligatoire");
					get("cp").focus();
					return false;
					}
					else
						{
							if(get("email").value=="")
							{
							alert("Le champs 'Email' est obligatoire");
							get("email").focus();
							return false;
							}
							else
								{
									if(get("commentaire").value=="")
									{
									alert("Veuillez indiquer votre Message");
									get("commentaire").focus();
									return false;	
									}
									else
										{
											if(!verifMail(window.document.form_contact))
											{
											alert("Veuillez indiquer une adresse E-mail valide");
											get("email").focus();
											return false;
											}
											else
												{
													if(get("actu").checked==true)
													{
														get("actu").value = "OUI";
														//alert(get("actu").value);
													}
													else
														{
															get("actu").value = "NON";
															//alert(get("actu").value);
														
															if(get("verif_saisie").value=="")
															{
																alert("Veuillez compléter le champ 'V\351rification de caract\350res' ");
																get("verif_saisie").focus();
																return false;
															}
															else
																{
																	if(get("verif_saisie").value!=get("verif_saisie2").value)
																	{
																		alert("Les caract\350res saisis, ne correspondent pas avec les caract\350res de l'image");
																		get("verif_saisie").focus();
																		return false;
																	}
																	else
																		{
																			return true;	
																		}
																}
														}
													
												}
										}
								}
								
						}
						
				}
		}
}
	

function verifNewsletter2()
{
	if(get("email_news").value=="")
	{
	alert("Please complete the field 'Email'");
	get("email_news").focus();
	return false;
	}
	else
		{
			if(!verifMail2(window.document.form_newsletter))
			{
			alert("Veuillez indiquer une adresse E-mail valide");
			get("email_news").focus();
			return false;
			}
			else
				{
					return true;
					
				}
		}
}

	
function verifMail(thisForm) {
	var email = thisForm.email.value;
	var aroba = email.indexOf("@");
	if (aroba == -1) {
	
	return false;
	}
	var point = email.indexOf(".", aroba);
	if ((point == -1) || (point == (aroba + 1))) {
	
	return false;
	}
	var point = email.lastIndexOf(".");
	if ((point + 1) == email.length) {
	
	return false;
	}
	var point = email.indexOf("..")
	if (point != -1) {
	return false;
	}
return true;
}


function get(id)
{
	return window.document.getElementById(id);
}


function verifMail2(thisForm) {
	var email2 = thisForm.email_news.value;
	var aroba2 = email2.indexOf("@");
	if (aroba2 == -1) {
	
	return false;
	}
	var point2 = email2.indexOf(".", aroba2);
	if ((point2 == -1) || (point2 == (aroba2 + 1))) {
	
	return false;
	}
	var point2 = email2.lastIndexOf(".");
	if ((point2 + 1) == email.length) {
	
	return false;
	}
	var point2 = email2.indexOf("..");
	if (point2 != -1) {
	return false;
	}
	return true;
}

