$(document).ready(
	function()
	{
		$(".shippingTypeRadio").click(function() {
			var shippingTypeId = $(this).next().val();
			$.ajax({
				type: 'POST',
				url: "/cart/recountshippingajax",
				dataType: 'json',
				data: {shippingTypeId: shippingTypeId},
				success: function(data) {
					$("#shippingCost").html("<b>" + data.deliveryCostView + "</b>");
					$("#totalCost").html("<b>" + data.totalCost + "</b>");
					setTimeout(function() {
						$("#shippingCost").html(data.deliveryCostView);
						$("#totalCost").html(data.totalCost);
					}, 1500);
				}
			});
			
		});
		$("#setPostalCode").click(function() {
			
			$("#postalCodeInput").slideDown(500);
			return false; 		
		});
		$("#setPostalCodeButton").click(function() {
			document.location = "/cart/setpostalcode/postalCode1/" + $("#postalCode1").val() + "/postalCode2/" + $("#postalCode2").val();
		});
		
		$("#postalCode1").keypress(function (e) {  
			        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {  
			            $("#setPostalCodeButton").click();  
			            return false;  
			        } else {  
			            return true;  
			        }  
		     });  
		
		$("#postalCode2").keypress(function (e) {  
	        if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {  
	            $("#setPostalCodeButton").click();  
	            return false;  
	        } else {  
	            return true;  
	        }  
     });  
		
	}
);   
