$(document).ready(function() {
  
  $.get(faq.entries, {}, function(xml){

    faq.theHTML = "<ul id=\"faq_questions\">\n";
    $(xml).find("section").each(function(index) {
      faq.theHTML += "\t<li><span  class=\"section\">" + $(this).attr("name") + "</span>";
      faq.theHTML += "\t<ol>\n";
      $(this).find("entry").each(function(index) {
        faq.theHTML += "\t\t<li>";
        $(this).find("que").each(function(index) {
          faq.theHTML += "<a href=\"javascript:;\" class=\"question\"><strong>" + $(this).text() + "</strong></a><br />";
        });
        $(this).find("ans").each(function(index) {
          var ans = $(this).text();
          ans = ans.replace(/\n\n/g,"<br /><br />");
          // ans = ans.replace(/<\/strong>\n\n/g,"<br />");
          faq.theHTML += "<div class=\"answer\">" + ans + "</div>";
        });
        
        faq.theHTML += "\t\t</li>\n";
      });
      faq.theHTML += "\t</ol>\n";
      faq.theHTML += "\t</li>\n";
   });
    faq.theHTML += "</ul>";
    $("#content_main").html(faq.theHTML);
    $("#content_main a.question").click(function() {
      faq.temp = $(this).parent().find(".answer");
      $(".answer").slideUp('slow');
      faq.temp.slideDown('slow');
      
    });
  },
  "xml");
  
});
