// faq.js
// Copyright © 2006 Round Table Interactive, Inc.

/*
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            if (oldonload) {
                oldonload();
            }
            func();
        }
    }
}

addLoadEvent(function() {
	linkEfx();
})
*/

linkEfx();

function linkEfx() {

if(!document.getElementById || !document.createTextNode) { return; }

// hide the right-hand list of links if we can use the javascript version instead.
Element.remove('linklist');

// put the question and answer elements into arrays
var questions = document.getElementsByClassName('question');
var answers = document.getElementsByClassName('answer');

// iterate over the array
questions.each(function(question, i) {

	question.innerHTML = "<a href=\"#\">" + question.innerHTML + "</a>";
	
	question.effect = new fx.Height(answers[i], {duration: 300});
	question.effect.hide();
	
	question.onclick = function() {
		this.effect.toggle();
		this.firstChild.className = this.firstChild.className === '' ? 'minus' : '';
	}
	
});
}