$(document).ready(function(){
	$("#functions").fadeTo(1, 0.1);
	$("div.tab").hide();
	var functionsOpen = false;
	var functionsLastTab = "";
	
	$("#comments").click(function () {
		$("div.tab").hide();
		$("#tab_comments").show()
		toggleFunctions("comments");
    });
	
	$("#tags").click(function () {
		$("div.tab").hide();
		$("#tab_tags").show();
		toggleFunctions("tags");
	});
	
	$("#related").click(function () {
		$("div.tab").hide();
		$("#tab_related").show()
		toggleFunctions("related");
    });

	$("#social").click(function () {
		$("div.tab").hide();
		$("#tab_social").show()
		toggleFunctions("social");
	});

	$("a[rel^='prettyPhoto']").prettyPhoto({
			animationSpeed: 'normal', /* fast/slow/normal */
			padding: 40, /* padding for each side of the picture */
			opacity: 0.35, /* Value betwee 0 and 1 */
			showTitle: true, /* true/false */
			allowresize: true, /* true/false */
			counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
			theme: 'dark_rounded' /* light_rounded / dark_rounded / light_square / dark_square */
	});


jQuery(function($){
  $("blockquote").addClass("more-block").after("<div class='toggle-block more'></div>").hide().click(function() { $(this).slideToggle("normal"); $(this).next().addClass("more").removeClass("less").text(""); });


  $(".toggle-block").show();
  $(".toggle-block").click(function() {
    if ($(this).hasClass("more")) {
	  $(this).addClass("less").removeClass("more").text("");
    } else {
      $(this).addClass("more").removeClass("less").text("");
    }
    $(this).prev().slideToggle("normal");
  })
});

function toggleFunctions(currentTab) {
	if ((functionsLastTab == currentTab) || (functionsLastTab == "")) {
		if (functionsOpen == false) {
			functionsLastTab = currentTab;
			functionsOpen = true;
			$("#functions").slideDown(50);
			$("#functions").fadeTo("slow", 1);
		} else {
			functionsLastTab = "";
			functionsOpen = false;
			$("#functions").fadeTo("slow", 0);
			$("#functions").slideUp(100);
		}
	} else { functionsLastTab = currentTab;	}
}

});


