
// this function returns the last name of a path. Using the forward slash as the delimiter
function getCurrentPageName(aLocationString)
{
	var anExample = aLocationString;
    var tester = anExample.split("/");
    var lastIndex = tester.length - 1;
	var firstIndex = tester[lastIndex].split("?");
	return firstIndex[0];
    

}
//Functions displays currentpage name in the grey menu bar. it uses the getCurrentPageName as a helper function
function getCurrentMenuName()
{
	var menuIsSet = false;
	var menuName;
	var currentName = getCurrentPageName(document.location.href);
	var tempMatch = currentName.split(".");
	var matchFound = tempMatch[0].charAt(0).toUpperCase() + tempMatch[0].slice(1);
	
	if(document.getElementById("Accordion1") != null)
	{
		menuName = document.getElementById("Accordion1").getElementsByTagName("a");
		for (var i=0; i<menuName.length; i++)
		{
			var menuMatch = getCurrentPageName(menuName[i].href);
			
			if(menuMatch == currentName) 
			{
				
				matchFound = menuName[i].innerHTML;
				//i = menuName.length;
				
				
			}
		}	
	}
	document.getElementById("currentPage").innerHTML = matchFound; 
}
//====================================================================================================================================================
// this hides and displays the club field on the registration page
function showClubs()
{
	if(document.getElementById("clubMenu").className == "noDisplayRow")
	{
		document.getElementById("clubMenu").className = "displayRow";
	}
	else
	{
		document.getElementById("clubMenu").className = "noDisplayRow";
	}
}

function getText(level, theLi)
{
	var theLevel = level;
	var levelText = document.getElementById("coachLevel");
	levelText.style.border = "#933 1px solid";
	var theElem = theLi;
	var ulElem = document.getElementById("certificateList").getElementsByTagName("li");
	for(var k = 0; k < ulElem.length; k++)
	{
		ulElem[k].className = "certList";
	}
	theElem.className = "certListSelected";
	levelText.innerHTML = "";
	if(level == 1)
	{
		levelText.innerHTML = "<h3>England Basketball Level 1 UK Coaching Certificate (UKCC L1)</h3><p>This is the basic level of coaching qualification for those who wish to commit coaching basketball. The course provides each candidate with the basic knowledge of basketball and coaching skills, and will enable the holder to assist a fully qualified Level 2 Coach. Candidates enrolled on a Level 1 UKCC Basketball courses should download and complete the following Coaching Practice Requirements and Home Study Questions before attending the first day of the course. It is also recomended that you download read the Health & Safety Guidelines for Basketball.</p>";
	}
	else if(level == 2)
	{
		levelText.innerHTML = "<h3>England Basketball Level 2 UK Coaching Certificate (UKCC L2)</h3><p>This is the standard level of coaching qualification for all club coaches working at local and junior national league level who wish to commit to coaching basketball. The award gives an overview of coaching styles and  the skills and techniques of basketball. Candidates enrolled on a Level 2 UKCC Basketball course should download and complete the following Coaching Practice Requirements and Home Study Questions before attending the first day of the course. It is also recomended that you download read the Health & Safety Guidelines for Basketball.</p>";

	}
	else if(level ==3)
	{
		levelText.innerHTML = "<h3>England Basketball Level 3 UK Coaching Certificate (UKCC L3)</h3><p>This is the advanced level of coaching qualification and is suitable for coaches working with all standards of players.</p>";

	}
}

function buttonPress(elem)
{
	var button1 = elem;
	//alert("style " + button1.style.backgroundImage);
	button1.style.color = "#FFF";
	button1.style.background = "url('../layoutImages/basicButtonOver.png')";
	button1.style.backgroundRepeat = "no-repeat";
}

function buttonUp(elem)
{
	var button1 = elem;
	button1.style.color = "#CCC";
	button1.style.background = "url('../layoutImages/basicButton.png')";
	button1.style.backgroundRepeat = "no-repeat";
}
