// mailmask

$.fn.noSpam = function() {
	at = '@';
	return this.each(function(){
		e = null;
		$(this).find('span').replaceWith(at);
		e = $(this).text();
		$(this).attr('href', 'mailto:' + e);
	});
};
// Onload-Methode ohne Prototype:
window.onload = noSpam;

// go to top

$.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);
		});
};

$(function(){
    Cufon.replace
	('#navi li a', {hover:true, fontFamily: 'Georgia'})
	('#footerContent h3', {fontFamily: 'Arian'})
	('.highlight', {fontFamily: 'Kalif'})
	('h2', {fontFamily: 'Arian'})
	('h4', {fontFamily: 'Myriad Pro'});

$('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%"});
	$('.slideshow').cycle({ 
    fx:    'fade', 
    pause:  1 
});
	jQueryHover();

});
