/*
 * @author  : Greg Wilton (Queensland Treasury)
 * @version : 4.1 (2008-02-14)
 */
var FAQs = Expandable;

FAQs.prototype.formatItem = function (header, content, row) {
	header.className = (row % 2 == 0) ? "even" : "odd";
	var a = null;
	
	// do formatting based on whether content exists
	if (content) {
		content.className = "content";
		content.style.display = "none";
		
		// add button
		var a = document.createElement("A");
		a.href = "javascript:" + this.varName + ".toggle(" + row + ");";
		this.button.create(a, row);		
		header.appendChild(a);
		a.appendChild(header.firstChild);
	}
	
	// return created button
	return a;
};


/*
 * @author  : Greg Wilton (Queensland Treasury)
 * @version : 2.0 (2003-11-26)
 */
var FAQButton = function (open, closed) {
	this.openImg = new Image();
	this.openImg.src = open;
	this.closedImg = new Image();
	this.closedImg.src = closed;
};
FAQButton.prototype.open = function (obj, row) {
	var img = obj.firstChild;
	img.src = this.openImg.src;
	img.alt = "(Collapse content)";
};
FAQButton.prototype.close = function (obj, row) {
	var img = obj.firstChild;
	img.src = this.closedImg.src;
	img.alt = "(Expand content)";
};
FAQButton.prototype.create = function (a, row) {
	var img = document.createElement("IMG");
	img.src = this.closedImg.src;
	img.style.border = 0;
	img.alt = "(Expand content)";
	a.appendChild(img);
};
