My data sheet for the 16f877 shows the ADCON1 register to be set up as follows:
Bit 7,6 Unimplemented, set as 0
Bit 5 "1"= Right Justified, "0"=Left Justified
Bit 4 Unimplemented set as 0
Bits 3,2,1,0 Choose these to select the channels you wish to be analog or digital.

So, for 10bit and AN0=analog and all others digital, and "Right Justify" result, I would use ADCON1%00101110

Is this not correct