/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(){ 
  rotatePics(1);
});
var text=["ADM Block","Academic Block","Library","Cafeteria","CAC Block"]
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) {
        $('#marker').html(text[((numberOfPhotos - i) + currentPhoto) % numberOfPhotos]);
      $(this).css(
        'zIndex', ((numberOfPhotos - i) + currentPhoto) % numberOfPhotos
      );
    });
    $(this).show();
    setTimeout(function() {rotatePics(++currentPhoto);}, 3000);
  });
}


