var Tristan_Perich_Site = {};


window.addEventListener("load", Start_Tristan_Perich, false);

function Start_Tristan_Perich()
{
	setInterval("Tristan_Perich_Watch_Address_Bar()", 100);
}

function Tristan_Perich_Watch_Address_Bar()
{
	// Get path
	var New_Path = document.location.href;
	
	// Start after pound
	var Pound_Position = New_Path.indexOf("#");
	if (Pound_Position > -1)
		New_Path = New_Path.substring(Pound_Position + 1);
	
	// Strip slashes
	New_Path = New_Path.replace(/^\/*/, "");
	New_Path = New_Path.replace(/\/*$/, "");
	
	// If no path is specified, set a default path
	if (document.getElementById("Last_Path_Item_Wrapper"))
	{
		if (New_Path == "" || Pound_Position == -1)
			document.getElementById("Last_Path_Item_Wrapper").style.visibility = "hidden";
		else
			document.getElementById("Last_Path_Item_Wrapper").style.visibility = "visible";
	}
}

function See_All_Events()
{
	 $('body').animate({scrollTop: $("#Calendar_Wrapper").offset().top}, 200);
}

var Last_Filter = {Compositions: "Selected", Calendar: "Upcoming"};
function Apply_Filter(Section, Filter)
{
	// Hide Last Filter
	$("#" + Section + "_" + Last_Filter[Section] + "_Link").toggleClass("On");
	
	// Set New Filter
	Last_Filter[Section] = Filter;
	$("#" + Section + "_" + Last_Filter[Section] + "_Link").toggleClass("On");
}

function Show_All_Compositions()
{
	document.getElementById("Selected_Compositions").style.display = "none";
	document.getElementById("All_Compositions").style.display = "none";
	document.getElementById("Piano_Improvisations").style.display = "none";
	
	document.getElementById("Selected_Link").style.display = "inline-block";
	document.getElementById("All_Works_Link").style.display = "inline-block";
	document.getElementById("Piano_Link").style.display = "inline-block";
	document.getElementById("Selected_Link_On").style.display = "none";
	document.getElementById("All_Works_Link_On").style.display = "none";
	document.getElementById("Piano_Link_On").style.display = "none";
	
	document.getElementById("All_Compositions").style.display = "inline-block";
	document.getElementById("All_Works_Link").style.display = "none";
	document.getElementById("All_Works_Link_On").style.display = "inline-block";
}

function Show_Piano_Improvisations()
{
	document.getElementById("Selected_Compositions").style.display = "none";
	document.getElementById("All_Compositions").style.display = "none";
	document.getElementById("Piano_Improvisations").style.display = "none";
	
	document.getElementById("Selected_Link").style.display = "inline-block";
	document.getElementById("All_Works_Link").style.display = "inline-block";
	document.getElementById("Piano_Link").style.display = "inline-block";
	document.getElementById("Selected_Link_On").style.display = "none";
	document.getElementById("All_Works_Link_On").style.display = "none";
	document.getElementById("Piano_Link_On").style.display = "none";
	
	document.getElementById("Piano_Improvisations").style.display = "inline-block";
	document.getElementById("Piano_Link").style.display = "none";
	document.getElementById("Piano_Link_On").style.display = "inline-block";
}

function Show_Upcoming_Events()
{
	document.getElementById("Upcoming_Events").style.display = "none";
	document.getElementById("Past_Events").style.display = "none";
	
	document.getElementById("Upcoming_Link").style.display = "inline-block";
	document.getElementById("Past_Link").style.display = "inline-block";
	document.getElementById("Upcoming_Link_On").style.display = "none";
	document.getElementById("Past_Link_On").style.display = "none";
	
	document.getElementById("Upcoming_Events").style.display = "inline-block";
	document.getElementById("Upcoming_Link").style.display = "none";
	document.getElementById("Upcoming_Link_On").style.display = "inline-block";
}

function Show_Past_Events()
{
	document.getElementById("Upcoming_Events").style.display = "none";
	document.getElementById("Past_Events").style.display = "none";
	
	document.getElementById("Upcoming_Link").style.display = "inline-block";
	document.getElementById("Past_Link").style.display = "inline-block";
	document.getElementById("Upcoming_Link_On").style.display = "none";
	document.getElementById("Past_Link_On").style.display = "none";
	
	document.getElementById("Past_Events").style.display = "inline-block";
	document.getElementById("Past_Link").style.display = "none";
	document.getElementById("Past_Link_On").style.display = "inline-block";
}

var Last_Recording_ID;
function Show_Recording_Information(Recording_ID)
{
	if (Last_Recording_ID)
		document.getElementById("Recording_" + Last_Recording_ID + "_Information").style.display = "none";
	Last_Recording_ID = Recording_ID;
	document.getElementById("Recording_" + Last_Recording_ID + "_Information").style.display = "block";
}