(function() {
	var showItem = function(nid) {
		if(nid && nid != '') {
			var content = $("#faq_answer_" + nid).html();
			$("#faq_selected_answer").html(content);
			
			// prevent navigation
			return false;
		}
	}
	
	$(function() {
		$("#faq .faq-items a").click(function () { 
			var nid = $(this).attr('id');
			showItem(nid);
			return false;
		});
	});
	
	GWR.Init(function() {
		var keywordList = GWR.GetHashKeywords();
		if(keywordList.length > 0) {
			var keyword = keywordList[0];
			$('#body .faq-category a').each(function() {
				var title = $(this).text();
				if(GWR.HashString(title, keyword)) {
					GWR.Log(title, keyword);
					var nid = $(this).attr('id');
					showItem(nid);
					
					return false;
				}
			});
		}
	});
})();
