Study of B±→J/ψπ± and B±→J/ψK± Decays: Measurement of the Ratio of Branching Fractions and Search for Direct CP Violation