// JavaScript Document
function testPassword() {
var namein=0;
var passin=0;
var passconfirmin=0;
var passmatch=0;
var townin=0;
var addressin=0;
var codein=0;
var telin=0;
var countyin=0;
var titlein=0;
var firstnamein=0;
var lastnamein=0;
var termsin=0;
var myForm=document.regform;

if (myForm.usernamein.value=="")  {
if (document.all) {
document.all["noname"].innerText="* enter email address";
}
else {
alert ("you must complete all fields");
}
}
else if (myForm.usernamein.value.indexOf ("@") ==-1) {
if (document.all) {
document.all["noname"].innerText="* not a valid email address";
}
else {
alert ("this is not a valid email address");
}
}
else {
document.all["noname"].innerText="";
namein=1;
}
if (myForm.passwordin.value=="")  {
if (document.all) {
document.all["nopassword"].innerText="* enter password";
}
else {
alert ("you must complete all fields");
}
}
else if (myForm.passwordin.value.length<6) {
if (document.all) {
document.all["nopassword"].innerText="* password must be at least 6 characters ";
}
else {
alert ("you must complete all fields");
}
}
else {
document.all["nopassword"].innerText="";
passin=1;
}
if (myForm.passwordconfirm.value=="")  {
if (document.all) {
document.all["nopasswordconfirm"].innerText="* confirm password";
}
else {
alert ("you must complete all fields");
}
}
else {
document.all["nopasswordconfirm"].innerText="";
passconfirmin=1;
}
if (myForm.title.value=="")  {
if (document.all) {
document.all["notitle"].innerText="* enter title";
}
else {
alert ("you must complete all fields");
}
}
else {
document.all["notitle"].innerText="";
titlein=1;
}
if (myForm.firstname.value=="")  {
if (document.all) {
document.all["nofirstname"].innerText="* enter firstname";
}
else {
alert ("you must complete all fields");
}
}
else {
document.all["nofirstname"].innerText="";
firstnamein=1;
}
if (myForm.lastname.value=="")  {
if (document.all) {
document.all["nolastname"].innerText="* enter last name";
}
else {
alert ("you must complete all fields");
}
}
else {
document.all["nolastname"].innerText="";
lastnamein=1;
}

if (myForm.address1.value=="")  {
if (document.all) {
document.all["noaddress1"].innerText="* enter address";
}
else {
alert ("you must complete all fields");
}
}
else {
document.all["noaddress1"].innerText="";
addressin=1;
}
if (myForm.town.value=="")  {
if (document.all) {
document.all["notown"].innerText="* enter town/city";
}
else {
alert ("you must complete all fields");
}
}
else {
document.all["notown"].innerText="";
townin=1;
}

if (myForm.postcode.value=="")  {
if (document.all) {
document.all["nocode"].innerText="* enter postcode";
}
else {
alert ("you must complete all fields");
}
}
else {
document.all["nocode"].innerText="";
codein=1;
}
if (myForm.telephone.value=="")  {
if (document.all) {
document.all["notel"].innerText="* enter telephone no.";
}
else {
alert ("you must complete all fields");
}
}
else {
document.all["notel"].innerText="";
telin=1;
}
if ((myForm.passwordin.value) != (myForm.passwordconfirm.value)) {
alert ("your passwords did not match, please re-enter and confirm your information");
}
else {
passmatch=1;
}
if (document.regform.acceptbox.checked==false) {
alert ("you must acknowledge acceptance of our terms and conditions by checking the tick box");
}
else {
termsin=1;
}
if (namein==1&&passin==1&&passconfirmin==1&&passmatch==1&&addressin==1&&townin==1&&codein==1&&telin==1&&termsin==1){
myForm.action = "registrationconfirmation.asp";
myForm.submit();
}
else {
return;
}
}
