

eoy_init();

/*
	init() - Is run as the .js file loads in the browser.
	at this point, the full HTML document has not yet loaded therefore
	the DOM Tree is not fully built.
	
	This function attaches the 'initialise' function to the window onload event
	when the HTML document is loaded, initialise() is called.
*/

function eoy_init()
{
	if (window.addEventListener) 
	{
       	window.addEventListener('load', eoy_initialise, false);
       	return true;
   	}
	else if (window.attachEvent)
	{
       	var r = window.attachEvent('onload', eoy_initialise);
      	return r;
   	}
	else
	{
       	return false;
   	}
}

function eoy_initialise()
{
	//get all the images, check the className add an onclick event
	var tbl = document.getElementById('EOYreportTable');
	if(tbl)
	{
		var cells = tbl.getElementsByTagName('td');
		for (var i=0; i<cells.length; i++)
		{
			if (cells[i].className == 'name') { cells[i].onclick = openRow; cells[i].style.cursor='pointer'; }
		}
	}
	
}
function ding() {alert('ding');}

function openRow()
{
	var openDiv = document.getElementById('open');
	if (openDiv)
	{
		openDiv.id = openDiv.name;
		openDiv.className='closed';
	}
	
	var div = document.getElementById(this.parentNode.id.substring(1, this.parentNode.id.length));
	if (div.className=='closed') {div.className =''; div.name=div.id; div.id='open';}
	else{div.className='closed';}
	
	/*if(this.childNodes[1].title == 'Collapse') 
	{
		list.className = 'networkList hidden';
		this.childNodes[1].title = 'Expand';
		this.childNodes[1].src = '/style/networkList_exp.png';
	}
	else
	{
		list.className = 'networkList';
		this.childNodes[1].title = 'Collapse';
		this.childNodes[1].src = '/style/networkList_col.png';
	}
	
	var h2s = document.getElementsByTagName('h2');
	var status = ''
	for (var h=0; h<h2s.length; h++)
	{
		if(h2s[h].childNodes[1])
		{
			if (h2s[h].childNodes[1].title == 'Collapse') {status += h2s[h].childNodes[1].alt + ':o,';}
			else {status += h2s[h].childNodes[1].alt + ':-,'; }
		}
	}
	
	var date = new Date();
	date.setTime(date.getTime()+(31*24*60*60*1000));
	var expires = "; expires="+date.toGMTString();
	
	document.cookie='networkFolders=' + status + expires + '; path=/';*/
	
}
