$(document).ready(function() {
	
	// HTML: Kopfbereich: Slogan: Einfügen eines Span-Tags für den transparenten Rahmen
	$('div.head h2').append('<span></span>');
	
	// HTML: Navigation: Einfügen eines Span-Tags mit Pfeil
	$('div.navigation ul li a').prepend('<span>►</span>');
	
	// HTML: Sidebar: Einfügen eines Span-Tags für den Kopfbereich
	$('div.sidebar').prepend('<span class="top"></span>');
	
	// HTML: Sidebar: Einfügen eines Span-Tags für den Fuß
	$('div.sidebar').append('<span class="bottom"></span>');
	
	// HTML: Inhalt: Zitate: Einfügen eines Span-Tags für den Fuß
	$('div.main div.zitat').after('<div class="zitat_footer"></div>');
	
	// CSS: Inhalt: Mitglieder: Einfügen einer CSS-Klasse
	$('div.main div.mitarbeiter_mitglieder div.mitglieder:nth-child(odd)').addClass('odd');
	$('div.main div.mitarbeiter_mitglieder div.mitglieder:nth-child(even)').after('<br clear="all">');
	
	
	// Lightbox Initialisierung
	$('a[rel*=lightbox]').lightBox({
		fixedNavigation: true,
		overlayBgColor: '#000',
		overlayOpacity: 0.8,
		imageLoading: '/assets/js/jquery-lightbox/images/loading.gif',
		imageBtnClose: '/assets/js/jquery-lightbox/images/closelabel.gif',
		imageBtnPrev: '/assets/js/jquery-lightbox/images/prevlabel.gif',
		imageBtnNext: '/assets/js/jquery-lightbox/images/nextlabel.gif',
		containerResizeSpeed: 350,
		txtImage: 'Bild',
		txtOf: 'von',
		currentLocation: currentLocation
	});
	

	// E-Mails entschlüsseln
	$('a[href^=mailto:]').each(function() {
		this.href=this.href.split("?")[0].replace("ANTI[at]SPAMBOT", "@");
		$(this).html($(this).html().replace("TOBMAPS]ta[ITNA", "@"));
	});
	
	
	// jQuery SmoothScroll
	$('a[href*=#]').click(function() {
		
		// make sure it's the same location		
		if(location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'') && location.hostname==this.hostname && this.hash.replace(/#/,''))
		{
			// get parameters
			var hash=this.hash;
			var target=$(hash).offset().top;
			
			// animate to target and set the hash to the window.location after the animation
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: target }, 500, function() { location.hash=hash; });
			
			// cancel default click action
			return false;
		}
		
	});

});
