var clb_timer, clb_timer_ref, clb_autoload_timer;
var first = true;
var agent_wts=0;
var agent_wte=24;
var agent_is_developer=false;
var agent_build_id=3245;
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;
if (agent_is_developer)
$('.is_developer').css('display','inline-block');
$('body').removeClass('no_calls');
$('.callback').show();
MakeCallbackWidget();
}
};
function MakeCallbackWidget() {
$('.ag_phone_cont, .callback_form').show();
$('.ag_phone_cont em').html('+7 (499) 350-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: 4652, source: 2, 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();
$(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='Интересует ЖК "AFI Tower"';
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
$('.callback_modal').addClass('callback_mini');
$('.callback_modal span.t span').text('Выбрать удобное время для звонка');
}
}