$(document).ready(function() {
   var anchorLink = document.location.hash;
   $(".tabcontent").each(function(){
		if (anchorLink == '') {
			var linkToLoad = $(this).parent().children("ul").children("li").children("a[class=active][type=tabLink]");
		} else {
			var linkToLoad = $("a[href="+ anchorLink +"]");	
		}
		loadContent(linkToLoad);
   });
   
   $("a[url!='noFollow'][type=tabLink]").click(function() {
		loadContent($(this));
	return false;
   });
 
 
 
 	function loadContent(forLink){
		var ziel = forLink.attr("url");
		if (ziel != 'noFollow') {
		var divElement = forLink.parent().parent().parent();
		 if (divElement.attr("class") == 'tabs'){
			divElement.children("ul").children("li").children("a").removeClass("active");
		 }
		 forLink.addClass("active");	
		 $.ajax({
			url: ziel,
			beforeSend: function() {
				divElement.children("div").html("Bitte warten...");
			},
			success: function(data) {
				divElement.children("div").html(data);
			}
		});
		}
	}
 
});
