Measurement of CP asymmetries and branching fractions in charmless two-body B-meson decays to pions and kaons