$(document).ready(function(){
	
	jQuery.validator.addClassRules("requiredIfAnyDateSelected", {
		required: function(element) {
			var req = false;
			$("select option:selected", $(element).parent()).each(function(i,elm){
				if ($(elm).val()!='') {
					req = true;
					console.log('here');
					return false;
				}
			});
			return req;
		}
	});
	
	$("#applyonline").validate({
		
		submitHandler: function(form) {
			jQuery(form).ajaxSubmit({
				success: function (response) {
					$('#applyonline').fadeOut('slow', function(){$('#applyonlineContainer').html(response)});
				},
				type: 'post'
			});
		}
	});
});
