

	$(function(){
		// enable/disable the correct size(s) for the chosen flavor:
		var flavorSizes = {
			//allvar : ["hg","qt","pt","188s","48s","24s"],
			amaretto : ["qt","pt"],
			belgwcm : ["qt"],
			cinnhaz : ["qt","pt"],
			fvanilla : ["hg","qt","pt","188s","48s","24s"],
			hazelnut : ["qt","pt","48s","24s"],
			choccar : ["qt","pt"],
			icreme : ["qt","pt","48s","24s"],
			southbp : ["qt","pt"],
			vhaz : ["pt"],
			vtofcar : ["qt","pt"],
			cinncream: ["qt","pt"],
			engaltoffee: ["qt"],
			duldeleche: ["qt"],
			//sugarfree : ["qt","pt"],
			sffvanilla : ["qt","pt"],
			sfhazelnut : ["pt"],
			
			fffvanilla : ["qt","pt"],
			
			limited : ["qt","pt"],
			
			carmach : ["pt"],
			wtchmocha : ["pt"],
			vlatte : ["pt"]
		};
		$("input[name=product]").click(function() {
			var sizes = flavorSizes[this.value] || [];
			$("input[name=size]").parent().hide().end().filter(function() {
				return $.inArray(this.value, sizes) != -1;
			}).parent().show().end().eq(0).attr("checked","checked");
			$("#limitededition").hide();
			$("#fatfree").hide();
			
			if(this.value == 'limited')
				$("#limitededition").show();
			if(this.value == 'fffvanilla')
				$("#fatfree").show();
			
			
		}).filter(":checked").click();
		
		// disable the submit button unless a valid zip is entered
		$("#zip").change(function() {
			var valid = this.value.match(/^\d{5}(-\d{4})?$/);
			$("#submit").attr("disabled", !valid);
		}).keyup(function(){
			$(this).change()
		}).change();
	});