///****************************************************************
///	CHECK STAY IN TOUCH LOGIN FORM
///****************************************************************

function CheckLoginForm(frm) {

	   // Check to see that the Email Address is entered 
	   var str = frm.email.value
	   if( !CheckEmail( str ) ) {
	   	  frm.email.focus();
	      return false;
	   }
	   else {
	   	return true;
	   }
}


///***************************************************************
///	CHECK SEND TO A FRIEND FORM
///*****************************************************************

function ChecksendtoafriendForm(frm) {
	// Check to see that the Email Address is entered 
	var str = frm.strEmail.value
	if( !CheckEmail( str ) ) {
		frm.strEmail.focus();
		return false;
	}   
	
	// Check to see that the Friend's Email Address is entered 
	var str = frm.strFriendEmail.value
	if( !CheckEmail( str ) ) {
		frm.strFriendEmail.focus();
		return false;
	}   
	return true;
}


///****************************************************************
///	CHECK STAY IN TOUCH FORM
///****************************************************************

function CheckStayInTouchForm(frm) {

if (theVillage == 5) {
	// Verify that the Visited Options should not be blank
	var blnVisited = false;
	//check visited box
	for ( var i=0; i < frm.chrVisited.length; i++)
	{
		if (frm.chrVisited[i].checked)
		{
			var blnVisited = true;
		}
	}
}
if (theVillage == 5) {
	if (!blnVisited)
	{
		switch (theLan) {
			case 'de':
				alert("\nBitte teilen Sie uns mit, ob Sie \n Maasmechelen Village bereits besucht haben.");
				break;
			case 'fr':
				alert("\nMerci de renseigner le champ '' Etes-vous déjà venu(e)");
				break;
			case 'nl':
				alert("\nGelieve een keuze te maken of u Maasmechelen Village \n reeds bezocht hebt. Alvast bedankt. ");
				break;
			default:
				alert("\nPlease select visited option.  Thank you.");
				break;
		}
	return false;

	}
}

if (theVillage == 4) {
	// Verify that the Visited Options should not be blank
	var blnVisited = false;
	//check visited box
	for ( var i=0; i < frm.chrVisited.length; i++)
	{
		if (frm.chrVisited[i].checked)
		{
			var blnVisited = true;
		}
	}
}
if (theVillage == 4) {
	if (!blnVisited)
	{
		switch (theLan) {
			case 'de':
				alert("\nBitte teilen Sie uns mit, ob Sie \n La Vallee  Village bereits besucht haben.");
				break;
			case 'fr':
				alert("\nMerci de renseigner le champ '' Etes-vous déjà venu(e)");
				break;
			case 'nl':
				alert("\nGelieve een keuze te maken of u La Vallee  Village \n reeds bezocht hebt. Alvast bedankt. ");
				break;
			default:
				alert("\nPlease select visited option.  Thank you.");
				break;
		}
	return false;

	}
}

	// Verify that the First Name should not be blank
	var str = frm.strFirstName.value;
	if( str.length == 0 || str == "" || str == "Insert your first name here" ) {
		switch (theLan) {
			case 'ct':
				alert("\nNecessitem el seu nom. Si us plau, torni a escriure'l.");
				break;
			case 'de':
				alert("\nIhr Vorname wird benötigt, bitte erneut eingeben.");
				break;
			case 'es':
				alert("\nNecesitamos su nombre.\nPor favor, vuelva a escribirlo.");
				break;
			case 'fr':
				alert("\nVotre prénom est une mention obligatoire. \nVeuillez réintroduire.");
				break;
			case 'it':
				alert("\nE' necessario digitare il proprio nome.\nProcedere nuovamente.");
				break;
			case 'jp':
				alert("\nYour First Name is required.\nPlease re-enter.");
				break;
			case 'nl':
				alert("\nUw voornaam is een verplicht veld. \nGelieve dit in te vullen.");
				break;
			default:
				alert("\nYour First Name is required.\nPlease re-enter.");
				break;
		}
		frm.strFirstName.focus();
		return false;
	}
	
	// Check to see that the First Name entered is valid .. i.e., it contains
	// only Alphabetic Characters
	if (! ( checkAlpha(str) ) ) {
		switch (theLan) {
			case 'ct':
				alert("\nEl vostre nom conté caràcters que no són vàlids. \nSi us plau, torneu escriure el vostre nom.");
				break;
			case 'de':
				alert("\nIhr Vorname enthält ungültige Zeichen.\nBitte geben Sie Ihren Vornamen erneut ein.");
				break;
			case 'es':
				alert("\nSu nombre contiene caracteres que no son válidos.\nPor favor, vuela a escribir su nombre.");
				break;
			case 'fr':
				alert("\nVotre prénom contient des caractères illicites.\nVeuillez réessayer votre prénom.");
				break;
			case 'it':
				alert("\nIl nome contiene caratteri non validi.\nPregasi digitare nuovamente.");
				break;
			case 'jp':
				alert("\nYour First Name contains invalid Characters.\nPlease re-enter First Name.");
				break;
			case 'nl':
				alert("\nUw voornaam bevat ongeldige tekens.\nGelieve uw voornaam opnieuw in te geven.");
				break;
			default:
				alert("\nYour First Name contains invalid Characters.\nPlease re-enter First Name.");
				break;
		}
		frm.strFirstName.focus();
		return false;
	}
	
	// Verify that the Last Name should not be blank
	var str = frm.strLastName.value
	if( str.length == 0 || str == "" || str == "Insert your surname here"  ) {
		switch (theLan) {
			case 'ct':
				alert("\nNecessitem el seu cognom. Si us plau torni a escriure'l.");
				break;
			case 'de':
				alert("\nIhr Nachname wird benötigt, bitte erneut eingeben.");
				break;
			case 'es':
				alert("\nNecesitamos sus apellidos.\nPor favor, vuelva a escribirlos.");
				break;
			case 'fr':
				alert("\nVotre nom est une mention obligatoire. \nVeuillez réintroduire.");
				break;
			case 'it':
				alert("\nE' necessario digitare il proprio cognome.\nProcedere nuovamente.");
				break;
			case 'jp':
				alert("\nYour Surname is required.\nPlease re-enter.");
				break;
			case 'nl':
				alert("\nUw achternaam is een verplicht veld. \nGelieve dit in te vullen.");
				break;
			default:
				alert("\nYour Surname is required.\nPlease re-enter.");
				break;
		}
		frm.strLastName.focus();
		return false;
	}
	   
	// Check to see that the Last Name entered is valid .. i.e., it contains
	// only Alphabetic Characters
	if (! ( checkAlpha(str) ) ) {
		switch (theLan) {
			case 'ct':
				alert("\nEls vostres cognoms contenen caràcters que no són vàlids. \nSi us plau, torneu a escriure els vostres cognoms.");
				break;
			case 'de':
				alert("\nIhr Nachname enthält ungültige Zeichen.\nBitte geben Sie Ihren Nachnamen erneut ein.");
				break;
			case 'es':
				alert("\nSus apellidos contienen caracteres que no son válidos.\nPor favor, vuela a escribir sus apellidos.");
				break;
			case 'fr':
				alert("\nVotre nom contient des caractères illicites.\nVeuillez réessayer votre nom.");
				break;
			case 'it':
				alert("\nIl cognome contiene caratteri non validi.\nPregasi digitare nuovamente.");
				break;
			case 'jp':
				alert("\nYour Surname contains invalid Characters.\nPlease re-enter Surname.");
				break;
			case 'nl':
				alert("\nUw achternaam bevat ongeldige tekens.\nGelieve uw achternaam opnieuw in te geven.");
				break;
			default:
				alert("\nYour Surname contains invalid Characters.\nPlease re-enter Surname.");
				break;
		}
		frm.strLastName.focus();
		return false;
	}
	   
	// Checking date of birth
	if (theVillage == 1) {
		if ( frm.stryyyy.value != "0000" || frm.strdd.value != "00" || frm.strmm.value != "00") {
			var year = frm.stryyyy.value;
			var month = frm.strmm.value;
			var day = frm.strdd.value;
			var dob = day + '/' + month + '/' + year;
			if( !checkDate(dob) ) {
				return false;
			}
		}
	}
	else {
		if ( frm.strdd.value != "" || frm.strmm.value != "" || frm.stryyyy.value != "") {
			var year = frm.stryyyy.value;
			var month = frm.strmm.value;
			var day = frm.strdd.value;
			var dob = day + '/' + month + '/' + year;
			if( !checkDate(dob) ) {
				return false;
			}
		}
	}

	// Check to see that the Email Address is entered 
	var str = frm.strEmail.value
	if( !CheckEmail( str ) ) {
		frm.strEmail.focus();
		return false;
	}   

	// Check to see that a Password is entered 
	if (typeof frm.strPassword != "undefined") {
		var str = frm.strPassword.value
		if( str == "" || str.length == 0 || str == "Insert your password here"  ) {
			switch (theLan) {
				case 'ct':
					alert("\nSi us plau, escrigui una contrasenya.");
					break;
				case 'de':
					alert("\nBitte geben Sie Ihr Passwort ein.");
					break;
				case 'es':
					alert("\nPlease enter a password.");
					break;
				case 'fr':
					alert("\nVeuillez entrer votre mot de passe.");
					break;
				case 'it':
					alert("\nInserisci la tua password.");
					break;
				case 'jp':
					alert("\nPlease enter a password.");
					break;
				case 'nl':
					alert("\nGelieve een wachtwoord in te geven.");
					break;
				default:
					alert("\nPlease enter a password.");
					break;
			}
			frm.strPassword.focus();
			return false;
		}   
	}
	
	// Check to see that Friend's Email Address is correct
	//var str = frm.strFriendsEmail.value
	//if (str != '') {
	//	if (str != "Insert an email here"){
		//	if( !CheckEmail( str ) ) {
		//		frm.strFriendsEmail.focus();
		//		return false;
		//	}
	//	}   
	//}
		
	// Check to see that 1st Recommended Friend's Email Address is correct
	//var str = frm.strEmail1.value
	//if (str != '') {
		//if (str != "Insert an email here"){
		//	if( !CheckEmail( str ) ) {
		//		frm.strEmail1.focus();
		//		return false;
		//	}
		//}   
	//}
		
	// Check to see that 2nd Recommended Friend's Email Address is correct
	//var str = frm.strEmail2.value
	//if (str != '') {
	//	if (str != "Insert an email here"){
	//		if( !CheckEmail( str ) ) {
	//			frm.strEmail2.focus();
	//			return false;
	//		}
		//}   
	//}

	
	// Check to see that the legal text has been cheched - only Fidenza Italian version
	if (theLan == 'it') {
		var str = frm.intLegalText.checked
		if (str == false) {
			alert("\nE' necessaria l'autorizzazione al trattamento dei dati personali.");
			frm.intLegalText.focus();
			return false;
		}
 	}
	// Check to see that the address is entered 
	if ( frm.strAddress1.value == "" || frm.strTown.value == "" || frm.strPostCode.value == "" || frm.strCountry.value == "" || frm.strAddress1.value == "Insert your address here" || frm.strTown.value == "Insert your town here" || frm.strPostCode.value == "Insert your postcode here" || frm.strCountry.value == "Insert your country here" ) {
		var strMsg;
		switch (theLan) {
			case 'ct':
				strMsg = "Pot ser que perdi l'oportunitat de conèixer alguna de les brillants promocions si no ens deixa l'adreça de casa seva o la seva feina.";
				break;
			case 'de':
				strMsg = "Sie könnten einige aufregende Sonderangebote verpassen, wenn Sie Ihre private\/Arbeits-Adresse nicht angeben! Möchten Sie jetzt Ihre Adresse eingeben?";
				break;
			case 'es':
				strMsg = "Puede que pierda la oportunidad de conocer alguna de las magnificas promociones si no nos deja la dirección de su casa\/trabajo. ¿Quiere introducir su dirección ahora?";
				break;
			case 'fr':
				strMsg = "Entrez votre adresse personnelle\/ professionnelle pour ne rien manquer de nos offres exceptionnelles. Désirez-vous nous donner votre adresse?";
				break;
			case 'it':
				strMsg = "Se non inserisci il tuo indirizzo di casa o di lavoro, potresti perdere l'occasione di visionare le nostre fantastiche offerte speciali. Vuoi inserire il tuo indirizzo postale adesso?";
				break;
			case 'jp':
				strMsg = "You may be missing out on some great offers by not entering your home\/work address. Would you like to enter your postal address now?";
				break;
			case 'nl':
				strMsg = "Je zou belangrijke aanbieden missen, bij het niet opgeven van uw e-mail adres. Wenst u uw postadres op te geven ?";
				break;
			default:
				strMsg = "You may be missing out on some great offers by not entering your home\/work address. Would you like to enter your postal address now?";
				break;
		}
		if (!confirm("\n" + strMsg)){		   	  	
		}
		else {
			if (frm.strAddress1.value == "" || frm.strAddress1.value == "Insert your address here") { 
				frm.strAddress1.focus();
				return false;
			}
			if (frm.strTown.value == "" || frm.strTown.value == "Insert your town here") { 
				frm.strTown.focus();
				return false;
			}
			if (frm.strPostCode.value == "" || frm.strPostCode.value == "Insert your postcode here") { 
				frm.strPostCode.focus();
				return false;
			}
			if (frm.strCountry.value == "" || frm.strCountry.value == "Insert your country here"  ) { 
				frm.strCountry.focus();
				return false;
			}		      
		} 		   
	}

	return ConfirmSend();
}


