// I set the debug option to true, so the data is not commited, 
// enabling me to review the outcome.
$.validator.setDefaults({
	debug: false
});


$(document).ready(function() {
	 // validate signup form on keyup and submit
	 
	$("#jobmail").validate({
	
		//As soon as a key within a form field in “myform” is release then start
		event: "keyup",
		
		//Here the rules for the individual inputs are defined.
		rules: {
			
			//for id "username"
			roepnaam: {
				required: true,
				minlength: 2
			},
			email: {
				required: true,
				//It is an E-Mail address
				email: true
			},
			tonaam: {
				required: true,
				minlength: 2
			},
			tomail: {
				required: true,
				//It is an E-Mail address
				email: true
			}
			
		},
		
		//Here the error messages for all rules are defined.
		messages: {
			roepnaam: {
				required: 'Vul uw naam in',
				minlength: 'Uw naam moet tenminste 2 letters lang zijn'
			},
			email: 'Vul een correct email adres in',
			tonaam: {
				required: 'Vul de naam van uw vriend(in) in',
				minlength: 'De naam moet tenminste 2 letters lang zijn'
			},
			tomail: 'Vul een correct email adres in'
		},
		
        // specifying a submitHandler prevents the default submit, good for the demo 
        //submitHandler: function() { 
        //    alert("submitted!"); 
        //}, 
        // set this class to error-labels to indicate valid fields 
        success: function(label) { 
            // set   as text for IE 
            label.html(" ").addClass("checked"); 
        }
	});
});
