$(document).ready(function(){

	/* Scrol To */
	
	$.scrollTo(0);
	
	$('#toc a').click(function(){
		$.scrollTo(this.hash,500);
		return false;
	});
	
	
	/* Mouse Wheel */
	
	$('html').mousewheel(function(event, delta) {

      this.scrollLeft -= (delta * 30);
      event.preventDefault();
	  
	});
	 
   
	/* Div Slide */
   
	var currentPosition = 0;
	var slideWidth = 800;
	var slides = $('.slide');
	var numberOfSlides = slides.length;
	
	// Remove scrollbar in JS
	$('#slidesContainer').css('overflow', 'hidden');
	
	// Wrap all .slides with #slideInner div
	slides
		.wrapAll('<div id="slideInner"></div>')
		// Float left to display horizontally, readjust .slides width
		.css({
		  'float' : 'left',
		  'width' : slideWidth
		});
	
	// Set #slideInner width equal to total width of all slides
	$('#slideInner').css('width', slideWidth * numberOfSlides);
	
	// Insert controls in the DOM
	$('#slideshow')
	.prepend('<span class="control" id="leftControl">klicken nach links</span>')
	.append('<span class="control" id="rightControl">klicken nach rechts</span>');
	
	// Hide left arrow control on first load
	manageControls(currentPosition);
	
	// Create event listeners for .controls clicks
	$('.control')
		.bind('click', function(){
		// Determine new position
		currentPosition = ($(this).attr('id')=='rightControl') ? currentPosition+1 : currentPosition-1;
		
		// Hide / show controls
		manageControls(currentPosition);
		// Move slideInner using margin-left
		$('#slideInner').animate({
		  'marginLeft' : slideWidth*(-currentPosition)
		});
	  });
	
	  // manageControls: Hides and Shows controls depending on currentPosition
	  function manageControls(position){
		// Hide left arrow if position is first slide
		if(position==0){ $('#leftControl').hide() } else{ $('#leftControl').show() }
		// Hide right arrow if position is last slide
		if(position==numberOfSlides-1){ $('#rightControl').hide() } else{ $('#rightControl').show() }
	  }
	  
	  
	  /* Gallery */
	  	
		$('.txt_01').show();
	  	$('.img_01').show();
		
		$('a.gal_01').mouseover(function() {
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_01').show();
	  		$('.img_01').show();
			return false;
		});
				
		$('a.gal_02').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_02').show();
	  		$('.img_02').show();
			return false;
		});
		
		$('a.gal_03').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_03').show();
	  		$('.img_03').show();
			return false;
		});
		
		$('a.gal_04').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_04').show();
	  		$('.img_04').show();
			return false;
		});
		
		$('a.gal_05').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_05').show();
	  		$('.img_05').show();
			return false;
		});
		
		$('a.gal_06').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_06').show();
	  		$('.img_06').show();
			return false;
		});
		
		$('a.gal_07').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_07').show();
	  		$('.img_07').show();
			return false;
		});
		
		$('a.gal_08').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_08').show();
	  		$('.img_08').show();
			return false;
		});
		
		$('a.gal_09').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_09').show();
	  		$('.img_09').show();
			return false;
		});
		
		$('a.gal_10').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_10').show();
	  		$('.img_10').show();
			return false;
		});
		
		$('a.gal_11').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_12').hide();
			$('.img_12').hide();
			$('.txt_11').show();
	  		$('.img_11').show();
			return false;
		});
		
		$('a.gal_12').mouseover(function() {
			$('.txt_01').hide();
			$('.img_01').hide();
			$('.txt_02').hide();
			$('.img_02').hide();
			$('.txt_03').hide();
			$('.img_03').hide();
			$('.txt_04').hide();
			$('.img_04').hide();
			$('.txt_05').hide();
			$('.img_05').hide();
			$('.txt_06').hide();
			$('.img_06').hide();
			$('.txt_07').hide();
			$('.img_07').hide();
			$('.txt_08').hide();
			$('.img_08').hide();
			$('.txt_09').hide();
			$('.img_09').hide();
			$('.txt_10').hide();
			$('.img_10').hide();
			$('.txt_11').hide();
			$('.img_11').hide();
			$('.txt_12').show();
	  		$('.img_12').show();
			return false;
		});
		
		$('a.gal_01, a.gal_02, a.gal_03, a.gal_04, a.gal_05, a.gal_06, a.gal_07, a.gal_08, a.gal_09, a.gal_10, a.gal_11, a.gal_12').click(function() {
			return false;
		});
	
});
