/**************************************************
	NAVIGATION
**************************************************/

function nav(){
	$('.nav ul ul').css({display: 'none'});
	
	$('.nav ul li').hover(function(){
		$(this).find('ul:first').css({
			visibility: 'visible',
			display: 'none'
		}).fadeIn('1000');
	},
	function(){
		$(this).find('ul:first').css({
			visibility: 'hidden'
		});
	});
}

$(document).ready(function() {

	/**************************************************
		NAVIGATION
	**************************************************/

	nav();

	/**************************************************
		PORTFOLIO
	**************************************************/
	
	$('.posts.portfolio .item').hover(function(){
		$(this).find('.image p.pattern').hide();
		//$(this).find('.info').animate({bottom: '10px'}, {queue:false, duration: 300});
		$('.nav, .nav2, .sidebar, .posts.portfolio .item').not(this).animate({opacity: '0.2'}, {queue:false, duration: 300});
    $('.columns').animate({opacity: '0.2'}, {queue:false, duration: 300});
    //$(this).find('img').animate({opacity: '1'}, {queue:false, duration: 300});
    //alert("test");
	},
	function(){
		$(this).find('.image p.pattern').show();
		//$(this).find('.info').animate({bottom: '65px'}, {queue:false, duration: 300});
		$('.nav, .nav2, .sidebar, .posts.portfolio .item').not(this).animate({opacity: '1'}, {queue:false, duration: 300});
    $('.columns').animate({opacity: '1'}, {queue:false, duration: 300});
	});
	
	/**************************************************
		PRETTY PHOTO
	**************************************************/
	
	$("a[rel^='prettyPhoto']").prettyPhoto({
		showTitle : false,
		theme : 'dark_square'
	});



///

						   
			$("a.cdplaylist").fancybox({
				'width'				: 800,
				'height'			: 500,
		        'autoScale'     	: false,
		        'transitionIn'		: 'none',
				'transitionOut'		: 'none',
				'type'				: 'iframe'
			});

	/* This is basic - uses default settings */
	$("a.fancyimg").fancybox({ 'titleShow': false });
	$("a.ngg-gallery-link").fancybox({ 'titleShow': false });
	$("a.fancyinline").fancybox();
	
	$("a.fancychatiframe").fancybox({ 'titleShow': false, 'hideOnOverlayClick':false, 'width': 800, 'height': 650, 'type': 'iframe' }); 

	$("a.fancyiframe").fancybox({ 'width': 800, 'height': 600  }); 

			
jQuery("#chronikzeitleiste ul li").click(function () {
  jQuery(".chroniktext").fadeOut("slow");
  jQuery("#chronikzeitleiste ul li").removeClass("active");
  jQuery("#chronik_"+jQuery(this).text()).fadeIn("slow");
  jQuery(this).addClass("active");
});
});



$(function () {
	$('.bubbleInfo').each(function () {
		var distance = 20;
		var time = 250;
		var hideDelay = 750;

		var hideDelayTimer = null;

		var beingShown = false;
		var shown = false;
		var trigger = $('.trigger', this);
		var info = $('.popup', this).css('opacity', 0);


		$([trigger.get(0), info.get(0)]).mouseover(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			if (beingShown || shown) {
				// don't trigger the animation again
				return;
			} else {
				// reset position of info box
				beingShown = true;

				info.css({
					top: -190,
					
					display: 'block'
				}).animate({
					top: '-=' + distance + 'px',
					opacity: 0.8
				}, time, 'swing', function() {
					beingShown = false;
					shown = true;
				});
			}

			return false;
		}).mouseout(function () {
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				info.animate({
					top: '-=' + distance + 'px',
					opacity: 0
				}, time, 'swing', function () {
					shown = false;
					info.css('display', 'none');
				});

			}, hideDelay);

			return false;
		});
	});

	
 
  
  
});