A flat bundle with compact connected structure group
and its adjoint bundles of Lie groups are shown to satisfy
the Leray-Hirsch theorem. This information
has been used to construct a cohomology class of the adjoint bundle
whose restriction to each fiber is the class of the Maurer-Cartan 3-form.
Then we use this result to define an invariant of a gauge
transformation which describes its effect on the Chern-Simons
functional defined by choosing a reference
connection.