at the time of their construction , both belief systems were prevalent in the empire , and as rulers came and went-buddhists replaced by hindus , and vice versa-temples were constructed to reflect the changing times .