$(document).ready(function(){
	//Right Sidebar's navigation function
	$(".pane-list li").click(function(){
		window.location=$(this).find("a").attr("href");return false;
	});
	
	if (SIDEBAR_SELECTED_INDEX > 0) {
		//select active option in sidebar
		SIDEBAR_SELECTED_INDEX = SIDEBAR_SELECTED_INDEX - 1;
		$("ul.pane-list li:eq(" + SIDEBAR_SELECTED_INDEX + ")").attr("class", "current");
	}
	
});

$(document).ready(function() {
	//sort the items in alphabetical order
	//var quicklinks = ""; //store quick links for display on top
	var activities = new Array();
	$("div.adv").each(function(i){
		activities[i] = $(this);
	});
	
	if(SIDEBAR_SELECTED_INDEX + 1 != 4) //choose what to exclude from sorting
	{
		activities.sort(function(a, b){
			var first = $(a).find("h3").text();
			var second = $(b).find("h3").text();
			return (first > second) ? 1 : (second > first) ? -1 : 0;
		});	
	}
	
	
	$("#advcontainer").html("");
	for(i in activities)
	{
		//alert(i);
		html  = '<a name="' + i + '"></a>';
		html += '<div class="adv">';
		html += $(activities[i]).html();
		html += '</div>';
		$("#advcontainer").append(html);
	}
	$("#advcontainer").fadeIn("slow");
	
		
});

$(document).ready(function() {
	//Activate FancyBox
	$("div.advgal a").fancybox({
		'zoomSpeedIn':		10,
		'zoomSpeedOut':		10,
		'overlayOpacity':		0.85,
		'overlayShow':	true
	});
});