function nospam(){	
	var p = $.makeArray(arguments).reverse().join(".").split('#'); m = p[1] + "@" + p[0];
	document.write('<a href="mailto:'+m+'?subject=Kontakt">'+m+'</a>');		
}

/* Communicate swf/js */
function swfPath(swfid) {
    if(navigator.appName.indexOf("Microsoft") != -1){
		return window[swfid]
    }else{
		return document[swfid]
    }
}

function makeMenu(holder,w){
	var itemCount = holder.find("li.show").size();
	w = w-(itemCount-1);
	
	if(itemCount==0){
		holder.hide();
	}
	
	holder.find("li").each(function (i) {
		var newItemW = w/itemCount;
		$(this).width(newItemW+"px");
	});
	
	holder.find("li:first-child").addClass("first-child");
	holder.find("li:last-child").addClass("last-child");
}

function showcontentbox(speed){
	if(speed!=0){
		speed = 500;
	}
	$(".trans_bar_expanded").slideDown(speed);
	$(".trans_bar_expand").hide();
	//$(".trans_bar_inner").hide();
	$(".trans_bar_numbers").hide();
	$(".trans_bar_detract").show();
}

function hidecontentbox(speed){
	if(speed!=0){
		speed = 500;
	}
	$(".trans_bar_expanded").slideUp(speed);
	$(".trans_bar_expand").show();
	//$(".trans_bar_inner").show();
	$(".trans_bar_numbers").show();
	$(".trans_bar_detract").hide();
}



$(document).ready(function() {	
	makeMenu($("#nav_main .level1"),820);
	makeMenu($("#nav_main .level2"),820);
	
	//toggle the componenet with class msg_body
	$(".trans_bar_expand").click(function(){
		showcontentbox();
	});
	
	//toggle the componenet with class msg_body
	$(".trans_bar_detract").click(function(){
		hidecontentbox();
	});	
	
	if($.trim($("div.trans_bar_expanded_right").text()).length<2){
		$(".trans_bar_switchbuttons").hide();
	}
	
})