function validateEmail(email) { var pattern = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return pattern .test(email); } //cookies if (typeof functionName == 'getCookie') { } else { function getCookie(name) { var matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" )); return matches ? decodeURIComponent(matches[1]) : undefined; } function setCookie(name, value, options) { options = options || {}; var expires = options.expires; if (typeof expires == "number" && expires) { var d = new Date(); d.setTime(d.getTime() + expires * 1000); expires = options.expires = d; } if (expires && expires.toUTCString) { options.expires = expires.toUTCString(); } value = encodeURIComponent(value); var updatedCookie = name + "=" + value; for (var propName in options) { updatedCookie += "; " + propName; var propValue = options[propName]; if (propValue !== true) { updatedCookie += "=" + propValue; } } document.cookie = updatedCookie; } function deleteCookie(name) { setCookie(name, "", { expires: -1 }) } } //cookies document.addEventListener("DOMContentLoaded", function(event) { //jQuery("#cntnr").show(); jQuery("#ccclose").on("click",function() { jQuery("#cntnr").addClass("actv"); if(jQuery(window).width() < 768) { jQuery("#cntnr").addClass("actv");} setCookie("livechat",1); }); jQuery("#titsl").on("click",function() { jQuery("#cntnr").toggleClass("actv"); if(jQuery(window).width() < 768) { /*jQuery("#cntnr").toggleClass("actv");*/} }); jQuery("#mobisurrogate").on("click",function() { jQuery("#cntnr").toggleClass("actv"); /*jQuery("#cntnr").toggle();*/ } ); setTimeout(function () { jQuery("#my_audio").get(0).play(); }, 9000); // время в мс setTimeout(function(){ //document.getElementById("surname").classList.add("passedit"); jQuery('.surnako').addClass("passedit"); }, 3000); //через 3 секунды прячем поле для живого посетителя. бот будет работать с ним //детектор что наводили мышь и кликнули на поле ////jQuery('.checksend').on("mouseover", function(e) { jQuery(document).on("mouseover",".checksend",function(e){ jQuery(this).closest(".parenti").find("input[name=utp_mx]").val( e.pageX ); jQuery(this).closest(".parenti").find("input[name=utp_my]").val( e.pageY ); }); //подсчет входов форму ////jQuery('.checkmessage').focus(function(e){ jQuery(document).on("focus",".checkmessage",function(e){ jQuery(this).closest(".parenti").find("input[name=utp_frms]").val( parseInt(jQuery(this).closest(".parenti").find("input[name=utp_frms]").val())+1 ); }); //jQuery(".checkemail").focus(function(e){ jQuery(document).on("focus",".checkemail",function(e){ jQuery(this).closest(".parenti").find("input[name=utp_frms]").val( parseInt(jQuery(this).closest(".parenti").find("input[name=utp_frms]").val())+1 ); }); //набирали ли текст или копипастили ////jQuery('.checkmessage').keyup(function(e){ jQuery(document).on("keyup",".checkmessage",function(e){ jQuery(this).closest(".parenti").find("input[name=utp_cnts]").val( parseInt(jQuery(this).closest(".parenti").find("input[name=utp_cnts]").val())+1 ); }); var messa = []; messa[10] = 'Failed: spam detected'; messa[11] = 'Required'; jQuery("#okay").on("click",function(){jQuery(this).hide()}); jQuery("#checksend").on("click",function(){ jQuery("#checksend").hide(); var ero = 0; if(jQuery("#checkmessage").val().length<5) { jQuery("#checkmessage").addClass("erro"); ero = 1; } else jQuery("#checkmessage").removeClass("erro"); if(jQuery("#branch").val()<1) { jQuery("#branch").addClass("erro"); ero = 1; } else jQuery("#branch").removeClass("erro"); if(!validateEmail(jQuery("#checkemail").val())) { jQuery("#checkemail").addClass("erro"); ero = 1; } else jQuery("#checkemail").removeClass("erro"); if(ero == 1) { jQuery("#checksend").show(); //чтобы кнопка пряталась return false; } //отправка ajax if(ero == 0) { var $form = jQuery("#fanto"); jQuery.ajax({ type: "POST", //$form.attr('method') url: '/GEOIP/ajax.php', //$form.attr('action') data: $form.serialize() }).done(function(ddd) { var obj = jQuery.parseJSON(ddd); if(obj.status=="validation_failed") { alert(messa[obj.invalidFields[0].code]); } else { ///alert("Thank you. Your message has been forwarded to the clinic. We will contact you within the next 24 hours"); jQuery("#okay").show(); setTimeout(function () { jQuery("#okay").hide(); jQuery("#checksend").show(); }, 5000); // время в мс jQuery("#cntnr").addClass("actv"); //после запроса прячем форму jQuery(".kotte").hide(); //и уведомление if(jQuery(window).width() < 768) { jQuery("#cntnr").toggle(); } gtag('event', 'clickchatlive', { 'event_category': 'chatsend', 'event_action': 'openchat', }); setCookie("livechat",1); } }).fail(function(a) { //console.log('fail'); alert("Failed. Please, recheck form"); }); //отмена действия по умолчанию для кнопки submit // $form.preventDefault(); } }); jQuery('.cheko').each(function(e) { //проверим существование полей у формы if(jQuery(this).find("input[name=utm_source]").length == 0) jQuery(this).append(''); if(jQuery(this).find("input[name=utm_medium]").length == 0) jQuery(this).append(''); if(jQuery(this).find("input[name=utm_campaign]").length == 0) jQuery(this).append(''); if(jQuery(this).find("input[name=utm_term]").length == 0) jQuery(this).append(''); }); }); //favicon var inter; function faviconPulse (time){ var favicon = document.getElementById("favicon"), href = favicon.getAttribute('href'); if (favicon.getAttribute('data')) { inter = setInterval(function(){ if (!document.hidden) { favicon.setAttribute('href', href); } else { if (favicon.getAttribute('href') == href) { favicon.setAttribute('href', favicon.getAttribute('data')); } else { favicon.setAttribute('href', href); } } }, (time ? time : 500)); } }; faviconPulse(500); document.write("#cntnr{"+"height: 536px;}<"+"/style>");document.write("
X
Contact us. We are online!
The agents are online! Please enter your information
" +"
"+atob("PGlucHV0IG5hbWU9Jw==")+"your-name' class='inputField_G5 _grey_1R' autocomplete='text' placeholder='Your name'>
"+atob("PGlucHV0IG5hbWU9Jw==")+"tel' class='inputField_G5 _grey_1R' type='tel' autocomplete='tel' placeholder='Your phone'>
"+atob("PGlucHV0IG5hbWU9Jw==")+"email' class='inputField_G5 _grey_1R checkemail' type='email' autocomplete='email' id='checkemail' placeholder='Your email*'>
Send
"+atob("PGlucHV0IG5hbWU9Jw==")+"_wpcf7' type='hidden' value='1099'>"+atob("PGlucHV0IG5hbWU9Jw==")+"_wpcf7_unit_tag' type='hidden' value='1099'>"+""+"<\/form>
");