﻿/**
 * @fileOverview Overwrite the default configuration for participant validation in this file.
 * The default configuration can be found in Sundio\generic\common\validator.js
 * Specific configuration for adult participants
 * @extends Validator.Config.ParticipantConfig
 * @constructor
 */
Validator.Config.BrochureConfig = function() {
	
	this.productcode = {
		custom: function () {
		    // At least one brochure checkbox should be selected
            return $("fieldset.brochures input[type=checkbox]:checked").length > 0;
        }
	};
	
    this.title = {
        required: true,
		custom: function () {
			return $("#mag-title").val() != "0";
		}
    };
    
    this.firstletter = {
        required: true,
        maxLength: 10,
        regex: Validator.regexes.text
    };

    this.lastname = {
        required: true,
		maxLength: 100,
        regex: Validator.regexes.text
    };
    
    this.country = {
        required: true
    };
    
    this.postal = {
		required: true,
		maxLength: 6,
		minLength: 1,
		regex: Validator.regexes.postal
		/* 
		 * Postal code validation turned off for now: functionality isn't present in
		 * the platform at this moment (25 Sept. 2009)
		 */
         //,validatePostalCode: true
	};
    
    this.city = {
        required: true,
		maxLength: 100
    };
    
    this.street = {
        required: true,
        maxLength: 100
    };
    
    this.streetnr = {
        required: true,
        regex: Validator.regexes.number
    };

    this.streetnrext = {
        required: false,
        maxLength: 10
    };
	
	this.phoneprivate = {
		required: false,
        regex: Validator.regexes.phone,
		maxLength: 50
	};
	
	this.phonework = {
        required: false,
        regex: Validator.regexes.phone,
        maxLength: 50
	};
	
	this.email = {
		required: true,
		regex: Validator.regexes.email,
        maxLength: 250
	};
};
