The Functional Measure of Gauge Theories in the Presence of Gribov Horizons