/* Variables */var divid = 0, questions = "", answers = "";function showAnswer(divid) {	$("div.answer[set=" + divid + "]").appendTo("div.set[set=" + divid + "]").slideToggle();}$(document).ready(function(){ 	$.ajaxSetup({ cache: false });	$.get(xmlFile, {}, function(xml){		/*agentName = $('agentInfo', xml).attr('agentName');*/		$("C", xml).each(function(i) {			catName = 	$(this).attr('name');			lastQuestion = "";			breakAt = new Array();			$("S", this).each(function(s) {				questions += "<div class=\"set\" set=\"" + divid + "\">";				$("Q", this).each(function(q) {					currentQuestion = $(this).text().replace(/.*?:/,'');					if (lastQuestion != currentQuestion) { 						questions += "<div class=\"question\" set=\"" + divid + "\" onclick=\"showAnswer("+divid+")\">";						questions += "<p><img src=\"mm/css/img/question.png\"> " + currentQuestion + "</p>";						questions += "</div>";						breakAt.push(s);					}					lastQuestion = currentQuestion;				});								$("A", this).each(function(a) {					answers += "<div set=\"" + breakAt[breakAt.length-1] + "\" class=\"answer\" style=\"display:none\"><p><img src=\"mm/css/img/answer.png\"> " + $(this).text() + "</p></div>";				});				divid++;				questions += "</div>";			});		});		$("#questions").html(questions);		$("#answers").html(answers);			});});function viewAllTopics() {	$("div.question").trigger('click');	$("div.answer").slideDown();	$(".collapseAllTopics").show();}function collapseAllTopics() {	$("div.question").trigger('click');	$("div.answer").slideUp();}