// Ready Function - called when DOM loads - initializes page.
$(document).ready(function()
	{
	// enable page event handlers
	bindEvents();	
	
	// fix so load works w/ie
	$.ajaxSetup({'xhr':function(){return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();}});
   		
	// starts with home page displayed so set link to correct state
	$('a#home').addClass("active");
	
	});

// Assign Event Handlers for ckinperson.php page - called by Ready Function
function bindEvents()
	{
	//alert("bind events");
	$('a.menulink').click(menuClick);
	}

function menuClick()
	{
	//alert("tournaments flag " + tourneysEnabled);
	$('div#contentdiv').html("");
	$('a.menulink').removeClass("active");
	$(this).addClass("active");
	//alert("switch")
	switch (this.id)
		{
		case "home":
			$('#contentdiv').load("home.html");
			break;
		case "tourneys":
			$('#contentdiv').load("tournaments.html");
			break;
		case "leagues":
			$('#contentdiv').load("leagues.html");
			break;
		case "handicaps":
			$('#contentdiv').load("handicaps.html");
			break;
		case "juniors":
			$('#contentdiv').load("juniors.html");
			break;
		case "officers":
			//$('#contentdiv').load("officers.html",loadComplete);
			$('#contentdiv').load("officers.html");
			break;
		case "hall":
			$('#contentdiv').load("hall.html");
			break;
		case "news":
			$('#contentdiv').load("news.html");
			break;
		case "links":
			$('#contentdiv').load("links.html");
			break;
		}
	//alert("click complete")	
	}

