var CycleImage = {
  max : new Array(),
  idx : new Array(),
  cycle : function (i) {
    $('div.cycle').eq(i).children('img').eq(CycleImage.idx[i]).fadeOut(2000);
    CycleImage.idx[i]++
    if (CycleImage.idx[i] == CycleImage.max[i]) CycleImage.idx[i] = 0;
    $('div.cycle').eq(i).children('img').eq(CycleImage.idx[i]).fadeIn(2000);
    setTimeout("CycleImage.cycle(" + i + ")", 5000);
  }  
}

Cufon.replace('h1' , {fontFamily: 'RotisSemiSerif'});

$(function() {
  $('div.cycle').each(function(i) {
    CycleImage.idx[i] = 0;
    CycleImage.max[i] = $('div.cycle').eq(i).children('img').length;
    if (CycleImage.max[i] > 1) setTimeout("CycleImage.cycle(" + i + ")", 2000);
  });

  var pt = parseInt($('#footer').css('paddingTop'));
  if ($(window).height() > $('#frame').height() + 28 - pt) {
    $('#footer').css('paddingTop', ($(window).height() - $('#frame').height() - 28 + pt) + 'px');
  }

  $(window).resize(function () {
    var pt = parseInt($('#footer').css('paddingTop'));
    if ($(window).height() > $('#frame').height() + 29 - pt) {
      $('#footer').css('paddingTop', ($(window).height() - $('#frame').height() - 29 + pt) + 'px');
    }
  });
});

