Fading between two images based on time

Fading between two images based on time

Hey everyone, hopefully this will be a quick question for you guys.
Here's what I have going on. I have these two images at the very top of my body - they will serve as the background to the page.
  1.       <img src="image1.jpg" id = "background" >
  2.       <img src="image2.jpg" id = "background_hidden">
Here is the corresponding css for the two images:
  1.       
  2. #background {
  3.     width: 100%;
  4.     height: 100%;
  5.     z-index: -1;
  6.     position: absolute;
  7. }

  8. #background_hidden {
  9.     width: 100%;
  10.     height: 100%;
  11.     display: none;
  12.     position: absolute;
  13.     z-index: -1;
  14. }
Here's where javascript comes in. I'd like to have a simple method like this
  1. function changeBackground() {
  2.     
  3.     if (secs > 30) {
  4.         //have image1
  5.     }
  6.     else {
  7.         //have image2
  8.     }
  9. }
The variable secs refers to the number of seconds in a minute.  If the seconds is > 30, then have image1.  As soon as the number of seconds cycles over 0 it should fade to image2.
I've been looking for ways to do this and am completely stuck.

Any insight would be great.