(function (c, l, a, r, i, t, y) { c[a] = c[a] || function () { (c[a].q = c[a].q || []).push(arguments) }; t = l.createElement(r); t.async = 1; t.src = "https://www.clarity.ms/tag/" + i; y = l.getElementsByTagName(r)[0]; y.parentNode.insertBefore(t, y); })(window, document, "clarity", "script", "p0jm0tjwln"); // PROGRESS BAR function setProgressBar(curStep) { if (isNaN(curStep)) var curStep = 1; else curStep = curStep + 1; console.log(curStep); // var element_p = document.getElementById("step_progress_"+(curStep-1)); var element_n = document.getElementById("step_progress_" + curStep); // element_p.classList.remove("footer--active"); element_n.classList.add("footer--active"); } // FORM var currentTab = 0; // Current tab is set to be the first tab (0) showTab(currentTab); // Display the current tab function showTab(n) { // This function will display the specified tab of the form... var x = document.getElementsByClassName("container__box-2--form"); //var y = document.getElementsByClassName("container__box-1--box"); x[n].style.display = "flex"; //y[n].style.display = "flex"; } function nextPrev(n) { // This function will figure out which tab to display var x = document.getElementsByClassName("container__box-2--form"); //var y = document.getElementsByClassName("container__box-1--box"); // Exit the function if any field in the current tab is invalid: if (n == 1 && !validateForm()) return false; // Hide the current tab: x[currentTab].style.display = "none"; //y[currentTab].style.display = "none"; // Increase or decrease the current tab by 1: currentTab = currentTab + n; // Otherwise, display the correct tab: setProgressBar(currentTab); showTab(currentTab); } function createCookie(name, value, hours) { if (hours) { var date = new Date(); date.setTime(date.getTime() + (hours * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); } else { var expires = ""; } document.cookie = name + "=" + value + expires + "; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1, c.length); } if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length, c.length); } } return null; } function validateForm() { var x, y, z, i, valid = true; x = document.getElementsByClassName("container__box-2--form"); y = x[currentTab].getElementsByTagName("input"); z = x[currentTab].getElementsByTagName("p"); k = x[currentTab].getElementsByTagName("select"); id = $(z[1]).attr('id'); // A loop that checks every input field in the current tab: for (i = 0; i < y.length; i++) { id = $(z[i]).attr('id'); if (id == "text_05") { var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; if (regex.test(y[i].value) == false) { $(".text_05").html("Vennligst skriv inn en gyldig e-postadresse"); $(".text_05").css("visibility", "visible"); valid = false; } else if (y[i].value != "") { $(".text_05").css("visibility", "collapse"); } } } return valid; // return the valid status } function togglePopup(id) { $("#" + id).dialog({ width: 'auto', maxWidth: 600, height: ($(window).height() - 300), modal: true, fluid: true, resizable: false, buttons: { Close: function () { $(this).dialog("close"); } } }); } $(document).ready(function () { var url = new URL(window.location.href); var c = url.searchParams.get("terms"); if (c == 0) { $('#termsc').prop('checked', false); } var browserLanguage = navigator.language || navigator.userLanguage; $("input[name=browser_lang]").val(browserLanguage); $("input[name=browser_timezone]").val(Intl.DateTimeFormat().resolvedOptions().timeZone); }); function showPreloader() { $('body').prepend('

Et øyeblikk....

'); } // back button functionality (function (w, d) { var targetLocation = function () { var url = ''; if (w.backOfferUrl) { url = w.backOfferUrl } else { return } w.history && w.history.pushState && w.history.pushState(null, null, w.location); w.addEventListener && w.addEventListener('popstate', function () { w.location = url }, !1) }; (function () { if (w.addEventListener) { w.addEventListener('pageshow', function () { setTimeout(targetLocation, 0) }, !1) } else { setTimeout(targetLocation, 0) } }()) }(window, document)); (function (w) { w.backOfferUrl = "https://s.datingclix.com/d.php?z=24" }(window));