/**
 * searchFAQ function will filter a list based on a provided string
 * @param {Object} txt | values to search on
 */
 
function goToLink(url) {
	document.location = url;
}

function searchFAQ(txt)
{
	if (txt != '' || txt != null) {
		question_found = false;
		searchTags = txt.toLowerCase().split(" ");
		var questionList = $('.faqQuestion');
		var ignoreList = 'the that what of does how can I find is am a set';
		$.each(questionList, function() { 
			found1 = true;
			faq_value = $(this).text().toLowerCase();
			$.each(searchTags, function(i, val) {
				if (ignoreList.indexOf(val) == -1) {
					found1 = (faq_value.indexOf(val) == -1) ? false : found1;
					if (found1) {
						question_found = true;
					}
				}
			});
			if (found1) {
				$(this).parent().show();
				$(this).children().show();
			} else {
				$(this).parent().hide();
				$(this).children().hide();
			}
		});
		
		if (!question_found) {
			var answerList = $('.faqAnswer');
			$.each(answerList, function() { 
				found2 = true;
				faq_value = $(this).text().toLowerCase();
				$.each(searchTags, function(i, val) {
					if (ignoreList.indexOf(val) == -1) {
						found2 = (faq_value.indexOf(val) == -1) ? false : found2;
					}
				});
				if (found2) {
					$(this).prev().show();
					$(this).prev().children().show();
					$(this).parent().show();
				} else {
					$(this).prev().hide();
					$(this).prev().children().hide();
					$(this).parent().hide();
				}
			});
		}
	}
}