function validateCheckoutContinue(oForm) {
	if (oForm.registerAgree.checked == false) {
		alert('You must state that you agree to the terms and conditions to purchase.');
		return false;
	} else {
		var bValid = true;

		//check for registration and password
		if (oForm.registerAccount.checked == true && oForm.registerPassword.value.length < 5) {
			alert('Your password must be 5 or more characters');
			return false;
		}
		if (oForm.registerAccount.checked == true && (oForm.registerPassword.value != oForm.registerConfirm.value)) {
			alert('Your password and confirmation do not match');
			return false;
		}

		//check normal form
		if (oForm.registerName.value == '' || oForm.registerAddress1.value == '' || oForm.registerTown.value == '' || oForm.registerEmail.value == '') {
			bValid = false;
		}
		//check postcode
		if (oForm.registerCountry.value == 'United Kingdom' && oForm.registerPostcode.value == '') {
			bValid = false;
		}
		//check delivery form
		if (oForm.deliveryAddress[1].checked && (oForm.deliveryName.value == '' || oForm.deliveryAddress1.value == '' || oForm.deliveryTown.value == '')) {
			bValid = false;
		}
		//check delivery postcode
		if (oForm.deliveryAddress[1].checked && oForm.deliveryCountry.value == 'United Kingdom' && oForm.deliveryPostcode.value == '') {
			bValid = false;
		}

		//return correctly
		if (bValid == false) {
			alert('Please fill out all required fields *');
			return false;
		}
	}
}

function validateRegister(oForm) {
	if (oForm.registerAgree.checked == false) {
		alert('You must state that you agree to the terms and conditions to purchase.');
		return false;
	} else {
		var bValid = true;

		//check for registration and password
		if (oForm.registerPassword.value.length < 5) {
			alert('Your password must be 5 or more characters');
			return false;
		}
		if (oForm.registerPassword.value != oForm.registerConfirm.value) {
			alert('Your password and confirmation do not match');
			return false;
		}

		//check normal form
		if (oForm.registerName.value == '' || oForm.registerAddress1.value == '' || oForm.registerTown.value == '' || oForm.registerEmail.value == '') {
			bValid = false;
		}
		//check postcode
		if (oForm.registerCountry.value == 'United Kingdom' && oForm.registerPostcode.value == '') {
			bValid = false;
		}

		//return correctly
		if (bValid == false) {
			alert('Please fill out all required fields *');
			return false;
		}
	}
}

function validateChangeLogin(oForm) {
	//check password
	if (oForm.currentPassword.value == '') {
		alert('You must specify your current password');
		return false;
	}
	if (oForm.email.value == '') {
		alert('You must specify the email address for your account');
		return false;
	}
	if (oForm.newPassword.value.length < 5) {
		alert('Your new password must be 5 or more characters');
		return false;
	}
	if (oForm.newPassword.value != oForm.confirmPassword.value) {
		alert('Your new password and confirmation do not match');
		return false;
	}
}

function popup (obj, iW, iH) {
	var winW = iW;
	var winH = iH;
	var winName = '_blank';
	var winL = (screen.width - winW) / 2;
	var winT = (screen.height - winH) / 2;
	window.open(obj.href, winName, 'location=no, toolbar=no, status=no, directories=no, scrollbars=yes, menubar=no, resizable=no, left=' + winL + ', top=' + winT +', width=' + winW + ', height=' + winH);
}