$(document).ready(function() {
	$("ul.level3").hide();
	$("li#lev2_aktiv").find("ul.level3").show();
	$("li#lev3_aktiv").parent("ul.level3").show();
	
	$("li.level3 > div").click(function() {
		var temp = $(this).find("a:first").attr("href");
		if (temp != "") document.location.href = temp;
	});
	
	if ($.browser.msie && $.browser.version < 7) {
		$("li.level3[id!=lev3_aktiv] > div").hover(
			function() { $(this).css("background-color","#4E4F4F"); },
			function() { $(this).css("background-color","transparent"); }
		);
	}
});

/* In Tabellen die Klassen styled_table/even/odd/first ergänzen */

$("#content table").each(function() {
  $(this).addClass("styled_table");
  $(this).find("tr:first").addClass("first");
  $(this).find("tr:even").addClass("even");
  $(this).find("tr:odd").addClass("odd");
});



/* Links mit Klassen versehen */

$("#content a").each(function() {
  if ($(this).children(":first").length == 0) { 
    if ($(this).attr("href").indexOf("http://") == 0) { 
      $(this).addClass("external");
    }
    else if ($(this).attr("href").indexOf("ftp://") == 0) {
      $(this).addClass("ftp");
    }
    else if ($(this).attr("href").indexOf("mailto:") == 0) {
      $(this).addClass("email");
    }
    else {
      var temp = ($(this).attr("href").length - 4);
      if ($(this).attr("href").lastIndexOf(".") == temp) {
        var temp2 = $(this).attr("href").substr((temp+1),3);
        if (temp2 != "php") {
          $(this).addClass(temp2);
          $(this).addClass("filetype");
        }
      }
    }
  }
});

