$(function () {
	BACK_TO_TOP_TEXT = typeof(BACK_TO_TOP_TEXT) == 'string' ? BACK_TO_TOP_TEXT : 'Retour';
	BACK_TO_TOP_TITLE = typeof(BACK_TO_TOP_TITLE) == 'string' ? BACK_TO_TOP_TITLE : 'Retour aux questions';
	var anchors = $('.jfaq-questions a[href^="#"]');
	anchors.each(function (i) {
		var el = $(this);
		var target_id = el.attr('href').substr(1);
		var question_id = el.attr('id');
		if (question_id == null || question_id.length == 0) {
			question_id = 'jfaq-q-' + target_id;
			el.attr('id', question_id);
		}
		answer = $(el.attr('href'));
		answer.attr('id', '');
		answer.before(
			$('<p class="jfaq-answer-title"></p>').text(el.text()).attr('id', target_id)
		);
		answer.append(
			$('<a></a>').text(BACK_TO_TOP_TEXT).attr('href', '#' + question_id).attr('title', BACK_TO_TOP_TITLE).addClass('jfaq-back-to-top')
		);
		//el.click(function () { answer.addClass('highlight'); return true; });
	});
});
