// <![CDATA[
  var theHeader = new Object();

  // User config variables
  theHeader.divs_to_flip = new Array('headerContainer1', 'headerContainer2');
  theHeader.divHeight = 1440;
  theHeader.numSteps = 10;
  theHeader.wait = 5000;

  // Auto config variables
  theHeader.i = 0;
  theHeader.current = 0;
  theHeader.next = (theHeader.current == 0) ? 1 : 0;
  theHeader.deltaY = -theHeader.divHeight / theHeader.numSteps;
  
  theHeader.crossFlip = function() {
      // Not a switch step, only move the one in question
      if(theHeader.i < theHeader.numSteps) {
          new Effect.Parallel([
               new Effect.Move(theHeader.divs_to_flip[theHeader.current], { sync: true, x: 0, y: theHeader.deltaY, mode: 'relative' }),
               new Effect.Move(theHeader.divs_to_flip[theHeader.next],    { sync: true, x: 0, y: theHeader.deltaY, mode: 'relative' })
              ],
              {
                  duration: 1.0
              });
          theHeader.i++;
      }
      else
      {
          theHeader.current = (theHeader.current == 0) ? 1 : 0;
          theHeader.next = (theHeader.current == 0) ? 1 : 0;
          theHeader.i = 1;
          new Effect.Parallel([
                  new Effect.Move(theHeader.divs_to_flip[theHeader.current], { sync: true, x: 0, y: theHeader.deltaY, mode: 'relative' }),
                  new Effect.Move(theHeader.divs_to_flip[theHeader.next],    { sync: true, x: 0, y: theHeader.deltaY, mode: 'relative' })
              ],
              {
                  duration: 1.0,
                  beforeStart: (function() {
                      new Effect.Move(theHeader.divs_to_flip[theHeader.next], { duration: 0.0, x: 0, y: theHeader.divHeight*2, mode: 'relative' });
                  }).bind(theHeader)
              }
          );
      }
  }

  theHeader.startFlip = function() {
          new Effect.Parallel([
               new Effect.Opacity(theHeader.divs_to_flip[theHeader.current], { sync: true, from: 1, to: 0 }),
               new Effect.Move(theHeader.divs_to_flip[theHeader.current], { sync: true, x: 0, y: theHeader.deltaY, mode: 'relative' }),
               new Effect.Move(theHeader.divs_to_flip[theHeader.next],    { sync: true, x: 0, y: theHeader.deltaY, mode: 'relative' })
              ],
              {
                  duration: 0.0
              });
          new Effect.Parallel([
               new Effect.Opacity(theHeader.divs_to_flip[theHeader.current], { sync: true, from: 0, to: 1 })
              ],
              {
                  duration: 1.0
              });
      $('theHeader').timer = setInterval('theHeader.crossFlip()', theHeader.wait);
  }

  Event.observe(window, 'load', theHeader.startFlip);
// ]]>

