Mixing and magnetic properties of surface alloys: The role of the substrate