$(document).ready(function(){

	// Hide all elements on load
	$("#rss").hide();
	$("#boxlatestcomments").hide();
	$("#tagcloud").hide();
	$("#search").hide();

	// Define what happens if the RSS-Button is clicked
	$("#rssbutton").click(function () {

		// Show Toggle the RSS-Div
		$("#rss").slideToggle("slow");

		// Check if the Latest Comments is open and close it if neccessary
		if ($("#boxlatestcomments").is(":hidden")) {
			// Do nothing
		} else {
			$("#boxlatestcomments").slideUp("slow");
		}

		// Check if the Tagcloud is open and close it if neccessary
		if ($("#tagcloud").is(":hidden")) {
			// Do nothing
		} else {
			$("#tagcloud").slideUp("slow");
		}

		// Check if Search is open and close it if neccessary
		if ($("#search").is(":hidden")) {
			// Do nothing
		}
		else {
			$("#search").slideUp("slow");
		}
		
	}); // EOF RSS-Button Effects
	
// Define what happens if the RSS-Button is clicked
	$("#commentbutton").click(function () {

		// Show Toggle the RSS-Div
		$("#boxlatestcomments").slideToggle("slow");

		// Check if the RSS is open and close it if neccessary
		if ($("#rss").is(":hidden")) {
			// Do nothing
		} else {
			$("#rss").slideUp("slow");
		}

		// Check if the Tagcloud is open and close it if neccessary
		if ($("#tagcloud").is(":hidden")) {
			// Do nothing
		} else {
			$("#tagcloud").slideUp("slow");
		}

		// Check if Search is open and close it if neccessary
		if ($("#search").is(":hidden")) {
			// Do nothing
		}
		else {
			$("#search").slideUp("slow");
		}
		
	}); // EOF RSS-Button Effects	

	// Define what happens if the Tagcloud is clicked
	$("#tagcloudbutton").click(function () {

		// Show Toggle the Tagcloud-Div
		$("#tagcloud").slideToggle("slow");

		// Check if the Latest Comments is open and close it if neccessary
		if ($("#boxlatestcomments").is(":hidden")) {
			// Do nothing
		} else {
			$("#boxlatestcomments").slideUp("slow");
		}

		// Check if the RSS is open and close it if neccessary
		if ($("#rss").is(":hidden")) {
			// Do nothing
		} else {
			$("#rss").slideUp("slow");
		}

		// Check if Search is open and close it if neccessary
		if ($("#search").is(":hidden")) {
			// Do nothing
		}
		else {
			$("#search").slideUp("slow");
		}
		
	}); // EOF Tagcloud-Button Effects

	// Define what happens if Search is clicked
	$("#searchbutton").click(function () {

		// Show Toggle the Tagcloud-Div
		$("#search").slideToggle("slow");

		// Check if the Latest Comments is open and close it if neccessary
		if ($("#boxlatestcomments").is(":hidden")) {
			// Do nothing
		} else {
			$("#boxlatestcomments").slideUp("slow");
		}

		// Check if the RSS is open and close it if neccessary
		if ($("#rss").is(":hidden")) {
			// Do nothing
		} else {
			$("#rss").slideUp("slow");
		}

		// Check if Search is open and close it if neccessary
		if ($("#tagcloud").is(":hidden")) {
			// Do nothing
		}
		else {
			$("#tagcloud").slideUp("slow");
		}
		
	}); // EOF Tagcloud-Button Effects	
	
});

// Funktion um Selektoren fuer FancyBox Image-Gallery zu bestimmen
$(function() {
        $("a.lWOn").fancybox({ 'hideOnContentClick': true });
	$("a.zoom").fancybox({ 'hideOnContentClick': true });
});
