$(document).ready(function() { 
	
	$('div.fitts').fitted();

	$('div.search_panel form').validate({
		rules: {
			q: {
				required: true,
				minlength: 4
			}
		},
		messages: {
			q: {
				required: 'Please enter a minimum of 4 characters'
			}
		}
	});


	$(function(){
			$('.checkout input').click(function(){
			$("table.basket .error").hide();
			var hasError = false;
			var passwordVal = $("#postcode_area").val();
			if (passwordVal == '') {
				$("#postcode_area").before('<div class="message error"><p>Please choose your delivery area.</p></div>');
				hasError = true;
			} 
			if(hasError == true) {return false;}
		});
	});


}); 

function shipping_amount(postcode_area) {
	location.href="/products/shop/basket/?postcode_area=" + postcode_area;
};

function terms_accepted(value) {
	location.href="/products/shop/basket/?terms_accepted=" + value;
};

