
	function loadGallery(id)
	{
		$.get( 
			"/de/galerie?id=" + id, 
			null, 
		   	function(html){ 
	   			$('#ajax').html(html);
	   			initGallery();
			} 
		); 
	}
	
	function initGallery()
	{
		$('#ajax').html($('#ajax').html());
		$('#overlay').css('display','block').css('opacity',0);
		$('#overlay').animate({'opacity':0.5},1000);
		$('#overlay').click(function()
		{
			fadeGallery('out');
			t1 = window.setTimeout("fadeOverlay('out');",250);
		});
		$('#galleryEasing').css('opacity',0).css('display','none');
		
		$(document).keyup(function(e)
		{
			if(e.keyCode == 27)
			{
				e.preventDefault();
				fadeGallery('out');
				t1 = window.setTimeout("fadeOverlay('out');",250);
			}
		});
		
		var buttons = { previous:$('.lof-next') ,
						next:$('.lof-previous') };
						
		$obj = $('#lofslidecontent45').lofJSidernews({
			interval        : 4000,
			direction		: 'opacitys',	
		 	easing			: 'easeInOutExpo',
			duration		: 1200,
			auto		 	: false,
			maxItemDisplay  : 11,
			navPosition     : 'horizontal', // horizontal
			navigatorHeight : 32,
			navigatorWidth  : 80,
			mainWidth       : 980,
			buttons			: buttons
		});	
		
		$('#galleryEasing').css('display','block').css('opacity',0);
		t1 = window.setTimeout("fadeGallery('in');",1000);
		
		$('.lof-imageItem').each(function(key,obj)
		{
			$(obj).mouseenter(function()
			{
				$('.lof-main-item-desc').each(function(key,obj)
				{
					$(obj).stop().animate({'height':'120px'},250);
				});
			});
			
			$(obj).mouseleave(function()
			{
				$('.lof-main-item-desc').each(function(key,obj)
				{
					$(obj).stop().animate({'height':'0px'},250);
				});
			});
		});
	}
	
	function fadeGallery(direction)
	{
		if(direction == 'in')
		{
			$('#galleryEasing').animate({'opacity':1},1000);
		}
		 else
		 {
		 	$('#galleryEasing').stop().animate({'opacity':0},250);
		 	t1 = window.setTimeout("hideGallery();",250);
		 }
	}
	
	function fadeOverlay(direction)
	{
		if(direction == 'in')
		{
			$('#overlay').stop().css('opacity',0).css('display','block');
			$('#overlay').stop().animate({'opacity':1},1000);
		}
		 else
		 {
		 	$('#overlay').stop().animate({'opacity':0},250);
		 	t1 = window.setTimeout("hideOverlay();",250);
		 }
	}
	
	function hideGallery()
	{
		$('#ajax').html('');
	}
	
	function hideOverlay()
	{
		$('#overlay').css('display','none');
	}
