function enableInfo(id)
{
	var links,i;
	if(!document.getElementById || !document.getElementsByTagName)
	return;
	
	if(id==null) 
		links=document.getElementsByTagName("a");
	else 
		links=document.getElementById(id).getElementsByTagName("a");
	
	for(i=0;i<links.length;i++)
	{
		PrepareLinks(links[i]);
	}
}

function PrepareLinks(el)
{
	//we filter out the <a tags that dont have an id attribute that is called title
	if(el.getAttribute("id") == "title")
	{
		el.onmouseover = showInfo;
		el.onmouseout  = hideInfo;
	}
}

//searchs the event info for key strings such as bka or masamun or ekf
//and uses this info to select the correct title and its icon image

function setEventInfo(description)
{
	var img ;
	var imgsrc ;
	var node;
	
	img = document.createElement("img");
	
	if(description != null && description.length > 0)
	{
		/*if(description.search(/BKA/i) >= 0)
		{		
			imgsrc = new String('../images/bka_small.png');
			img.setAttribute('width', '38');
			img.setAttribute('height', '30');
			node = document.createTextNode("British Kendo Association");
					
		}
		else if (description.search(/EKF/i) >= 0)
		{
			imgsrc = new String('../images/ekf_small.png');
			img.setAttribute('width', '30');
			img.setAttribute('height', '30');
			node = document.createTextNode("European Kendo Federation");					
		}
		else if (description.search(/masamune/i) >= 0)
		{
			imgsrc = new String('../images/masamune_small.png');
			img.setAttribute('width', '30');
			img.setAttribute('height', '30');
			node = document.createTextNode("Masamune Dojo Birmingham");					
		}
		else*/
		{
			//put your icon image in here !!!!!!!!!!!!!!!!!
			imgsrc = new String('./images/sbk.png');
			img.setAttribute('width', '31');
			img.setAttribute('height', '31');
			node = document.createTextNode("Chrysler Restorers Club of Australia");					
		}
		
		img.setAttribute('src', imgsrc);
		var logo = document.getElementById("logo");
		var infotitle = document.getElementById("info_title");
						
		logo.appendChild(img);
		infotitle.appendChild(node);
	}	  	
}

function showInfo(e)
{
	//show the info pane
	document.getElementById("infodiv").style.visibility="visible";
	document.getElementById("border").style.visibility="visible";
	
	var div = document.getElementById("info");
	var el;
	
	if(!e)
		el = window.event.srcElement;
	else
		el = e.target;
	
	var info = el.getAttribute("info");
	
	//set the image and title to use
	//depending on the description
	setEventInfo(info);
	
	var title = el.getAttribute('eventTitle');
	
	document.getElementById('event_title').appendChild(document.createTextNode(title));
	
	
	div.appendChild(document.createTextNode(info));
}


function hideInfo()
{
	//document.getElementById("infodiv").style.visibility="hidden";
	//document.getElementById("border").style.visibility="hidden";
	cleanout(document.getElementById("info"));
	cleanout(document.getElementById("logo"));
	cleanout(document.getElementById("info_title"));	
	cleanout(document.getElementById('event_title'));
}

function cleanout(d)
{
	if(d.childNodes.length > 0)
	{
		var len = d.childNodes.length;
		var i;
		for(i=0; i < len ; i++)
			d.removeChild(d.childNodes[0]);
	}
}
