// This function is called when any of the tab is clicked
// It is adapted from https://www.w3schools.com/howto/howto_js_tabs.asp
function openInfo(evt, tabName) {
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName('tabcontent')
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = 'none'
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName('tablinks')
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(' active', '')
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(tabName).style.display = 'block'
evt.currentTarget.className += ' active'
}
// generate a checkbox list from a list of products
// it makes each product name as the label for the checkbos
function populateListProductChoices(slct1, slct2) {
var s1 = document.getElementById(slct1);
var s2 = document.getElementById(slct2);
// s2 represents the
in the Products tab, which shows the product list, so we first set it empty
s2.innerHTML = "";
s2.appendChild(document.createElement("br"));
s2.appendChild(document.createElement("br"));
// obtain a reduced list of products based on restrictions
var optionArray = restrictListProducts(products, s1.value);
//add to the filtered array
filtered = optionArray;
console.log("hello", filtered);
// for each item in the array, create a checkbox element, each containing information such as:
//
//