Magnetism and superconductivity in the extended periodic Anderson model