var maxSplash=0;
var currentSplash=0;
var splashTimer;
var splashDelayTime=6800;
var splashTransitionTime=500;

$(document).ready(function() {
  if((maxSplash=$('#splash li').length)>1) {
    $('#splash li').css({top:0,left:0}).not(':eq('+currentSplash+')').hide();
    splashTimer=setTimeout('nextSplash()',splashDelayTime);
  }
});

function nextSplash() {
  var n=currentSplash+1;
  if(n>=maxSplash)
    n=0;
  
  var nTarget=$('#splash li').eq(n);
  var target=$('#splash li').not(nTarget);
  
  target.css('z-index','98');
  nTarget.css('z-index','99');
  
  $('.content',nTarget).stop().css('bottom','-20px').animate({bottom:'0'},{duration:splashTransitionTime*2,easing:'easeOutCirc'});
  nTarget.stop().fadeIn({duration:splashTransitionTime,
                         easing:'easeOutQuart',
                         complete:function() {
                           target.stop().hide();
                           currentSplash=n;
                         }
                        });
  
  splashTimer=setTimeout('nextSplash()',splashDelayTime);
}

function gotoSplash(i) {
  clearTimeout(splashTimer);
  currentSplash=i-1;
  nextSplash();
  return false;
}