$(document).ready(function() {
	if ($('#faq_categories').length) {
		$('.category .question a.title').each(function() {
		    var dis = $(this), state = false, answer = dis.parent().parent().next('.answer').slideUp();
		    dis.click(function() {
		      state = !state;
		      answer.slideToggle(state);
		      dis.toggleClass('active',state);
		    });
		  });
		
		$('.category').each(function() {
			if ($(this).attr('id') != 'category_0')
				$(this).hide();
		});
		
		$('#faq_categories').change(function() {
			selected_category = $(this).val();
			$('.category').each(function() { $(this).hide() });
			$('#' + selected_category).show();
		});
	}
});
