
var displayedDay = "day0"

function courseWeek()	{
	
	/* check the browser is capable of recognising the DOM objects
	   we need to implement the script - otherwise return false and allow the normal link to be executed */
	   
	if(!document.getElementsByTagName) return false;
	if(!document.getElementById) return false;
	if(!document.getElementById("courseWeek")) return false;
	
	
	/* get the reference to the productRange object and then create an array 
	   of all the <a> tags found in the array. To each tag assign a function to
	   the onmouseover and onmouseout events - which calls the changeColour and changeColour functions. */	
	
	var menu = document.getElementById("courseWeek");
	var menulinks = menu.getElementsByTagName("h2");
	
		for(i = 0; i < menulinks.length; i++) {
		
			
			menulinks[i].onclick = function() {
			
					  return showDay(this);		
			}
			
			
			
			
			
			
		}
}


function showDay(thisDay)	{
	

var thisNodeName = thisDay.nextSibling.nodename

if (thisDay.nextSibling.nodeName.toLowerCase() == "div") {
	
	//alert(thisDay.nextSibling.id)
	
	thisDay.nextSibling.style.display = "block"
	
	document.getElementById(displayedDay).style.display = "none"
	
	
		if ((thisDay.nextSibling.id) == (displayedDay)) {
			
			
			thisDay.nextSibling.style.display = "block"
		
		}
			
	displayedDay = thisDay.nextSibling.id
	
}

else if (thisDay.nextSibling.nextSibling.nodeName.toLowerCase() == "div") {

	//alert(thisDay.nextSibling.nextSibling.id)
	
	thisDay.nextSibling.nextSibling.style.display = "block"
	
	document.getElementById(displayedDay).style.display = "none"
			
	displayedDay = thisDay.nextSibling.nextSibling.id

	
			if ((thisDay.nextSibling.nextSibling.id) == (displayedDay)) {
			
			
			thisDay.nextSibling.nextSibling.style.display = "block"
		
			}
		
}
			
		return false			
}




