Two-matrix model with semiclassical potentials and extended Whitham hierarchy