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]
    }
}

$(document).ready(function(){	
	/* Sitemap toggle */
	if($.cookie("sitemapopen") == "true"){
		$("#sitemap_content").show();
	}else{
		$("#sitemap_content").hide();
		$("#sitemap_btn").addClass("close");		
	}	
    $("a#sitemap_btn").click(function(){
        $(this).toggleClass("close");
		$("#sitemap_content").slideToggle("slow",function(){			
			$.cookie("sitemapopen", $('#sitemap_content').is(":visible"), {path:'/', expires:7 });
			if ($('#sitemap_content').is(":visible")) {
				$().scrollTo($("a#sitemap_btn"), 500);
			}			
		});
		return false;
    });
	
	/* Menu positioning */
	if ($.browser.msie == true && $.browser.version < 7){
		$("#nav_main ul li.level_0:hover a span.title").css("background","none")	
	}
	
	var fullWith = 960;
	var lastChildWidth = 230;
	var newdivisionWidth = fullWith - lastChildWidth;
	
	$("#nav_main ul li.level_0:last-child").width(lastChildWidth + "px").addClass("last");
	$("#nav_main ul li.level_0:last-child a").css({'border-right': 'none'});	
	
	$("#nav_main ul li.level_0").each(function(){
		if ($(this).hasClass("last") == false) {
			var newItemWidth = $(this).find("a .title").width();
			newdivisionWidth -= newItemWidth;	
			$(this).width(newItemWidth + "px");
		}
	});
	var addingDivisionWidth = Math.floor(newdivisionWidth / 5);	
	
	$("#nav_main ul li.level_0").each(function(){
		if ($(this).hasClass("last") == false) {
			var newItemWidth = $(this).find("a .title").width() + addingDivisionWidth;				
			newdivisionWidth -= addingDivisionWidth;
			$(this).width(newItemWidth + "px");
		}
	});		
	var newItemWidth = $("#nav_main ul li.level_0:first-child").width() + newdivisionWidth;
	$("#nav_main ul li.level_0:first-child").width(newItemWidth + "px");
	
	/* Meta positioning */
	var nav_lang_w = $("#nav_lang .dropdown").width();
	var nav_country_w = $("#nav_country .dropdown").width();
	$("#nav_lang .dropdown").width(nav_lang_w+"px");
	$("#nav_country .dropdown").width(nav_country_w+"px");
	$(".lang_country ul.dropdown ul").width((nav_lang_w+nav_country_w+8)+"px");
	
	/* Newsletter/TAF */ 
	$("#fastform_newsletter input[type=text]").attr({
		title: $("#fastform_newsletter input.textinput").attr("value"),
		value: ""
	})
	$(".sendpage_newsletter input.textinput").fieldtag();	
	
	$(".mission_submission input.textinput").fieldtag();
	
});
