
var f = new formValidator({formId : 'contactForm',	// the form id
						  submitId : 'ok', 	// id of submit button
						  errorMsg : 'Debe completar todos los campos para continuar...',	// general error message on submit
						  msgContainer : 'formError'	// id of the container element to show error msg
			});


f.addValidator({field : 'name',				// the field id
			   validator : 'nameValidator',	// id of the message validator
			   container : 'nameP',			// id of the container in the form (i.e. a P element)
			   successClass : 'success',
			   errorClass: 'error',
			   func : function(field) {
					if (!field.value) {
						f.setMessage('name', 'Por favor, ingrese su nombre.');
						return false;
					}
					else {
						f.setMessage('name', '');
						return true;
					}
				}
			   });

f.addValidator({field : 'email',				// the field id
			   validator : 'emailValidator',	// id of the message validator
			   container : 'emailP',			// id of the container in the form (i.e. a P element)
			   successClass : 'success',
			   errorClass: 'error',
			   func : function(field) {
					if (!field.value) {
						f.setMessage('email', 'Por favor, ingrese su dirección de Mail.');
						return false;
					}
					else {
						if (!f.isValidEmail(field.value)) {
							f.setMessage('email', 'La dirección de Mail ingresada es incorrecta.');
							return false;
						}
						else {
							f.setMessage('email', '');
							return true;
						}
					}
				}
			   });

f.addValidator({field : 'title',				// the field id
			   validator : 'titleValidator',	// id of the message validator
			   container : 'titleP',			// id of the container in the form (i.e. a P element)
			   successClass : 'success',
			   errorClass: 'error',
			   func : function(field) {
					if (!field.value) {
						f.setMessage('title', 'Por favor, ingrese el asunto.');
						return false;
					}
					else {
						f.setMessage('title', '');
						return true;
					}
				}
			   });

f.addValidator({field : 'comment',				// the field id
			   validator : 'commentValidator',	// id of the message validator
			   container : 'commentP',			// id of the container in the form (i.e. a P element)
			   successClass : 'success',
			   errorClass: 'error',
			   func : function(field) {
					if (!field.value) {
						f.setMessage('comment', 'Por favor, ingrese su mensaje.');
						return false;
					}
					else {
						f.setMessage('comment', '');
						return true;
					}
				}
			   });
