<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Symptoms, Deficiencies, and Products Selector</title> 
    <style>
        /* General Styling */
        body {
            font-family: Calibri,'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
            margin: 0;
            padding: 0;
            color: #333;
        }

        .container {
            display: flex;
            max-width: 2300px;
            margin: 50px auto;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 10px;
            box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
            overflow: hidden;
        }

        .main-section {
            flex: 3;
            padding: 20px;
        }

        .section {
            margin-bottom: 20px;
        }



        .sidebar {
            flex: 1;
            border-left: 1px solid #ccc;
            padding: 10px;
            background: #f1f8e9;
        }

        .product-item {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
        }

            .product-item img {
                width: 50px;
                height: 50px;
                margin-right: 8px;
            }

            .product-item a {
                text-decoration: none;
                color: #0066cc;
                font-weight: bold;
            }

        .symptoms-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
            gap: 5px;
        }

        .symptom-item {
            padding: 5px;
            border: 1px solid #ccc;
            border-radius: 3px;
            text-align: center;
            cursor: pointer;
            transition: background 0.3s ease, transform 0.2s ease;
        }

            .symptom-item:hover {
                background-color: #e8f5e9;
                transform: scale(1.05);
            }

            .symptom-item.selected {
                background-color: #a5d6a7;
            }

        button {
            padding: 5px 10px;
            margin: 5px;
            background-color: #4caf50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-weight: bold;
        }

            button:hover {
                background-color: #388e3c;
            }

        input[type="text"], textarea {
            width: 100%;
            padding: 10px;
            margin-bottom: 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }

        .notes-section {
            background: #ffffff;
            border: 1px solid #ccc;
            padding: 10px;
            border-radius: 5px;
            margin-top: 10px;
        }

        .toggle-notes-btn {
            background-color: #ff9800;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            padding: 10px 20px;
            margin: 10px 0;
            font-weight: bold;
        }

            .toggle-notes-btn:hover {
                background-color: #f57c00;
            }
    </style>
