/*
 
 Zeitstrahl

*/

$(function() {		
	$("div.scrollable").scrollable({
		size: 14,
		items: '#thumbs', 
    clickable: false,
    easing: 'linear', 
		hoverClass: 'hover'
	});	
});

$(".timeline_top").click(function() {
  var overdiv = $(this).parents().map(function () { return this; }).get()[1];
  var inner_bottom = $(overdiv).children().map(function () { return this; }).get()[2];
  var real_cont = $(inner_bottom).children().map(function () { return this; }).get()[1];
  
  $("#real_content").fadeOut(100, function() {
   $(this).html($(real_cont).html());
   $(this).fadeIn(500);
  });
  
});

$(".inner_middle img").click(function() {
  var overdiv = $(this).parents().map(function () { return this; }).get()[1];
  var inner_bottom = $(overdiv).children().map(function () { return this; }).get()[2];
  var real_cont = $(inner_bottom).children().map(function () { return this; }).get()[1];
  
  $("#real_content").fadeOut(100, function() {
   $(this).html($(real_cont).html());
   $(this).fadeIn(500);
  });
  
});

var nextButton, prevButton = null;
var hoverNext = function() { $("div.scrollable").scrollable().next(); };
var hoverPrev = function() { $("div.scrollable").scrollable().prev(); };
             
$('#nextButton').hover(function() { hoverNext(); nextButton = setInterval(hoverNext, 400); }, function() { clearInterval(nextButton); });    
$('#prevButton').hover(function() { hoverPrev(); prevButton = setInterval(hoverPrev, 400); }, function() { clearInterval(prevButton); }); 
       
$(".timeline_top").mouseover(function() {
  var overdiv = $(this).parents().map(function () { return this; }).get()[1];
  var inner_bottom = $(overdiv).children().map(function () { return this; }).get()[2];
  var inner_bottom_cont = $(inner_bottom).children().map(function () { return this; }).get()[0]; 
  
  $(inner_bottom_cont).fadeIn(80);
});  

$(".timeline_top").mouseout(function() {
  var overdiv = $(this).parents().map(function () { return this; }).get()[1];
  var inner_bottom = $(overdiv).children().map(function () { return this; }).get()[2];
  var inner_bottom_cont = $(inner_bottom).children().map(function () { return this; }).get()[0]; 
  
  $(inner_bottom_cont).fadeOut(80);
});  

$(".inner_middle img").mouseover(function() {
  var overdiv = $(this).parents().map(function () { return this; }).get()[1];
  var inner_bottom = $(overdiv).children().map(function () { return this; }).get()[2];
  var inner_bottom_cont = $(inner_bottom).children().map(function () { return this; }).get()[0]; 
  
  $(inner_bottom_cont).fadeIn(80);
  $(this).css("cursor", "pointer");
});  

$(".inner_middle img").mouseout(function() {
  var overdiv = $(this).parents().map(function () { return this; }).get()[1];
  var inner_bottom = $(overdiv).children().map(function () { return this; }).get()[2];
  var inner_bottom_cont = $(inner_bottom).children().map(function () { return this; }).get()[0]; 
  
  $(inner_bottom_cont).fadeOut(80);
  $(this).css("cursor", "normal");
});  
