function validate_form()
{
    var valid = true;
    var colleague = false;
    
    var name = $('name');
    var jobTitle = $('jobTitle');
    var company = $('company'); // may be null as colleague form has only hidden company field
    var phone = $('phone');
    var email = $('email');
    var country = $('country');
        
    // Reset each field's color at the beginning of the validation call
    name.style.backgroundColor = "white";
    jobTitle.style.backgroundColor = "white";
    if (company != null) company.style.backgroundColor = "white";
    phone.style.backgroundColor = "white";
    email.style.backgroundColor = "white";
    country.style.backgroundColor = "white";
        
    if ( name.value.length == 0 )
    {
        valid = false;
        $('name_error').update("Enter name");
        name.style.backgroundColor="#E7D7E7";
    }
    if ( jobTitle.value.length == 0 )
    {
        valid = false;
        $('jobTitle_error').update("Enter job title");
        jobTitle.style.backgroundColor="#E7D7E7";
    }
    if ( company != null && company.value.length == 0 )
    {
        valid = false;
        $('company_error').update("Enter company name");
        company.style.backgroundColor="#E7D7E7";
    }
    if ( phone.value.length == 0 )
    {
        valid = false;
        $('phone_error').update("Enter phone number");
        phone.style.backgroundColor="#E7D7E7";
    }
    if ( email.value.length == 0 )
    {
        valid = false;
        $('email_error').update("Enter e-mail address");
        email.style.backgroundColor="#E7D7E7";
    }
    if ( country.value.length == 0 || country.value == "Select one..." )
    {
        valid = false;
        $('country_error').update("Choose your country");
        country.style.backgroundColor="#E7D7E7";
    }
    
    if (valid)
    {
        return true;
    }
    return false;
}
