/*----------------------CUFON-------------------------------------*/
Cufon.replace('#navi li a, h2,h3,h4,h5,.click',{ fontFamily: 'Fontin Sans Rg' , hover:'true'});	
/*-----------------------------------------------------------
    to encrypt e-mail address
    ---------------------------------------------------------*/
	
function noSpam() {
    if (document.getElementById) {
		var at = "@";
	  	var links = document.getElementsByTagName('a');
	  	for (var i = 0; i < links.length; i++) {
		  	var linkElem = links[i];
		  	if (linkElem.className == 'email') {
		  		var mail = linkElem.firstChild; var domain = linkElem.lastChild;
		  		mail.nextSibling.firstChild.innerHTML = at;
		  		linkElem.href = "mailto:" + mail.data + at + domain.data;
		  	}		
	  	} 	  
    } 
}

/*-----------------------------------------------------------
    to start functions
    ---------------------------------------------------------*/
	 
$(function(){ 
	noSpam();
});

/*--- smooth scroll ------------------------------------*/
	 
$(function(){	    $('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}, 800);
                return false;
            }
	        }
});
});

/*--- fancybox ------------------------------------*/

		jQuery(document).ready(function() {
			jQuery("a[class=zoom]").fancybox({
				'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'titlePosition' 	: 'over',
				'overlayOpacity'	:	0.4,
				'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
					return '<span id="fancybox-title-over">Bild ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
				}
			});
			
						jQuery("a.iframe").fancybox({
				'easingIn, easingOut': true,
				'overlayOpacity'	:	0.5
			});
																			
			accordion();
		});

/*--- accordion ------------------------------------*/

function accordion(){
	jQuery('.inhalt').slideUp();
//	jQuery('.inhalt:first').slideDown();
	jQuery('.click').click(function(){
			jQuery('.inhalt').slideUp('slow');
			jQuery('.activeClick').removeClass('activeClick');
		if(jQuery(this).next('.inhalt').css('display') == 'none'){
			jQuery(this).next('.inhalt').slideDown('slow');
			jQuery(this).addClass('activeClick');
		}
	});
};

