// Add To Cart Validation //
var zipCodeRE = /^(\d{5}-\d{4})|(\d{5})$/;
var date1RE = /^\d{1,2}\/\d{1,2}\/\d{4}$/; /* i.e. 01/02/2007 */

function checkZipCode(){
	var the_uri = $("#checkAvailForm").serialize();
	var zip_code = $("#zip").val();
	var the_date = $("#date").val();
	if(!zipCodeRE.test(zip_code)){
		alert('Please enter a zip code.');
	}else{
		var the_zip_uri = 'zip=' + zip_code;
		$.ajax({type:'GET', url:'/includes/ajax/zip.php', data:the_uri, success: function(data){
				if(data == 0){
					alert('The zip code you entered does not match the zip codes in our areas of service. Please try again.');
				}else{
					if(!date1RE.test(the_date)){
						alert("Please Select a Date");
					}else{
						$.ajax({type:'GET', url:'/cart.php', data:the_uri, success: function(){
								window.location = 'https://www.flamingosurprise.com/shopping-cart.php';
							}
						});
					}
				}
			}
		});
	}
	return(false);
}
	