const faqText = $("#faq").data("faqtext").replace(/<[^>]*>/g,'');
const faqURL = $("#faq").data("faqurl").replace(/<[^>]*>/g,'');
const faqHeadings = $("#faq").data("faqheadings").replace(/<[^>]*>/g,'');
const faqTitle = $("#faq").data("faqtitle").replace(/<[^>]*>/g,'');
if (faqText.length > 0) {
  const faqTextArray = faqText.split("|");
  const faqURLArray = faqURL.split("|");
  const faqHeadingsArray = faqHeadings.split("|");
  if (faqTextArray.length == faqURLArray.length && faqTextArray.length == faqHeadingsArray.length) {
    let faqAppender = "";
    faqAppender += '<p>'+faqTitle+'</p>';
    faqAppender += '<ul>';
    for (i=0;i<faqURLArray.length;i++) {
      faqAppender += '<li><a href="'+faqURLArray[i].replace(/"|:/g, '')+'" title="'+faqTextArray[i].replace(/"/g, '')+'">'+faqHeadingsArray[i]+'</a></li>';
    }
    faqAppender += '</ul>';
    $("#faq").append(faqAppender);
  }
} else {
  $("#faq").hide();
}
