{"id":1465,"date":"2024-02-20T01:37:28","date_gmt":"2024-02-19T23:37:28","guid":{"rendered":"http:\/\/jhb-webdevelopers\/rsg-fm\/?page_id=1465"},"modified":"2026-02-16T20:52:43","modified_gmt":"2026-02-16T18:52:43","slug":"soek","status":"publish","type":"page","link":"https:\/\/www.rsg.co.za\/rsg-fm\/soek\/","title":{"rendered":"Soek"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"1465\" class=\"elementor elementor-1465\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-6a2ac5c e-con-full e-flex e-con e-parent\" data-id=\"6a2ac5c\" data-element_type=\"container\" data-settings=\"{&quot;jet_parallax_layout_list&quot;:[]}\">\n\t\t<div class=\"elementor-element elementor-element-98f67ec e-con-full e-flex e-con e-child\" data-id=\"98f67ec\" data-element_type=\"container\" data-settings=\"{&quot;jet_parallax_layout_list&quot;:[]}\">\n\t\t<div class=\"elementor-element elementor-element-0169ba3 e-con-full e-flex e-con e-child\" data-id=\"0169ba3\" data-element_type=\"container\" data-settings=\"{&quot;jet_parallax_layout_list&quot;:[]}\">\n\t\t\t\t<div class=\"elementor-element elementor-element-5e68753 elementor-widget elementor-widget-heading\" data-id=\"5e68753\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h3 class=\"elementor-heading-title elementor-size-default\">SOEK<\/h3>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d7aeec8 elementor-hidden-mobile elementor-widget elementor-widget-image\" data-id=\"d7aeec8\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"254\" height=\"85\" src=\"https:\/\/www.rsg.co.za\/rsg-fm\/wp-content\/uploads\/2024\/01\/7-1-1.png\" class=\"attachment-large size-large wp-image-1105\" alt=\"\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a229844 elementor-widget elementor-widget-image\" data-id=\"a229844\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"254\" height=\"186\" src=\"https:\/\/www.rsg.co.za\/rsg-fm\/wp-content\/uploads\/2025\/08\/8-2-1.png\" class=\"attachment-large size-large wp-image-119454\" alt=\"\" srcset=\"https:\/\/www.rsg.co.za\/rsg-fm\/wp-content\/uploads\/2025\/08\/8-2-1.png 254w, https:\/\/www.rsg.co.za\/rsg-fm\/wp-content\/uploads\/2025\/08\/8-2-1-150x110.png 150w\" sizes=\"(max-width: 254px) 100vw, 254px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-754e04d e-con-full e-flex e-con e-parent\" data-id=\"754e04d\" data-element_type=\"container\" data-settings=\"{&quot;jet_parallax_layout_list&quot;:[]}\">\n\t\t<div class=\"elementor-element elementor-element-da358da e-con-full e-flex e-con e-child\" data-id=\"da358da\" data-element_type=\"container\" data-settings=\"{&quot;jet_parallax_layout_list&quot;:[]}\">\n\t\t\t\t<div class=\"elementor-element elementor-element-401d156 elementor-widget elementor-widget-shortcode\" data-id=\"401d156\" data-element_type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\">    <div class=\"global-search-container\">\n        <div class=\"filter-controls\">\n            <!-- Global Search Bar -->\n            <div class=\"filter-group\">\n                <label for=\"global-search\">Soek alles:<\/label>\n                <input type=\"text\" id=\"global-search\" placeholder=\"Soek oor potgooisnitte, RSG NOU artikels, en resepte\" class=\"filter-input\" \/>\n            <\/div>\n\n            <!-- Date Picker Filter -->\n            <div class=\"filter-group\">\n                <label for=\"global-date-picker\">Datum:<\/label>\n                <input type=\"text\" id=\"global-date-picker\" class=\"date-picker-input\" placeholder=\"Kies 'n datum of reeks\" readonly \/>\n            <\/div>\n\n            <!-- Search and Reset Buttons -->\n            <div class=\"global-filter-buttons\">\n                <button type=\"button\" id=\"global-search-btn\" class=\"search-btn\">Soek Alles<\/button>\n                <button type=\"button\" id=\"global-reset-btn\" class=\"reset-btn\">Herstel Alles<\/button>\n            <\/div>\n        <\/div>\n\n        <!-- Advanced Controls: Sort -->\n        <div class=\"filter-advanced-controls\">\n            <!-- Sort Section -->\n            <div class=\"sort-section\">\n                <span>Sorteer volgens:<\/span>\n                <div class=\"sort-links\">\n                    <a href=\"#\" class=\"sort-link active\" data-sort=\"best_match\">mees relevante<\/a>\n                    <span class=\"sort-separator\">|<\/span>\n                    <a href=\"#\" class=\"sort-link\" data-sort=\"newest\">jongste<\/a>\n                    <span class=\"sort-separator\">|<\/span>\n                    <a href=\"#\" class=\"sort-link\" data-sort=\"oldest\">oudste<\/a>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <!-- Loading Spinner -->\n        <div id=\"global-loading\" class=\"loading-spinner\" style=\"display: none;\">\n            <div class=\"spinner\"><\/div>\n            <p>Soek oor alle inhoud...<\/p>\n        <\/div>\n\n                <!-- Results Container with all sections -->\n\t\t<div id=\"global-results\" class=\"global-results\">\n\t\t\t\t<!-- Podcast Clips Section -->\n\t\t\t\t<div class=\"content-section\" id=\"podcast-section\">\n\t\t\t\t\t<h3 class=\"section-title\">Potgooisnitte<\/h3>\n\t\t\t\t\t<div id=\"global-podcast-results\" class=\"clips-results\">\n\t\t\t\t\t\t<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\n\t\t\t\t<!-- RSG Nou Section -->\n\t\t\t\t<div class=\"content-section\" id=\"rsg-nou-section\">\n\t\t\t\t\t<h3 class=\"section-title\">RSG NOU Artikels<\/h3>\n\t\t\t\t\t<div id=\"global-rsg-nou-results\" class=\"rsg-nou-results\">\n\t\t\t\t\t\t<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\n\t\t\t\t<!-- Nuusbulletins Section -->\n\t\t\t\t<div class=\"content-section\" id=\"nuusbulletins-section\">\n\t\t\t\t\t<h3 class=\"section-title\">Nuusbulletins<\/h3>\n\t\t\t\t\t<div id=\"global-nuusbulletins-results\" class=\"nuusbulletins-results\">\n\t\t\t\t\t\t<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\n\t\t\t\t<!-- Recipes Section -->\n\t\t\t\t<div class=\"content-section\" id=\"recipe-section\">\n\t\t\t\t\t<h3 class=\"section-title\">Resepte<\/h3>\n\t\t\t\t\t<div id=\"global-recipe-results\" class=\"recipe-results\">\n\t\t\t\t\t\t<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\n\t\t\t\t<!-- Presenters Section -->\n\t\t\t\t<div class=\"content-section\" id=\"presenters-section\">\n\t\t\t\t\t<h3 class=\"section-title\">Aanbieders<\/h3>\n\t\t\t\t\t<div id=\"global-presenters-results\" class=\"presenters-results\">\n\t\t\t\t\t\t<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\n\t\t\t\t<!-- Shows Section -->\n\t\t\t\t<div class=\"content-section\" id=\"shows-section\">\n\t\t\t\t\t<h3 class=\"section-title\">Programme<\/h3>\n\t\t\t\t\t<div id=\"global-shows-results\" class=\"shows-results\">\n\t\t\t\t\t\t<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\n\t\t\t\t<!-- Competitions Section -->\n\t\t\t\t<div class=\"content-section\" id=\"competitions-section\">\n\t\t\t\t\t<h3 class=\"section-title\">Kompetisies<\/h3>\n\t\t\t\t\t<div id=\"global-competitions-results\" class=\"competitions-results\">\n\t\t\t\t\t\t<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\t\t\t\t<!-- Events Section -->\n\t\t\t\t<div class=\"content-section\" id=\"events-section\">\n\t\t\t\t\t<h3 class=\"section-title\">Wat Gebeur<\/h3>\n\t\t\t\t\t<div id=\"global-events-results\" class=\"events-results\">\n\t\t\t\t\t\t<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t<\/div>\t\n\n            <script type=\"text\/javascript\">\n        jQuery(document).ready(function($) {\n            let searchTimeout;\n            let currentPage = 1;\n            let currentSort = 'best_match';\n\n            \/\/ Initialize Flatpickr calendar\n            \/\/ Initialize Flatpickr with toggle\n\t\t\t\n\t\t\tfunction initDatePicker() {\n\t\t\t\tconst datePicker = document.getElementById('global-date-picker');\n\t\t\t\tif (datePicker && typeof flatpickr !== 'undefined') {\n\t\t\t\t\t\/\/ Check if already initialized with radio buttons\n\t\t\t\t\tif (!datePicker.nextElementSibling || \n\t\t\t\t\t\t!datePicker.nextElementSibling.classList.contains('date-radio-container')) {\n\n\t\t\t\t\t\t\/\/ Create radio button container\n\t\t\t\t\t\tconst radioContainer = document.createElement('div');\n\t\t\t\t\t\tradioContainer.className = 'date-radio-container';\n\t\t\t\t\t\tradioContainer.innerHTML = `\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t`;\n\n\t\t\t\t\t\t\/\/ Insert radio buttons after the date picker\n\t\t\t\t\t\tdatePicker.parentNode.insertBefore(radioContainer, datePicker.nextSibling);\n\n\t\t\t\t\t\t\/\/ Initialize Flatpickr\n\t\t\t\t\t\tconst fp = flatpickr(datePicker, {\n\t\t\t\t\t\t\tmode: \"single\",\n\t\t\t\t\t\t\tdateFormat: \"Y-m-d\",\n\t\t\t\t\t\t\taltInput: true,\n\t\t\t\t\t\t\taltFormat: \"F j, Y\",\n\t\t\t\t\t\t\tmaxDate: new Date(),\n\t\t\t\t\t\t\tlocale: \"af\",\n\t\t\t\t\t\t\tplaceholder: \"Kies net een dag\",\n\t\t\t\t\t\t\tonReady: function(selectedDates, dateStr, instance) {\n\t\t\t\t\t\t\t\tinstance.calendarContainer.classList.add('global-date-picker');\n\t\t\t\t\t\t\t\tupdateDatePlaceholder(instance);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tonChange: function(selectedDates, dateStr, instance) {\n\t\t\t\t\t\t\t\tupdateDatePlaceholder(instance);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\/\/ Store reference\n\t\t\t\t\t\tradioContainer.flatpickrInstance = fp;\n\n\t\t\t\t\t\t\/\/ Set up radio button events\n\t\t\t\t\t\tconst radios = radioContainer.querySelectorAll('.date-mode-radio');\n\t\t\t\t\t\tradios.forEach(radio => {\n\t\t\t\t\t\t\tradio.addEventListener('change', function() {\n\t\t\t\t\t\t\t\tif (this.checked) {\n\t\t\t\t\t\t\t\t\tconst mode = this.value;\n\t\t\t\t\t\t\t\t\tfp.set('mode', mode);\n\t\t\t\t\t\t\t\t\tfp.clear();\n\t\t\t\t\t\t\t\t\tupdateDatePlaceholder(fp);\n\n\t\t\t\t\t\t\t\t\t\/\/ Update placeholder text\n\t\t\t\t\t\t\t\t\tif (mode === 'single') {\n\t\t\t\t\t\t\t\t\t\tfp.altInput.placeholder = \"Kies een dag\";\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tfp.altInput.placeholder = \"Kies verskeie dae\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tfunction updateDatePlaceholder(instance) {\n\t\t\t\t\t\t\tconst selectedDates = instance.selectedDates;\n\n\t\t\t\t\t\t\tif (selectedDates.length === 0) {\n\t\t\t\t\t\t\t\tif (!instance.altInput.placeholder.includes('geselecteerd')) {\n\t\t\t\t\t\t\t\t\tinstance.altInput.placeholder = instance.config.mode === 'single' \n\t\t\t\t\t\t\t\t\t\t? \"Kies een dag\" \n\t\t\t\t\t\t\t\t\t\t: \"Kies verskeie dae\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (instance.config.mode === 'single' && selectedDates.length === 1) {\n\t\t\t\t\t\t\t\tinstance.altInput.placeholder = 'Een dag geselecteerd';\n\t\t\t\t\t\t\t} else if (instance.config.mode === 'range' && selectedDates.length === 1) {\n\t\t\t\t\t\t\t\tinstance.altInput.placeholder = 'Kies einde datum';\n\t\t\t\t\t\t\t} else if (instance.config.mode === 'range' && selectedDates.length === 2) {\n\t\t\t\t\t\t\t\tinstance.altInput.placeholder = 'Verskeie dae geselecteerd';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconsole.warn('Flatpickr not loaded or date picker element not found');\n\t\t\t\t}\n\t\t\t}\n\n            \/\/ Initialize date picker on document ready\n            initDatePicker();\n\n            function searchAllContent(page = 1) {\n                currentPage = page;\n                var searchTerm = $('#global-search').val();\n\n                \/\/ Get date range from the flatpickr instance\n\t\t\t\tvar dateFilter = window.getDateFilterValue('global-date-picker');\n                const datePicker = document.getElementById('global-date-picker');\n                if (datePicker && datePicker._flatpickr) {\n                    const selectedDates = datePicker._flatpickr.selectedDates;\n                    if (selectedDates.length === 1) {\n                        \/\/ Single date selected\n                        dateFilter = datePicker._flatpickr.formatDate(selectedDates[0], 'Y-m-d');\n                    } else if (selectedDates.length === 2) {\n                        \/\/ Date range selected\n                        const startDate = datePicker._flatpickr.formatDate(selectedDates[0], 'Y-m-d');\n                        const endDate = datePicker._flatpickr.formatDate(selectedDates[1], 'Y-m-d');\n                        dateFilter = startDate + ' to ' + endDate;\n                    }\n                }\n\n                \/\/ Show loading\n                $('#global-loading').show();\n\n                \/\/ IMPORTANT: Always show all content sections\n                $('.content-section').show();\n\n                \/\/ Clear previous timeout\n                clearTimeout(searchTimeout);\n\n                \/\/ Set new timeout for debouncing\n                searchTimeout = setTimeout(function() {\n                    \/\/ Array to track AJAX completion\n                    let ajaxRequests = 8; \/\/ Total number of AJAX requests (increased to 8)\n                    let completedRequests = 0;\n\n                    function checkAllRequestsComplete() {\n                        completedRequests++;\n                        if (completedRequests === ajaxRequests) {\n                            $('#global-loading').hide();\n\n                            \/\/ Show advanced controls if this is the first search\n                            $('#global-advanced-controls').addClass('visible');\n\n                            \/\/ Update pagination event handlers for all content types\n                            $('.pagination-page').off('click').on('click', function(e) {\n                                e.preventDefault();\n                                var page = $(this).data('page');\n                                searchAllContent(page);\n                            });\n\n                            \/\/ Re-init image fallbacks\n                            initImageFallbacks();\n\n                            \/\/ Re-init click handlers for all content types\n                            initClickHandlers();\n\n                            \/\/ Ensure all sections remain visible after search\n                            $('.content-section').show();\n                        }\n                    }\n\n                    \/\/ Search podcasts\n                    $.ajax({\n                        url: 'https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php',\n                        type: 'POST',\n                        data: {\n                            action: 'search_podcast_clips',\n                            search: searchTerm,\n                            podcast_id: '',\n                            date_filter: dateFilter,\n                            sort_by: currentSort,\n                            page: page,\n                            nonce: 'ce1a065f90'\n                        },\n                        success: function(response) {\n                            $('#global-podcast-results').html(response);\n                            \/\/ Ensure podcast section stays visible\n                            $('#global-podcast-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        },\n                        error: function() {\n                            $('#global-podcast-results').html('<p class=\"no-results\">Fout met soek potgooisnitte.<\/p>');\n                            $('#global-podcast-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        }\n                    });\n\n                    \/\/ Search RSG Nou\n                    $.ajax({\n                        url: 'https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php',\n                        type: 'POST',\n                        data: {\n                            action: 'search_rsg_nou',\n                            search: searchTerm,\n                            category: '',\n                            date_filter: dateFilter,\n                            sort_by: currentSort,\n                            page: page,\n                            nonce: '60b5946d9f'\n                        },\n                        success: function(response) {\n                            $('#global-rsg-nou-results').html(response);\n                            \/\/ Ensure RSG Nou section stays visible\n                            $('#global-rsg-nou-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        },\n                        error: function() {\n                            $('#global-rsg-nou-results').html('<p class=\"no-results\">Fout met soek RSG NOU artikels.<\/p>');\n                            $('#global-rsg-nou-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        }\n                    });\n\n                    \/\/ Search Nuusbulletins\n                    $.ajax({\n                        url: 'https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php',\n                        type: 'POST',\n                        data: {\n                            action: 'search_nuusbulletins',\n                            search: searchTerm,\n                            date_filter: dateFilter,\n                            sort_by: currentSort,\n                            page: page,\n                            nonce: 'a5d4d1a7fc'\n                        },\n                        success: function(response) {\n                            $('#global-nuusbulletins-results').html(response);\n                            \/\/ Ensure Nuusbulletins section stays visible\n                            $('#global-nuusbulletins-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        },\n                        error: function() {\n                            $('#global-nuusbulletins-results').html('<p class=\"no-results\">Fout met soek nuusbulletins.<\/p>');\n                            $('#global-nuusbulletins-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        }\n                    });\n\n                    \/\/ Search recipes\n                    $.ajax({\n                        url: 'https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php',\n                        type: 'POST',\n                        data: {\n                            action: 'search_recipes',\n                            search: searchTerm,\n                            category: '',\n                            date_filter: dateFilter,\n                            sort_by: currentSort,\n                            page: page,\n                            nonce: '71e9306785'\n                        },\n                        success: function(response) {\n                            $('#global-recipe-results').html(response);\n                            \/\/ Ensure recipe section stays visible\n                            $('#global-recipe-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        },\n                        error: function() {\n                            $('#global-recipe-results').html('<p class=\"no-results\">Fout met soek resepte.<\/p>');\n                            $('#global-recipe-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        }\n                    });\n\n                    \/\/ Search presenters\n                    $.ajax({\n                        url: 'https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php',\n                        type: 'POST',\n                        data: {\n                            action: 'search_presenters',\n                            search: searchTerm,\n                            date_filter: dateFilter,\n                            sort_by: currentSort,\n                            page: page,\n                            nonce: '094e62aa55'\n                        },\n                        success: function(response) {\n                            $('#global-presenters-results').html(response);\n                            \/\/ Ensure presenters section stays visible\n                            $('#global-presenters-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        },\n                        error: function() {\n                            $('#global-presenters-results').html('<p class=\"no-results\">Fout met soek aanbieders.<\/p>');\n                            $('#global-presenters-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        }\n                    });\n\n                    \/\/ Search shows\n                    $.ajax({\n                        url: 'https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php',\n                        type: 'POST',\n                        data: {\n                            action: 'search_shows',\n                            search: searchTerm,\n                            date_filter: dateFilter,\n                            sort_by: currentSort,\n                            page: page,\n                            nonce: '20df099e22'\n                        },\n                        success: function(response) {\n                            $('#global-shows-results').html(response);\n                            \/\/ Ensure shows section stays visible\n                            $('#global-shows-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        },\n                        error: function() {\n                            $('#global-shows-results').html('<p class=\"no-results\">Fout met soek programme.<\/p>');\n                            $('#global-shows-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        }\n                    });\n\n                    \/\/ Search events\n                    $.ajax({\n                        url: 'https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php',\n                        type: 'POST',\n                        data: {\n                            action: 'search_events',\n                            search: searchTerm,\n                            date_filter: dateFilter,\n                            sort_by: currentSort,\n                            page: page,\n                            nonce: '78c62eedef'\n                        },\n                        success: function(response) {\n                            $('#global-events-results').html(response);\n                            \/\/ Ensure events section stays visible\n                            $('#global-events-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        },\n                        error: function() {\n                            $('#global-events-results').html('<p class=\"no-results\">Fout met soek wat gebeur.<\/p>');\n                            $('#global-events-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        }\n                    });\n\n                    \/\/ Search competitions\n                    $.ajax({\n                        url: 'https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php',\n                        type: 'POST',\n                        data: {\n                            action: 'search_competitions',\n                            search: searchTerm,\n                            date_filter: dateFilter,\n                            sort_by: currentSort,\n                            page: page,\n                            nonce: 'e33bcd3221'\n                        },\n                        success: function(response) {\n                            $('#global-competitions-results').html(response);\n                            \/\/ Ensure competitions section stays visible\n                            $('#global-competitions-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        },\n                        error: function() {\n                            $('#global-competitions-results').html('<p class=\"no-results\">Fout met soek kompetisies.<\/p>');\n                            $('#global-competitions-results').closest('.content-section').show();\n                            checkAllRequestsComplete();\n                        }\n                    });\n                }, 300);\n            }\n\n            function initClickHandlers() {\n                \/\/ RSG Nou click handlers\n                $('.rsg-nou-item').off('click').on('click', function() {\n                    var link = $(this).find('.rsg-nou-permalink');\n                    if (link.length) {\n                        window.location.href = link.attr('href');\n                    }\n                });\n\n                \/\/ Recipe click handlers\n                $('.recipe-item').off('click').on('click', function() {\n                    var link = $(this).find('.recipe-permalink');\n                    if (link.length) {\n                        window.location.href = link.attr('href');\n                    }\n                });\n\n                \/\/ Presenters click handlers\n                $('.presenters-item').off('click').on('click', function() {\n                    var link = $(this).find('.presenters-permalink');\n                    if (link.length) {\n                        window.location.href = link.attr('href');\n                    }\n                });\n\n                \/\/ Shows click handlers\n                $('.shows-item').off('click').on('click', function() {\n                    var link = $(this).find('.shows-permalink');\n                    if (link.length) {\n                        window.location.href = link.attr('href');\n                    }\n                });\n\n                \/\/ Events click handlers\n                $('.events-item').off('click').on('click', function() {\n                    var link = $(this).find('.events-permalink');\n                    if (link.length) {\n                        window.location.href = link.attr('href');\n                    }\n                });\n\n                \/\/ Competitions click handlers\n                $('.competitions-item').off('click').on('click', function() {\n                    var link = $(this).find('.competitions-permalink');\n                    if (link.length) {\n                        window.location.href = link.attr('href');\n                    }\n                });\n\n                \/\/ Nuusbulletins click handlers\n                $('.nuusbulletins-item').off('click').on('click', function() {\n                    var link = $(this).find('.nuusbulletins-permalink');\n                    if (link.length) {\n                        window.location.href = link.attr('href');\n                    }\n                });\n\n                \/\/ Social sharing functionality\n                $('.facebook-share').off('click').on('click', function(e) {\n                    e.stopPropagation();\n                    var url = encodeURIComponent(window.location.href);\n                    var title = encodeURIComponent($(this).closest('.clip-item').find('.clip-title').text());\n                    window.open('https:\/\/www.facebook.com\/sharer\/sharer.php?u=' + url + '&t=' + title, 'facebook-share', 'width=600,height=400');\n                });\n\n                $('.whatsapp-share').off('click').on('click', function(e) {\n\t\t\t\t\te.stopPropagation();\n\n\t\t\t\t\t\/\/ Get the permalink from the clip-item\n\t\t\t\t\tvar $clipItem = $(this).closest('.clip-item');\n\t\t\t\t\tvar permalink = $clipItem.find('.clip-title-link').attr('href') || \n\t\t\t\t\t\t\t\t\t$clipItem.find('.clip-permalink').attr('href') || \n\t\t\t\t\t\t\t\t\twindow.location.href;\n\n\t\t\t\t\tvar title = $clipItem.find('.clip-title').text().trim();\n\t\t\t\t\tvar fullUrl = permalink; \/\/ Use the actual permalink\n\n\t\t\t\t\t\/\/ Encode for WhatsApp\n\t\t\t\t\tvar whatsappUrl = 'https:\/\/api.whatsapp.com\/send?text=' + \n\t\t\t\t\t\t\t\t\t encodeURIComponent(title + ' - ') + \n\t\t\t\t\t\t\t\t\t encodeURIComponent(fullUrl);\n\n\t\t\t\t\twindow.open(whatsappUrl, 'whatsapp-share', 'width=600,height=400');\n\t\t\t\t});\n            }\n\n            function resetGlobalFilters() {\n                $('#global-search').val('');\n                currentSort = 'best_match';\n                currentPage = 1;\n\n                \/\/ Reset date picker\n                const datePicker = document.getElementById('global-date-picker');\n                if (datePicker && datePicker._flatpickr) {\n                    datePicker._flatpickr.clear();\n                    datePicker._flatpickr.input.value = ''; \/\/ Clear the input field too\n                } else {\n                    $('#global-date-picker').val(''); \/\/ Fallback\n                }\n\n                \/\/ Hide advanced controls\n                $('#global-advanced-controls').removeClass('visible');\n\n                \/\/ Reset sort links\n                updateSortLinks('best_match');\n\n                \/\/ Clear all results and show \"no results\" messages\n                $('#global-podcast-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n                $('#global-rsg-nou-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n                $('#global-nuusbulletins-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n                $('#global-recipe-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n                $('#global-presenters-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n                $('#global-shows-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n\t\t\t\t$('#global-competitions-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n                $('#global-events-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n                \n\n                \/\/ Show all sections\n                $('.content-section').show();\n            }\n\n            function updateSortLinks(sort) {\n                $('.sort-link').removeClass('active');\n                $(`.sort-link[data-sort=\"${sort}\"]`).addClass('active');\n                currentSort = sort;\n            }\n\n            function initImageFallbacks() {\n                \/\/ Image fallback initialization\n                $('.rsg-nou-thumbnail, .clip-thumbnail, .recipe-thumbnail').on('error', function() {\n                    $(this).closest('.rsg-nou-image, .clip-image, .recipe-image').html('<div class=\"rsg-nou-placeholder\">Geen beeld<\/div>');\n                });\n            }\n\n            \/\/ Event handlers\n            $('#global-search-btn').on('click', function() {\n                currentPage = 1;\n                searchAllContent(1);\n            });\n\n            $('#global-reset-btn').on('click', function() {\n                resetGlobalFilters();\n            });\n\n            $('.sort-link').on('click', function(e) {\n                e.preventDefault();\n                const sort = $(this).data('sort');\n                updateSortLinks(sort);\n                currentPage = 1;\n                if (hasSearched) {\n                    searchAllContent(1);\n                }\n            });\n\n            \/\/ Enter key support for search\n            $('#global-search').on('keypress', function(e) {\n                if (e.which === 13) {\n                    currentPage = 1;\n                    searchAllContent(1);\n                }\n            });\n\n            \/\/ Initialize image fallbacks on load\n            initImageFallbacks();\n            initClickHandlers();\n\n            \/\/ Initialize with empty state messages\n            resetGlobalFilters();\n        });\n        <\/script>\n\n\t\t<script type=\"text\/javascript\">\njQuery(document).ready(function($) {\n    let searchTimeout;\n    let currentPage = 1;\n    let currentSort = 'best_match';\n\n    \/\/ Helper: Get URL parameter\n    function getUrlParameter(name) {\n        name = name.replace(\/[\\[]\/, '\\\\[').replace(\/[\\]]\/, '\\\\]');\n        var regex = new RegExp('[\\\\?&]' + name + '=([^&#]*)');\n        var results = regex.exec(location.search);\n        return results === null ? '' : decodeURIComponent(results[1].replace(\/\\+\/g, ' '));\n    }\n\n    \/\/ Initialize Flatpickr\n    \/\/ Initialize Flatpickr with toggle\n\nfunction initDatePicker() {\n    const datePicker = document.getElementById('global-date-picker');\n    if (datePicker && typeof flatpickr !== 'undefined') {\n        \/\/ Check if already initialized with radio buttons\n        if (!datePicker.nextElementSibling || \n            !datePicker.nextElementSibling.classList.contains('date-radio-container')) {\n            \n            \/\/ Create radio button container\n            const radioContainer = document.createElement('div');\n            radioContainer.className = 'date-radio-container';\n            radioContainer.innerHTML = `\n                <div class=\"date-mode-radios\">\n                    <label class=\"radio-label\">\n                        <input type=\"radio\" name=\"global-date-mode\" value=\"single\" class=\"date-mode-radio\" checked>\n                        <span class=\"radio-text\">Een Dag<\/span>\n                    <\/label>\n                    <label class=\"radio-label\">\n                        <input type=\"radio\" name=\"global-date-mode\" value=\"range\" class=\"date-mode-radio\">\n                        <span class=\"radio-text\">Verskeie dae<\/span>\n                    <\/label>\n                <\/div>\n            `;\n            \n            \/\/ Insert radio buttons after the date picker\n            datePicker.parentNode.insertBefore(radioContainer, datePicker.nextSibling);\n            \n            \/\/ Initialize Flatpickr\n            const fp = flatpickr(datePicker, {\n                mode: \"single\",\n                dateFormat: \"Y-m-d\",\n                altInput: true,\n                altFormat: \"F j, Y\",\n                maxDate: new Date(),\n                locale: \"af\",\n                placeholder: \"Kies een dag\",\n                onReady: function(selectedDates, dateStr, instance) {\n                    instance.calendarContainer.classList.add('global-date-picker');\n                    updateDatePlaceholder(instance);\n                },\n                onChange: function(selectedDates, dateStr, instance) {\n                    updateDatePlaceholder(instance);\n                }\n            });\n            \n            \/\/ Store reference\n            radioContainer.flatpickrInstance = fp;\n            \n            \/\/ Set up radio button events\n            const radios = radioContainer.querySelectorAll('.date-mode-radio');\n            radios.forEach(radio => {\n                radio.addEventListener('change', function() {\n                    if (this.checked) {\n                        const mode = this.value;\n                        fp.set('mode', mode);\n                        fp.clear();\n                        updateDatePlaceholder(fp);\n                        \n                        \/\/ Update placeholder text\n                        if (mode === 'single') {\n                            fp.altInput.placeholder = \"Kies een dag\";\n                        } else {\n                            fp.altInput.placeholder = \"Kies verskeie dae\";\n                        }\n                    }\n                });\n            });\n            \n            function updateDatePlaceholder(instance) {\n                const selectedDates = instance.selectedDates;\n                \n                if (selectedDates.length === 0) {\n                    if (!instance.altInput.placeholder.includes('geselecteerd')) {\n                        instance.altInput.placeholder = instance.config.mode === 'single' \n                            ? \"Kies een dag\" \n                            : \"Kies verskeie dae\";\n                    }\n                } else if (instance.config.mode === 'single' && selectedDates.length === 1) {\n                    instance.altInput.placeholder = 'Een dag geselecteerd';\n                } else if (instance.config.mode === 'range' && selectedDates.length === 1) {\n                    instance.altInput.placeholder = 'Kies einde datum';\n                } else if (instance.config.mode === 'range' && selectedDates.length === 2) {\n                    instance.altInput.placeholder = 'Verskeie dae geselecteerd';\n                }\n            }\n        }\n    } else {\n        console.warn('Flatpickr not loaded or date picker element not found');\n    }\n}\n    \n    initDatePicker();\n\n    \/\/ Main search function\n    function searchAllContent(page = 1) {\n        currentPage = page;\n        var searchTerm = $('#global-search').val().trim();\n\n        var dateFilter = '';\n        const datePicker = document.getElementById('global-date-picker');\n        if (datePicker && datePicker._flatpickr) {\n            const selected = datePicker._flatpickr.selectedDates;\n            if (selected.length === 1) {\n                dateFilter = datePicker._flatpickr.formatDate(selected[0], 'Y-m-d');\n            } else if (selected.length === 2) {\n                const start = datePicker._flatpickr.formatDate(selected[0], 'Y-m-d');\n                const end   = datePicker._flatpickr.formatDate(selected[1], 'Y-m-d');\n                dateFilter = start + ' to ' + end;\n            }\n        }\n\n        \/\/ Show loading\n        $('#global-loading').show();\n        $('.content-section').show();\n\n        clearTimeout(searchTimeout);\n        searchTimeout = setTimeout(function() {\n            let ajaxRequests = 8;\n            let completedRequests = 0;\n\n            function checkAllDone() {\n                completedRequests++;\n                if (completedRequests === ajaxRequests) {\n                    $('#global-loading').hide();\n                    $('#global-advanced-controls').addClass('visible');\n                    \n                    \/\/ Update pagination event handlers\n                    $('.pagination-page').off('click').on('click', function(e) {\n                        e.preventDefault();\n                        searchAllContent($(this).data('page'));\n                    });\n                    \n                    \/\/ Initialize image fallbacks\n                    initImageFallbacks();\n                    \n                    \/\/ Initialize click handlers\n                    initClickHandlers();\n                    \n                    \/\/ Ensure all sections remain visible\n                    $('.content-section').show();\n                }\n            }\n\n            \/\/ Function to handle AJAX errors\n            function handleAjaxError(sectionId, contentType) {\n                $(sectionId).html('<div class=\"no-results\"><p>Fout met soek ' + contentType + '<\/p><\/div>');\n                $(sectionId).closest('.content-section').show();\n                checkAllDone();\n            }\n\n            \/\/ Search Podcast Clips\n            $.post('https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php', {\n                action: 'search_podcast_clips',\n                search: searchTerm,\n                podcast_id: '',\n                date_filter: dateFilter,\n                sort_by: currentSort,\n                page: page,\n                nonce: 'ce1a065f90'\n            }, function(response) {\n                $('#global-podcast-results').html(response);\n                $('#global-podcast-results').closest('.content-section').show();\n                checkAllDone();\n            }).fail(function() {\n                handleAjaxError('#global-podcast-results', 'potgooisnitte');\n            });\n\n            \/\/ Search RSG Nou\n            $.post('https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php', {\n                action: 'search_rsg_nou',\n                search: searchTerm,\n                category: '',\n                date_filter: dateFilter,\n                sort_by: currentSort,\n                page: page,\n                nonce: '60b5946d9f'\n            }, function(response) {\n                $('#global-rsg-nou-results').html(response);\n                $('#global-rsg-nou-results').closest('.content-section').show();\n                checkAllDone();\n            }).fail(function() {\n                handleAjaxError('#global-rsg-nou-results', 'RSG NOU artikels');\n            });\n\n            \/\/ Search Nuusbulletins\n            $.post('https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php', {\n                action: 'search_nuusbulletins',\n                search: searchTerm,\n                date_filter: dateFilter,\n                sort_by: currentSort,\n                page: page,\n                nonce: 'a5d4d1a7fc'\n            }, function(response) {\n                $('#global-nuusbulletins-results').html(response);\n                $('#global-nuusbulletins-results').closest('.content-section').show();\n                checkAllDone();\n            }).fail(function() {\n                handleAjaxError('#global-nuusbulletins-results', 'nuusbulletins');\n            });\n\n            \/\/ Search Recipes\n            $.post('https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php', {\n                action: 'search_recipes',\n                search: searchTerm,\n                category: '',\n                date_filter: dateFilter,\n                sort_by: currentSort,\n                page: page,\n                nonce: '71e9306785'\n            }, function(response) {\n                $('#global-recipe-results').html(response);\n                $('#global-recipe-results').closest('.content-section').show();\n                checkAllDone();\n            }).fail(function() {\n                handleAjaxError('#global-recipe-results', 'resepte');\n            });\n\n            \/\/ Search Presenters\n            $.post('https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php', {\n                action: 'search_presenters',\n                search: searchTerm,\n                date_filter: dateFilter,\n                sort_by: currentSort,\n                page: page,\n                nonce: '094e62aa55'\n            }, function(response) {\n                $('#global-presenters-results').html(response);\n                $('#global-presenters-results').closest('.content-section').show();\n                checkAllDone();\n            }).fail(function() {\n                handleAjaxError('#global-presenters-results', 'aanbieders');\n            });\n\n            \/\/ Search Shows\n            $.post('https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php', {\n                action: 'search_shows',\n                search: searchTerm,\n                date_filter: dateFilter,\n                sort_by: currentSort,\n                page: page,\n                nonce: '20df099e22'\n            }, function(response) {\n                $('#global-shows-results').html(response);\n                $('#global-shows-results').closest('.content-section').show();\n                checkAllDone();\n            }).fail(function() {\n                handleAjaxError('#global-shows-results', 'programme');\n            });\n\n            \/\/ Search Events\n            $.post('https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php', {\n                action: 'search_events',\n                search: searchTerm,\n                date_filter: dateFilter,\n                sort_by: currentSort,\n                page: page,\n                nonce: '78c62eedef'\n            }, function(response) {\n                $('#global-events-results').html(response);\n                $('#global-events-results').closest('.content-section').show();\n                checkAllDone();\n            }).fail(function() {\n                handleAjaxError('#global-events-results', 'wat gebeur');\n            });\n\n            \/\/ Search Competitions\n            $.post('https:\/\/www.rsg.co.za\/rsg-fm\/wp-admin\/admin-ajax.php', {\n                action: 'search_competitions',\n                search: searchTerm,\n                date_filter: dateFilter,\n                sort_by: currentSort,\n                page: page,\n                nonce: 'e33bcd3221'\n            }, function(response) {\n                $('#global-competitions-results').html(response);\n                $('#global-competitions-results').closest('.content-section').show();\n                checkAllDone();\n            }).fail(function() {\n                handleAjaxError('#global-competitions-results', 'kompetisies');\n            });\n        }, 300);\n    }\n\n    \/\/ Reusable handlers\n    function initClickHandlers() {\n        \/\/ RSG Nou click handler\n        $('#global-rsg-nou-results').off('click', '.rsg-nou-item').on('click', '.rsg-nou-item', function() {\n            var link = $(this).find('a[href]').first();\n            if (link.length) window.location.href = link.attr('href');\n        });\n\n        \/\/ Recipe click handler\n        $('#global-recipe-results').off('click', '.recipe-item').on('click', '.recipe-item', function() {\n            var link = $(this).find('a[href]').first();\n            if (link.length) window.location.href = link.attr('href');\n        });\n\n        \/\/ Presenters click handler\n        $('#global-presenters-results').off('click', '.presenters-item').on('click', '.presenters-item', function() {\n            var link = $(this).find('a[href]').first();\n            if (link.length) window.location.href = link.attr('href');\n        });\n\n        \/\/ Shows click handler\n        $('#global-shows-results').off('click', '.shows-item').on('click', '.shows-item', function() {\n            var link = $(this).find('a[href]').first();\n            if (link.length) window.location.href = link.attr('href');\n        });\n\n        \/\/ Events click handler\n        $('#global-events-results').off('click', '.events-item').on('click', '.events-item', function() {\n            var link = $(this).find('a[href]').first();\n            if (link.length) window.location.href = link.attr('href');\n        });\n\n        \/\/ Competitions click handler\n        $('#global-competitions-results').off('click', '.competitions-item').on('click', '.competitions-item', function() {\n            var link = $(this).find('a[href]').first();\n            if (link.length) window.location.href = link.attr('href');\n        });\n\n        \/\/ Nuusbulletins click handler\n        $('#global-nuusbulletins-results').off('click', '.nuusbulletins-item').on('click', '.nuusbulletins-item', function() {\n            var link = $(this).find('a[href]').first();\n            if (link.length) window.location.href = link.attr('href');\n        });\n\n        \/\/ Podcast clips social sharing\n        $('#global-podcast-results').off('click', '.facebook-share').on('click', '.facebook-share', function(e) {\n            e.stopPropagation();\n            var url = encodeURIComponent(window.location.href);\n            var title = encodeURIComponent($(this).closest('.clip-item').find('.clip-title').text());\n            window.open('https:\/\/www.facebook.com\/sharer\/sharer.php?u=' + url + '&t=' + title, 'facebook-share', 'width=600,height=400');\n        });\n\n        $('#global-podcast-results').off('click', '.whatsapp-share').on('click', '.whatsapp-share', function(e) {\n\t\t\te.stopPropagation();\n\t\t\tvar $clipItem = $(this).closest('.clip-item');\n\t\t\tvar permalink = $clipItem.find('.clip-title-link').attr('href') || \n\t\t\t\t\t\t\twindow.location.href;\n\t\t\tvar title = $clipItem.find('.clip-title').text().trim();\n\n\t\t\twindow.open('https:\/\/api.whatsapp.com\/send?text=' + \n\t\t\t\t\t\tencodeURIComponent(title + ' - ') + \n\t\t\t\t\t\tencodeURIComponent(permalink), \n\t\t\t\t\t\t'whatsapp-share', 'width=600,height=400');\n\t\t});\n\n        \/\/ Recipe social sharing\n        $('#global-recipe-results').off('click', '.facebook-share').on('click', '.facebook-share', function(e) {\n            e.stopPropagation();\n            var url = encodeURIComponent(window.location.href);\n            var title = encodeURIComponent($(this).closest('.recipe-item').find('.recipe-title').text());\n            window.open('https:\/\/www.facebook.com\/sharer\/sharer.php?u=' + url + '&t=' + title, 'facebook-share', 'width=600,height=400');\n        });\n\n        $('#global-recipe-results').off('click', '.twitter-share').on('click', '.twitter-share', function(e) {\n            e.stopPropagation();\n            var url = encodeURIComponent(window.location.href);\n            var title = encodeURIComponent($(this).closest('.recipe-item').find('.recipe-title').text());\n            window.open('https:\/\/twitter.com\/intent\/tweet?text=' + title + '&url=' + url, 'twitter-share', 'width=600,height=400');\n        });\n\n        $('#global-recipe-results').off('click', '.whatsapp-share').on('click', '.whatsapp-share', function(e) {\n            e.stopPropagation();\n            var url = encodeURIComponent(window.location.href);\n            var title = encodeURIComponent($(this).closest('.recipe-item').find('.recipe-title').text());\n            window.open('https:\/\/api.whatsapp.com\/send?text=' + title + ' ' + url, 'whatsapp-share', 'width=600,height=400');\n        });\n    }\n\n    \/\/ Image fallback handler\n    function initImageFallbacks() {\n        const fallbackImage = 'https:\/\/www.rsg.co.za\/rsg-fm\/wp-content\/uploads\/rsg-advanced-search-fallback\/fallback-image.jpg';\n        \n        \/\/ Handle existing images\n        $('.clip-image img, .rsg-nou-image img, .recipe-image img, .podcast-image img').each(function() {\n            const $img = $(this);\n            \n            \/\/ Check if image is already broken\n            if ($img[0].complete && $img[0].naturalHeight === 0) {\n                $img.attr('src', fallbackImage);\n                $img.css('object-fit', 'contain');\n                $img.closest('.clip-image, .rsg-nou-image, .recipe-image, .podcast-image').addClass('has-fallback');\n            }\n            \n            \/\/ Add error handler\n            $img.off('error').on('error', function() {\n                $(this).attr('src', fallbackImage);\n                $(this).css('object-fit', 'contain');\n                $(this).closest('.clip-image, .rsg-nou-image, .recipe-image, .podcast-image').addClass('has-fallback');\n            });\n        });\n    }\n\n    \/\/ Reset all filters\n    function resetGlobalFilters() {\n        $('#global-search').val('');\n        currentSort = 'best_match';\n        currentPage = 1;\n        \n        \/\/ Reset date picker\n        const datePicker = document.getElementById('global-date-picker');\n        if (datePicker && datePicker._flatpickr) {\n            datePicker._flatpickr.clear();\n        } else {\n            $('#global-date-picker').val('');\n        }\n        \n        \/\/ Hide advanced controls\n        $('#global-advanced-controls').removeClass('visible');\n        \n        \/\/ Reset sort links\n        updateSortLinks('best_match');\n        \n        \/\/ Clear all results and show initial messages\n        $('#global-podcast-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n        $('#global-rsg-nou-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n        $('#global-nuusbulletins-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n        $('#global-recipe-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n        $('#global-presenters-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n        $('#global-shows-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n        $('#global-competitions-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n        $('#global-events-results').html('<p class=\"no-results\">Gebruik die soekbalk bo om inhoud te soek.<\/p>');\n        \n        \/\/ Show all sections\n        $('.content-section').show();\n    }\n\n    \/\/ Update sort links\n    function updateSortLinks(sort) {\n        $('.sort-link').removeClass('active');\n        $(`.sort-link[data-sort=\"${sort}\"]`).addClass('active');\n        currentSort = sort;\n    }\n\n    \/\/ Check for URL parameters and apply them\n    function checkUrlParameters() {\n        const urlSearchTerm = getUrlParameter('sleutelwoord');\n        const urlDateRange  = getUrlParameter('daterange');\n        const urlSort       = getUrlParameter('sort');\n        \n        if (urlSearchTerm || urlDateRange || urlSort) {\n            \/\/ Apply search term\n            if (urlSearchTerm) {\n                $('#global-search').val(urlSearchTerm);\n            }\n            \n            \/\/ Apply date range\n            if (urlDateRange && document.getElementById('global-date-picker')._flatpickr) {\n                const fp = document.getElementById('global-date-picker')._flatpickr;\n                const parts = urlDateRange.split(' to ');\n                if (parts.length === 2) {\n                    fp.setDate([parts[0], parts[1]], true);\n                }\n            }\n            \n            \/\/ Apply sorting\n            if (urlSort) {\n                currentSort = urlSort;\n                updateSortLinks(urlSort);\n            }\n            \n            \/\/ Perform search\n            currentPage = 1;\n            hasSearched = true;\n            searchAllContent(1);\n            \n            \/\/ Show advanced controls\n            $('#global-advanced-controls').addClass('visible');\n            \n            \/\/ Scroll to results\n            $('html, body').animate({ \n                scrollTop: $('#global-results').offset().top - 100 \n            }, 500);\n            \n            return true;\n        }\n        return false;\n    }\n\n    \/\/ Initialize everything\n    function initGlobalSearch() {\n        \/\/ Check URL parameters first\n        const hasUrlParams = checkUrlParameters();\n        \n        \/\/ If no URL parameters, set initial state\n        if (!hasUrlParams) {\n            resetGlobalFilters();\n        }\n        \n        \/\/ Initialize image fallbacks\n        initImageFallbacks();\n        \n        \/\/ Initialize click handlers\n        initClickHandlers();\n        \n        \/\/ Event Listeners\n        $('#global-search-btn').off('click').on('click', function() {\n            currentPage = 1;\n            searchAllContent(1);\n        });\n\n        $('#global-reset-btn').off('click').on('click', resetGlobalFilters);\n\n        $('#global-search').off('keypress').on('keypress', function(e) {\n            if (e.which === 13) {\n                currentPage = 1;\n                searchAllContent(1);\n            }\n        });\n\n        $('.sort-link').off('click').on('click', function(e) {\n            e.preventDefault();\n            const sort = $(this).data('sort');\n            updateSortLinks(sort);\n            currentPage = 1;\n            if (hasSearched) {\n                searchAllContent(1);\n            }\n        });\n    }\n\n    \/\/ Initialize on document ready\n    initGlobalSearch();\n});\n<\/script>\n    <\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>SOEK<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"elementor_theme","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-1465","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.rsg.co.za\/rsg-fm\/wp-json\/wp\/v2\/pages\/1465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rsg.co.za\/rsg-fm\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.rsg.co.za\/rsg-fm\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.rsg.co.za\/rsg-fm\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rsg.co.za\/rsg-fm\/wp-json\/wp\/v2\/comments?post=1465"}],"version-history":[{"count":360,"href":"https:\/\/www.rsg.co.za\/rsg-fm\/wp-json\/wp\/v2\/pages\/1465\/revisions"}],"predecessor-version":[{"id":134348,"href":"https:\/\/www.rsg.co.za\/rsg-fm\/wp-json\/wp\/v2\/pages\/1465\/revisions\/134348"}],"wp:attachment":[{"href":"https:\/\/www.rsg.co.za\/rsg-fm\/wp-json\/wp\/v2\/media?parent=1465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}