var error = "Please fill in the following fields:";

function validateNewClient(whichForm)
{
	var valid = true;
	with (whichForm) {
		if (client_registered[0].checked) {
			if (!isSet(domain_registrar_url) || !isSet(domain_registrar_username) || !isSet(domain_registrar_password)) {
				valid = false; 
			}
		}
		if (client_registered[1].checked) {
			if (!isSet(domain_pref2) || domain_pref2.value=="www.") {
				error += "<br />domain-second-preference";
				valid = false;
			}
		}
		if (store_included[0].checked) {
			if (!isSet(store_orders_email)) {
				valid = false;
			}
			if (paypal_account[0].checked) {
				if (!isSet(paypal_email_address)) {
					valid = false;
				}
			}
		}
		if (cms_update[0].checked) {
			if (!cms_update_payment[0].checked && !cms_update_payment[1].checked) {
				valid = false;
			}
		}
		if (!trading_terms[0].checked) {
			error += "<br />trading_terms";
			valid = false;
		}
		if (!valid) {
			errormsg.innerHTML = error;
			errormsg.backgroundColor = "#ff0000";
			errormsg.color = "#ff0000";
			scroll(0,0);
		}
	}
	error = "Please fill in the following fields:";
	return valid;
}

function isSet(field) {
	with (field) {
		if (value == null || value == "") {
			error += "<br />" + name;
			return false;
		} else {
			return true;
		}
	}
}
