$(document).ready(function(){
  setTimeout("makeVisible();",500);
  rotatePics(-1);
});
function makeVisible()
{
	document.getElementById('artwork').style.visibility="visible";
}
function rotatePics(currentPhoto) {
  var numberOfPhotos = $('#artwork img').length;
  currentPhoto = currentPhoto % numberOfPhotos;
	
  $('#artwork img').eq(currentPhoto).fadeOut(function() {
		// re-order the z-index
    $('#artwork img').each(function(i) {
      $(this).css(
        'zIndex', ((numberOfPhotos - i) + currentPhoto) % numberOfPhotos
      );
    });
    $(this).show();
    setTimeout(function() {rotatePics(++currentPhoto);}, 4000);
  });
}

