$(document).ready(function() {
	//div. Klassen zuordnen
	$("#navbar ul:first, #objFilter ul:first").addClass("navigation");
	//breadcrumbs
	$("#breadcrumbs li:not(:first)").before("<span class='leftalign trenner'>&gt;</span>");
	$("#breadcrumbs li").each(function(){
		var linklast = $(this).children("a").attr("href");
		if(linklast == "uebersicht.xhtml"){
			$(this).remove();
			}
		});

	// letzte/erste Border/Margin weg
	$("#details .links li:first, #flags li:last, #topnav li:last, #topbjekte .single:last").css("margin", "0").css("border", "0");
	//Trenner einrichten
	$("#sidebar hr, #navbar hr, span.my_content_seperator:first").addClass("seperator");
	// Innerhalb Multi-Columns keine Trenner
	$(".multicolumn").children(".my_content_seperator").each(function(){
		$(this).remove();
		});
	//Untertitel
	$("#content p > img").each(function(){
		//$(this).css("border", "1px solid blue");
		var imgTitle = $(this).attr("alt");
		var imgStyle = $(this).attr("style");
		var imgWidth = $(this).width();

		if(imgTitle){
			$(this).after('<span class=\"imagetitle\">' + imgTitle + '</span><br/>');
			if(imgStyle.match('float: right;')){
				$(this).next("span.imagetitle").css("width", imgWidth).addClass("right");
				}
			else if(imgStyle.match('float: left;')){
				$(this).next("span.imagetitle").css("width", imgWidth).addClass("left");
				}
			}
		});

	//div striped tables
	$("#content table > tbody > tr:odd, .info table > tbody > tr:odd").addClass("grey");

	// Table Top Zinsen
	$("#topZins > table > tbody > tr:first").children("td").css("font-weight","bold");
	// Angebote
	$(".single img").each(function(){
		var breiteFoto = $(this).width();
		$(this).parent("a").parent("li").parent("ul").parent(".foto").next(".objnr").css("width", breiteFoto);
		$(this).next("span").addClass("status");
		});
	//Gallery
	$("#gallery > div > div > div > img").addClass("imgBig");

	$("#gallery > div > div > div").addClass("foto");
	$("#gallery .foto").next("p").addClass("imagetitle");

	//Menu mit Mouse over
	$("ul.navigation ul").addClass("subnavi").addClass("global-shadow");
	$("ul.subnavi").css("display","none");
	$("ul.navigation li").each(function(){
		$(this).mouseenter(function(){
      $(this).children('ul.subnavi').stop(true, true).slideDown('medium');
    });
    $(this).mouseleave(function(){
      $(this).children('ul.subnavi').stop(true, true).slideUp('fast');
    });
	});//Ende Each
	//überflüssige Sprachen entfernen
	$("#flags li a").each(function(){
		$(this).children("img").attr("src");
		var quelle = $(this).children("img").attr("src");
		var newquelle = quelle.match(/FRA.png/g);
		if(newquelle){
			$(this).parent("li").remove();
			}
		});
	//alert("Hallo");
});
