/*
$(document).ready(function(){
    var curPos = 1;
    var curIndex = 6;
    setInterval(function(){
      $theLink = $('a[data-pos="'+curPos+'"]');
      $theLink.find('img').attr('src','archive/pics/'+bookIds[curIndex]+'.jpg');
      $theLink.attr('href','http://archive.denisbehr.de/archive/resultbook.php?book='+bookIds[curIndex]+'&edit=');
      if(curPos == 6) {
         curPos = 0;
      } else {
        curPos++;    
      }
      if(curIndex == amountOfBooks -1) {
        curIndex = 0;
      } else {
        curIndex++;    
      }
    } , 2200);    
});
*/

//-- Slide down the history on index.php:
$('body').delegate('#fullhistory', 'click', function(){
	var offset = $(this).attr('data-offset');
	$.get('includes/fullhistory.php', 'offset=' + offset,
		function(data){
			$('#fullhistory').replaceWith(data);
			$('ul').delay(300).slideDown(1200);
		}
	);
    return false;
});


//--galerie auf Startseite
$(document).ready(function(){
    var curPos = 1;
    var curIndex = 6;
    setInterval(function(){
      $theLink = $('a[data-pos="'+curPos+'"]');
      $theLink.find('img')
      		  .animate({opacity: 0},600)
              .queue(function(next) { $(this).attr('src','covers/'+bookIds[curIndex-1]+'.jpg'); next(); })
      		  .delay(300)
              .animate({opacity: 0.75},600);
      $theLink.attr('href','show.php?book='+bookIds[curIndex]);
      if(curPos == 6) {
         curPos = 0;
      } else {
        curPos++;    
      }
      if(curIndex == amountOfBooks -1) {
        curIndex = 0;
      } else {
        curIndex++;    
      }
    } , 2200);    
});
