
	
	function check_format() {
			
			
					if (document.addtocart.category_id.value != "") { 
						 	document.addtocart.submit(); return true;		     
				}	else { alert('Please select which type you would like.');	
						return false; }
				
				
			
			
		}
		
	function updateTotalPrice() {

	
		shippingLength = document.superShipping.shipping.length;
		var checked = false;
		for (i=0; shippingLength > i; i++) {
			
			if (document.superShipping.shipping[i].checked == true) {
				
				selectedShipping = document.superShipping.shipping[i].value;
				shipping = parseFloat(document.superShipping[selectedShipping].value);
				if (selectedShipping != "priority") { shipping = shipping +parseFloat(0.60);}
				subtotal = parseFloat(document.superShipping.subtotal.value);
				shippingDisplay = shipping.toFixed(2);
			
				total = shipping+subtotal;
				total = Math.floor(total * 100) / 100;
			    
				document.checkout.shippingtype.value = document.superShipping.shipping[i].value; //shipping;
			
				document.checkout.shipping.value = shipping; //document.superShipping[selectedShipping].value;
				document.checkout.amount.value = total; // <-- this will set the real price
			
				totalDisplay = total.toFixed(2);
				document.getElementById('finalPricing').innerHTML = "<h4>Total: <span class='totalPrice'>$"+totalDisplay+"</span> (with shipping, and tax if applicable)</h4>";
				
				var checked = true;
				
			} 
			
			}
			if (!checked) {
				var checked = true;
					document.superShipping.shipping[0].checked = true;
					selectedShipping = document.superShipping.shipping[0].value;
					shipping = parseFloat(document.superShipping[selectedShipping].value);
					if (selectedShipping != "priority") { shipping = shipping +parseFloat(0.60);}
					subtotal = parseFloat(document.superShipping.subtotal.value);
					shippingDisplay = shipping.toFixed(2);

					total = shipping+subtotal;
					total = Math.floor(total * 100) / 100;
						document.checkout.shippingtype.value = document.superShipping.shipping[0].value; //shipping;

			
					document.checkout.shipping.value = shipping; //document.superShipping[selectedShipping].value; //shipping;
					document.checkout.amount.value = total; // <-- this will set the real price
			
					totalDisplay = total.toFixed(2);
					document.getElementById('finalPricing').innerHTML = "<p>Total: <span class='totalPrice'>$"+totalDisplay+"</span> (with shipping, and tax if applicable)<br/>";
				
			}
		
		
	}	
	
	function popUp(URL) {
		day = new Date();
		id = day.getTime();
		eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=590,height=245,left = 490,top = 312');");
		}
		


function jumpto(x){

if (document.form1.jumpmenu1.value != "null") {
	document.location.href = x
	}

if (document.form2.jumpmenu2.value != "null") {
	document.location.href = x
	}
}

function options_change(category_id,product_id) {
	
	$("span#options_container").hide();  
							
								$.ajax({
								   type: "POST",
								   url: "js/options_change.php",
								   data: "category_id="+category_id+"&product_id="+product_id,
								   dataType: "html",
								   success: function(msg){
									
									if (msg.indexOf("no results") == -1) { 
									 $("span#options_container").html(msg);
									 $("span#options_container").show("fast"); }
										
										
								   }

		});
}
