On vortex configurations in two-dimensional sine-Gordon systems with applications to phase transitions of the Kosterlitz-Thouless type and to Josephson junctions