</head>
<body>
    <div class="container">
        <!-- Main Section -->
        <div class="main-section">
           
            <div>
                <button onclick="downloadProductList()">Download Product List</button>
                <button onclick="printProductList()">Print Product List</button>
            </div>
            <div class="section">
                <h2>Search Products</h2>
                <input type="text"
                       id="search-bar"
                       placeholder="Search for a product by name..."
                       oninput="searchProducts()">
                <div id="search-results"></div>
            </div>

            <div class="section">
                <h2>Select Symptoms</h2>
                <div id="symptoms-grid" class="symptoms-grid"></div>
            </div>

        </div>
        <div class="section">
            <h2>Recommended Products</h2>
            <div id="products-list"></div>
        </div>
        <!-- Right Sidebar -->
        <div class="sidebar">
            <h2>Deficiencies</h2>
            <ul id="deficiencies-list"></ul>

            <div>
                <!-- Button to toggle visibility of notes section -->
                <button class="toggle-notes-btn" onclick="toggleNotesSection()">Toggle Notes Section</button>
            </div>

            <div class="notes-section" id="notes-section">
                <h3>Notes Per Symptom</h3>
                <div id="notes-list"></div>
            </div>
        </div>
    </div>

    <script>
        // Sample data for symptoms, vitamins, and products
        const symptoms = [
            { id: 1, name: "Acid Reflux", products: [540, 509, 561, 514], deficiencies: [], notes: "" },
            { id: 2, name: "Acne", products: [540, 561, 552, 505, 509], deficiencies: ["Vitamin-A", "Vitamin-C", "Vitamin-E", "Zn", "Si"], notes: "" },
            { id: 3, name: "ADD/ADHD", products: [517, 516, 505, 539, 500], deficiencies: [], notes: "" },
            { id: 4, name: "Aging", products: [540, 524, 567, 563, 546, 509, 505, 539, 500], deficiencies: [], notes: "" },
            { id: 5, name: "Aids", products: [540, 561, 541, 527, 505, 535, 566, 509], deficiencies: [], notes: "" },
            { id: 6, name: "Alcoholism", products: [505, 509, 535, 527], deficiencies: [], notes: "" },
            { id: 7, name: "Alertness", products: [540, 505, 527, 567, 533], deficiencies: [], notes: "" },
            { id: 8, name: "Allergies", products: [540, 561, 541], deficiencies: ["Vitamin-C", "Vitamin-D", "Mg", "O3", "Q"], notes: "" },
            { id: 10, name: "Amblyopic", products: [566], deficiencies: [], notes: "" },
            { id: 11, name: "Anemia", products: [541, 540, 505, 535, 566], deficiencies: [], notes: "" },
            { id: 12, name: "Angina", products: [540, 524, 527, 566, 509, 535], deficiencies: [], notes: "" },
            { id: 13, name: "Anorexia", products: [535], deficiencies: [], notes: "" },
            { id: 14, name: "Anxiety", products: [505, 509, 540, 541, 535, 559], deficiencies: ["Vitamin-B6", "Vitamin-B9", "Vitamin-B12", "Vitamin-D", "Mg", "O3", "I", "Q", "AL"], notes: "" },
            { id: 15, name: "Appetite", products: [533, 527, 505], deficiencies: [], notes: "" },
            { id: 16, name: "Arrhythmia", products: [540, 527, 509, 512, 567, 524], deficiencies: [], notes: "" },
            { id: 17, name: "Arteries", products: [540, 539, 568], deficiencies: [], notes: "" },
            { id: 18, name: "Arthritis", products: [540, 561, 527, 566, 509, 567, 523], deficiencies: [], notes: "" },
            { id: 19, name: "Asthma", products: [540, 542, 505, 535], deficiencies: [], notes: "" },
            { id: 20, name: "Athlete's Foot", products: [540, 566, 562, 561], deficiencies: [], notes: "" },
            { id: 21, name: "Atherosclerosis", products: [540, 527, 524, 561, 505, 567, 535], deficiencies: [], notes: "" },
            { id: 22, name: "Autism", products: [519, 516, 518, 505, 514, 567, 530], deficiencies: [], notes: "" },
            { id: 23, name: "Back Pain", products: [540, 535, 509, 505, 523, 541], deficiencies: ["Vitamin-B12", "Vitamin-D", "Mg", "Ca", "AL"], notes: "" },
            { id: 24, name: "Bed Wetting", products: [540, 561], deficiencies: ["Vitamin-B12", "Vitamin-D", "Mg"], notes: "" },
            { id: 25, name: "Bell's Palsey", products: [540, 505, 507], deficiencies: [], notes: "" },
            { id: 26, name: "Bladder", products: [540, 561, 511, 514], deficiencies: [], notes: "" },
            { id: 27, name: "Bloating", products: [514, 511, 561, 537], deficiencies: [], notes: "" },
            { id: 28, name: "Blood Purifier", products: [540, 541, 561], deficiencies: [], notes: "" },
            { id: 29, name: "Blood Pressure", products: [540, 521, 532, 501, 567, 539], deficiencies: ["Mg", "I", "CoQ10"], notes: "In cases of high BP, start w Multi & B for a week before adding 1 cap of OPC3. The OPC3 can cause the body to detox pulling toxins out of fat cells, the body's response to increased toxins in the bloodstream, is to add fluid to allow toxins to be purged, but added fluids increase blood pressure. It's a short term response but still can cause the customer to panic ." },
            { id: 30, name: "Body Builder", products: [540, 505, 527, 567, 557, 556], deficiencies: [], notes: "" },
            { id: 31, name: "Boils", products: [540, 541, 527, 561, 509, 505, 535], deficiencies: [], notes: "" },
            { id: 32, name: "Bone Spurs", products: [540, 567, 509, 523], deficiencies: [], notes: "" },
            { id: 33, name: "Breast Cancer", products: [540, 541, 527, 505, 566, 567, 535, 561], deficiencies: [], notes: "" },
            { id: 34, name: "Breast Lumps", products: [540, 541, 561, 527, 505, 567], deficiencies: [], notes: "" },
            { id: 35, name: "Bronchitis", products: [561, 540, 541, 566], deficiencies: [], notes: "" },
            { id: 36, name: "Bruising", products: [540, 505, 509, 566, 567], deficiencies: [], notes: "" },
            { id: 37, name: "Burns", products: [540, 561, 562], deficiencies: [], notes: "" },
            { id: 38, name: "Bursitis", products: [540, 509, 541, 547], deficiencies: [], notes: "" },
            { id: 40, name: "Candida Albicans", products: [561, 540, 527, 505, 511, 514], deficiencies: [], notes: "" },
            { id: 41, name: "Canker Sores", products: [540, 541, 561, 566], deficiencies: [], notes: "" },
            { id: 39, name: "Cancer", products: [540, 541, 511, 505, 567, 561], deficiencies: [], notes: "Isochrome, Bromelain, Curcumin, Resveratrol (not for female hormone related cancers). Also, Karen Marino's detox regimen (the sweat one)(while on chemo 4x Vit-B, D3, Mg are all safe, won't affect chemo)" },
            { id: 42, name: "Cardiovascular Disease", products: [540, 541, 501, 505, 567, 561], deficiencies: [], notes: "" },
            { id: 43, name: "Carpal Tunnel", products: [540, 505, 523, 541, 507], deficiencies: [], notes: "" },
            { id: 44, name: "Cataracts", products: [540, 564, 505, 567, 541], deficiencies: [], notes: "" },
            { id: 45, name: "Celiac Disease", products: [561, 540, 514, 507], deficiencies: ["Vitamin-B12", "Vitamin-D", "Fe", "Zn"], notes: "" },
            { id: 46, name: "Cervical Dysplasia", products: [540, 541, 561, 505, 509], deficiencies: [], notes: "" },
            { id: 47, name: "Chemotherapy", products: [561, 541, 505, 566], deficiencies: [], notes: "" },
            { id: 48, name: "Cholesterol", products: [560, 505, 540, 567], deficiencies: [], notes: "" },
            { id: 49, name: "Chronic Fatigue", products: [540, 541, 505, 567, 561], deficiencies: ["Vitamin-B12", "Vitamin-D", "Fe", "Mg", "ME"], notes: "" },
            { id: 50, name: "Circulation", products: [540, 509, 505, 541], deficiencies: [], notes: "" },
            { id: 51, name: "Cirrhosis", products: [561, 540, 505, 509], deficiencies: [], notes: "" },
            { id: 52, name: "Colds and Flu", products: [540, 561, 567, 566], deficiencies: [], notes: "" },
            { id: 53, name: "Cold Sore", products: [540, 541, 566, 561], deficiencies: [], notes: "" },
            { id: 54, name: "Colitis", products: [561, 540, 514, 507], deficiencies: [], notes: "" },
            { id: 55, name: "Conjunctivitis", products: [566], deficiencies: [], notes: "" },
            { id: 56, name: "Constipation", products: [], deficiencies: [], notes: "" },
            { id: 57, name: "Cough", products: [540, 561], deficiencies: [], notes: "" },
            { id: 58, name: "Cramps (intestinal)", products: [540, 561, 514, 532], deficiencies: ["Vitamin-B1", "Vitamin-B6", "K2", "Mg", "Ca", "Mn", "I"], notes: "" },
            { id: 59, name: "Cramps (muscle)", products: [540, 509, 505, 532], deficiencies: ["Vitamin-B1", "Vitamin-B6", "K2", "Mg", "Ca", "Mn", "I"], notes: "" },
            { id: 60, name: "Crohn's Disease", products: [561, 514, 540], deficiencies: ["Vitamin-B12", "Vitamin-D", "Mg", "Zn", "GL"], notes: "" },
            { id: 61, name: "Cystitis", products: [540, 561, 566], deficiencies: [], notes: "" },
            { id: 62, name: "Depression", products: [518, 513, 567, 532], deficiencies: ["Vitamin-B6", "Vitamin-B9", "Vitamin-D", "O3"], notes: "" },
            { id: 63, name: "Dermatitis", products: [540, 561, 562, 566], deficiencies: ["Vitamin-B2", "Vitamin-B3", "Zn", "O3", "GL"], notes: "" },
            { id: 64, name: "Detoxification", products: [540, 537, 561, 511, 541], deficiencies: [], notes: "" },
            { id: 65, name: "Diabetes", products: [540, 527, 528, 551, 561], deficiencies: [], notes: "" },
            { id: 66, name: "Diarrhea", products: [561, 514], deficiencies: ["Zn", "I", "GL"], notes: "" },
            { id: 67, name: "Digestive Problems", products: [514, 561, 540, 509, 511, 550], deficiencies: [], notes: "" },
            { id: 68, name: "Diverticulitis", products: [561, 514, 540, 541, 509, 511], deficiencies: [], notes: "" },
            { id: 69, name: "Dizziness", products: [540, 541, 566], deficiencies: [], notes: "" },
            { id: 70, name: "Drug Toxicity", products: [540, 541, 566, 561, 514], deficiencies: [], notes: "" },
            { id: 71, name: "Ear Infections", products: [561, 540, 505, 566], deficiencies: [], notes: "" },
            { id: 72, name: "Eczema", products: [561, 538, 540, 531, 515], deficiencies: [], notes: "" },
            { id: 73, name: "Edema", products: [540, 509, 505, 567], deficiencies: [], notes: "" },
            { id: 74, name: "Emphysema", products: [540, 561, 541, 566, 505], deficiencies: [], notes: "" },
            { id: 75, name: "Endometriosis", products: [540, 566, 509, 505], deficiencies: [], notes: "" },
            { id: 76, name: "Energy", products: [505, 533, 504, 540, 555], deficiencies: [], notes: "" },
            { id: 77, name: "Epilepsy", products: [540, 505, 566, 567, 541], deficiencies: [], notes: "" },
            { id: 78, name: "Epstein Barr Virus", products: [540, 527, 505, 505, 535, 533], deficiencies: [], notes: "" },
            { id: 79, name: "Estrogen Supp.", products: [563, 546, 509, 505, 522], deficiencies: [], notes: "" },
            { id: 80, name: "Eyes", products: [564, 540, 566, 505], deficiencies: [], notes: "" },
            { id: 81, name: "Fatigue", products: [540, 505, 535, 533, 566, 567, 555], deficiencies: [], notes: "" },
            { id: 82, name: "Female Issue", products: [540, 522, 505, 509], deficiencies: [], notes: "" },
            { id: 83, name: "Fever", products: [561, 540, 566], deficiencies: [], notes: "" },
            { id: 84, name: "Fever Blisters", products: [540, 561, 562], deficiencies: [], notes: "" },
            { id: 85, name: "Fibromyalgia", products: [540, 541, 505, 509, 567, 566, 535], deficiencies: [], notes: "" },
            { id: 86, name: "Fibroids", products: [540, 513], deficiencies: [], notes: "" },
            { id: 87, name: "Fungus", products: [562, 561, 566], deficiencies: [], notes: "" },
            { id: 88, name: "Gall bladder", products: [540, 509, 561, 505], deficiencies: [], notes: "" },
            { id: 89, name: "Gall Stones", products: [561, 566], deficiencies: [], notes: "" },
            { id: 90, name: "Gastric Cancer", products: [540, 561, 511, 505, 541, 567], deficiencies: [], notes: "" },
            { id: 91, name: "GERD", products: [540, 561, 514, 511, 509], deficiencies: [], notes: "" },
            { id: 92, name: "Gestational Diabetes", products: [540, 527, 528], deficiencies: [], notes: "" },
            { id: 93, name: "Gingivitis", products: [540, 566, 512], deficiencies: ["Vitamin-C", "Vitamin-D", "CoQ10"], notes: "" },
            { id: 94, name: "Glaucoma", products: [540, 541, 566, 567, 564], deficiencies: [], notes: "" },
            { id: 95, name: "Goiter", products: [540, 566], deficiencies: [], notes: "" },
            { id: 98, name: "Gums(receding)", products: [540, 509, 512], deficiencies: [], notes: "" },
            { id: 206, name: "Gut Health", products: [561, 514, 540], deficiencies: [], notes: "" },
            { id: 99, name: "Hair", products: [540, 509, 566], deficiencies: [], notes: "" },
            { id: 100, name: "Halitosis", products: [566, 540, 561], deficiencies: [], notes: "" },
            { id: 101, name: "Hangover", products: [505,540], deficiencies: [], notes: "" },
            { id: 102, name: "Hay Fever", products: [540, 505, 541, 561], deficiencies: [], notes: "" },
            { id: 103, name: "Headache", products: [505, 540, 509], deficiencies: [], notes: "" },
            { id: 104, name: "Heartburn", products: [561, 540, 511, 509, 514], deficiencies: [], notes: "" },
            { id: 105, name: "Heart Murmurs", products: [569, 509, 540], deficiencies: [], notes: "" },
            { id: 106, name: "Hemophilia", products: [566], deficiencies: [], notes: "" },
            { id: 107, name: "Hemorrhoids", products: [540, 561, 509], deficiencies: [], notes: "" },
            { id: 108, name: "Hepatitis C", products: [540, 541, 535, 505, 561], deficiencies: [], notes: "" },
            { id: 109, name: "Herpes", products: [540, 566, 561, 535], deficiencies: ["Vitamin-C", "Vitamin-D", "Zn"], notes: "" },
            { id: 110, name: "Hiatal Hernia", products: [561, 514], deficiencies: [], notes: "" },
            { id: 111, name: "High Blood Pressure", products: [569, 540, 541, 505, 567, 512], deficiencies: [], notes: "" },
            { id: 112, name: "High Cholesterol", products: [560, 505, 540, 567], deficiencies: [], notes: "" },
            { id: 113, name: "Hormone Imbalance", products: [563, 546, 522, 505, 540, 509], deficiencies: [], notes: "" },
            { id: 114, name: "Hot Flashes", products: [522, 527, 505, 540, 541], deficiencies: [], notes: "" },
            { id: 115, name: "Hyperactivity", products: [540, 505, 535, 509], deficiencies: [], notes: "" },
            { id: 116, name: "Hypoglycemia", products: [540, 528, 527, 561, 505], deficiencies: [], notes: "" },
            { id: 117, name: "Hyperkinesias", products: [509], deficiencies: [], notes: "" },
            { id: 118, name: "Hypertension", products: [569, 540, 566, 505, 512], deficiencies: ["Vitamin-D", "Mg", "O3", "L-A"], notes: "" },
            { id: 120, name: "Immune System", products: [540, 541, 561, 505, 511, 566], deficiencies: [], notes: "" },
            { id: 121, name: "Impotency", products: [563, 546, 534, 540, 541], deficiencies: [], notes: "" },
            { id: 122, name: "Indigestion", products: [561, 514, 509, 511], deficiencies: [], notes: "" },
            { id: 123, name: "Infection", products: [561, 540, 566, 567], deficiencies: [], notes: "" },
            { id: 124, name: "Insomnia", products: [545, 509, 546, 563], deficiencies: [], notes: "" },
            { id: 125, name: "Iron Deficiency", products: [540, 536, 509], deficiencies: [], notes: "" },
            { id: 126, name: "IBS", products: [514, 561], deficiencies: ["Vitamin-D", "Mg", "O3", "GL"], notes: "" },
            { id: 127, name: "ITP", products: [567, 521], deficiencies: [], notes: "" },
            { id: 128, name: "Jaundice", products: [540, 566], deficiencies: [], notes: "" },
            { id: 130, name: "Kidneys", products: [540, 541, 561, 509, 505], deficiencies: [], notes: "" },
            { id: 132, name: "Knee Pain", products: [540, 535, 509, 505, 567, 523, 547, 513, 518], deficiencies: [], notes: "" },
            { id: 133, name: "Lactose Intolerance", products: [540, 561, 538], deficiencies: [], notes: "" },
            { id: 134, name: "Laryngitis", products: [540, 561], deficiencies: [], notes: "" },
            { id: 135, name: "Leg Cramps", products: [540, 509, 505, 532], deficiencies: [], notes: "" },
            { id: 137, name: "Leukemia", products: [540, 541, 561, 566], deficiencies: [], notes: "" },
            { id: 138, name: "Lou Gehrig's Disease", products: [540, 541, 561, 566, 567], deficiencies: [], notes: "" },
            { id: 139, name: "Low Blood Pressure", products: [524, 527, 540, 512], deficiencies: [], notes: "" },
            { id: 140, name: "Low Blood Sugar", products: [528, 527, 540, 505], deficiencies: [], notes: "" },
            { id: 141, name: "Lupus", products: [540, 527, 561, 509, 505, 567], deficiencies: [], notes: "" },
            { id: 143, name: "Macular Degeneration", products: [564, 549, 503, 540, 566], deficiencies: [], notes: "" },
            { id: 144, name: "Malnutrition", products: [511, 535, 505], deficiencies: [], notes: "" },
            { id: 145, name: "Memory Loss", products: [540, 505, 567, 510, 548], deficiencies: [], notes: "" },
            { id: 146, name: "Meningitis", products: [566], deficiencies: [], notes: "" },
            { id: 147, name: "Menopause", products: [522, 540, 505, 509], deficiencies: [], notes: "" },
            { id: 148, name: "Menstrual Problems", products: [540, 509, 505, 522], deficiencies: [], notes: "" },
            { id: 150, name: "Mononucleosis", products: [540, 566, 527], deficiencies: [], notes: "" },
            { id: 151, name: "Morning Sickness", products: [505, 540, 561], deficiencies: [], notes: "" },
            { id: 152, name: "Multiple Sclerosis", products: [540, 561, 505, 535, 509, 567], deficiencies: [], notes: "" },
            { id: 153, name: "Muscular Dystrophy", products: [540, 527, 535, 566], deficiencies: [], notes: "" },
            { id: 154, name: "Nails", products: [540, 509], deficiencies: [], notes: "" },
            { id: 155, name: "Narcolepsy", products: [540, 512, 509, 535], deficiencies: [], notes: "" },
            { id: 156, name: "Nausea", products: [561, 540, 514], deficiencies: ["Vitamin-B6", "Mg"], notes: "" },
            { id: 157, name: "Nephritis", products: [540, 505], deficiencies: [], notes: "" },
            { id: 158, name: "Nerves", products: [509, 505, 540], deficiencies: [], notes: "" },
            { id: 159, name: "Neuropathy", products: [505, 540], deficiencies: [], notes: "" },
            { id: 160, name: "Numbness", products: [505, 540], deficiencies: [], notes: "" },
            { id: 161, name: "Obesity", products: [555, 527, 554, 533], deficiencies: [], notes: "" },
            { id: 162, name: "Osteoarthritis", products: [540, 509, 567, 505], deficiencies: [], notes: "" },
            { id: 163, name: "Osteoporosis", products: [509, 540, 566, 567, 535], deficiencies: [], notes: "" },
            { id: 164, name: "Ovarian Cysts", products: [540, 505, 567, 541], deficiencies: [], notes: "" },
            { id: 165, name: "Panic Attacks", products: [505, 540, 567], deficiencies: [], notes: "Bliss or ACTS" },
            { id: 166, name: "Pancreas", products: [540, 527], deficiencies: [], notes: "" },
            { id: 167, name: "Parkinson’s Disease", products: [505, 540, 512, 509], deficiencies: [], notes: "" },
            { id: 168, name: "Phlebitis", products: [540, 527, 509, 561, 566], deficiencies: [], notes: "" },
            { id: 169, name: "PMS", products: [540, 509, 532, 505, 522], deficiencies: [], notes: "" },
            { id: 170, name: "Pneumonia", products: [561, 540, 566, 541], deficiencies: [], notes: "" },
            { id: 186, name: "Sickle Cell Anemia", products: [540, 541, 505], deficiencies: [], notes: "" },
            { id: 187, name: "Sinusitis", products: [502], deficiencies: [], notes: "" },
            { id: 188, name: "Smoking", products: [540, 505, 566, 541, 503], deficiencies: [], notes: "" },
            { id: 189, name: "Sore Throat", products: [561, 566], deficiencies: [], notes: "" },
            { id: 190, name: "Stress", products: [506, 555, 505, 540, 567, 509], deficiencies: [], notes: "" },
            { id: 191, name: "Stroke", products: [540, 569, 541, 535], deficiencies: [], notes: "" },
            { id: 192, name: "Tendonitis", products: [502, 507, 547, 513], deficiencies: [], notes: "" },
            { id: 193, name: "Thyroid (hyper)", products: [541, 509, 532, 505, 527], deficiencies: [], notes: "X2 Plus might add Isochrome" },
            { id: 194, name: "Thyroid (hypo)", products: [555, 540, 535, 509, 513, 505], deficiencies: [], notes: "" },
            { id: 195, name: "Tinnitus", products: [510, 540, 505, 535, 566], deficiencies: [], notes: "" },
            { id: 196, name: "TMJ", products: [540, 505], deficiencies: [], notes: "" },
            { id: 197, name: "Tumors", products: [541, 561, 540, 566], deficiencies: [], notes: "" },
            { id: 198, name: "Ulcers", products: [561, 514, 511], deficiencies: [], notes: "" },
            { id: 199, name: "Urinary Problems", products: [540, 561, 514], deficiencies: [], notes: "" },
            { id: 200, name: "Varicose Veins", products: [540, 527, 561, 509, 566], deficiencies: [], notes: "" },
            { id: 201, name: "Vertigo", products: [530, 540, 566], deficiencies: [], notes: "" },
            { id: 202, name: "Warts", products: [540, 566, 561], deficiencies: [], notes: "" },
            { id: 203, name: "Wounds", products: [540, 566, 561], deficiencies: [], notes: "" },
            { id: 204, name: "Yeast Infection", products: [526, 561, 540, 541, 505], deficiencies: [], notes: "Vit-C may help too" },
            { id: 205, name: "Yellow Jaundice", products: [540, 527, 561], deficiencies: [], notes: "" },
            { id: 9, name: "Alzheimer's", products: [540, 539, 510, 535, 505], deficiencies: [], notes: "For prevention: Curcumin, Omega3, OPC-3" },
        
            { id: 96, name: "Gout", products: [540, 561, 505, 514], deficiencies: [], notes: "For a  flare up Dig Enzymes w/ every meal. Aloe half a bottle a day. OPC-3 3caps twice a day. For long term the Essentials Kit along with complete greens or aloe should help keep it away and greatly reduce frequency and severity of flare ups. Get water filters! Chlorine is a halogen (free radical) will aggravate gout & asthma" },
            { id: 97, name: "Graves Disease", products: [540, 561, 505, 566, 567, 541], deficiencies: [], notes: "ORAC optional" },
            { id: 119, name: "Hyperthyroidism", products: [541, 509, 532, 505, 527], deficiencies: ["Vitamin-A", "Vitamin-D", "Se", "I", "NAC"], notes: "2x per day" },
            { id: 129, name: "Joint Pain", products: [540, 507, 518, 547], deficiencies: [], notes: "3x per day for 6 weeks" },
            { id: 131, name: "Kidney Stones", products: [509, 532, 567, 509], deficiencies: [], notes: "avoid too much Vit-C" },
            { id: 136, name: "Liver", products: [540, 561, 537, 525, 503], deficiencies: [], notes: "use Detox Kit" },
            { id: 142, name: "Lyme Disease", products: [540, 505, 567, 538, 512], deficiencies: [], notes: "Bromelain and Immune may help as well" },
            { id: 149, name: "Migraines", products: [505, 540, 532, 509], deficiencies: ["Vitamin-B5", "Vitamin-B7", "Mg", "Zn", "CoQ10", "Q", "AL"], notes: "Several caps of Acai & B-complex to crash an ongoing migraine (or AWAKE may work)" },
            { id: 171, name: "PolyCystic Ovarian Syndrome", products: [540, 541, 505, 522], deficiencies: [], notes: "" },
            { id: 172, name: "Prostate", products: [534, 540, 535], deficiencies: [], notes: "" },
            { id: 173, name: "Psoriasis", products: [540, 520, 561, 514, 511, 509, 505, 567], deficiencies: [], notes: "6 weeks of 4 caps of OPC-3" },
            { id: 174, name: "Rashes", products: [540, 561, 562], deficiencies: [], notes: "" },
            { id: 175, name: "Restless Leg Syndrome", products: [521, 532], deficiencies: [], notes: "" },
            { id: 176, name: "Reynaud’s Disease", products: [505, 540, 561, 540, 512, 509, 567], deficiencies: [], notes: "" },
            { id: 177, name: "Rheumatoid Arthritis", products: [540, 505, 518, 541, 561, 567, 507], deficiencies: [], notes: "Bromelain for additional support for bad days 3 or 4 Astaxanthin may also help with flare-ups" },
            { id: 178, name: "Rosacea", products: [540, 535, 561, 514, 538], deficiencies: ["Vitamin-B2", "Vitamin-C", "Zn", "O3", "Si"], notes: "Lumiere de Vie fading fluid with Skintelegence cleanser and toner first for pH balance" },
            { id: 179, name: "Rotator Cuff", products: [540, 547, 523], deficiencies: [], notes: "" },
            { id: 180, name: "Sciatica", products: [540, 505, 507, 547], deficiencies: [], notes: " 1xVitB,1xCalcium,1xPrimeJoint all 3x a day." },
            { id: 181, name: "Scleroderma", products: [540, 566, 512, 535], deficiencies: [], notes: "" },
            { id: 182, name: "Scoliosis", products: [540, 509, 505, 567], deficiencies: [], notes: "" },
            { id: 183, name: "Seizures", products: [540, 505, 566, 567, 541, 532], deficiencies: [], notes: "Extra B complex" },
            { id: 184, name: "Sex Drive", products: [540, 505], deficiencies: [], notes: "Bliss and B complex if it's stress related" },
            { id: 185, name: "Shingles", products: [540, 507, 518, 562], deficiencies: [], notes: "Ultimate Aloe Drink is optional" },
        
            
            
            

        ];

        const products = [
            { id: 500, name: "Isotonix® Açai Advanced Energy and Antioxidant Formula", image: "https://img.shop.com/Image/210000/214100/214196/products/561800355.jpg", url: "https://www.shop.com/icanhelpyou/-561800355-p.xhtml" },
            { id: 501, name: "Heart Health Co-Q10", image: "https://img.shop.com/Image/210000/214100/214196/products/561800367.jpg", url: "https://www.shop.com/icanhelpyou/-561800367-p.xhtml" },
            { id: 502, name: "Isotonix® Daily Essentials Kit (With Iron)", image: "https://img.shop.com/Image/210000/214100/214196/products/1126614911.jpg", url: "https://www.shop.com/icanhelpyou/-1126614911-p.xhtml" },
            { id: 503, name: "Isotonix® Astaxanthin", image: "https://img.shop.com/Image/210000/214100/214196/products/1841504709.jpg", url: "https://www.shop.com/icanhelpyou/-1841504709-p.xhtml" },
            { id: 504, name: "Awake® Energy Shot", image: "https://img.shop.com/Image/210000/214100/214196/products/960397641.jpg", url: "https://www.shop.com/icanhelpyou/-960397641-p.xhtml" },
            { id: 505, name: "Isotonix® Activated B Complex", image: "https://img.shop.com/Image/210000/214100/214196/products/604981550.jpg", url: "https://www.shop.com/icanhelpyou/-604981550-p.xhtml" },
            { id: 506, name: "Bliss® Anti-Stress Formula", image: "https://img.shop.com/Image/210000/214100/214196/products/1730212093.jpg", url: "https://www.shop.com/icanhelpyou/-1730212093-p.xhtml" },
            { id: 507, name: "Isotonix® Bromelain Plus", image: "https://img.shop.com/Image/210000/214100/214196/products/912160941.jpg", url: "https://www.shop.com/icanhelpyou/-912160941-p.xhtml" },
            { id: 508, name: "Detoxification Kit", image: "https://img.shop.com/Image/210000/214100/214196/products/1852370867.jpg", url: "https://www.shop.com/icanhelpyou/-1852370867-p.xhtml" },
            { id: 509, name: "Isotonix® Calcium Plus", image: "https://img.shop.com/Image/210000/214100/214196/products/561800352.jpg", url: "https://www.shop.com/icanhelpyou/-561800352-p.xhtml" },
            { id: 510, name: "Prime Cognitin", image: "https://img.shop.com/Image/210000/214100/214196/products/559053475.jpg", url: "https://www.shop.com/icanhelpyou/-559053475-p.xhtml" },
            { id: 511, name: "Complete Greens", image: "https://img.shop.com/Image/210000/214100/214196/products/1741625450.jpg", url: "https://www.shop.com/icanhelpyou/-1741625450-p.xhtml" },
            { id: 512, name: "Isotonix® Coenzyme Q10", image: "https://img.shop.com/Image/210000/214100/214196/products/561800361.jpg", url: "https://www.shop.com/icanhelpyou/-561800361-p.xhtml" },
            { id: 513, name: "Curcumin Extreme™", image: "https://img.shop.com/Image/210000/214100/214196/products/1730212096.jpg", url: "https://www.shop.com/icanhelpyou/-1730212096-p.xhtml" },
            { id: 514, name: "Isotonix® Digestive Enzymes with Probiotics", image: "https://img.shop.com/Image/210000/214100/214196/products/1301699648.jpg", url: "https://www.shop.com/icanhelpyou/-1301699648-p.xhtml" },
            { id: 515, name: "DNA Foaming Wash", image: "https://img.shop.com/Image/210000/214100/214196/products/904054725.jpg", url: "https://www.shop.com/icanhelpyou/-904054725-p.xhtml" },
            { id: 516, name: "DNA Miracles Isotonix® Multivitamin Plus", image: "https://img.shop.com/Image/210000/214100/214196/products/1065616462.jpg", url: "https://www.shop.com/icanhelpyou/-1065616462-p.xhtml" },
            { id: 517, name: "DNA Miracles Isotonix OPC-3®", image: "https://img.shop.com/Image/210000/214100/214196/products/1065616465.jpg", url: "https://www.shop.com/icanhelpyou/-1065616465-p.xhtml" },
            { id: 518, name: "DNA Omega3", image: "https://img.shop.com/Image/210000/214100/214196/products/1065616464.jpg", url: "https://www.shop.com/icanhelpyou/-1065616464-p.xhtml" },
            { id: 519, name: "DNA OPC-3", image: "https://img.shop.com/Image/210000/214100/214196/products/1065616465.jpg", url: "https://www.shop.com/icanhelpyou/-1065616465-p.xhtml" },
            { id: 520, name: "DNA Soothing Ointment", image: "https://img.shop.com/Image/210000/214100/214196/products/960258130.jpg", url: "https://www.shop.com/icanhelpyou/-960258130-p.xhtml" },
            { id: 521, name: "Isotonix® Daily Essentials Kit (Without Iron)", image: "https://img.shop.com/Image/210000/214100/214196/products/701199621.jpg", url: "https://www.shop.com/icanhelpyou/-701199621-p.xhtml" },
            { id: 522, name: "Feminine", image: "https://img.shop.com/Image/210000/214100/214196/products/1447829883.jpg", url: "https://www.shop.com/icanhelpyou/-1447829883-p.xhtml" },
            { id: 523, name: "Glucosatrin", image: "https://img.shop.com/Image/210000/214100/214196/products/1730212095.jpg", url: "https://www.shop.com/icanhelpyou/-1730212095-p.xhtml" },
            { id: 524, name: "Heart Health BP", image: "https://img.shop.com/Image/210000/214100/214196/products/1902671917.jpg", url: "https://www.shop.com/icanhelpyou/-1902671917-p.xhtml" },
            { id: 525, name: "Hepatocleanse", image: "https://img.shop.com/Image/210000/214100/214196/products/604981555.jpg", url: "https://www.shop.com/icanhelpyou/-604981555-p.xhtml" },
            { id: 526, name: "Isotonix® Immune", image: "https://img.shop.com/Image/210000/214100/214196/products/893741343.jpg", url: "https://www.shop.com/icanhelpyou/-893741343-p.xhtml" },
            { id: 527, name: "Isotonix Isochrome®", image: "https://img.shop.com/Image/210000/214100/214196/products/561800351.jpg", url: "https://www.shop.com/icanhelpyou/-561800351-p.xhtml" },
            { id: 528, name: "Level 90", image: "https://img.shop.com/Image/210000/214100/214196/products/1730212450.jpg", url: "https://www.shop.com/icanhelpyou/-1730212450-p.xhtml" },
            { id: 529, name: "Core 3 Health", image: "https://img.shop.com/Image/210000/214100/214196/products/1981669486.jpg", url: "https://www.shop.com/icanhelpyou/-1981669486-p.xhtml" },
            { id: 530, name: "L-Tryptophan", image: "https://img.shop.com/Image/210000/214100/214196/products/1570985387.jpg", url: "https://www.shop.com/icanhelpyou/-1570985387-p.xhtml" },
            { id: 531, name: "Lumiere Intensive Hand Cream", image: "https://img.shop.com/Image/210000/214100/214196/products/894127078.jpg", url: "https://www.shop.com/icanhelpyou/-894127078-p.xhtml" },
            { id: 532, name: "Isotonix® Magnesium", image: "https://img.shop.com/Image/210000/214100/214196/products/792868342.jpg", url: "https://www.shop.com/icanhelpyou/-792868342-p.xhtml" },
            { id: 533, name: "Mochatonix", image: "https://img.shop.com/Image/210000/214100/214196/products/1730212091.jpg", url: "https://www.shop.com/icanhelpyou/-1730212091-p.xhtml" },
            { id: 534, name: "MPC® Maximum Prostate Care", image: "https://img.shop.com/Image/210000/214100/214196/products/559049965.jpg", url: "https://www.shop.com/icanhelpyou/-559049965-p.xhtml" },
            { id: 535, name: "Isotonix® Multi-Vitamin Without Iron", image: "https://img.shop.com/Image/210000/214100/214196/products/1604659974.jpg", url: "https://www.shop.com/icanhelpyou/-1604659974-p.xhtml" },
            { id: 536, name: "Isotonix® Multi-Vitamin With Iron", image: "https://img.shop.com/Image/210000/214100/214196/products/561800359.jpg", url: "https://www.shop.com/icanhelpyou/-561800359-p.xhtml" },
            { id: 537, name: "Nutri-Clean", image: "https://img.shop.com/Image/210000/214100/214196/products/604981554.jpg", url: "https://www.shop.com/icanhelpyou/-604981554-p.xhtml" },
            { id: 538, name: "Probiotics 10", image: "https://img.shop.com/Image/210000/214100/214196/products/1730212451.jpg", url: "https://www.shop.com/icanhelpyou/-1730212451-p.xhtml" },
            { id: 539, name: "Omega3", image: "https://img.shop.com/Image/210000/214100/214196/products/561800368.jpg", url: "https://www.shop.com/icanhelpyou/-561800368-p.xhtml" },
            { id: 540, name: "Isotonix OPC-3®", image: "https://img.shop.com/Image/210000/214100/214196/products/561800349.jpg", url: "https://www.shop.com/icanhelpyou/-561800349-p.xhtml" },
            { id: 541, name: "Isotonix® Maximum ORAC Formula", image: "https://img.shop.com/Image/210000/214100/214196/products/604981549.jpg", url: "https://www.shop.com/icanhelpyou/-604981549-p.xhtml" },
            { id: 542, name: "Skintelligence® Hydra Derm Deep Cleansing Emulsion", image: "https://img.shop.com/Image/210000/214100/214196/products/559053510.jpg", url: "https://www.shop.com/icanhelpyou/-559053510-p.xhtml" },
            { id: 543, name: "Oxygen Extreme", image: "https://img.shop.com/Image/210000/214100/214196/products/867821034.jpg", url: "https://www.shop.com/icanhelpyou/-867821034-p.xhtml" },
            { id: 544, name: "Skintelligence® Travel Kit", image: "https://img.shop.com/Image/210000/214100/214196/products/559053512.jpg", url: "https://www.shop.com/icanhelpyou/-559053512-p.xhtml" },
            { id: 545, name: "Prime Sleep", image: "https://img.shop.com/Image/210000/214100/214196/products/1865413574.jpg", url: "https://www.shop.com/icanhelpyou/-1865413574-p.xhtml" },
            { id: 547, name: "Prime™ Joint Support Formula by Isotonix®", image: "https://img.shop.com/Image/210000/214100/214196/products/559053476.jpg", url: "https://www.shop.com/icanhelpyou/-559053476-p.xhtml" },
            { id: 549, name: "Prime Vision", image: "https://img.shop.com/Image/210000/214100/214196/products/701325741.jpg", url: "https://www.shop.com/icanhelpyou/-701325741-p.xhtml" },
            { id: 550, name: "Prime Digestive Support", image: "https://img.shop.com/Image/210000/214100/214196/products/1980086518.jpg", url: "https://www.shop.com/icanhelpyou/-1980086518-p.xhtml" },
            { id: 551, name: "Isotonix® Resveratrol", image: "https://img.shop.com/Image/210000/214100/214196/products/561800350.jpg", url: "https://www.shop.com/icanhelpyou/-561800350-p.xhtml" },
            { id: 552, name: "Skintelligence® Daily Moisture Enhancer", image: "https://img.shop.com/Image/210000/214100/214196/products/559053507.jpg", url: "https://www.shop.com/icanhelpyou/-559053507-p.xhtml" },
            { id: 553, name: "Skintelligence® pH Skin Normalizer", image: "https://img.shop.com/Image/210000/214100/214196/products/559053511.jpg", url: "https://www.shop.com/icanhelpyou/-559053511-p.xhtml" },
            { id: 554, name: "GoTrim® Thermochrome® V6", image: "https://img.shop.com/Image/210000/214100/214196/products/1986892131.jpg", url: "https://www.shop.com/icanhelpyou/-1986892131-p.xhtml" },
            { id: 555, name: "TLS® ACTS Adrenal, Cortisol, Thyroid & Stress Support Formula", image: "https://img.shop.com/Image/210000/214100/214196/products/1986891714.jpg", url: "https://www.shop.com/icanhelpyou/-1986891714-p.xhtml" },
            { id: 556, name: "Tower+™ Pure Whey Protein Isolate + Creatine", image: "https://img.shop.com/Image/210000/214100/214196/products/1980062768.jpg", url: "https://www.shop.com/icanhelpyou/-1980062768-p.xhtml" },
            { id: 557, name: "Tower+™ Electrolyte Mix", image: "https://img.shop.com/Image/210000/214100/214196/products/1986575384.jpg", url: "https://www.shop.com/icanhelpyou/-1986575384-p.xhtml" },
            { id: 558, name: "Isotonix® Daily Essentials Packets", image: "https://img.shop.com/Image/210000/214100/214196/products/935461732.jpg", url: "https://www.shop.com/icanhelpyou/-935461732-p.xhtml" },
            { id: 559, name: "DNA Miracles Isotonix® Multivitamin", image: "https://img.shop.com/Image/210000/214100/214196/products/1065616463.jpg", url: "https://www.shop.com/icanhelpyou/-1065616463-p.xhtml" },
            { id: 561, name: "Ultimate Aloe™", image: "https://img.shop.com/Image/210000/214100/214196/products/603891601.jpg", url: "https://www.shop.com/icanhelpyou/-603891601-p.xhtml" },
            { id: 562, name: "Ultimate Aloe™ Gel", image: "https://img.shop.com/Image/210000/214100/214196/products/559090759.jpg", url: "https://www.shop.com/icanhelpyou/-559090759-p.xhtml" },
            { id: 563, name: "Prime™ Ultra Secretagogue - HGH Enhancer", image: "https://img.shop.com/Image/210000/214100/214196/products/559053470.jpg", url: "https://www.shop.com/icanhelpyou/-559053470-p.xhtml" },
            { id: 564, name: "Isotonix® Vision Formula with Lutein", image: "https://img.shop.com/Image/210000/214100/214196/products/561800346.jpg", url: "https://www.shop.com/icanhelpyou/-561800346-p.xhtml" },
            { id: 565, name: "Prime™ Vision Eye Health Formula", image: "https://img.shop.com/Image/210000/214100/214196/products/701325741.jpg", url: "https://www.shop.com/icanhelpyou/-701325741-p.xhtml" },
            { id: 566, name: "Isotonix® Vitamin C", image: "https://img.shop.com/Image/210000/214100/214196/products/561800360.jpg", url: "https://www.shop.com/icanhelpyou/-561800360-p.xhtml" },
            { id: 567, name: "Isotonix® Vitamin D with K2", image: "https://img.shop.com/Image/210000/214100/214196/products/561800345.jpg", url: "https://www.shop.com/icanhelpyou/-561800345-p.xhtml" },
            { id: 569, name: "Heart Health™ System", image: "https://img.shop.com/Image/210000/214100/214196/products/561800370.jpg", url: "https://www.shop.com/icanhelpyou/-561800370-p.xhtml" },
            { id: 570, name: "Isotonix Essentials® Anti-Aging", image: "https://img.shop.com/Image/210000/214100/214196/products/1570985385.jpg", url: "https://www.shop.com/icanhelpyou/-1570985385-p.xhtml" },

        ];

        let selectedSymptoms = [];
        let recommendedProducts = new Set();

        // Initialize symptom list in a grid layout
        function loadSymptoms() {
            const symptomsGrid = document.getElementById("symptoms-grid");
            symptoms.forEach(symptom => {
                const div = document.createElement("div");
                div.className = "symptom-item";
                div.innerText = symptom.name;
                div.onclick = () => toggleSymptom(symptom.id, div);
                symptomsGrid.appendChild(div);
            });
        }

        // Toggle symptom selection
        function toggleSymptom(symptomId, element) {
            const index = selectedSymptoms.indexOf(symptomId);
            if (index > -1) {
                selectedSymptoms.splice(index, 1);
                element.classList.remove("selected");
                removeProductsFromSymptom(symptomId);
                clearSymptomNotes(symptomId);
                removeDeficiencies(symptomId);
            } else {
                selectedSymptoms.push(symptomId);
                element.classList.add("selected");
                addProductsFromSymptom(symptomId);
                displaySymptomNotes(symptomId);
                addDeficiencies(symptomId);
            }
            updateDeficienciesList();
            updateProductsList();
        }

        // Add products based on selected symptoms
        function addProductsFromSymptom(symptomId) {
            const symptom = symptoms.find(s => s.id === symptomId);
            symptom.products.forEach(productId => {
                recommendedProducts.add(productId);
            });
        }

        // Remove products based on unselected symptoms
        function removeProductsFromSymptom(symptomId) {
            const symptom = symptoms.find(s => s.id === symptomId);
            symptom.products.forEach(productId => {
                recommendedProducts.delete(productId);
            });
        }

        // Add deficiencies based on selected symptoms
        function addDeficiencies(symptomId) {
            const symptom = symptoms.find(s => s.id === symptomId);
            symptom.deficiencies.forEach(deficiency => {
                const li = document.createElement("li");
                li.innerText = deficiency;
                document.getElementById("deficiencies-list").appendChild(li);
            });
        }

        // Remove deficiencies based on unselected symptoms
        function removeDeficiencies(symptomId) {
            const symptom = symptoms.find(s => s.id === symptomId);
            symptom.deficiencies.forEach(deficiency => {
                const listItems = document.querySelectorAll("#deficiencies-list li");
                listItems.forEach(item => {
                    if (item.innerText === deficiency) {
                        item.remove();
                    }
                });
            });
        }

        // Update the deficiencies list dynamically
        function updateDeficienciesList() {
            const deficienciesList = document.getElementById("deficiencies-list");
            deficienciesList.innerHTML = "";

            selectedSymptoms.forEach(symptomId => {
                const symptom = symptoms.find(s => s.id === symptomId);
                symptom.deficiencies.forEach(deficiency => {
                    const li = document.createElement("li");
                    li.innerText = deficiency;
                    deficienciesList.appendChild(li);
                });
            });
        }

        // Update the recommended products list
        function updateProductsList() {
            const productsList = document.getElementById("products-list");
            productsList.innerHTML = "";

            recommendedProducts.forEach(productId => {
                const product = products.find(p => p.id === productId);
                const div = document.createElement("div");
                div.classList.add("product-item");
                div.innerHTML = `
                        <img src="${product.image}" alt="${product.name}">
                        <a href="${product.url}" target="_blank">${product.name}</a>
                        <button onclick="removeProductFromRecommended(${product.id})">Remove</button>
                    `;
                productsList.appendChild(div);
            });
        }

        // Remove a product from the recommended products list
        function removeProductFromRecommended(productId) {
            recommendedProducts.delete(productId);
            updateProductsList();
        }

        // Manage notes for symptoms
        function displaySymptomNotes(symptomId) {
            const symptom = symptoms.find(s => s.id === symptomId);
            const notesList = document.getElementById("notes-list");

            const div = document.createElement("div");
            div.id = `notes-symptom-${symptomId}`;
            div.innerHTML = `
                    <h4>${symptom.name}</h4>
                    <textarea
                        placeholder="Add notes here..."
                        oninput="updateSymptomNotes(${symptomId}, this.value)"
                    >${symptom.notes}</textarea>
                `;
            notesList.appendChild(div);
        }

        function clearSymptomNotes(symptomId) {
            const notesDiv = document.getElementById(`notes-symptom-${symptomId}`);
            if (notesDiv) notesDiv.remove();
        }

        function updateSymptomNotes(symptomId, notes) {
            const symptom = symptoms.find(s => s.id === symptomId);
            symptom.notes = notes;
        }

        // Toggle visibility of the notes section
        function toggleNotesSection() {
            const notesSection = document.getElementById("notes-section");
            if (notesSection.style.display === "none") {
                notesSection.style.display = "block";
            } else {
                notesSection.style.display = "none";
            }
        }

        // Search products
        function searchProducts() {
            const searchQuery = document.getElementById("search-bar").value.toLowerCase();
            const searchResults = document.getElementById("search-results");
            searchResults.innerHTML = "";

            if (searchQuery.trim() === "") return;

            const results = products.filter(product =>
                product.name.toLowerCase().includes(searchQuery)
            );

            results.forEach(product => {
                const div = document.createElement("div");
                div.classList.add("product-item");
                div.innerHTML = `
                        <img src="${product.image}" alt="${product.name}">
                        <a href="${product.url}" target="_blank">${product.name}</a>
                        <button onclick="addToRecommended(${product.id})">Add to Recommended</button>
                    `;
                searchResults.appendChild(div);
            });
        }

        // Add a product to the recommended products list
        function addToRecommended(productId) {
            recommendedProducts.add(productId);
            updateProductsList();
        }

        // Download the recommended products list
        function downloadProductList() {
            const productsArray = Array.from(recommendedProducts).map(id => {
                const product = products.find(p => p.id === id);
                return `${product.name} - ${product.url}`;
            });

            const blob = new Blob([productsArray.join("\n")], { type: "text/plain" });
            const a = document.createElement("a");
            a.href = URL.createObjectURL(blob);
            a.download = "recommended_products.txt";
            a.click();
        }

        // Print the recommended products list
        function printProductList() {
            const productsArray = Array.from(recommendedProducts).map(id => {
                const product = products.find(p => p.id === id);
                return `${product.name} - ${product.url}`;
            });

            const newWindow = window.open("", "_blank");
            newWindow.document.write("<h1>Recommended Products</h1>");
            newWindow.document.write("<ul>");
            productsArray.forEach(product => {
                newWindow.document.write(`<li>${product}</li>`);
            });
            newWindow.document.write("</ul>");
            newWindow.document.write("<button onclick='window.print()'>Print</button>");
        }

        // Initialize the application
        loadSymptoms();
    </script>
</body>
</html>