jQuery.validator.addMethod("phone", function(value, element, param) {
											 
	// Ignore if empty
	if(value.length == 0)
	{
		return true;
	}

	// Remove all non-numeric characters
	value = value.replace(/[^0-9]/g, ''); 

	// Make sure there are 10 numbers
	if(value.length != 10)
	{
		return false;
	}
	else
	{
		$(element).val(value.substr(0,3) + '-' + value.substr(3,3) + '-' + value.substr(6,4));
		return true;
	}


}, 'Invalid phone number.');

jQuery.validator.addMethod("date", function(value, field) {
											
	// Return true if empty
	if(value.length == 0) return true;

	// Set variable to track status
	var valid = false;

	$.ajax({
		type: "post",
		data: {
			dt: value
		},
		async: false,
		url: "/admin/utils/format-date/",
		success: function(response){
			if(response.length == 0){
				valid = false;
			} else {
				$(field).val(response);
				valid = true;
			}
		}
	});
	
	return valid;
}, 'Invalid date.');
