function siteSetup()
{
	$(".jqnavi").click(siteNavigation);
	$("img.gallery").fullsize();
	
	fixLayout();
}

// --------------------------------------------------------------------------------------

function switchTeaser(_section)
{
	var teaser = $("#teaser");
	var fader  = teaser.clone();
	
	teaser.attr("src", "lib/images/teaser_" + _section + ".jpg");
	
	fader.insertAfter(teaser);
	
	fader.css({ 
		position : "absolute",
		top      : teaser.top,
		left	 : 27,
		zindex   : 10
	});
		
	fader.fadeOut(1000, function() { $(this).remove(); });
}

// --------------------------------------------------------------------------------------

function startSwitchContent(_section)
{
	$("#text").fadeOut(500, function() { 
		$(this).empty();
		
		$("#content").height("100%");
		$(".layout > .left").height("100%");
		$(".layout > .right").height("100%");
		
		$(".footer").css({ 
			top    : 0,
			bottom : 20
		});
		
		$(".footer").hide();
	 
		$(this).load(_section + ".fragment.php", { inline : true }, finishSwitchContent); 
	});
}

// --------------------------------------------------------------------------------------

function fixLayout()
{
	var docHeight = $(document).height();
	
	$("#content").height(docHeight);
	$(".layout > .left").height(docHeight);
	$(".layout > .right").height(docHeight);
	
	$(".footer").show();
	
	$(".footer").css({ 
		top    : docHeight - (20 + 33),
		bottom : 0
	});
}

// --------------------------------------------------------------------------------------

function finishSwitchContent(_responseText, _textStatus, _XMLHttpRequest)
{
	$("#text").fadeIn(500);
	$("#text img").load(fixLayout);	
	
	fixLayout();
}

// --------------------------------------------------------------------------------------

function siteNavigation(_event)
{
	var section = _event.currentTarget.id.substring(5);
	
	switchTeaser(section);
	startSwitchContent(section);
}

// --------------------------------------------------------------------------------------

function openImage(_imageNode)
{
	var baseImagePath = $(_imageNode).attr("src");
	var separator = baseImagePath.lastIndexOf("/");
	var imagePath = baseImagePath.substring(0, separator) + "/large" + baseImagePath.substring(separator);
	
	alert(imagePath);
}











