  $(document).ready(function(){
    
        $('a.email').each(function() {
            e = this.rel.replace('/','@');
            this.href = 'mailto:' + e;
            $(this).text(e);
        });
  $('#message ul').innerfade({
    animationtype: 'slide',
    speed: 750,
    timeout: 4000,
    type: 'random'
  });
  $('#photos').attr('style','display:block');
  rotatePics(0);
  
  
				function layout() {
 					var wh = $(window).height();
                                        var space = wh - $('#container').height();
                                        var shalf=0.0;
					if (space > 0)
                                        {
                                            shalf = 0.25 * space;
					}
                                        $('#container').css('margin-top',shalf);
				}	
 				layout();

 				$(window).resize(layout);
  
});

function rotatePics(currentPhoto) {
  var numberOfPhotos = $('#photos img').length;
  currentPhoto = currentPhoto % numberOfPhotos;
	
  $('#photos img').eq(currentPhoto).fadeOut(function() {
		// re-order the z-index
    $('#photos img').each(function(i) {
      $(this).css(
        'zIndex', ((numberOfPhotos - i) + currentPhoto) % numberOfPhotos
      );
    });
    $(this).show();
    setTimeout(function() {rotatePics(++currentPhoto);}, 2000);
  });
}



