function addLoadEvent(func){
	var oldonload=window.onload;
	if(typeof window.onload != 'function'){
		window.onload = func;
	}else{
		window.onload = function(){
		oldonload();
		func();
		}
	}
}
addLoadEvent(initTable);

function initTable(){
	table = document.getElementById('eventsTable');
	linkArray = table.getElementsByTagName('a');
	triggerLinks = []
	for(i=0;i<linkArray.length;i++){
		if(linkArray[i].className.match('trigger')){
			triggerLinks.push(linkArray[i]);
			linkArray[i].onclick = function (){
				var rows = table.getElementsByTagName('tr');
				activeRow = this.parentNode.parentNode;
				for(j=0;j<rows.length;j++){
					if(rows[j] == activeRow){
						if(activeRow.className == 'current'){
							activeRow.className = activeRow.className.replace('current', '');
							rows[j+1].className = rows[j+1].className.replace('show', 'hidden')
						}else{
							activeRow.className = 'current';
							rows[j+1].className = rows[j+1].className.replace('hidden', 'show');
							showContent = rows[j+1].getElementsByTagName('td');
							showContent[0].setAttribute('id', 'fade');
						}
					}
				}
			}
		}
	}
}

