/**
 * IRIS-specific chart expander initialisation
 */
function init_expander(expander) {

	// add event handler
	expander.onclick = function() {
		toggle_section(this.parentNode);
	}

	// add 'pointer' cursor on mouseover
	expander.style.cursor = 'pointer';

	// get current expander contents (should be in a <p>)
	var p = expander.getElementsByTagName('p').item(0);
	if (p == null) {
		p = expander;
	}
	var nodes = Array();

	for (var i = 0; i < p.childNodes.length; i++) {
		var n = p.childNodes[i];
		nodes.push(n);
		p.removeChild(n);
	}

	// create 'collapse' icon at start of p
	var icon = document.createElement('img');
	icon.src = collapseIcon.src;
	icon.className = 'icon';
	p.appendChild(icon);

	// put the existing stuff back
	for (var j = 0; j < nodes.length; i++) {
			p.appendChild(nodes.pop());
	}

	// create colour-coding icon
	var colourcode = document.createElement('img');
	colourcode.src = colourCodeIcon.src;
	colourcode.className = 'colour-code';
	p.appendChild(colourcode);
}