function checkOrder(form) {
	var strErrors = '';
	var intErrors = '';

	// Customer details
	if(form.name.value == '') { strErrors += "You must enter your full name\n"; intErrors++; }
	if(form.email.value == '') { strErrors += "You must enter your email address\n"; intErrors++; }
	if(form.phone.value == '') { strErrors += "You must enter your contact phone number\n"; intErrors++; }
	if(form.otherName && form.otherName.value == '') { strErrors += "You must enter your partner's name\n"; intErrors++; }
	if(form.dueDate && form.dueDate.value == '') { strErrors += "You must enter your baby's due date\n"; intErrors++; }
	if(form.lmc && form.lmc.value == '') { strErrors += "You must enter your lead maternity carer\n"; intErrors++; }
	
	// Delivery details
	if(form.numStreet.value == '') { strErrors += "You must enter your street number\n"; intErrors++; }
	if(form.city.value == '') { strErrors += "You must enter your city\n"; intErrors++; }
	if(form.deliverTo.value == '' && form.localPickup.value == '') { strErrors += "You must state where in New Zealand to deliver to\nor the date and time you wish to pick up your order\n"; intErrors++; }

	// Other details

	if(intErrors > 0) {
		alert("The following " + intErrors + " occured:\n\n" + strErrors + "\nPlease fix the above and resubmit your details");
		return false;
	} else {
		return true;
	}
}

function deliveryCheck() {
	divDelivery = document.getElementById('deliverTo');
	divPickup	= document.getElementById('localPickup');

	// Check if delivery has been selected and if so disable the local pickup box and remove any text from there
	if(divDelivery.value != '') {
		divPickup.value = '';
		divPickup.disabled = true;
	} else {
		divPickup.disabled = false;
	}

	// Check if local pickup has been entered and if so disable the delivery dropdown and remove any value from there
	if(divPickup.value != '') {
		divDelivery.value = '';
		divDelivery.disabled = true;
	} else {
		divDelivery.disabled = false;
	}
}

function checkPaymentOrder(form) {
	var strErrors = '';
	var intErrors = '';

	if(form.quantityPool.value == '0' && form.quantityWrap.value == '0' && form.quantityWrapMerino.value == '0' && form.quantityBall.value == '0' && form.quantityTap.value == '0' && form.quantityPump.value == '0' && form.quantityHose.value == '') { strErrors += "You must select at least one product to order\n"; intErrors++; }
	if(form.paymentMethod[3].checked == false && form.sendPayment.value == '') { strErrors += "You must select when you intend on sending your payment\n"; intErrors++; }

	if(intErrors > 0) {
		alert("The following " + intErrors + " occured:\n\n" + strErrors + "\nPlease fix the above and resubmit your details");
		return false;
	} else {
		return true;
	}
}