$(document).ready(function() {
    checks = new Array(
        new CheckSet('email',[new Check(PATTERN_EMAIL, 'Email address not properly formatted')]),
        new CheckSet('password_confirm',null,'password','Password fields do not match'),
        new CheckSet('password',[new Check(/^.{0,4}$/,'Password must be longer than four characters',false)]),
        new CheckSet('postal_code',[new Check(PATTERN_PCODE,'You must enter a Canadian postal code (ex. M6K 3P6)')]),
        new CheckSet('birth_year',[new Check(/^[0-9]{4}$/,'Invalid birth year; please enter the full year (four digits)')])
        );
    validator = new Validator('signup_form',checks);
    validator.validate();
    
    $('#username').change(function() {
        ajaxAccountCheck($(this),'username');
    });
    $('#email').change(function() {
        ajaxAccountCheck($(this),'new_email');
    });
});