



	// CN: override the init() method to allow validation of select boxes onchange (see http://osdir.com/ml/jQuery/2009-06/msg01117.html)
// unfortunately, doesn't work
/*$.validator.prototype.init = function() {
	this.labelContainer = $(this.settings.errorLabelContainer);
	this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
	this.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );
	this.submitted = {};
	this.valueCache = {};
	this.pendingRequest = 0;
	this.pending = {};
	this.invalid = {};
	this.reset();
	
	var groups = (this.groups = {});
	$.each(this.settings.groups, function(key, value) {
		$.each(value.split(/\s/), function(index, name) {
			groups[name] = key;
		});
	});
	var rules = this.settings.rules;
	$.each(rules, function(key, value) {
		rules[key] = $.validator.normalizeRule(value);
	});
	
	function delegate(event) {
		var validator = $.data(this[0].form, "validator");
		validator.settings["on" + event.type] && validator.settings["on" + event.type].call(validator, this[0] );
	}
	$(this.currentForm)
		.delegate("focusin focusout keyup", ":text, :password, :file, textarea", delegate)
		.delegate("focusin focusout keyup change", "select", delegate)
		.delegate("click", ":radio, :checkbox", delegate);

	if (this.settings.invalidHandler)
		$(this.currentForm).bind("invalid-form.validate", this.settings.invalidHandler);
}*/

// CN: like the 'accept' test but it gets the list of accepted filetypes from the tag
$.validator.addMethod(
	"acceptFromTag",
	function(value, element) {
		if (element.getAttribute("accept")) {
			var correctFileType = new RegExp('\\.(' + element.getAttribute("accept").replace(/\,/g, '|') + ')$');
			return correctFileType.test(value);
		}
		return true;
	},
	validationMessages["fileTypes"]);

// CN: for selects where the first value is "please select" (seems to be over-ridden by 'required' test, tho)
$.validator.addMethod(
	"selectAnyButFirst",
	function(value, element) {
		if (element.nodeName.toLowerCase() == 'select' && element.selectedIndex > -1) {
			return element.selectedIndex > 0;
		}
		return true;
	},
	validationMessages["selectNotFirst"]);

// CN: check that passwords are valid
$.validator.addMethod(
	"validPass",
	function(value, element) {
		if (element.nodeName.toLowerCase() == 'input' && element.type.toLowerCase() == 'password') {
			return element.value.length > 7 && /[a-zA-Z]/.test(element.value) && /\d/.test(element.value);
		}
		return true;
	},
	validationMessages["validPass"]);




<!--generated: Tue Nov 03 20:08:09 PST 2009, host: '38', release: v.3.0.14 r.9747 id:78470 -->