/**
 * class	CS_Faq
 * author	Marco Troost
 */
var CS_Faq = new Class({
	
	/**
	 * start
	 * @return void
	 */
	start: function()
	{
		// set vars
		var root_node = $('cs_faq_wrapper');
		
		if (root_node)
		{
			// loop through all items and set event
			var question_nodes			= root_node.getElements('.cs_faq_question');
			var total_question_nodes	= question_nodes.length;

			if (total_question_nodes > 0)
			{
				question_nodes.each(function(question_node, index)
				{
					question_node.removeEvents();
					question_node.addEvents(
					{
						'click' : function()
						{
							var li_node = this.getParent('li');
							
							if (li_node)
							{
								var sub_node = li_node.getElement('ul');
								
								if (sub_node)
								{
									var sub_node_state = sub_node.getStyle('display');
									
									if (sub_node_state == 'block') sub_node.setStyle('display', 'none');
									else sub_node.setStyle('display', 'block');
								}
							}
						}
					});
				});
			}
		}
	}
	
});
