if(window.location.hash) {
 	var activeWork = window.location.hash.replace("#", ""); 
 	console.log(activeWork);
} else {
	activeWork = "";
}

$(document).ready(function(){

setTimeout(function() {
  if(activeWork != "") {
  	$("#"+activeWork).addClass("active");
  	$("[class^=kunde]").not(".kunde-"+activeWork).fadeTo(300, 0.3);
  	$('html, body').animate({scrollTop: $(".kunde-"+activeWork).offset().top -20}, 'slow');
  	$('a.toggle_all').show("fast");
  	return false;
  }
}, 1);

	
	$('a.toggle_all').hide(); //OnLoad Alle Einblenden Button ausblenden :)
	
	$('a.toggle_all').click(function() { // auf klick werden alle eingefadet...
		$('[class^=kunde]').fadeTo(300, 1);
		$('[id^=link]').removeClass("active");
		$('html, body').animate({scrollTop:0}, 'slow');
		$('a.toggle_all').hide("fast"); //Alle Einblenden Button ausblenden :)
		return false;
	});
								  
	$('[id^=link]').click(function() { //Alle Klassen "Link*.*"
												  
		var $this = $(this); //Variable "y" Definieren
		var x = $this.attr("id"); //Variable "x" = Klassenname von Variable "y"
				
		$('[class^=kunde]').not('.kunde-' +x).fadeTo(300, 0.3);	//Jeder Klasse "Kunde" ausser der aktuellen ausfaden
			$('[id^=link]').removeClass("active"); //Active Entfernen
			$('.kunde-' +x).fadeTo(300, 1);  //Wenn ausgefadet dann aktuelle einfaden
			$(this).addClass("active"); //Active machen
			$('html, body').animate({scrollTop: $(".kunde-"+x).offset(200).top -20}, 'slow');
			$('a.toggle_all').show("fast"); //Alle Einblenden Button einblenden :)
		return false;
	});	

						
}); 
