// Mailmask
$.fn.noSpam = function() {
	at = '@';
	return this.each(function(){
		e = null;
		$(this).find('span').replaceWith(at);
		e = $(this).text();
		$(this).attr('href', 'mailto:' + e);
	});
};

// Accordeon
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('7(!f)2 f=s;7(!k)2 k=u;d y(4){2 4=0.x({1:\'v\',3:\'w\',5:\'z\',9:\'9\',8:\'8\',b:m},4);2 1=4.1;2 3=4.3;2 5=4.5;2 9=4.9;2 8=4.8;2 b=4.b;0(\'.\'+5).A();0(\'.\'+3+\'.\'+8).p(d(){7(0.q(0(6).r())==\'\'){0(6).t()}});$e=0(f.P.L);$1=$e.c(3)?$e:(b?0(\'.\'+3+\':K\'):o);7($1){$1.j(1).h(\'.\'+5).M(N,d(){7($e.c(3)){2 l=$1.O().l;0(k).J(l)}})}0(\'.\'+3+\', .\'+9).B(d(){$6=0(6);$a=$6.c(3)?$6:0(0(6).I(\'D\'));2 i=$a.h(\'.\'+5).C(\':i\')?m:o;0(\'.\'+5).E(g);0(\'.\'+1).F(1);7(i){7($a.c(8)){$a.j(1).H(\'.\'+3).n(g)}G{$a.j(1).h(\'.\'+5).n(g)}}})};',52,52,'jQuery|active|var|toggle|settings|content|this|if|multi|onPageNavi|toggler|openFirst|hasClass|function|urlElem|doc|300|next|hidden|addClass|win|top|true|slideDown|false|each|trim|text|document|remove|window|accActive|click|extend|acc|inhalt|hide|click|is|href|slideUp|removeClass|else|nextUntil|attr|scrollTop|first|hash|show|10|offset|location'.split('|'),0,{}))

$.fn.topLink = function(settings) {
	settings = jQuery.extend({fadeSpeed: 200}, settings);
		var scroll_timer;
		var displayed = false;
		var $message = $(this);
		var $window = $(window);
		var top = $(document.body).children(0).position().top;
		$window.scroll(function () {
			window.clearTimeout(scroll_timer);
			scroll_timer = window.setTimeout(function () {
				if($window.scrollTop() <= top)
				{
					displayed = false;
					$message.fadeOut(settings.fadeSpeed);
				}
					else if(displayed == false) 
				{
					displayed = true;
					$message.stop(true, true).fadeIn(settings.fadeSpeed).click(function () { $message.fadeOut(settings.fadeSpeed); });
				}
			}, 100);
		});
};

// CUFON
$(function(){
			  $('a.escape').noSpam();
    $('a[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
        && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset}, 1000);
                return false;
            }
        }
    });
	$('.gototop').topLink({fadeSpeed: 500});
	$("a[rel='lightbox']").colorbox({maxHeight:"90%"});
});

jQuery("#naviToggle").click(function(){
	var $navi = jQuery('#navi-left');
	var move = $navi.css('left') == '12px' ? '-200px' : '12px';
	var bg = $navi.css('left') == '12px' ? 'url(images/bildwechsel/bg-navi-left-open.gif) center left no-repeat' : "none";
  jQuery("#navi-left").animate({"left": move}, 300);
  jQuery(this).animate({"left": move}, 300, function (){
	  jQuery(this).css("background",bg);
	});
});
