/// <reference path="jquery-1.5.1-vsdoc.js" />

// we add a custom jquery validation method
jQuery.validator.addMethod('requiredcheckbox', function (value, element, params) {
    return element.checked;
}, '');

// and an unobtrusive adapter
jQuery.validator.unobtrusive.adapters.add('requiredcheckbox', {}, function (options) {
    options.rules['requiredcheckbox'] = true;
    options.messages['requiredcheckbox'] = options.message;
});


// we add a custom jquery validation method
jQuery.validator.addMethod('validateemail', function (value, element, params) {
    var reg = new RegExp(/^(("[\w-+\s]+")|([\w-+]+(?:\.[\w-+]+)*)|("[\w-+\s]+")([\w-+]+(?:\.[\w-+]+)*))(@((?:[\w-+]+\.)*\w[\w-+]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][\d]\.|1[\d]{2}\.|[\d]{1,2}\.))((25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\.){2}(25[0-5]|2[0-4][\d]|1[\d]{2}|[\d]{1,2})\]?$)/i);
    return reg.test(value);
}, '');

// and an unobtrusive adapter
jQuery.validator.unobtrusive.adapters.add('validateemail', {}, function (options) {
    options.rules['validateemail'] = true;
    options.messages['validateemail'] = options.message;
});
