$( function()
{
	/////////////////////////////////////////////////////////////////////////////////////////////
	var requireds = {
		subscriber_email : {
			validators	: {
				1	: {
					type		: 'text',
					errorMsg	: 'No has introduït cap dada.',
					errorClass	: 'borderRed',
					valorOmision: 'El seu e-mail',
					regEx		: null
				},
				2	: {
					type		: 'text',
					errorMsg	: 'L\'adreça introduïda no té el format correcte.',
					errorClass	: 'borderRed',
					valorOmision: 'El seu e-mail',
					regEx		: /^([\w\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
				}
			}
		}
	};

	var formVip = new formValidator({
		jSONrequired	: requireds,
		sendingMsg		: 'Sending data...',
		okMsg			: 'Thank you for taking part in MÉS.',
		formID			: 'followUsForm',
		errorClass		: 'borderRed',
		url				: '/mes/registerToNewsLetter.action',
		errorLabel		: $('.errorMsg p'),
		prefixID		: 'ID_',
		dataType		: 'xml',
		success			: function(xml)
		{
			var e = $('data error',xml).text();
			if ( e == "0" )
			{
				$('.errorMsg p').html('Thank you for taking part in MÉS.');
				setTimeout( function(){ $('#bot_follow').click() } , 2000 );
			}
			else
			{ 
				$('.errorMsg p').html('An error has occurred.');
				setTimeout( function(){ $('#bot_follow').click() } , 2000 );
			}
			return false;
		}
	});
});