var Answer =  {

	INVISIBLE_CLASS_NAME : 'invisible',
	CLOSED_CLASS_NAME : 'closed',

	toggle : function(oElement) {

		try {

			var
				oAnswerElement = oElement.parentNode.parentNode.parentNode;
				oToggleImage = oElement.getElementsByTagName('img')[1]
				;

			if(Common.Class.match(oAnswerElement, Answer.CLOSED_CLASS_NAME)) {

				Common.Class.remove(oAnswerElement, Answer.CLOSED_CLASS_NAME);
				Common.Class.add(oToggleImage, Answer.INVISIBLE_CLASS_NAME);

			}
			else {

				Common.Class.add(oAnswerElement, Answer.CLOSED_CLASS_NAME);
				Common.Class.remove(oToggleImage, Answer.INVISIBLE_CLASS_NAME);

			}

		}
		catch(oException) {
		}

		return false;

	},

	expandAll : function(
		oContainer,
		bExpand
		) {

		try {

			var
				oAnswerElements = oContainer.getElementsByTagName('dl'),
				oToggleImage,
				oExpandAllElement = document.getElementById('expand_all').getElementsByTagName('a')[0],
				oCollapseAllElement = document.getElementById('expand_all').getElementsByTagName('a')[1]
				;

			for(var i = 0; i < oAnswerElements.length; i++) {

				if(Common.Class.match(oAnswerElements[i], 'question')) {

					oToggleImage = oAnswerElements[i].getElementsByTagName('img')[1];

					if(bExpand) {

						Common.Class.remove(oAnswerElements[i], Answer.CLOSED_CLASS_NAME);
						Common.Class.add(oToggleImage, Answer.INVISIBLE_CLASS_NAME);

					}
					else {

						Common.Class.add(oAnswerElements[i], Answer.CLOSED_CLASS_NAME);
						Common.Class.remove(oToggleImage, Answer.INVISIBLE_CLASS_NAME);

					}

				}

			}

			if(bExpand) {

				Common.Class.add(oExpandAllElement, Answer.INVISIBLE_CLASS_NAME);
				Common.Class.remove(oCollapseAllElement, Answer.INVISIBLE_CLASS_NAME);

			}
			else {

				Common.Class.remove(oExpandAllElement, Answer.INVISIBLE_CLASS_NAME);
				Common.Class.add(oCollapseAllElement, Answer.INVISIBLE_CLASS_NAME);

			}

		}
		catch(oException) {
		}

		return false;

	}

}
