// <input type="tel" name="phone" maxlength="14" required/>
//
// pretty phone
if ($('input[name=phone]').length > 0)
{
	$('input[name=phone]').on('keyup', function(e){
		var val = $(this).val();
		// clean
		val = val.replace(/[^0-9]/gi, ''); 
		if (val.length > 6)
		{
			$(this).val(val.replace(/(\d{3})(\d{3})(.*)/, '($1) $2-$3'));
			return;
		}
		if (val.length >= 3)
		{
			$(this).val(val.replace(/(\d{3})(\d)/, '($1) $2'));
			return;
		}
		
		$(this).val(val);
	});
}