///****************************************************************
///	CHECK Promotion FORM
///****************************************************************

function CheckPromotionForm(frm) {

	// Verify that the First Name should not be blank
	var str = frm.strFirstName.value;
	if( str.length == 0 || str == "" ) {
		switch (theLan) {
			case 'ct':
				alert("\nYour First Name is required.\nPlease re-enter.");
				break;
			case 'de':
				alert("\nIhr Vorname wird benötigt, bitte erneut eingeben.");
				break;
			case 'es':
				alert("\nNecesitamos su nombre.\nPor favor, vuelva a escribirlo.");
				break;
			case 'fr':
				alert("\nVotre prénom est une mention obligatoire. \nVeuillez réintroduire.");
				break;
			case 'it':
				alert("\nE' necessario digitare il proprio nome.\nProcedere nuovamente.");
				break;
			case 'jp':
				alert("\nYour First Name is required.\nPlease re-enter.");
				break;
			case 'nl':
				alert("\nUw voornaam is een verplicht veld. \nGelieve dit in te vullen.");
				break;
			default:
				alert("\nYour First Name is required.\nPlease re-enter.");
				break;
		}
		frm.strFirstName.focus();
		return false;
	}
	
	// Check to see that the First Name entered is valid .. i.e., it contains
	// only Alphabetic Characters
	if (! ( checkAlpha(str) ) ) {
		switch (theLan) {
			case 'ct':
				alert("\nEl vostre nom conté caràcters que no són vàlids. \nSi us plau, torneu escriure el vostre nom.");
				break;
			case 'de':
				alert("\nIhr Vorname enthält ungültige Zeichen.\nBitte geben Sie Ihren Vornamen erneut ein.");
				break;
			case 'es':
				alert("\nSu nombre contiene caracteres que no son válidos.\nPor favor, vuela a escribir su nombre.");
				break;
			case 'fr':
				alert("\nVotre prénom contient des caractères illicites.\nVeuillez réessayer votre prénom.");
				break;
			case 'it':
				alert("\nIl nome contiene caratteri non validi.\nPregasi digitare nuovamente.");
				break;
			case 'jp':
				alert("\nYour First Name contains invalid Characters.\nPlease re-enter First Name.");
				break;
			case 'nl':
				alert("\nUw voornaam bevat ongeldige tekens.\nGelieve uw voornaam opnieuw in te geven.");
				break;
			default:
				alert("\nYour First Name contains invalid Characters.\nPlease re-enter First Name.");
				break;
		}
		frm.strFirstName.focus();
		return false;
	}
	
	// Verify that the Last Name should not be blank
	var str = frm.strLastName.value
	if( str.length == 0 || str == "" ) {
		switch (theLan) {
			case 'ct':
				alert("\nYour Surname is required.\nPlease re-enter.");
				break;
			case 'de':
				alert("\nIhr Nachname wird benötigt, bitte erneut eingeben.");
				break;
			case 'es':
				alert("\nNecesitamos sus apellidos.\nPor favor, vuelva a escribirlos.");
				break;
			case 'fr':
				alert("\nVotre nom est une mention obligatoire. \nVeuillez réintroduire.");
				break;
			case 'it':
				alert("\nE' necessario digitare il proprio cognome.\nProcedere nuovamente.");
				break;
			case 'jp':
				alert("\nYour Surname is required.\nPlease re-enter.");
				break;
			case 'nl':
				alert("\nUw achternaam is een verplicht veld. \nGelieve dit in te vullen.");
				break;
			default:
				alert("\nYour Surname is required.\nPlease re-enter.");
				break;
		}
		frm.strLastName.focus();
		return false;
	}
	   
	// Check to see that the Last Name entered is valid .. i.e., it contains
	// only Alphabetic Characters
	if (! ( checkAlpha(str) ) ) {
		switch (theLan) {
			case 'ct':
				alert("\nEls vostres cognoms contenen caràcters que no són vàlids. \nSi us plau, torneu a escriure els vostres cognoms.");
				break;
			case 'de':
				alert("\nIhr Nachname enthält ungültige Zeichen.\nBitte geben Sie Ihren Nachnamen erneut ein.");
				break;
			case 'es':
				alert("\nSus apellidos contienen caracteres que no son válidos.\nPor favor, vuela a escribir sus apellidos.");
				break;
			case 'fr':
				alert("\nVotre nom contient des caractères illicites.\nVeuillez réessayer votre nom.");
				break;
			case 'it':
				alert("\nIl cognome contiene caratteri non validi.\nPregasi digitare nuovamente.");
				break;
			case 'jp':
				alert("\nYour Surname contains invalid Characters.\nPlease re-enter Surname.");
				break;
			case 'nl':
				alert("\nUw achternaam bevat ongeldige tekens.\nGelieve uw achternaam opnieuw in te geven.");
				break;
			default:
				alert("\nYour Surname contains invalid Characters.\nPlease re-enter Surname.");
				break;
		}
		frm.strLastName.focus();
		return false;
	}
	   
	// Checking date of birth
	if ( frm.strdd.value != "" || frm.strmm.value != "" || frm.stryyyy.value != "" ) {
		var year = frm.stryyyy.value;
		var month = frm.strmm.value;
		var day = frm.strdd.value;
		var dob = day + '/' + month + '/' + year;
		if( !checkDate(dob) ) {
			return false;
		}
	}

	// Check to see that the Email Address is entered 
	var str = frm.strEmail.value
	if( !CheckEmail( str ) ) {
		frm.strEmail.focus();
		return false;
	}   

	// Check to see that a Password is entered 
	if (typeof frm.strPassword != "undefined") {
		var str = frm.strPassword.value
		if( str == "" || str.length == 0 ) {
			switch (theLan) {
				case 'ct':
					alert("\nPlease enter a password.");
					break;
				case 'de':
					alert("\nBitte geben Sie Ihr Passwort ein.");
					break;
				case 'es':
					alert("\nPlease enter a password.");
					break;
				case 'fr':
					alert("\nVeuillez entrer votre mot de passe.");
					break;
				case 'it':
					alert("\nInserisci la tua password.");
					break;
				case 'jp':
					alert("\nPlease enter a password.");
					break;
				case 'nl':
					alert("\nGelieve een wachtwoord in te geven.");
					break;
				default:
					alert("\nPlease enter a password.");
					break;
			}
			frm.strPassword.focus();
			return false;
		}   
	}
	
	// Check to see that the legal text has been cheched - only Fidenza Italian version
	if (theLan == 'it') {
		var str = frm.intLegalText.checked
		if (str == false) {
			alert("\nE' necessaria l'autorizzazione al trattamento dei dati personali.");
			frm.intLegalText.focus();
			return false;
		}
 	}

	
	return ConfirmSend();
}


