// 
//	jQuery Validate example script
//
//	Prepared by PII
//	
//	Free for your use -- No warranties, no guarantees!
//

$(document).ready(function(){

	// Validate
	// http://bassistance.de/jquery-plugins/jquery-plugin-validation/
	// http://docs.jquery.com/Plugins/Validation/
	// http://docs.jquery.com/Plugins/Validation/validate#toptions
	
		$('#createNewProject').validate({
	    rules: {
	      projectType: {
	        required: true
	      },
		  officialName: {
	        minlength: 2,
	        required: true
	      },
	      shortName: {
	        required: true,
	        email: true
	      },
	      startDate: {
	        required: true
	      },
	      irbNumber: {
	        required: true
	      },
		   irbExpDate: {
	        required: true
	      }
	    },
	    highlight: function(label) {
	    	$(label).closest('.control-group').addClass('error');
	    },
	    success: function(label) {
	    	label
	    		.addClass('valid')
	    		.closest('.control-group').addClass('success');
	    }
	  });
	  
}); // end document.ready