var clb_timer, clb_timer_ref, clb_autoload_timer; var first = true; var agent_wts=9; var agent_wte=21; var agent_is_developer=false; var agent_build_id=3319; if(typeof jQuery == 'undefined'){ var oScriptElem = document.createElement("script"); oScriptElem.type = "text/javascript"; oScriptElem.src = "https://agentguru.ru/script/jquery-1.9.1.min.js"; document.head.insertBefore(oScriptElem, document.head.getElementsByTagName("script")[0]) } window.onload = function() { if (first) { first = false; MakeCallbackWidget(); } }; function MakeCallbackWidget() { $('.ag_phone_cont, .callback_form').show(); $('.ag_phone_cont em').html('+7 (812) 425-XX-XX'); if (typeof(gaUserId) == 'undefined') gaUserId = ''; $('.ag_get_phone').bind('click',function(){ if ($('.ag_get_phone').data('set')!=1) { $.ajax({ type: "POST", url: "https://agentguru.ru/api/v2/redirect", data: JSON.stringify({ resource: { s_id: '', id: 4723, source: 1, uid: gaUserId } }), success: function(phone) { if (phone=='') $('.ag_phone_cont').hide(); else { if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { mobile = true; } else mobile = false; $('.ag_phone_r').each(function(){ style = $(this).attr('style'); if (style==undefined) style=''; style=style+';text-decoration:none !important;color:'+$(this).css("color")+' !important;font-size:'+$(this).css("font-size")+' !important;font-weight:'+$(this).css("font-weight")+' !important;'; if (mobile) { text = $(this).html(); if (text != 'Позвонить') text = phone; $(this).replaceWith(''+text+''); } else $(this).replaceWith(''+phone+''); }); $('head').append(''); $('.ag_phone_cont').addClass('ag_phone_set'); if (mobile) window.location.assign($('a.ag_phone_set:eq(0)').attr('href')); } $('.ag_get_phone').data('set',1); } }); } return false; }); if ($('#awidget').attr('data-company-name')!=undefined) b_name='Хотите связаться с "'+$('#awidget').attr('data-company-name')+'"'; else b_name='Интересует ЖК "Master Place"'; if( !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { $('body').append('
Давайте мы перезвоним Вам за 40 секунд и ответим на интересующие вопросы?
Мы позвоним Вам '+date0+' в '+time+' на номер '+phone+' по ЖК "Master Place".
'); $.post("https://spbguru.ru/main/callback_schedule", { id: "3319", p: phone, d: date, t: time }); } else { $('.callback_modal div:not(.agree_cnt) *:not(em)').hide(); $('.callback_modal div.agree_cnt').hide(); $('.callback_modal div:not(.agree_cnt)').prepend('Мы соединяем Вас с менеджером...'); $.post("https://spbguru.ru/main/callback", { id: "3319", p: phone }); clb_timer = 4000; clb_timer_ref = setInterval(function(){ clb_timer--; s = clb_timer; ms = s % 100; s = (s - ms) / 100; secs = s % 60; s = (s - secs) / 60; mins = s % 60; ms = ms.toLocaleString('en-US', { minimumIntegerDigits: 2, useGrouping:false }); secs = secs.toLocaleString('en-US', { minimumIntegerDigits: 2, useGrouping:false }); mins = mins.toLocaleString('en-US', { minimumIntegerDigits: 2, useGrouping:false }); str = mins + ':' + secs + ':' + ms; $('.callback_modal em').text(str); if (clb_timer==0) { $('.callback_modal em').hide(); $('.callback_modal .s1').remove(); $('.callback_modal *:not(i)').hide(); $('.callback_modal').append('Вам позвонил наш менеджер?ДаНет'); $('.clb_y').bind('click',function(){ $('.callback_modal i').click(); return false; }); $('.clb_n').bind('click',function(){ $('.callback_modal .s1').remove(); $('.callback_modal > div, .callback_modal > div *').show(); $('.callback_modal span.t span').click(); $('.callback_modal').prepend('Приносим наши извинения'); $('.callback_modal p.s1').text('Давайте мы попробуем еще раз Вам позвонить'); $('.callback_modal input[name=phone]').val(phone); return false; }); clearInterval(clb_timer_ref); } },10); } } else $('.callback_modal input[name=phone]').addClass('e'); }); $('.callback_modal input[name=phone]').bind('keyup',function(){ phone = $(this).val(); if (phone.substr(0,6)=="+7 (79" || phone.substr(0,6)=="+7 (89") { if ($('#phone_hint').length==0) $(this).after(''); $('#phone_hint').text("Вероятней всего вы указали лишнюю цифру "+phone.substr(4,1)+". Проверьте правильность номера."); } else $('#phone_hint').remove(); }); $('.callback_modal span.t span').bind('click',function(){ $('.callback_modal p, .callback_modal em, .callback_modal span').hide(); var d1 = new Date(); var d2 = new Date(); var d3 = new Date(); d1.setDate(d1.getDate()+2); d2.setDate(d2.getDate()+3); d3.setDate(d3.getDate()+4); $('.callback_modal b').after('Выберите удобное время для звонка