document.addEventListener('DOMContentLoaded', function() { function adjustHeaderSpacer() { const header = document.querySelector('.fixed-header-container'); const spacer = document.querySelector('.header-spacer'); const stickyContainer = document.querySelector('.sticky-container'); if (header && spacer && stickyContainer) { const headerHeight = header.offsetHeight; const stickyHeight = stickyContainer.offsetHeight; const totalOffset = headerHeight + stickyHeight + 20; document.documentElement.style.setProperty('--header-height', headerHeight + 'px'); document.documentElement.style.setProperty('--sticky-height', stickyHeight + 'px'); document.documentElement.style.setProperty('--total-offset', totalOffset + 'px'); document.querySelectorAll('#vps, #resel, #host, #domains, #shop').forEach(section => { section.style.scrollMarginTop = totalOffset + 'px'; }); spacer.style.height = headerHeight + 'px'; stickyContainer.style.top = headerHeight + 'px'; } } adjustHeaderSpacer(); window.addEventListener('resize', adjustHeaderSpacer); const baseUrl = window.location.origin; const desktopProfileBtn = document.getElementById('desktopProfileBtn'); const desktopProfileDropdown = document.getElementById('desktopProfileDropdown'); if (desktopProfileBtn && desktopProfileDropdown) { desktopProfileBtn.addEventListener('click', function(e) { e.stopPropagation(); desktopProfileDropdown.classList.toggle('show'); }); document.addEventListener('click', function(e) { if (!desktopProfileDropdown.contains(e.target) && !desktopProfileBtn.contains(e.target)) { desktopProfileDropdown.classList.remove('show'); } }); } const profileBtn = document.getElementById('profileBtn'); const profileDropdown = document.getElementById('profileDropdown'); if (profileBtn && profileDropdown) { profileBtn.addEventListener('click', function(e) { e.stopPropagation(); profileDropdown.classList.toggle('show'); }); document.addEventListener('click', function(e) { if (!profileDropdown.contains(e.target) && !profileBtn.contains(e.target)) { profileDropdown.classList.remove('show'); } }); } const domainTariffs = [ { id: '1', ext: 'click', regPrice: '2.08', renewPrice: '22.26' },{ id: '4', ext: 'digital', regPrice: '2.08', renewPrice: '63.76' },{ id: '3', ext: 'world', regPrice: '3.13', renewPrice: '63.76' },{ id: '15', ext: 'today', regPrice: '3.13', renewPrice: '44.10' },{ id: '5', ext: 'work', regPrice: '3.70', renewPrice: '17.89' },{ id: '6', ext: 'ink', regPrice: '3.70', renewPrice: '44.10' },{ id: '7', ext: 'wiki', regPrice: '3.70', renewPrice: '44.10' },{ id: '8', ext: 'fit', regPrice: '3.70', renewPrice: '52.84' },{ id: '9', ext: 'xyz', regPrice: '4.12', renewPrice: '24.44' },{ id: '10', ext: 'mom', regPrice: '4.12', renewPrice: '55.02' },{ id: '11', ext: 'lol', regPrice: '4.12', renewPrice: '48.47' },{ id: '12', ext: 'pics', regPrice: '4.12', renewPrice: '48.47' },{ id: '13', ext: 'skin', regPrice: '4.12', renewPrice: '24.44' },{ id: '14', ext: 'best', regPrice: '4.18', renewPrice: '33.18' },{ id: '16', ext: 'guru', regPrice: '4.18', renewPrice: '63.76' },{ id: '17', ext: 'rest', regPrice: '4.18', renewPrice: '55.02' },{ id: '18', ext: 'live', regPrice: '4.18', renewPrice: '50.65' },{ id: '22', ext: 'info', regPrice: '4.18', renewPrice: '41.92' },{ id: '44', ext: 'company', regPrice: '4.18', renewPrice: '27.72' },{ id: '47', ext: 'agency', regPrice: '4.18', renewPrice: '46.28' },{ id: '48', ext: 'cards', regPrice: '4.18', renewPrice: '59.39' },{ id: '19', ext: 'art', regPrice: '4.79', renewPrice: '44.10' },{ id: '20', ext: 'pro', regPrice: '5.23', renewPrice: '41.92' },{ id: '21', ext: 'run', regPrice: '5.23', renewPrice: '39.73' },{ id: '43', ext: 'wtf', regPrice: '5.23', renewPrice: '55.02' },{ id: '23', ext: 'shop', regPrice: '6.28', renewPrice: '83.98' },{ id: '24', ext: 'help', regPrice: '6.28', renewPrice: '55.02' },{ id: '25', ext: 'bar', regPrice: '6.28', renewPrice: '109.62' },{ id: '26', ext: 'email', regPrice: '6.28', renewPrice: '46.28' },{ id: '38', ext: 'team', regPrice: '6.28', renewPrice: '57.20' },{ id: '54', ext: 'sale', regPrice: '6.28', renewPrice: '59.39' },{ id: '67', ext: 'dog', regPrice: '6.28', renewPrice: '96.52' },{ id: '27', ext: 'store', regPrice: '6.30', renewPrice: '87.78' },{ id: '28', ext: 'space', regPrice: '6.30', renewPrice: '44.10' },{ id: '29', ext: 'online', regPrice: '6.30', renewPrice: '55.02' },{ id: '30', ext: 'website', regPrice: '6.30', renewPrice: '44.10' },{ id: '31', ext: 'blog', regPrice: '6.97', renewPrice: '42.00' },{ id: '32', ext: 'mobi', regPrice: '7.33', renewPrice: '65.94' },{ id: '33', ext: 'site', regPrice: '7.35', renewPrice: '55.02' },{ id: '34', ext: 'us', regPrice: '7.64', renewPrice: '14.18' },{ id: '35', ext: 'vip', regPrice: '8.06', renewPrice: '28.81' },{ id: '36', ext: 'club', regPrice: '8.06', renewPrice: '28.81' },{ id: '37', ext: 'golf', regPrice: '8.38', renewPrice: '98.70' },{ id: '39', ext: 'rip', regPrice: '8.38', renewPrice: '35.36' },{ id: '40', ext: 'media', regPrice: '8.38', renewPrice: '70.31' },{ id: '42', ext: 'network', regPrice: '8.38', renewPrice: '52.84' },{ id: '45', ext: 'camp', regPrice: '8.38', renewPrice: '89.96' },{ id: '46', ext: 'directory', regPrice: '8.38', renewPrice: '39.73' },{ id: '50', ext: 'city', regPrice: '8.38', renewPrice: '39.73' },{ id: '74', ext: 'works', regPrice: '8.38', renewPrice: '59.39' },{ id: '79', ext: 'center', regPrice: '8.38', renewPrice: '48.47' },{ id: '199', ext: 'cafe', regPrice: '8.38', renewPrice: '70.31' },{ id: '51', ext: 'fun', regPrice: '8.40', renewPrice: '55.02' },{ id: '52', ext: 'de', regPrice: '8.65', renewPrice: '8.65' },{ id: '53', ext: 'gifts', regPrice: '10.48', renewPrice: '55.02' },{ id: '55', ext: 'press', regPrice: '10.48', renewPrice: '129.28' },{ id: '56', ext: 'bio', regPrice: '10.48', renewPrice: '115.08' },{ id: '57', ext: 'wine', regPrice: '10.48', renewPrice: '89.96' },{ id: '58', ext: 'host', regPrice: '10.48', renewPrice: '164.22' },{ id: '59', ext: 'legal', regPrice: '10.48', renewPrice: '107.44' },{ id: '60', ext: 'ltd', regPrice: '10.48', renewPrice: '46.28' },{ id: '61', ext: 'love', regPrice: '10.48', renewPrice: '48.47' },{ id: '63', ext: 'gold', regPrice: '10.48', renewPrice: '164.22' },{ id: '64', ext: 'cheap', regPrice: '10.48', renewPrice: '55.02' },{ id: '65', ext: 'cool', regPrice: '10.48', renewPrice: '59.39' },{ id: '66', ext: 'fitness', regPrice: '10.48', renewPrice: '61.57' },{ id: '68', ext: 'chat', regPrice: '10.48', renewPrice: '59.39' },{ id: '69', ext: 'kim', regPrice: '10.48', renewPrice: '33.18' },{ id: '77', ext: 'app', regPrice: '10.48', renewPrice: '29.38' },{ id: '78', ext: 'dev', regPrice: '10.48', renewPrice: '25.18' },{ id: '88', ext: 'capital', regPrice: '10.48', renewPrice: '107.44' },{ id: '106', ext: 'news', regPrice: '10.48', renewPrice: '50.65' },{ id: '138', ext: 'zip', regPrice: '10.48', renewPrice: '22.26' },{ id: '140', ext: 'mov', regPrice: '10.48', renewPrice: '22.26' },{ id: '141', ext: 'foo', regPrice: '10.48', renewPrice: '22.26' },{ id: '226', ext: 'town', regPrice: '10.48', renewPrice: '57.20' },{ id: '227', ext: 'solar', regPrice: '10.48', renewPrice: '96.52' },{ id: '70', ext: 'fyi', regPrice: '11.34', renewPrice: '11.34' },{ id: '71', ext: 'biz', regPrice: '11.34', renewPrice: '35.36' },{ id: '72', ext: 'taxi', regPrice: '11.53', renewPrice: '98.70' },{ id: '73', ext: 'group', regPrice: '11.53', renewPrice: '39.73' },{ id: '75', ext: 'uk', regPrice: '11.91', renewPrice: '11.91' },{ id: '76', ext: 'in', regPrice: '12.26', renewPrice: '27.26' },{ id: '41', ext: 'support', regPrice: '12.58', renewPrice: '41.92' },{ id: '80', ext: 'vin', regPrice: '12.58', renewPrice: '89.96' },{ id: '81', ext: 'social', regPrice: '12.58', renewPrice: '59.39' },{ id: '82', ext: 'codes', regPrice: '12.58', renewPrice: '100.88' },{ id: '83', ext: 'pet', regPrice: '12.58', renewPrice: '38.64' },{ id: '84', ext: 'green', regPrice: '12.58', renewPrice: '124.91' },{ id: '86', ext: 'credit', regPrice: '12.58', renewPrice: '164.22' },{ id: '87', ext: 'fan', regPrice: '12.58', renewPrice: '83.41' },{ id: '96', ext: 'cash', regPrice: '12.58', renewPrice: '55.02' },{ id: '90', ext: 'casa', regPrice: '13.52', renewPrice: '13.52' },{ id: '89', ext: 'singles', regPrice: '13.63', renewPrice: '50.65' },{ id: '151', ext: 'style', regPrice: '13.63', renewPrice: '59.39' },{ id: '114', ext: 'farm', regPrice: '14.68', renewPrice: '59.39' },{ id: '108', ext: 'cam', regPrice: '15.71', renewPrice: '31.00' },{ id: '91', ext: 'fail', regPrice: '15.73', renewPrice: '55.02' },{ id: '92', ext: 'red', regPrice: '15.73', renewPrice: '35.36' },{ id: '93', ext: 'poker', regPrice: '15.73', renewPrice: '100.88' },{ id: '94', ext: 'bike', regPrice: '15.73', renewPrice: '59.39' },{ id: '95', ext: 'pink', regPrice: '15.73', renewPrice: '38.64' },{ id: '97', ext: 'money', regPrice: '15.73', renewPrice: '59.39' },{ id: '98', ext: 'tax', regPrice: '15.73', renewPrice: '107.44' },{ id: '99', ext: 'salon', regPrice: '15.73', renewPrice: '96.52' },{ id: '100', ext: 'plus', regPrice: '15.73', renewPrice: '70.31' },{ id: '101', ext: 'tips', regPrice: '15.73', renewPrice: '46.28' },{ id: '102', ext: 'bet', regPrice: '15.73', renewPrice: '39.73' },{ id: '103', ext: 'bingo', regPrice: '15.73', renewPrice: '89.96' },{ id: '104', ext: 'video', regPrice: '15.73', renewPrice: '55.02' },{ id: '105', ext: 'doctor', regPrice: '15.73', renewPrice: '175.14' },{ id: '107', ext: 'zone', regPrice: '15.73', renewPrice: '59.39' },{ id: '109', ext: 'fund', regPrice: '16.78', renewPrice: '107.44' },{ id: '121', ext: 'finance', regPrice: '16.78', renewPrice: '98.70' },{ id: '110', ext: 'fans', regPrice: '17.89', renewPrice: '17.89' },{ id: '49', ext: 'casino', regPrice: '18.88', renewPrice: '258.13' },{ id: '111', ext: 'show', regPrice: '18.88', renewPrice: '65.94' },{ id: '228', ext: 'dance', regPrice: '18.88', renewPrice: '41.92' },{ id: '112', ext: 'ceo', regPrice: '19.38', renewPrice: '168.59' },{ id: '113', ext: 'cc', regPrice: '19.61', renewPrice: '65.48' },{ id: '115', ext: 'army', regPrice: '20.98', renewPrice: '59.39' },{ id: '116', ext: 'promo', regPrice: '20.98', renewPrice: '37.55' },{ id: '122', ext: 'toys', regPrice: '20.98', renewPrice: '98.70' },{ id: '123', ext: 'fish', regPrice: '20.98', renewPrice: '65.94' },{ id: '124', ext: 'domains', regPrice: '20.98', renewPrice: '65.94' },{ id: '125', ext: 'cab', regPrice: '20.98', renewPrice: '50.65' },{ id: '126', ext: 'theater', regPrice: '20.98', renewPrice: '96.52' },{ id: '127', ext: 'pizza', regPrice: '20.98', renewPrice: '98.70' },{ id: '128', ext: 'mba', regPrice: '20.98', renewPrice: '59.39' },{ id: '129', ext: 'soccer', regPrice: '20.98', renewPrice: '37.55' },{ id: '130', ext: 'land', regPrice: '20.98', renewPrice: '61.57' },{ id: '131', ext: 'haus', regPrice: '20.98', renewPrice: '50.65' },{ id: '132', ext: 'limo', regPrice: '20.98', renewPrice: '83.41' },{ id: '133', ext: 'voto', regPrice: '20.98', renewPrice: '118.36' },{ id: '153', ext: 'games', regPrice: '20.98', renewPrice: '50.65' },{ id: '134', ext: 'co', regPrice: '21.82', renewPrice: '56.76' },{ id: '135', ext: 'com', regPrice: '22.03', renewPrice: '21.32' },{ id: '143', ext: 'org', regPrice: '22.09', renewPrice: '22.09' },{ id: '85', ext: 'dad', regPrice: '22.26', renewPrice: '22.26' },{ id: '136', ext: 'day', regPrice: '22.26', renewPrice: '22.26' },{ id: '137', ext: 'page', regPrice: '22.26', renewPrice: '22.26' },{ id: '139', ext: 'rsvp', regPrice: '22.26', renewPrice: '22.26' },{ id: '142', ext: 'boo', regPrice: '22.26', renewPrice: '22.26' },{ id: '144', ext: 'studio', regPrice: '23.08', renewPrice: '68.12' },{ id: '145', ext: 'blue', regPrice: '23.08', renewPrice: '37.55' },{ id: '146', ext: 'contact', regPrice: '24.44', renewPrice: '24.44' },{ id: '147', ext: 'net', regPrice: '25.45', renewPrice: '25.45' },{ id: '148', ext: 'archi', regPrice: '26.23', renewPrice: '157.67' },{ id: '149', ext: 'desi', regPrice: '26.63', renewPrice: '26.63' },{ id: '150', ext: 'luxe', regPrice: '26.63', renewPrice: '26.63' },{ id: '152', ext: 'cl', regPrice: '28.81', renewPrice: '40.82' },{ id: '154', ext: 'band', regPrice: '31.48', renewPrice: '48.47' },{ id: '156', ext: 'care', regPrice: '31.48', renewPrice: '65.94' },{ id: '160', ext: 'pw', regPrice: '32.74', renewPrice: '32.74' },{ id: '157', ext: 'rent', regPrice: '33.18', renewPrice: '109.62' },{ id: '158', ext: 'place', regPrice: '33.18', renewPrice: '33.18' },{ id: '159', ext: 'baby', regPrice: '33.18', renewPrice: '109.62' },{ id: '161', ext: 'uno', regPrice: '33.18', renewPrice: '33.18' },{ id: '162', ext: 'cloud', regPrice: '33.18', renewPrice: '33.18' },{ id: '164', ext: 'bz', regPrice: '34.92', renewPrice: '34.92' },{ id: '163', ext: 'me', regPrice: '35.13', renewPrice: '35.13' },{ id: '165', ext: 'id', regPrice: '38.20', renewPrice: '38.20' },{ id: '166', ext: 'lc', regPrice: '39.29', renewPrice: '39.29' },{ id: '167', ext: 'soy', regPrice: '39.73', renewPrice: '39.73' },{ id: '117', ext: 'vote', regPrice: '41.98', renewPrice: '140.20' },{ id: '155', ext: 'travel', regPrice: '41.98', renewPrice: '218.82' },{ id: '168', ext: 'ski', regPrice: '41.98', renewPrice: '100.88' },{ id: '169', ext: 'rio', regPrice: '42.50', renewPrice: '42.50' },{ id: '225', ext: 'az', regPrice: '44.00', renewPrice: '22.00' },{ id: '172', ext: 'party', regPrice: '44.06', renewPrice: '44.06' },{ id: '173', ext: 'men', regPrice: '44.06', renewPrice: '44.06' },{ id: '174', ext: 'win', regPrice: '44.06', renewPrice: '44.06' },{ id: '175', ext: 'loan', regPrice: '44.06', renewPrice: '44.06' },{ id: '177', ext: 'bid', regPrice: '44.06', renewPrice: '44.06' },{ id: '171', ext: 'ooo', regPrice: '44.08', renewPrice: '44.08' },{ id: '118', ext: 'esq', regPrice: '44.10', renewPrice: '44.10' },{ id: '119', ext: 'phd', regPrice: '44.10', renewPrice: '44.10' },{ id: '120', ext: 'prof', regPrice: '44.10', renewPrice: '44.10' },{ id: '170', ext: 'name', regPrice: '44.10', renewPrice: '44.10' },{ id: '176', ext: 'how', regPrice: '44.10', renewPrice: '44.10' },{ id: '178', ext: 'lat', regPrice: '48.47', renewPrice: '48.47' },{ id: '179', ext: 'sarl', regPrice: '50.65', renewPrice: '50.65' },{ id: '180', ext: 'asia', regPrice: '51.91', renewPrice: '51.91' },{ id: '181', ext: 'ac', regPrice: '52.48', renewPrice: '52.48' },{ id: '182', ext: 'beer', regPrice: '52.84', renewPrice: '52.84' },{ id: '183', ext: 'surf', regPrice: '52.84', renewPrice: '52.84' },{ id: '184', ext: 'horse', regPrice: '52.84', renewPrice: '52.84' },{ id: '185', ext: 'vc', regPrice: '54.58', renewPrice: '54.58' },{ id: '186', ext: 'gd', regPrice: '54.58', renewPrice: '54.58' },{ id: '187', ext: 'tv', regPrice: '54.58', renewPrice: '54.58' },{ id: '188', ext: 'vg', regPrice: '54.58', renewPrice: '54.58' },{ id: '189', ext: 'io', regPrice: '56.68', renewPrice: '94.48' },{ id: '190', ext: 'tel', regPrice: '59.39', renewPrice: '72.49' },{ id: '191', ext: 'gay', regPrice: '59.39', renewPrice: '59.39' },{ id: '192', ext: 'pub', regPrice: '61.57', renewPrice: '61.57' },{ id: '193', ext: 'sh', regPrice: '62.98', renewPrice: '62.98' },{ id: '194', ext: 'vet', regPrice: '63.76', renewPrice: '63.76' },{ id: '195', ext: 'to', regPrice: '65.50', renewPrice: '65.50' },{ id: '196', ext: 'tattoo', regPrice: '65.94', renewPrice: '65.94' },{ id: '197', ext: 'frl', regPrice: '65.94', renewPrice: '65.94' },{ id: '198', ext: 'market', regPrice: '70.31', renewPrice: '70.31' },{ id: '200', ext: 'gl', regPrice: '70.75', renewPrice: '70.75' },{ id: '201', ext: 'mn', regPrice: '76.42', renewPrice: '76.42' },{ id: '202', ext: 'music', regPrice: '81.23', renewPrice: '81.23' },{ id: '203', ext: 'mx', regPrice: '106.95', renewPrice: '128.79' },{ id: '204', ext: 'gg', regPrice: '109.18', renewPrice: '109.18' },{ id: '205', ext: 'fo', regPrice: '110.06', renewPrice: '110.06' },{ id: '206', ext: 'vu', regPrice: '120.10', renewPrice: '120.10' },{ id: '207', ext: 'ag', regPrice: '163.78', renewPrice: '163.78' },{ id: '209', ext: 'law', regPrice: '175.14', renewPrice: '175.14' },{ id: '208', ext: 'sc', regPrice: '185.62', renewPrice: '185.62' },{ id: '210', ext: 'fm', regPrice: '185.62', renewPrice: '185.62' },{ id: '211', ext: 'porn', regPrice: '186.06', renewPrice: '186.06' },{ id: '212', ext: 'xxx', regPrice: '186.06', renewPrice: '186.06' },{ id: '213', ext: 'adult', regPrice: '186.06', renewPrice: '186.06' },{ id: '214', ext: 'sex', regPrice: '186.06', renewPrice: '186.06' },{ id: '215', ext: 'icu', regPrice: '207.90', renewPrice: '207.90' },{ id: '216', ext: 'cfd', regPrice: '207.90', renewPrice: '207.90' },{ id: '217', ext: 'sbs', regPrice: '207.90', renewPrice: '207.90' },{ id: '218', ext: 'hiv', regPrice: '391.36', renewPrice: '391.36' },{ id: '219', ext: 'inc', regPrice: '546.42', renewPrice: '4368.42' },{ id: '220', ext: 'pr', regPrice: '2183.98', renewPrice: '2183.98' },{ id: '221', ext: 'case', regPrice: '4368.42', renewPrice: '4368.42' },{ id: '222', ext: 'car', regPrice: '4368.42', renewPrice: '4368.42' },{ id: '223', ext: 'auto', regPrice: '4368.42', renewPrice: '4368.42' },{ id: '224', ext: 'sexy', regPrice: '5460.42', renewPrice: '5460.42' }, ]; const domainSuggestions = domainTariffs; const toggleServices = document.getElementById('toggle_services'); const mobileMenu = document.getElementById('mobileMenu'); const mobileMenuOverlay = document.getElementById('mobileMenuOverlay'); const closeMenuBtn = document.getElementById('closeMenuBtn'); if (toggleServices) { toggleServices.addEventListener('click', function(e) { e.preventDefault(); mobileMenu.classList.add('active'); mobileMenuOverlay.style.display = 'block'; document.body.style.overflow = 'hidden'; }); } function closeMobileMenu() { mobileMenu.classList.remove('active'); mobileMenuOverlay.style.display = 'none'; document.body.style.overflow = ''; } if (closeMenuBtn) { closeMenuBtn.addEventListener('click', closeMobileMenu); } if (mobileMenuOverlay) { mobileMenuOverlay.addEventListener('click', closeMobileMenu); } document.querySelectorAll('.mobile-menu-link').forEach(link => { link.addEventListener('click', closeMobileMenu); }); const modalOverlay = document.getElementById('modalOverlay'); const loginModal = document.getElementById('loginModal'); const registerModal = document.getElementById('registerModal'); const recoveryModal = document.getElementById('recoveryModal'); const domainResultModal = document.getElementById('domainResultModal'); const contactModal = document.getElementById('contactModal'); const domainInfoModal = document.getElementById('domainInfoModal'); const closeLoginModal = document.getElementById('closeLoginModal'); const closeRegisterModal = document.getElementById('closeRegisterModal'); const closeRecoveryModal = document.getElementById('closeRecoveryModal'); const closeDomainResultModal = document.getElementById('closeDomainResultModal'); const closeContactModal = document.getElementById('closeContactModal'); const closeDomainInfoModal = document.getElementById('closeDomainInfoModal'); function openModal(modalId) { modalOverlay.style.display = 'flex'; document.body.classList.add('modal-open'); loginModal.style.display = 'none'; registerModal.style.display = 'none'; recoveryModal.style.display = 'none'; domainResultModal.style.display = 'none'; contactModal.style.display = 'none'; domainInfoModal.style.display = 'none'; if (modalId === 'loginModal') { loginModal.style.display = 'block'; } else if (modalId === 'registerModal') { registerModal.style.display = 'block'; } else if (modalId === 'recoveryModal') { recoveryModal.style.display = 'block'; } else if (modalId === 'domainResultModal') { domainResultModal.style.display = 'block'; } else if (modalId === 'contactModal') { contactModal.style.display = 'block'; } else if (modalId === 'domainInfoModal') { domainInfoModal.style.display = 'block'; } } function closeModal() { modalOverlay.style.display = 'none'; document.body.classList.remove('modal-open'); } const desktopLoginBtn = document.getElementById('desktopLoginBtn'); const desktopRegisterBtn = document.getElementById('desktopRegisterBtn'); const desktopContactBtn = document.getElementById('desktopContactBtn'); const mobileLoginBtn = document.getElementById('mobileLoginBtn'); const mobileRegisterBtn = document.getElementById('mobileRegisterBtn'); const mobileContactBtn = document.getElementById('mobileContactBtn'); const mobileMenuContact = document.getElementById('mobileMenuContact'); if (desktopLoginBtn) { desktopLoginBtn.addEventListener('click', function() { openModal('loginModal'); }); } if (desktopRegisterBtn) { desktopRegisterBtn.addEventListener('click', function() { openModal('registerModal'); }); } if (desktopContactBtn) { desktopContactBtn.addEventListener('click', function() { openModal('contactModal'); }); } if (mobileLoginBtn) { mobileLoginBtn.addEventListener('click', function() { closeMobileMenu(); openModal('loginModal'); }); } if (mobileRegisterBtn) { mobileRegisterBtn.addEventListener('click', function() { closeMobileMenu(); openModal('registerModal'); }); } if (mobileContactBtn) { mobileContactBtn.addEventListener('click', function() { openModal('contactModal'); }); } if (mobileMenuContact) { mobileMenuContact.addEventListener('click', function(e) { e.preventDefault(); closeMobileMenu(); openModal('contactModal'); }); } if (closeLoginModal) closeLoginModal.addEventListener('click', closeModal); if (closeRegisterModal) closeRegisterModal.addEventListener('click', closeModal); if (closeRecoveryModal) closeRecoveryModal.addEventListener('click', closeModal); if (closeDomainResultModal) closeDomainResultModal.addEventListener('click', closeModal); if (closeContactModal) closeContactModal.addEventListener('click', closeModal); if (closeDomainInfoModal) closeDomainInfoModal.addEventListener('click', closeModal); modalOverlay.addEventListener('click', function(e) { const domainInfoModal = document.getElementById('domainInfoModal'); if (domainInfoModal && domainInfoModal.style.display === 'block') { return; } if (e.target === modalOverlay) { closeModal(); } }); const phoneNumberInput = document.getElementById('phoneNumber'); if (phoneNumberInput) { phoneNumberInput.addEventListener('input', function(e) { let value = e.target.value.replace(/\D/g, ''); if (value.length > 7) { value = value.substring(0, 7); } let formatted = ''; for (let i = 0; i < value.length; i++) { if (i === 3 || i === 5) { formatted += ' '; } formatted += value[i]; } e.target.value = formatted; }); } const recoveryForm = document.getElementById('recoveryForm'); if (recoveryForm) { recoveryForm.addEventListener('submit', function(e) { e.preventDefault(); const submitBtn = this.querySelector('.submit-btn'); const originalBtnText = submitBtn.innerHTML; const recoveryError = document.getElementById('recoveryError'); const recoverySuccess = document.getElementById('recoverySuccess'); submitBtn.innerHTML = ''; submitBtn.disabled = true; recoveryError.style.display = 'none'; recoverySuccess.style.display = 'none'; const formData = new FormData(this); formData.append('ajax', '1'); fetch(this.action, { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { recoverySuccess.textContent = data.message; recoverySuccess.style.display = 'block'; this.reset(); setTimeout(() => { window.location.href = baseUrl + "/#vps"; }, 3000); } else if (data.error) { recoveryError.textContent = data.error; recoveryError.style.display = 'block'; } }) .catch(error => { recoveryError.textContent = 'Xəta baş verdi!'; recoveryError.style.display = 'block'; }) .finally(() => { submitBtn.innerHTML = originalBtnText; submitBtn.disabled = false; }); }); } document.querySelectorAll('.modal-switch-btn').forEach(button => { button.addEventListener('click', function() { const targetModal = this.getAttribute('data-target'); openModal(targetModal); }); }); const loginForm = document.getElementById('loginForm'); if (loginForm) { loginForm.addEventListener('submit', function(e) { e.preventDefault(); const form = this; const submitBtn = form.querySelector('.submit-btn'); const originalBtnText = submitBtn.innerHTML; const loginError = document.getElementById('loginError'); submitBtn.innerHTML = ''; submitBtn.disabled = true; loginError.style.display = 'none'; const formData = new FormData(form); formData.append('ajax', '1'); fetch(form.action, { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if(data.success) { const successAlert = document.createElement('div'); successAlert.className = 'global-success-alert'; successAlert.innerHTML = ` Uğurla daxil oldunuz! Sizi kabinetə yönləndiririk... `; document.body.appendChild(successAlert); setTimeout(() => { window.location.href = baseUrl + "/user/cabinet"; }, 3000); } else if(data.error) { loginError.textContent = data.error; loginError.style.display = 'block'; } }) .catch(error => { loginError.textContent = 'Xəta baş verdi: ' + error.message; loginError.style.display = 'block'; }) .finally(() => { submitBtn.innerHTML = originalBtnText; submitBtn.disabled = false; }); }); } const contactForm = document.getElementById('contactForm'); if (contactForm) { contactForm.addEventListener('submit', function(e) { e.preventDefault(); const submitBtn = this.querySelector('.submit-btn'); const originalBtnText = submitBtn.innerHTML; const contactError = document.getElementById('contactError'); const contactSuccess = document.getElementById('contactSuccess'); submitBtn.innerHTML = ''; submitBtn.disabled = true; contactError.style.display = 'none'; contactSuccess.style.display = 'none'; const formData = new FormData(this); formData.append('ajax', '1'); fetch(this.action, { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if (data.success) { contactSuccess.textContent = data.message; contactSuccess.style.display = 'block'; this.reset(); } else if (data.error) { contactError.textContent = data.error; contactError.style.display = 'block'; } }) .catch(error => { contactError.textContent = 'Xəta baş verdi: ' + error.message; contactError.style.display = 'block'; }) .finally(() => { submitBtn.innerHTML = originalBtnText; submitBtn.disabled = false; }); }); } const registerForm = document.getElementById('registerForm'); if (registerForm) { registerForm.addEventListener('submit', function(e) { e.preventDefault(); const prefix = document.getElementById('phonePrefix').value; const number = document.getElementById('phoneNumber').value.replace(/\s/g, ''); document.getElementById('phoneNumber').value = number; const form = this; const submitBtn = form.querySelector('.submit-btn'); const originalBtnText = submitBtn.innerHTML; const registerError = document.getElementById('registerError'); submitBtn.innerHTML = ''; submitBtn.disabled = true; registerError.style.display = 'none'; document.querySelectorAll('.field-error').forEach(el => el.remove()); const formData = new FormData(form); formData.append('ajax', '1'); fetch(form.action, { method: 'POST', body: formData }) .then(response => response.json()) .then(data => { if(data.success) { const successAlert = document.createElement('div'); successAlert.className = 'global-success-alert'; successAlert.innerHTML = ` Uğurla qeydiyyatdan keçdiniz! Sizi kabinetə yönləndiririk... `; document.body.appendChild(successAlert); setTimeout(() => { window.location.href = baseUrl + "/user/cabinet"; }, 3000); } else if(data.fieldErrors) { let errorHtml = ''; for (const field in data.fieldErrors) { errorHtml += data.fieldErrors[field] + '
'; } registerError.innerHTML = errorHtml; registerError.style.display = 'block'; } else if(data.error) { registerError.innerHTML = data.error; registerError.style.display = 'block'; } }) .catch(error => { registerError.innerHTML = 'Xəta baş verdi: ' + error.message; registerError.style.display = 'block'; }) .finally(() => { submitBtn.innerHTML = originalBtnText; submitBtn.disabled = false; }); }); } const domainInput = document.getElementById('domainInput'); const suggestionsContainer = document.getElementById('suggestionsContainer'); const clearDomainInput = document.getElementById('clearDomainInput'); if (domainInput && clearDomainInput) { domainInput.addEventListener('input', function() { clearDomainInput.style.display = this.value ? 'block' : 'none'; if (!this.value.trim()) { suggestionsContainer.classList.remove('show'); } }); } clearDomainInput.addEventListener('click', function() { domainInput.value = ''; suggestionsContainer.classList.remove('show'); clearDomainInput.style.display = 'none'; domainInput.focus(); }); if (domainInput && suggestionsContainer) { let inputTimeout; function createSuggestionItem(domainPart, item) { const suggestionItem = document.createElement('div'); suggestionItem.className = 'suggestion-item'; suggestionItem.innerHTML = `
${domainPart}.${item.ext}
Qeydiyyat
${item.regPrice} AZN
Uzatma
${item.renewPrice} AZN
`; return suggestionItem; } function generateSuggestions(inputValue) { suggestionsContainer.innerHTML = ''; if (inputValue.length < 2) { suggestionsContainer.classList.remove('show'); return; } if (inputValue.includes('.')) { const parts = inputValue.split('.'); const domainPart = parts.slice(0, -1).join('.'); const tldPart = parts[parts.length - 1].toLowerCase(); const foundSuggestion = domainSuggestions.find(item => item.ext.toLowerCase() === tldPart); if (foundSuggestion) { suggestionsContainer.appendChild( createSuggestionItem(domainPart, foundSuggestion) ); } else { const contactRow = document.createElement('div'); contactRow.className = 'suggestion-item'; contactRow.innerHTML = `
"${tldPart}" uzantısı ilə bağlı məlumat yoxdur
`; suggestionsContainer.appendChild(contactRow); } } else { domainSuggestions.forEach(item => { suggestionsContainer.appendChild( createSuggestionItem(inputValue, item) ); }); } document.querySelectorAll('.check-btn').forEach(btn => { btn.addEventListener('click', function(e) { e.stopPropagation(); checkDomainAvailability(this); }); }); suggestionsContainer.classList.add('show'); } function checkDomainAvailability(button) { const domain = button.getAttribute('data-domain'); const tariffId = button.getAttribute('data-id'); const resultContainer = button.parentElement.querySelector('.result-container'); button.style.display = 'none'; resultContainer.innerHTML = ' Yoxlanılır...'; resultContainer.style.display = 'block'; resultContainer.style.color = '#007bff'; fetch(`https://netdata.az/incfiles/check_domain.php?domain=${encodeURIComponent(domain)}`) .then(response => response.json()) .then(data => { resultContainer.innerHTML = ''; if (data.success && data.available) { resultContainer.innerHTML = ` `; const orderBtn = resultContainer.querySelector('.order-btn'); if (orderBtn) { orderBtn.addEventListener('click', function(e) { e.stopPropagation(); const isLoggedIn = document.querySelector('.profile-dropdown') !== null || document.querySelector('.desktop-profile-dropdown') !== null; if (!isLoggedIn) { openModal('loginModal'); } else { window.location.href = `https://netdata.az/tarif/domain/order/${tariffId}/domain/${domain}#vps`; } }); } } else if (data.success && !data.available) { resultContainer.innerHTML = ` `; const infoBtn = resultContainer.querySelector('.info-btn'); if (infoBtn) { infoBtn.addEventListener('click', function(e) { e.stopPropagation(); const domain = this.getAttribute('data-domain'); this.style.display = 'none'; resultContainer.innerHTML = ' Yoxlanılır...'; resultContainer.style.color = '#007bff'; fetchWhoisInfo(domain, resultContainer); }); } } else { resultContainer.innerHTML = ` Xəta baş verdi `; const retryBtn = resultContainer.querySelector('.retry-btn'); if (retryBtn) { retryBtn.addEventListener('click', function(e) { e.stopPropagation(); resultContainer.innerHTML = ' Yoxlanılır...'; resultContainer.style.color = '#007bff'; checkDomainAvailability(this); }); } } }) .catch(error => { resultContainer.innerHTML = ` Xəta baş verdi `; const retryBtn = resultContainer.querySelector('.retry-btn'); if (retryBtn) { retryBtn.addEventListener('click', function(e) { e.stopPropagation(); resultContainer.innerHTML = ' Yoxlanılır...'; resultContainer.style.color = '#007bff'; checkDomainAvailability(this); }); } }); } function fetchWhoisInfo(domain, resultContainer) { fetch(`https://netdata.az/incfiles/whois_domain.php?domain=${domain}`) .then(response => response.json()) .then(data => { showDomainInfoModal(data); resultContainer.innerHTML = ` `; const infoBtn = resultContainer.querySelector('.info-btn'); if (infoBtn) { infoBtn.addEventListener('click', function(e) { e.stopPropagation(); resultContainer.innerHTML = ' Yoxlanılır...'; resultContainer.style.color = '#007bff'; fetchWhoisInfo(domain, resultContainer); }); } }) .catch(error => { resultContainer.innerHTML = ` Xəta baş verdi `; const infoBtn = resultContainer.querySelector('.info-btn'); if (infoBtn) { infoBtn.addEventListener('click', function(e) { e.stopPropagation(); resultContainer.innerHTML = ' Yoxlanılır...'; resultContainer.style.color = '#007bff'; fetchWhoisInfo(domain, resultContainer); }); } }); } function showDomainInfoModal(data) { const modalContent = document.getElementById('domainInfoContent'); if (modalContent) { modalContent.innerHTML = `

${data.domain} - Domain Məlumatları

Domain Məlumatları

Qeydiyyat tarixi: ${data.domain_info.registered_on || 'Məlumat yoxdur'}
Bitmə tarixi: ${data.domain_info.expires_on || 'Məlumat yoxdur'}
Yenilənmə tarixi: ${data.domain_info.updated_on || 'Məlumat yoxdur'}

Əlaqə Məlumatları

Admin Adı: ${data.contacts.administrative.name || 'Məlumat yoxdur'}
Ünvan: ${[data.contacts.administrative.street, data.contacts.administrative.city, data.contacts.administrative.state, data.contacts.administrative.postal_code, data.contacts.administrative.country].filter(Boolean).join(', ') || 'Məlumat yoxdur'}
Telefon: ${data.contacts.administrative.phone ? `${data.contacts.administrative.phone}` : 'Məlumat yoxdur'}
Email: ${data.contacts.administrative.email ? `${data.contacts.administrative.email}` : 'Məlumat yoxdur'}
`; // Yeni bağlama düyməsinə hadisə dinləyicisi əlavə et const closeButton = document.getElementById('closeDomainInfoModalBtn'); if (closeButton) { closeButton.addEventListener('click', closeModal); } openModal('domainInfoModal'); } } domainInput.addEventListener('input', function() { const inputValue = this.value.trim(); clearTimeout(inputTimeout); if (inputValue === '') { suggestionsContainer.classList.remove('show'); return; } inputTimeout = setTimeout(() => { generateSuggestions(inputValue); }, 300); }); } document.addEventListener('click', function(event) { const domainInfoModal = document.getElementById('domainInfoModal'); const isDomainInfoModalOpen = domainInfoModal && window.getComputedStyle(domainInfoModal).display === 'block'; const domainInput = document.getElementById('domainInput'); if ((domainInput && domainInput.value.trim() !== '') || isDomainInfoModalOpen) { return; } if (suggestionsContainer && !event.target.closest('.search-container')) { suggestionsContainer.classList.remove('show'); } }); const navItems = document.querySelectorAll('.g, .nav_bar_panel'); const sections = { 'vps': document.getElementById('vps'), 'shop': document.getElementById('shop'), 'domains': document.getElementById('domains'), 'resel': document.getElementById('resel'), 'host': document.getElementById('host') }; const sectionMap = { 'show_shop': 'shop', 'show_vps': 'vps', 'show_resel': 'resel', 'show_host': 'host', 'show_domain': 'domains' }; function showSection(sectionId) { Object.values(sections).forEach(section => { if (section) section.classList.remove('active'); }); if (sections[sectionId]) { sections[sectionId].classList.add('active'); } window.location.hash = sectionId; navItems.forEach(item => { item.classList.remove('active'); const itemSection = sectionMap[item.id]; if (itemSection === sectionId) { item.classList.add('active'); } }); const element = document.getElementById(sectionId); if (element) { const headerContainer = document.querySelector('.fixed-header-container'); const headerHeight = headerContainer ? headerContainer.offsetHeight : 0; const stickyContainer = document.querySelector('.sticky-container'); const stickyHeight = stickyContainer ? stickyContainer.offsetHeight : 0; const totalOffset = headerHeight + stickyHeight + 20; const offsetPosition = element.offsetTop - totalOffset; window.scrollTo({ top: offsetPosition, behavior: 'smooth' }); } } navItems.forEach(item => { item.addEventListener('click', function(e) { const targetId = this.id; const sectionId = sectionMap[targetId]; if (sectionId) { showSection(sectionId); } }); }); function handleHash() { const hash = window.location.hash.substring(1); if (hash && sections[hash]) { showSection(hash); } else { showSection('vps'); } } handleHash(); window.addEventListener('hashchange', handleHash); const newsItems = document.querySelectorAll('.news-item'); const indicators = document.querySelectorAll('.news-indicators span'); const prevBtn = document.querySelector('.news-prev'); const nextBtn = document.querySelector('.news-next'); const dateElement = document.getElementById('news-date'); if (newsItems.length > 0 && indicators.length > 0 && prevBtn && nextBtn && dateElement) { let currentIndex = 0; function showNews(index) { newsItems.forEach(item => item.classList.remove('active')); indicators.forEach(indicator => indicator.classList.remove('active')); newsItems[index].classList.add('active'); indicators[index].classList.add('active'); currentIndex = index; const activeItem = newsItems[index]; const date = activeItem.getAttribute('data-date'); dateElement.textContent = `(${date})`; } indicators.forEach((indicator, index) => { indicator.addEventListener('click', () => showNews(index)); }); nextBtn.addEventListener('click', () => { const nextIndex = (currentIndex + 1) % newsItems.length; showNews(nextIndex); }); prevBtn.addEventListener('click', () => { const prevIndex = (currentIndex - 1 + newsItems.length) % newsItems.length; showNews(prevIndex); }); setInterval(() => { const nextIndex = (currentIndex + 1) % newsItems.length; showNews(nextIndex); }, 10000); } function setupCodeInputs() { document.querySelectorAll('.code-input').forEach(input => { input.addEventListener('input', function(e) { const value = e.target.value; if (!/^\d$/.test(value)) { e.target.value = ''; return; } const nextId = this.getAttribute('data-next'); if (nextId && value) { document.getElementById(nextId).focus(); } updateVerificationCode(); }); input.addEventListener('keydown', function(e) { if (e.key === 'Backspace' && this.value === '') { const prevId = this.getAttribute('data-prev'); if (prevId) { document.getElementById(prevId).focus(); } } }); }); } function updateVerificationCode() { var emailCode = document.getElementById('emailCode1').value + document.getElementById('emailCode2').value + document.getElementById('emailCode3').value + document.getElementById('emailCode4').value + document.getElementById('emailCode5').value + document.getElementById('emailCode6').value; document.getElementById('emailFullCode').value = emailCode; var phoneCode = document.getElementById('phoneCode1').value + document.getElementById('phoneCode2').value + document.getElementById('phoneCode3').value + document.getElementById('phoneCode4').value + document.getElementById('phoneCode5').value + document.getElementById('phoneCode6').value; document.getElementById('phoneFullCode').value = phoneCode; } const sendEmailCodeBtn = document.getElementById('sendEmailCode'); if (sendEmailCodeBtn) { sendEmailCodeBtn.addEventListener('click', function() { const email = document.getElementById('email').value; if (!validateEmail(email)) { alert('Düzgün email daxil edin'); return; } this.disabled = true; this.innerHTML = ''; fetch('https://netdata.az/incfiles/send_verification.php?type=email', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ email }) }) .then(response => response.json()) .then(data => { if (data.success) { const emailValue = email; document.getElementById('verifiedEmail').value = emailValue; document.getElementById('emailCodeGroup').style.display = 'block'; const emailInput = document.getElementById('email'); emailInput.disabled = true; const emailInputGroup = document.getElementById('emailInputGroup'); if (emailInputGroup) { emailInputGroup.style.display = 'none'; } document.getElementById('emailCodeGroup').style.display = 'block'; } else { alert('Xəta: ' + (data.error || 'Bilinməyən xəta')); } this.disabled = false; this.innerHTML = 'Təstiqlə'; }) .catch(() => { alert('Xəta baş verdi'); this.disabled = false; this.innerHTML = 'Təstiqlə'; }); }); } const sendPhoneCodeBtn = document.getElementById('sendPhoneCode'); if (sendPhoneCodeBtn) { sendPhoneCodeBtn.addEventListener('click', function() { const prefix = document.getElementById('phonePrefix').value; const number = document.getElementById('phoneNumber').value.replace(/\s/g, ''); const adjustedPrefix = prefix.replace(/^0/, ''); if ((adjustedPrefix + number).length !== 9) { alert('Düzgün nömrə daxil edin (9 rəqəm)'); return; } this.disabled = true; this.innerHTML = ''; fetch('https://netdata.az/incfiles/send_verification.php?type=phone', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ prefix: adjustedPrefix, number: number }) }) .then(response => response.json()) .then(data => { if (data.success) { const prefixValue = prefix; const numberValue = number; document.getElementById('verifiedPrefix').value = prefixValue; document.getElementById('verifiedNumber').value = numberValue; document.getElementById('phoneCodeGroup').style.display = 'block'; const phoneInput = document.getElementById('phoneNumber'); phoneInput.disabled = true; const phoneInputGroup = document.getElementById('phoneInputGroup'); if (phoneInputGroup) { phoneInputGroup.style.display = 'none'; } document.getElementById('phoneCodeGroup').style.display = 'block'; } else { alert('Xəta: ' + (data.error || 'Bilinməyən xəta')); } this.disabled = false; this.innerHTML = 'Təstiqlə'; }) .catch(() => { alert('Xəta baş verdi'); this.disabled = false; this.innerHTML = 'Təstiqlə'; }); }); } function validateEmail(email) { const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; return re.test(email); } setupCodeInputs(); // Sifariş düymələri üçün klik hadisəsi document.addEventListener('click', function(e) { if (e.target.classList.contains('buy-btn')) { const isLoggedIn = document.querySelector('.profile-dropdown') !== null || document.querySelector('.desktop-profile-dropdown') !== null; if (!isLoggedIn) { e.preventDefault(); openModal('loginModal'); } else { // İstifadəçi daxil olubsa, normal sifariş prosesi davam etsin const service = e.target.getAttribute('data-service'); const id = e.target.getAttribute('data-id'); // Domain sifarişi üçün xüsusi URL if (service === 'domain') { window.location.href = `https://netdata.az/tarif/domain/order/${id}`; } else { window.location.href = `https://netdata.az/tarif/${service}/order/${id}`; } } } }); });