/*function accordion(lang) {
	 // Accordion bei den Neuigkeiten 
	 $(".news."+lang+" .entry:not(:first) .content").addClass("invisible").removeClass("visible");
	 $(".news."+lang+" .entry .title").click(function() {
		//wenn nicht schon offen
		if($(this).next(".content").hasClass("invisible")) {
			//Andere offene schließen
			$(".news .entry .content.visible").slideUp().removeClass("visible").addClass("invisible");
			//Und dieses öffnen
			$(this).next(".content").slideDown().removeClass("invisible").addClass("visible");
		}
		fix_content_height(lang);
	 });
}*/

$j = $.noConflict();

$j(document).ready(function() {
 
 //CSS die nur für JavaScript gilt
 $j("head").append("<link rel='stylesheet' href='"+PATH+"css/withjs.css' type='text/css'>");
 
 //accordion("news-de");
 //accordion("news-en");
 
 /* Tooltip im Header unter Freunde */
 $j("map#imgmap2008101142157 span").hover(function() {
 	tooltip.show($j("area", this).attr("title"));
 }, function() {
 	tooltip.hide();
 });
 
 /* Einblenden der Kontaktbox */
 $j("span.panel_button").click(function() {
 		if($j("div#panel").css("height") == "0px") {
 			$j("div#panel").animate({height: "500px"}, "fast");
 		}
 		else {
 			$j("div#panel").animate({height: "0px"}, "fast");
 		}
 		return false;
 });
 
 /* Sprachumschalter */
 $j("li.lang a").click(function() {
 	 //Was soll gezeigt werden?
 	 show = $j(this).attr("rel");
 	 hide = show == "en" ? "de" : "en";
 	 
 	 //Inhalte faden
 	 $j("."+hide).fadeOut();
 	 $j("."+show).fadeIn(function() {
 	 	 //Höhe anpassen
 		 fix_content_height(show);
 	 });
 	 
 	 //Klassen der Flaggen anpassen
 	 $j(".lang a.flag"+hide).removeClass("aktiv");
 	 $j(".lang a.flag"+show).addClass("aktiv");
 	 
 	 //Fenstertitel korrektieren
 	 if(show == "de")
 	 	document.title = page_title_de;
 	 else
 	 	document.title = page_title_en;
 	 
 	 //Korrekte Verlinkung zum RSS Feed
 	 pfad = $j("link[rel=alternate]").attr("href");
 	 if(show == "de")
 	 	neu = pfad.replace(/-en/, "-en");
 	 else
 	 	neu = pfad.replace(/-de/, "-en");
 	 $j("link[rel=alternate]").attr("href", neu);
 	 
 	 return false;
 });
 
 
 /* Klick auf "okay" in der Fehlermeldung */
 $j(".error a").click(function() {
 	$j(this).parent().fadeOut();
 	return false;
 });

	 
 /* Effekte im Hauptmenü */
 // on mouse over
 $j("ul.menu a:not(.aktiv) span").hover(function () {
   // animate opacity to full
   $j(this).stop().animate({
   	opacity: 1
   }, "slow");
 },
 // on mouse out
 function () {
   // animate opacity to nill
   $j(this).stop().animate({
   	opacity: 0
   }, "slow");
 });
 
 //$j("ul.menu a:not(.aktiv) span").css("opacity", 0);

});


function fix_content_height(l) {
	var h = $j(".inhalt div."+l).height();
	$j(".inhalt").css("height", h+"px");
}