Electronic structure of polyaniline and substituted derivatives