// Accordion

$(document).ready(function() {
	$('.inhalt').hide();
	$('.inhalt:first').show();		//funktioniert mit :first, :last und natürlich auch mit klassen und id's
	$('.click').click(function(){
			$('.inhalt').hide('slow');
		if($(this).next('.inhalt').css('display') == 'none'){
			$(this).next('.inhalt').show('slow');
		}
	});
});



Cufon.replace
('h2', {fontFamily: 'FutshiCondensedSmall'});
Cufon.replace
('h3', {fontFamily: 'FutshiCondensedSmall'});
Cufon.replace
('h4', {fontFamily: 'FutshiCondensedSmall'});


// Mailmask

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


$.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(){ Cufon.replace
//('h2, .small', {fontFamily: 'Impact',textShadow: '#000 0 1px',color: '-linear-gradient(#ffffff, #e7e7e7)'})
//('#navi li a', {hover:true, fontFamily: 'Myriad Pro'})
//('h4', {fontFamily: 'Myriad Pro'});		  
	('h2,h3')( {hover: true});
    $('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;
            }
        }
    });
	$('a.escape').noSpam();
	$('.gototop').topLink({fadeSpeed: 500});
	$("a[rel='lightbox']").colorbox({maxHeight:"90%"});
});



// BRANDING FADE

$(document).ready(function(){
						   $(".branding").fadeTo(500, 1.0); // This sets the opacity of the thumbs to fade down to 30% when the page loads
						   $(".branding").hover(function(){
						   $(this).stop(true, true);
						   $(this).fadeTo(600, 0.4); // This should set the opacity to 100% on hover
						   },function(){
						   $(this).fadeTo(900, 1.0); // This should set the opacity back to 30% on mouseout
						   });
						   });
