function checkForm(form) {

	if (!checkFirstName(form.firstname.value)) {
		form.firstname.focus();
		return;
	}
	
	if (!checkLastName(form.lastname.value)) {
		form.lastname.focus();
		return;
	}

	if (!checkCompany(form.company.value)) {
		form.company.focus();
		return;
	}
	
	if (!checkCompanyPosition(form.companyPosition.value)) {
		form.companyPosition.focus();
		return;
	}

	if (!checkAd(form.address.value)) {
		form.address.focus();
		return;
	}
	
	if (!checkCity(form.city.value)) {
		form.city.focus();
		return;
	}
	
	if (!checkCountry(form.country.value)) {
		form.country.focus();
		return;
	}
	
	if (!checkTel(form.telephone.value)) {
		form.telephone.focus();
		return;
	}
	
	if (!checkPostcode(form.postcode.value)) {
		form.postcode.focus();
		return;
	}

	if (!checkUserName(form.username.value)) {
		form.username.focus();
		return;
	}
	
	if (!checkPass(form.password.value)) {
		form.password.focus();
		return;
	}
	
	if (!checkPass2(form.password2.value)) {
		form.password2.focus();
		return;
	}
	
	if (!verifyPass(form.password.value, form.password2.value)) {
		form.password2.focus();
		return;
	}		

	if (!checkEmail(form.email.value)) {
		form.email.focus();
		return;
	}
	
	if (!checkEmail(form.email2.value)) {
		form.email2.focus();
		return;
	}
	
	if (!verifyEmail(form.email.value, form.email2.value)) {
		form.email2.focus();
		return;
	}
	
	if (!checkInv(form.investor.value)) {
		form.investor.focus();
		return;
	}
	
	if(form.investor.value == "other") {
		if (!checkInvOther(form.other.value)) {
			form.other.focus();
			return;
		}
	}
	
	if (form.accept.checked) {	
		document.register.submit();
	} else {
		alert("Please ensure you agree to the Terms and Conditions");
	}
}

function checkFirstName(firstname) {
	if (firstname == "") {
		alert("Please enter your first name");
		return false;
	}
	return true;
}

function checkLastName(lastname) {
	if (lastname == "") {
		alert("Please enter your family name");
		return false;
	}
	return true;
}

function checkCompany(company) {
	if (company == "") {
		alert("Please enter your company");
		return false;
	}
	return true;
}

function checkCompanyPosition(companyPosition) {
	if (companyPosition == "") {
		alert("Please enter your company position");
		return false;
	}
	return true;
}

function checkPass(password) {
	if (password == "") {
		alert("Please enter your password");
		return false;
	}
	return true;
}

function checkPass2(password2) {
	if (password2 == "") {
		alert("Please verify your password");
		return false;
	}
	return true;
}

function verifyPass(password, password2) {
	if (password != password2) {
		alert("Your passwords do not match.");		
		return false;
	}
	return true;
}

function verifyEmail(email, email2) {
	if (email != email2) {
		alert("Your email addresses do not match.");		
		return false;
	}
	return true;
}

function checkUserName(username) {
	if (username == "") {
		alert("Please enter your username");
		return false;
	}
	return true;
}

function checkTitle(title) {
	if (title == "") {
		alert("Please enter your title");
		return false;
	}
	return true;
}

function checkAd(address) {
	if (address == "") {
		alert("Please enter your address");
		return false;
	}
	return true;
}

function checkCity(city) {
	if (city == "") {
		alert("Please enter your city");
		return false;
	}
	return true;
}

function checkState(state) {
	if (state == "") {
		alert("Please enter your state");
		return false;
	}
	return true;
}

function checkCountry(country) {
	if (country == "") {
		alert("Please enter your country");
		return false;
	}
	return true;
}

function checkTel(telephone) {
	if (telephone == "") {
		alert("Please enter your telephone number");
		return false;
	}
	return true;
}

function checkPostcode(postcode) {
	if (postcode == "") {
		alert("Please enter your postcode");
		return false;
	}
	return true;
}

function checkInv(investor) {
	if (investor == "") {
		alert("Please select your investor type");
		return false;
	}
	return true;
}

function checkInvOther(investorOther) {
	if (investorOther == "") {
		alert("Please enter your other investor type");
		return false;
	}
	return true;
}

function checkEmail(email) {
	if (checkBlank(email)) {
		alert("Please enter your E-mail address");
		return false; 
	}
	var atfound = email.indexOf("@");
	if(atfound == -1) {
		alert("Please enter a valid E-mail address with an @");
		return false;
	}
	
	if(email.indexOf(".", atfound) == -1) {
		alert("Please enter a valid E-mail domain after the @");
		return false;
	}
	return true;
}

function checkBlank(string) {
	if(string.length == 0)
		return true;
	for (var i = 0; i <= string.length-1; i++) {
		if (string.charAt(i) != " ") { 
		}	return false;
		return true;
	}
}