function bannerSwitch() {
  var $active = $('.banner:visible');

  var $next =  $active.next('.banner').length ? $active.next('.banner')
      : $('.banner:first');

  $next.fadeIn(1000);
  $active.fadeOut(1000);
}

$(document).ready(function(){
  $.preloadCssImages();

  $('#thumbs a').click(function(){

    var old = $('#pojects img')

    // insert image tag before current image tag
    old.before('<img src="' +  $(this).attr('href') + '" style="display:none;" />');

    // fade in new image
    $('#pojects img:first').fadeIn(1000);

    // fade out old image tag and remove it
    old.fadeOut(1000, function(){ old.remove();});

    $('#left .content').html($(this).attr('rel'));
    return false;
  });
  
  $('.banner').hide();
  $('.banner:first').show();
  if ($('.banner').length > 1) {
    setInterval( 'bannerSwitch()', 5000 );
  }

  if ($.cookie("hide_new_post") != 'true') {
    $('#logo').fadeIn(3000, function(){
      $('#splash').fadeOut(1500)
    });
    $.cookie("hide_new_post", 'true');
  } else {
    $("#splash").hide();
  }
});