if(!VVF.validation) {
	VVF.validation = {};
}

VVF.validation['sendtofriendForm'] = {
	header: 'The form contains an error at least. (skipped or not valid field) Any error is pointed out in italics and in red next to the concerned field.',
	SendToFirstnameFrom: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	SendToFirstnameTo: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	SendToMessage: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	SendToEmailFrom: {
		rule: /^\s*[\w-]+(\.[\w-]+)*@([\w-]+\.)+[A-Za-z]{2,7}\s*$/,
		msg: 'the email format is not valid'
	},	
	SendToEmailTo: {
		rule: /^\s*[\w-]+(\.[\w-]+)*@([\w-]+\.)+[A-Za-z]{2,7}\s*$/,
		msg: 'the email format is not valid'
	}	
};

VVF.validation['parrainageForm'] = {
	header: 'The form contains an error at least. (skipped or not valid field) Any error is pointed out in italics and in red next to the concerned field.',
	ParrainNomFilleul: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	ParrainPrenomFilleul: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	ParrainEmailFilleul: {
		rule: /^\s*[\w-]+(\.[\w-]+)*@([\w-]+\.)+[A-Za-z]{2,7}\s*$/,
		msg: 'the email format is not valid'
	}	
};

VVF.validation['bookingForm'] = {
	header: 'The form contains an error at least. (skipped or not valid field) Any error is pointed out in italics and in red next to the concerned field.',
	BookingConsiderNextDateDay: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	BookingConsiderStayLength: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	BookingConsiderLocation1: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	BookingCivility: {
		msg: 'Mandatory field'
	},
	BookingSurName: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	BookingFirstName: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	BookingAddress: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	BookingCity: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	BookingZipCode: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	BookingCountry: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},	
	BookingEmail: {
		rule: /^\s*[\w-]+(\.[\w-]+)*@([\w-]+\.)+[A-Za-z]{2,7}\s*$/,
		msg: 'the email format is not valid'
	},
	BookingLastStayFromMonth: {
		rule: /^\d*\.{0,1}\d+$/,
		msg: 'Mandatory field'
	},	
	BookingLastStayFromDay: {
		rule: /^\d*\.{0,1}\d+$/,
		msg: 'Mandatory field'
	},	
	BookingLastStayFromYear: {
		rule: /^\d*\.{0,1}\d+$/,
		msg: 'Mandatory field'
	},
	BookingLastStayToMonth: {
		rule: /^\d*\.{0,1}\d+$/,
		msg: 'Mandatory field'
	},	
	BookingLastStayToDay: {
		rule: /^\d*\.{0,1}\d+$/,
		msg: 'Mandatory field'
	},	
	BookingLastStayToYear: {
		rule: /^\d*\.{0,1}\d+$/,
		msg: 'Mandatory field'
	}
};


VVF.validation['contactForm'] = {
	header: 'The form contains an error at least. (skipped or not valid field) Any error is pointed out in italics and in red next to the concerned field.',
	ContactIdQuestion: {
		msg: 'Mandatory field'
	},
	ContactQuestionObj: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	ContactQuestionMsg: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	ContactCivility: {
		msg: 'Mandatory field'
	},
	ContactSurName: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	ContactFirstName: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	ContactAddress: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	ContactCity: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	ContactZipCode: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	ContactCountry: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},	
	ContactEmail: {
		rule: /^\s*[\w-]+(\.[\w-]+)*@([\w-]+\.)+[A-Za-z]{2,7}\s*$/,
		msg: 'the email format is not valid'
	}
};

VVF.validation['accountCreationForm'] = {
	header: 'The form contains an error at least. (skipped or not valid field) Any error is pointed out in italics and in red next to the concerned field.',
	CustomerCivility: {
		msg: 'Mandatory field'
	},
	CustomerSurName: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	CustomerFirstName: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	CustomerAddress: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	CustomerBirthDay: {
	    rule: /^(([0-2]?[0-9])|(3[0-1]))$/,
		msg: 'Mandatory field'
	},
	CustomerBirthMonth: {
	    rule: /^([0-1]?[0-9])$/,
		msg: 'Mandatory field'
	},
	CustomerBirthYear: {
	    rule: /^(19[0-9]?[0-9])$/,
		msg: 'Mandatory field'
	},
	CustomerCity: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	CustomerZipCode: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	CustomerNickName: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	CustomerPassword: {
		rule: /^.{7,}$/,
		msg: 'Mandatory field'
	},
	CustomerPasswordConfirm: {
		rule: function(value) {
		    return value != document.forms[0].elements['CustomerPassword'].value;
		},
		msg: 'The password\'s confirmation is wrong'
	},
	CustomerCountry: {
		rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},	
	CustomerEmail: {
		//rule: /^\s*[\w-]+(\.[\w-]+)*@([\w-]+\.)+[A-Za-z]{2,7}\s*$/,
		rule: /^[a-z0-9._-]+@[a-z0-9.-]{2,}[.][a-z]{2,3}$/,
		msg: 'the email format is not valid'
	}
};

VVF.validation['accountCreationStep2Form'] = {
	CustomerTelMobile2: {
	    rule: function(value) {
	        if (document.getElementById('fSMSOffers').checked) {
	            return /^\s*$/.test(value);
	        }
	        return false;
	    },
	    msg: 'Mobile phone number required '
	}
};

VVF.validation['bookingToolForm'] = {
	DevisClubRegion: {
	    rule: /^\S+.*\S+$/,
		msg: 'Mandatory field'
	},
	DevisStartDateDay: {
	    rule: /^\d{1,2}$/,
		msg: 'Mandatory field'
	},
	DevisStartDateMonth: {
	    rule: /^\d{1,2}$/,
		msg: 'Mandatory field'
	},
	DevisStartDateYear: {
	    rule: /^\d{4}$/,
		msg: 'Mandatory field'
	}
};
