	function validate(theForm) {
		
		if (theForm.cmbTitle.value=='') {
			alert("Please select a title");
			theForm.cmbTitle.focus();
			return false;
		}
		
		if (theForm.txtName.value=='') {
			alert("Please enter your first name");
			theForm.txtName.focus();
			return false;
		}
		
		if (theForm.txtSurname.value=='') {
			alert("Please enter your surname");
			theForm.txtSurname.focus();
			return false;
		}
		
		if ( (theForm.txtTelNo.value=='') && (theForm.txtMobNo.value=='') &&
			(theForm.txtFaxNo.value=='') ) {
			alert("Please enter at least one contact number");
			theForm.txtTelCode.focus();
			return false;
		}
		
		if ((theForm.txtEmail.value=='') || (theForm.txtEmailConfirm.value=='')) {
			alert("Please enter email address");
			return false;
		}
		
		if ((!emailCheck(theForm.txtEmail.value)) && (!emailCheck(theForm.txtEmailConfirm.value))){
			theForm.txtEmail.value = '';
			theForm.txtEmail.focus();
			return false;
		} else {
			if ((theForm.txtEmail.value)!=(theForm.txtEmailConfirm.value)) {
				alert("Both email addresses should be the same");
				return false;
			}
		}
		
		if (theForm.txtPassword.value=='') {
			alert("Please enter a password");
			theForm.txtPassword.focus();
			return false;
		}
		
		if (theForm.txtConfirmPassword.value=='') {
			alert("Please confirm password");
			theForm.txtConfirmPassword.focus();
			return false;
		}
		
		if ((theForm.txtPassword.value)!=(theForm.txtConfirmPassword.value)) {
			alert("Both passwords should be the same");
			return false;
		}
		
		if ((theForm.txtPassword.value.length < 6) || (theForm.txtConfirmPassword.value.length < 6)) {
			alert("Password must consist of at least 6 characters");
			return false;
		}
		
		if (!theForm.chkAgree.checked){
			alert("Please agree to our Terms of Use");
			theForm.chkAgree.focus();
			return false;
		}
		
		return true;
	}
	
	function emailCheck (emailStr) 
	{
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
		if (matchArray==null) 
		{
		alert("Please enter a valid email address (check @ and .'s)")
		return false
		}
	var user=matchArray[1]
	var domain=matchArray[2]
		if (user.match(userPat)==null) 
		{
	   	// user is not valid
	   	alert("The username doesn't seem to be valid.")
	   	return false
		}
	var IPArray=domain.match(ipDomainPat)
		if (IPArray!=null) 
		{
	   	// this is an IP address
	  	for (var i=1;i<=4;i++) 
		{
	    if (IPArray[i]>255) 
			{
	        alert("Destination IP address is invalid!")
			return false
	    	}
	   	}
	   	return true
	}
	var domainArray=domain.match(domainPat)
		if (domainArray==null) 
		{
		alert("The domain name doesn't seem to be valid.")
	   	return false
		}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
		if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
		{
		alert("The address must end in a three-letter domain, or two letter country.")
	   	return false
		}
		if (len<2) 
		{
		var errStr="This address is missing a hostname!"
		alert(errStr)
		return false
		}
		return true;
	}