
    function check_address() 
	{
	    var formType = document.getElementById("formType").value;
	  
	    if (formType == "feedback")
		{
			if  (document.getElementById("firstname").value == ""){ alert("Please enter your First Name"); document.getElementById("firstname").focus(); return false; }
			if  (document.getElementById("surname").value == ""){ alert("Please enter your Surname"); document.getElementById("surname").focus(); return false; }
			if  (document.getElementById("company").value == ""){ alert("Please enter your company name"); document.getElementById("company").focus(); return false; }
			if  (document.getElementById("email").value == ""){ alert("Please enter your email address"); document.getElementById("email").focus(); return false; }
			if  (document.getElementById("enquiry").value == ""){ alert("Please complete your enquiry"); document.getElementById("enquiry").focus(); return false; }
			if  (document.getElementById("chkFeedback").checked == false){ alert("Please indicate you agree to the Terms and Condition of the site."); document.getElementById("agree").focus(); return false; }
			if  (document.getElementById("session_output").value != document.getElementById("session_input").value){ alert("Please enter the security number exactly as you see it on screen"); document.getElementById("session_input").focus(); return false; }

		}

		if (formType == "register")
		{
			if  (document.getElementById("firstname").value == ""){ alert("Please enter your First Name"); document.getElementById("firstname").focus(); return false; }
			if  (document.getElementById("surname").value == ""){ alert("Please enter your Surname"); document.getElementById("surname").focus(); return false; }
			if  (document.getElementById("company").value == ""){ alert("Please enter your company name"); document.getElementById("company").focus(); return false; }
			if  (document.getElementById("email").value == ""){ alert("Please enter your email address"); document.getElementById("email").focus(); return false; }
			if  (document.getElementById("FSAType").value == ""){ alert("Please give details of your profession"); document.getElementById("FSAType").focus(); return false; }
			//if  (document.getElementById("FirmReferenceNumber").value == ""){ alert("Please stage your firm reference number"); document.getElementById("FirmReferenceNumber").focus(); return false; }
			if  (document.getElementById("chkReg").checked == false){ alert("Please indicate you agree to the Terms and Condition of the site."); document.getElementById("agree").focus(); return false; }
			if  (document.getElementById("session_output").value != document.getElementById("session_input").value){ alert("Please enter the security number exactly as you see it on screen"); document.getElementById("session_input").focus(); return false; }
		}
		
		if (formType == "forum")
		{  
			if  (document.getElementById("firstname").value == ""){ alert("Please enter your First Name"); document.getElementById("firstname").focus(); return false; }
			if  (document.getElementById("surname").value == ""){ alert("Please enter your Surname"); document.getElementById("surname").focus(); return false; }
			if  (document.getElementById("company").value == ""){ alert("Please enter your company name"); document.getElementById("company").focus(); return false; }
			if  (document.getElementById("email").value == ""){ alert("Please enter your email address"); document.getElementById("email").focus(); return false; }
			if  (document.getElementById("FSAType").value == ""){ alert("Please give details of your profession"); document.getElementById("FSAType").focus(); return false; }
			//if  (document.getElementById("FirmReferenceNumber").value == ""){ alert("Please stage your firm reference number"); document.getElementById("FirmReferenceNumber").focus(); return false; }
			if  (document.getElementById("chkReg").checked == false){ alert("Please indicate you agree to the Terms and Condition of the site."); document.getElementById("agree").focus(); return false; }
			if  (document.getElementById("session_output").value != document.getElementById("session_input").value){ alert("Please enter the security number exactly as you see it on screen"); document.getElementById("session_input").focus(); return false; }
		}
		
	}



    function validation()
    {
        var cName = document.getElementById("cName");
        var cEmail = document.getElementById("cEmail");
        var uName = document.getElementById("uName");
        var uEmail = document.getElementById("uEmail");

         //error strings
        var errStr = "";
        var errId = "";
   
        if (cName.value == "")
        {
            errStr += "\n - Your colleagues name";
            if (errId == "")
            {
                errId = cName;
            }
        }

        if (cEmail.value == "")
        {
            errStr += "\n - Your colleagues email address";
            if (errId == "")
            {
                errId = cEmail;
            }
        }
                
        if (cEmail.value != "" && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cEmail.value)) ) 
        { 
            errStr += "\n - Your colleagues email address: Incorrect format";
            if (errId=="") 
            { 
                errId = cEmail;
            } 
        }
        
        if (uName.value == "")
        {
            errStr += "\n - Your name";
            if (errId == "")
            {
                errId = uName;
            }
        }

        if (uEmail.value == "")
        {
            errStr += "\n - Your email address";
            if (errId == "")
            {
                errId = uEmail;
            }
        }
                
        if (uEmail.value != "" && !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(uEmail.value)) ) 
        { 
            errStr += "\n - Your email address: Incorrect format";
            if (errId=="") 
            { 
                errId = uEmail;
            } 
        }
        
        if (errStr != "") 
        {
            alert("* Information Required\n" + errStr);
            errId.focus();
            return false;
        }
    }
    
    function textCounter(max) 
    {
        var mess = document.getElementById("mess");
        var cntfield = document.getElementById("counter");
        
        if (mess.value.length > max) 
        {
            mess.value = mess.value.substring(max, mess);
            alert("The maximum number of character have been used.");
        }
        else 
        {
            cntfield.value = max - mess.value.length;
        }
    }
	
	function searchBlank(eID){
		if(eID.value=='Search this site') {
			eID.value='';
		}
	}
	
	function check_registration_fields() {
 
    document.getElementById("captch_err").innerHTML="";  
	if  (document.registration.txtFirstname.value == ""){ alert("Please state your First Name"); document.registration.txtFirstname.focus(); return false; }
	if  (document.registration.txtfamilyname.value == ""){ alert("Please state your Surname"); document.registration.txtfamilyname.focus(); return false; }
//	if  (document.registration.txtUsername.value == ""){ alert("Please specify your chosen uesrname"); document.registration.txtUsername.focus(); return false; }
//	if  (document.registration.txtUsername.value.length < 6 || document.registration.txtUsername.value.length > 12){ alert("Please choose a username between 6 and 12 characters in length"); document.registration.txtUsername.focus(); return false; }
    
    if (document.registration.txtEmail.value.indexOf('@', 0) == -1 || document.registration.txtEmail.value.indexOf('.', 0) == -1) {
    alert("Please enter a valid e-mail address.");
    document.registration.txtEmail.focus();
    return false;
    }
    if  (document.registration.txtVerifyEmail.value == ""){ alert("Please verify your Email Address"); document.registration.txtVerifyEmail.focus(); return false; }
	if  (document.registration.txtEmail.value != document.registration.txtVerifyEmail.value){ alert("Verify email does not match"); document.registration.txtVerifyEmail.focus(); return false; }
	
	if  (document.registration.txtPassword.value == ""){ alert("Please specify your chosen password"); document.registration.txtPassword.focus(); return false; }
	if  (document.registration.txtPassword.value.length < 6 || document.registration.txtPassword.value.length > 12){ alert("Please choose a password between 6 and 12 characters in length"); document.registration.txtPassword.focus(); return false; }

	if  (document.registration.txtVerifyPassword.value == ""){ alert("Please verify your password"); document.registration.txtVerifyPassword.focus(); return false; }
	if  (document.registration.txtPassword.value != document.registration.txtVerifyPassword.value){alert("Verify password does not match your chosen password."); document.registration.txtVerifyPassword.focus(); return false; }

	if  (document.registration.session_input.value ==  ""){alert("Please enter the security number as seen"); document.registration.session_input.focus(); return false; }
	if  (document.registration.chkTermsConditions.checked ==  false){alert("Please indicate you agree with our terms and conditions"); document.registration.chkTermsConditions.focus(); return false; }
}


	function check_forgotten_password_fields(){

	if  (document.registration.txtVerifyEmail.value == ""){ alert("Please verify your Email Address"); document.registration.txtVerifyEmail.focus(); return false; }
	if  (document.registration.txtEmail.value != document.registration.txtVerifyEmail.value){ alert("Verify email does not match"); document.registration.txtVerifyEmail.focus(); return false; }
	if  (document.registration.chkTermsConditions.checked ==  false){alert("Please indicate you agree with our terms and conditions"); document.registration.chkTermsConditions.focus(); return false; }
}

