};function runPageScript(){ document.addEventListener("DOMContentLoaded", function() { let attempts = 0; const maxAttempts = 10; const interval = setInterval(() => { const menu = document.querySelector('ul.head-menu'); if (menu && !menu.classList.contains('customized')) { menu.classList.add('customized'); const links = [ { name: "Home", url: "https://mktrealestateadvisors.com/" }, { name: "Buyers", url: "https://mktrealestateadvisors.com/buyers/" }, { name: "Sellers", url: "https://mktrealestateadvisors.com/sellers/" }, { name: "Search", url: "/search" }, { name: "About", url: "https://mktrealestateadvisors.com/about/" }, { name: "Contact", url: "https://mktrealestateadvisors.com/contact/" }, ]; // Add CSS styles once if (!document.querySelector('#custom-menu-style')) { const style = document.createElement('style'); style.id = 'custom-menu-style'; style.textContent = ` ul.head-menu li { display: inline-block; opacity: 0; transition: opacity 0.5s ease; } ul.head-menu li a { padding: 0 10px; color: #fff; text-decoration: none; font-weight: bold; font-size: 1.1em; position: relative; } ul.head-menu li a::after { content: ''; display: block; width: 0; height: 2px; background: #7FA0AC; transition: width 0.3s; position: absolute; bottom: -4px; left: 0; } ul.head-menu li a:hover::after { width: 100%; } `; document.head.appendChild(style); } // Clear and rebuild menu menu.innerHTML = ''; links.forEach(link => { const li = document.createElement('li'); const a = document.createElement('a'); a.href = link.url; a.textContent = link.name; a.target = link.url.startsWith('http') ? "_blank" : "_self"; li.appendChild(a); menu.appendChild(li); setTimeout(() => { li.style.opacity = '1'; }, 100); }); } attempts++; if (attempts >= maxAttempts) { clearInterval(interval); } }, 1000); // runs every 1 second, max 10 times }); };