function TableRowClicked() {
	if (this.childNodes[0].nodeValue == "\n")
		linkurl = this.childNodes[1].childNodes[0].getAttribute("href");
	else
		linkurl = this.childNodes[0].childNodes[0].getAttribute("href");
	location.href = linkurl;
}


$(document).ready(function() 
{ 
	// Ganze Zeile klickbar machen
	$("tr:not(.firstRow)").click(TableRowClicked);
	
	// Tabelle an Auflösung anpassen
	if (screen.width > 1100) 
	{
		var tableWidth = screen.width * 0.95;
		$("#wrapper").css("width",tableWidth);
		$(".Banner").show();
		$(".Mitglieder").show();
	}
	
	// Tooltips anzeigen
	$("th").tooltip({ 
		track: true, 
		delay: 0, 
		showURL: false, 
		opacity: 1, 
		fixPNG: true, 
		showBody: " - ", 
		extraClass: "pretty fancy", 
		top: -15, 
		left: 5,
	    bodyHandler: function() { 
			var text = $(this).text();
			var erklaerung = $(".erklaerung_title:contains("+ text +")").next().text();
			var info =  "<br/><span style='font-size:8pt;'><b>Hier klicken um nach '"+ text +"' zu sortieren</b><span>";
			return "<span>" + erklaerung + info + "</span>";
	    }
	});
	
	// Tabelle sortierbar machen
	$("#main2 #PaidmailerTable").tablesorter({ 
        headers: { 
	        3: { sorter: "digit" },
	        4: { sorter: "digit" },
        	8: { sorter: "digit" }
        } 
    });
    $("#PaidmailerTable tr:odd").addClass("odd");
    $("#main2 #PaidmailerTable").bind("sortEnd",function() { 
        $("#PaidmailerTable tr:odd").addClass("odd");
    	$("#PaidmailerTable tr:even").removeClass("odd");
    }); 
    
    $("#PaidmailerTable th:first").addClass("myheaderSortUp");
    
	$("#PaidmailerTable th").click(function () {
		$("#PaidmailerTable th").removeClass("myheaderSortUp");
		$(this).addClass("myheaderSortUp");
    });

    
   

});

