function validateregister(theForm)
{
	if (theForm.firstname.value == "")
	{
	alert("Please enter your first name");
	return false;
	}
	
	
	if (theForm.lastname.value == "")
	{
	alert("Please enter your last name");
	return false;
	}
	
//	if (theForm.address.value == "")
//	{
//	alert("Please enter your address");
//	return false;
//	}
	
	if (theForm.city.value == "")
	{
	alert("Please enter your city");
	return false;
	}
	
//	if (theForm.postcode.value == "")
//	{
//	alert("Please enter your postcode/zip");
//	return false;
//	}
//	if (theForm.telephone.value == "")
//	{
//	alert("Please enter your telephone number");
//	return false;
//	}
	
	if (theForm.emailaddress.value == "")
	{
	alert("Please enter your emailaddress");
	return false;
	}
	
	// test if valid email address, must have @ and .
	var checkEmail = "@.";
	var checkStr = theForm.emailaddress.value;
	var EmailValid = false;
	var EmailAt = false;
	var EmailPeriod = false;
	for (i = 0;  i < checkStr.length;  i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkEmail.length;  j++)
	{
	if (ch == checkEmail.charAt(j) && ch == "@")
	EmailAt = true;
	if (ch == checkEmail.charAt(j) && ch == ".")
	EmailPeriod = true;
		  if (EmailAt && EmailPeriod)
			break;
		  if (j == checkEmail.length)
			break;
		}
		// if both the @ and . were in the string
	if (EmailAt && EmailPeriod)
	{
			EmailValid = true
			break;
		}
	}
	if (!EmailValid)
	{
	alert("Please enter a valid email address.");
	theForm.emailaddress.focus();
	return (false);
	}

	
	if (theForm.password.value == "")
	{
	alert("Please enter a password");
	return false;
	}
	
	if (theForm.password.value.length < 6) 
	{
       alert("Password needs to be longer than 6 characters ");
	   return false;
    }


	if (theForm.confpassword.value == "")
	{
	alert("Please confirm your password");
	return false;
	}

	if (theForm.password.value != theForm.confpassword.value)
	{
	alert("Passwords dont match");
	return false;
	}

	if (theForm.username.value == "")
	{
	alert("Please enter a username");
	return false;
	}
	
	if (theForm.terms.checked == false)
	{
		alert("Please confirm your acceptance of our terms of use.");
		return (false);	
	}
}

function validateresend(theForm)
{
	
	if (theForm.yourem.value == "")
	{
	alert("Please enter your email address");
	return false;
	}
	
	// test if valid email address, must have @ and .
	var checkEmail = "@.";
	var checkStr = theForm.yourem.value;
	var EmailValid = false;
	var EmailAt = false;
	var EmailPeriod = false;
	for (i = 0;  i < checkStr.length;  i++)
	{
	ch = checkStr.charAt(i);
	for (j = 0;  j < checkEmail.length;  j++)
	{
	if (ch == checkEmail.charAt(j) && ch == "@")
	EmailAt = true;
	if (ch == checkEmail.charAt(j) && ch == ".")
	EmailPeriod = true;
		  if (EmailAt && EmailPeriod)
			break;
		  if (j == checkEmail.length)
			break;
		}
		// if both the @ and . were in the string
	if (EmailAt && EmailPeriod)
	{
			EmailValid = true
			break;
		}
	}
	if (!EmailValid)
	{
	alert("Please enter a valid email address.");
	theForm.yourem.focus();
	return (false);
	}
}

function confirmit(theForm)
{
	
	if (theForm.vcode.value == "")
	{
	alert("Please enter your verification code");
	return false;
	}
}

function validateblog(theForm)
{
	if (theForm.blogtitle.value == "")
	{
	alert("Please enter the blog title.");
	return false;
	}
	
	if (theForm.blogcontent.value == "")
	{
	alert("Please enter the blog content.");
	return false;
	}
}

function delConfirm(id)
{
  if(confirm("Are you sure you wish to delete this entry?"))
  {
  location='deleteblog.asp?id=' + id
   }
}
