function validate_contact_form()
{
    
	msg = "";
    valid = true;

    if ( document.contact_form.message.value == "" )
    {
		msg = msg + "You must enter a message.\n";
        valid = false;
    }   
	
    if ( document.contact_form.name.value == "" )
    {
		msg = msg + "You must enter your name.\n";
        valid = false;
    }   	
	
    if ( document.contact_form.captcha_code.value == "" )
    {
		msg = msg + "You must enter the security code.\n";		
        valid = false;
    }   	

	
	if (document.contact_form.email.value != "")
	{
	
		apos = document.contact_form.email.value.indexOf("@");
		dotpos = document.contact_form.email.value.lastIndexOf(".");
		
		if (apos < 1 || dotpos - apos < 2)
		{
			msg = msg + "The email address entered is not valid.\n";		
			valid = false;
		}
		
	}
	
	if(document.contact_form.email.value == "" && document.contact_form.tel.value == "")
    {
		msg = msg + "You must enter either your telephone number or email address.\n";		
        valid = false;
    }   	

	if(valid == false)       
	{
        alert (msg);		
	}
	   

    return valid;
	
}