///****************************************************************
///	CHECK Fidenza Competition FORM
///****************************************************************

function CheckFidenzaCompetition (frm) {

	var radio_domanda1 = false;
	var radio_domanda2 = false;
	var radio_domanda3 = false;

	for (counter = 0; counter < frm.domanda1.length; counter++)
	{
		if (frm.domanda1[counter].checked)
		radio_domanda1 = true; 
	}
	
	if (!radio_domanda1)
	{
		alert("\nE' necessario scegliere una risposta per la prima domanda")
		return false;
	}
	
	for (counter = 0; counter < frm.domanda2.length; counter++)
	{
		if (frm.domanda2[counter].checked)
		radio_domanda2 = true; 
	}
	
	if (!radio_domanda2)
	{
		alert("\nE' necessario scegliere una risposta per la seconda domanda")
		return false;
	}
	
	for (counter = 0; counter < frm.domanda3.length; counter++)
	{
		if (frm.domanda3[counter].checked)
		radio_domanda3 = true; 
	}
	
	if (!radio_domanda3)
	{
		alert("\nE' necessario scegliere una risposta per la terza domanda")
		return false;
	}

	// Verify that the First Name should not be blank
	var str = frm.strFirstName.value;
	if( str.length == 0 || str == "" ) {
		alert("\nE' necessario digitare il proprio nome. \nProcedere nuovamente.");
		frm.strFirstName.focus();
		return false;
	}
	
	// Check to see that the First Name entered is valid .. i.e., it contains
	// only Alphabetic Characters
	if (! ( checkAlpha(str) ) ) {
		alert("\nIl nome contiene caratteri non validi.\nPregasi digitare nuovamente.");
		frm.strFirstName.focus();
		return false;
	}

	// Verify that the Last Name should not be blank
	var str = frm.strLastName.value
	if( str.length == 0 || str == "" ) {
		alert("\nE' necessario digitare il proprio cognome. \nProcedere nuovamente.");
		frm.strLastName.focus();
		return false;
	}
   
	// Check to see that the Last Name entered is valid .. i.e., it contains
	// only Alphabetic Characters
	if (! ( checkAlpha(str) ) ) {
		alert("\nIl cognome contiene caratteri non validi.\nPregasi digitare nuovamente.");
		frm.strLastName.focus();
		return false;
	}

	// Checking date of birth
	if ( frm.strdd.value != "" || frm.strmm.value != "" || frm.stryyyy.value != "" ) {

		var year = frm.stryyyy.value;
		var month = frm.strmm.value;
		var day = frm.strdd.value;
		var dob = day + '/' + month + '/' + year;

		if( !checkDate(dob) ) {
			return false;
		}
	}
	
	// Check to see that the Email Address is entered 
	var str = frm.strEmail.value
	if( !CheckEmail( str ) ) {
		frm.strEmail.focus();
		return false;
	}
   					   
	//Check to see Dati personali
	var str = frm.intLegalText.checked
	if (str == false) {
		alert("\nE' necessaria l'autorizzazione al trattamento dei dati personali.");
		frm.intLegalText.focus();
		return false;
	}

			
	return ConfirmSend();
}



