// JavaScript Document

function submitCHK(){ 
var agree = true 
if (agree == true) { agree = confirmAgreement() }
// if (agree == true) { agree = confirmAmount() }

if (agree == true){ 
	document.location = "order_form.php" ;
//	document.frmCart.submit()
	} 
} 

	function confirmAgreement()
	{
		if (document.frmCart.agreement.checked == true)
		{
			return true
		}
		else
		{
			alert ('\nBefore continuing, please indicate that you agree to the \nterms of sale by clicking the checkbox.\n')
			return false
		}
	}

	function confirmAmount()
	{
		var total_value = document.frmCart.check_total_gst.value;
		if (total_value > 50)
		{
			return true
		}
		else
		{
			alert ('\nWe only accept orders with a value of AUD $50 or more.\n')
			return false
		}
	}

function GotoLocation(link){
 	DispWin = window.open(link,'Pwindow','width=630,height=450,toolbar=no,scrollbars=yes,resizable=yes,status=no,directories=no,location=yes,menubar=no,titlebar=no');
}

function UpdateQty(item)
{
	itemId = item.name;
	newQty = item.options[item.selectedIndex].text;
				
	document.location.href = 'add_to_cart.php?action=update_item&id='+itemId+'&qty='+newQty;
}

function verify() {
var themessage = "You are required to complete the following fields: ";
if (document.form.name.value=="") {
themessage = themessage + " - Name";
}
if (document.form.company.value=="") {
themessage = themessage + " -  Company";
}
if (document.form.email.value=="") {
themessage = themessage + " -  E-mail";
}
if (document.form.phone.value=="") {
themessage = themessage + " -  Phone";
}
//alert if fields are empty and cancel form submit
if (themessage != "You are required to complete the following fields: ") {
alert(themessage);
return false;
}
}
