var cc_payment_limit = 3000; // 3000function add_to_cart(id){	if (id == 0){		alert("You need to login as a Friend-of-the-Mint first.");		findObj("LoginUserID").focus();	}	else{	document.location = "add_to_cart.php?product_id=" + id;	}}function view_product_info(id){	document.location = "product_info.php?product_id=" + id;}function show_image(image) {	findObj("product_image").src = "images/products/" + image;}function go_to_page(page) {	// findObj("page_index").value = page;	// document.form1.action = "shop.php?c=" + queryString("c") + "&page_index=" + page;	// document.form1.submit();	document.location = "shop.php?c=" + queryString("c") + "&page_index=" + page;}function update_cart() {	findObj("action_type").value = "UPDATE";	document.form1.action = "update_cart.php"	document.form1.submit();}function checkout() {	findObj("action_type").value = "CHECKOUT";	document.form1.action = "update_cart.php"	document.form1.submit();}function change_delivery() {	findObj("action_type").value = "CHANGE_DELIVERY";	document.form1.action = "update_payment.php";	document.form1.submit();}function change_cart() {	if (findObj("action_type")) {		findObj("action_type").value = "CHANGE_CART";		document.form1.action = "update_payment.php";		document.form1.submit();	}	else {		document.location = "view_cart.php";	}}function continue_shopping() {	document.location = "shop.php";}function make_payment() {	controlToFocus = "";	var divs = $$("div.red_label_arrow"); for (i = 0; i < divs.length; i++) divs[i].remove(); // remove all error messages		if (!RequiredOption("DeliveryType")) {		ShowError("CollectionDeliveryDetailsHeader", "Please select whether you wish to collect or deliver your order", 376, 0, 320);		controlToFocus = (controlToFocus == "" ? "CollectionDeliveryDetailsHeader" : controlToFocus);	}	else if (findObj("DeliveryType1").checked) {		if (!RequiredField("ContactPerson")) {			ShowError("ContactPerson", "Please enter contact person");			controlToFocus = (controlToFocus == "" ? "ContactPerson" : controlToFocus);		}		if (!RequiredField("Address1")) {			ShowError("Address1", "Please enter address");			controlToFocus = (controlToFocus == "" ? "Address1" : controlToFocus);		}		if (!RequiredField("PostalCode")) {			ShowError("PostalCode", "Please enter postal code");			controlToFocus = (controlToFocus == "" ? "PostalCode" : controlToFocus);		}		if (!RequiredField("Country")) {			ShowError("Country", "Please select country");			controlToFocus = (controlToFocus == "" ? "Country" : controlToFocus);		}		if (!RequiredField("ContactNo")) {			ShowError("ContactNo", "Please enter contact no.");			controlToFocus = (controlToFocus == "" ? "ContactNo" : controlToFocus);		}		else if (!CustomValidator("ContactNo", IsNumeric, null)) {			ShowError("ContactNo", "Contact no. must be number only");			controlToFocus = (controlToFocus == "" ? "ContactNo" : controlToFocus);		}	}	if (controlToFocus != "") {		setFocus(controlToFocus);		$(controlToFocus).scrollTo();	}	else {		CountryError = false;		if (findObj("DeliveryType1").checked) {			if (findObj("Country").value == "Spain" || findObj("Country").value == "Russian Federation") {				alert("Please note that we are unable to deliver to " + findObj("Country").value + " due to the customs in the country.\nSorry for the inconvenience caused.");				CountryError = true;			}		}		if (!CountryError) {			document.form1.action = "update_delivery.php"			document.form1.submit();		}	}}function view_tnc() {	window.open("tnc.php");}function submit_order() {	controlToFocus = "";	var divs = $$("div.red_label_arrow"); for (i = 0; i < divs.length; i++) divs[i].remove(); // remove all error messages		if (!RequiredOption("PaymentMode")) {		ShowError("PaymentMode1", "Please select payment mode");		controlToFocus = (controlToFocus == "" ? "PaymentMode1" : controlToFocus);	}	else {		amount_payable = parseFloat(findObj("AmountPayable").value);		if (amount_payable > cc_payment_limit && !findObj("PaymentMode2").checked) {			ShowError("PaymentMode2", "Amount payable exceed S$" + cc_payment_limit + ", please pay by check");			controlToFocus = (controlToFocus == "" ? "PaymentMode2" : controlToFocus);		}	}	if (!RequiredCheckbox("Agree")) {		ShowError("Agree", "Please agree to the terms and conditions");		controlToFocus = (controlToFocus == "" ? "Agree" : controlToFocus);	}	if (controlToFocus != "") {		setFocus(controlToFocus);	}	else {		if (findObj("PaymentMode1").checked) {			document.form1.action = "payment_init.php";		}		else if (findObj("PaymentMode2").checked) {			document.form1.action = "payment_cheque_process.php";		}		else if (findObj("PaymentMode3").checked) {			document.form1.action = "payment_tt_process.php";		}		document.form1.submit();	}}function print_receipt(id) {	window.open("payment_receipt.php?order=" + id, "SGM", "width=760,height=600,location=0,toolbar=0,menubar=0,location=0,scrollbars=1,status=0", true);}