A nonlocal Hamiltonian formalism for semi-Hamiltonian systems of the hydrodynamic type