").append(ie.parseHTML(e)).find(r):e)}).complete(n&&function(e,t){a.each(n,i||[e.responseText,t,e])}),this},ie.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ie.fn[t]=function(e){return this.on(t,e)}}),ie.expr.filters.animated=function(e){return ie.grep(ie.timers,function(t){return e===t.elem}).length};var rn=e.document.documentElement;return ie.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l,c=ie.css(e,"position"),d=ie(e),f={};"static"===c&&(e.style.position="relative"),s=d.offset(),o=ie.css(e,"top"),u=ie.css(e,"left"),l=("absolute"===c||"fixed"===c)&&ie.inArray("auto",[o,u])>-1,l?(r=d.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),ie.isFunction(t)&&(t=t.call(e,n,s)),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):d.css(f)}},ie.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){ie.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o)return t=o.documentElement,ie.contains(t,i)?(typeof i.getBoundingClientRect!==Ce&&(r=i.getBoundingClientRect()),n=V(o),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===ie.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),ie.nodeName(e[0],"html")||(n=e.offset()),n.top+=ie.css(e[0],"borderTopWidth",!0),n.left+=ie.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-ie.css(r,"marginTop",!0),left:t.left-n.left-ie.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||rn;e&&!ie.nodeName(e,"html")&&"static"===ie.css(e,"position");)e=e.offsetParent;return e||rn})}}),ie.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);ie.fn[e]=function(r){return De(this,function(e,r,i){var o=V(e);return void 0===i?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(n?ie(o).scrollLeft():i,n?i:ie(o).scrollTop()):e[r]=i)},e,r,arguments.length,null)}}),ie.each(["top","left"],function(e,t){ie.cssHooks[t]=k(ne.pixelPosition,function(e,n){return n?(n=tt(e,t),rt.test(n)?ie(e).position()[t]+"px":n):void 0})}),ie.each({Height:"height",Width:"width"},function(e,t){ie.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){ie.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");
return De(this,function(t,n,r){var i;return ie.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===r?ie.css(t,n,a):ie.style(t,n,r,a)},t,o?r:void 0,o,null)}})}),typeof t===Ce&&(e.jSCB=ie),ie.noConflict=function(){},ie});
!function(e){function t(){var e=document.createElement("input"),t="onpaste";return e.setAttribute(t,""),"function"==typeof e[t]?"paste":"input"}var n,a=t()+".mask",r=navigator.userAgent,i=/iphone/i.test(r),o=/android/i.test(r);e.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},dataName:"rawMaskFn",placeholder:"_"},e.fn.extend({caret:function(e,t){var n;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof e?(t="number"==typeof t?t:e,this.each(function(){this.setSelectionRange?this.setSelectionRange(e,t):this.createTextRange&&(n=this.createTextRange(),n.collapse(!0),n.moveEnd("character",t),n.moveStart("character",e),n.select())})):(this[0].setSelectionRange?(e=this[0].selectionStart,t=this[0].selectionEnd):document.selection&&document.selection.createRange&&(n=document.selection.createRange(),e=0-n.duplicate().moveStart("character",-1e5),t=e+n.text.length),{begin:e,end:t})},unmask:function(){return this.trigger("unmask")},mask:function(t,r){var c,l,s,u,f,h;return!t&&this.length>0?(c=e(this[0]),c.data(e.mask.dataName)()):(r=e.extend({placeholder:e.mask.placeholder,completed:null},r),l=e.mask.definitions,s=[],u=h=t.length,f=null,e.each(t.split(""),function(e,t){"?"==t?(h--,u=e):l[t]?(s.push(RegExp(l[t])),null===f&&(f=s.length-1)):s.push(null)}),this.trigger("unmask").each(function(){function c(e){for(;h>++e&&!s[e];);return e}function d(e){for(;--e>=0&&!s[e];);return e}function m(e,t){var n,a;if(!(0>e)){for(n=e,a=c(t);h>n;n++)if(s[n]){if(!(h>a&&s[n].test(R[a])))break;R[n]=R[a],R[a]=r.placeholder,a=c(a)}b(),x.caret(Math.max(f,e))}}function p(e){var t,n,a,i;for(t=e,n=r.placeholder;h>t;t++)if(s[t]){if(a=c(t),i=R[t],R[t]=n,!(h>a&&s[a].test(i)))break;n=i}}function v(e){var t,n,a,r=e.which;8===r||46===r||i&&127===r?(t=x.caret(),n=t.begin,a=t.end,0===a-n&&(n=46!==r?d(n):a=c(n-1),a=46===r?c(a):a),k(n,a),m(n,a-1),e.preventDefault()):27==r&&(x.val(S),x.caret(0,y()),e.preventDefault())}function g(t){var n,a,i,l=t.which,u=x.caret();t.ctrlKey||t.altKey||t.metaKey||32>l||l&&(0!==u.end-u.begin&&(k(u.begin,u.end),m(u.begin,u.end-1)),n=c(u.begin-1),h>n&&(a=String.fromCharCode(l),s[n].test(a)&&(p(n),R[n]=a,b(),i=c(n),o?setTimeout(e.proxy(e.fn.caret,x,i),0):x.caret(i),r.completed&&i>=h&&r.completed.call(x))),t.preventDefault())}function k(e,t){var n;for(n=e;t>n&&h>n;n++)s[n]&&(R[n]=r.placeholder)}function b(){x.val(R.join(""))}function y(e){var t,n,a=x.val(),i=-1;for(t=0,pos=0;h>t;t++)if(s[t]){for(R[t]=r.placeholder;pos++
a.length)break}else R[t]===a.charAt(pos)&&t!==u&&(pos++,i=t);return e?b():u>i+1?(x.val(""),k(0,h)):(b(),x.val(x.val().substring(0,i+1))),u?t:f}var x=e(this),R=e.map(t.split(""),function(e){return"?"!=e?l[e]?r.placeholder:e:void 0}),S=x.val();x.data(e.mask.dataName,function(){return e.map(R,function(e,t){return s[t]&&e!=r.placeholder?e:null}).join("")}),x.attr("readonly")||x.one("unmask",function(){x.unbind(".mask").removeData(e.mask.dataName)}).bind("focus.mask",function(){clearTimeout(n);var e;S=x.val(),e=y(),n=setTimeout(function(){b(),e==t.length?x.caret(0,e):x.caret(e)},10)}).bind("blur.mask",function(){y(),x.val()!=S&&x.change()}).bind("keydown.mask",v).bind("keypress.mask",g).bind(a,function(){setTimeout(function(){var e=y(!0);x.caret(e),r.completed&&e==x.val().length&&r.completed.call(x)},0)}),y()}))}})}(jSCB);
if (typeof main_scb == 'undefined') {
main_scb = 'https://crm.smartcallback.ru/server_core.php';
token = '';
scbUdVvod = 'no';
gaIsOn = 'yes';
secondsToCall = 27;
porogActivity = 5000;
openLeave = 'no';
openLeavePause = 10;
pauseToShow = 37;
agressiveExit = 'no';
yaCounter = '';
canShow = -1;
countShow = 3;
reason_off = 1;
openCount = 3;
operators = true;
followLink = '';
indexActivity = 0;
try_count = 0;
try_count_fail = 0;
jquery_create = 0;
visit_session = 0;
mainButton = 'yes';
callLink = '';
openTypeGlobal = 0;
scbCallTrackIntegratorId = 'none';
scbEnabledMV = 'no';
scbButtonTitle_duringCallme = 'Отправляем...';
scbButtonTitle_afterCallme = 'Отправлено';
scbAjaxPagerCP = "";
op_phone = '';
scbAlreadyLoaded = false;
scb_rid = 0;
SCB_cid = 0;
var SmartCallBack = new (function(){
"use strict";
this.flags = {
skipQuestion: false,
butNoClose: false,
directCallMode: false,
hiddenCounter: false,
inactionShow: false,
potentialClient: false,
potentialClientSended: false,
isWorkTimeNow: false,
canConvTimeSelected: false,
querySended: false,
asm: {
enable: false,
shh: 0
},
outerServicesTrackers: {
jivochat: {
jivo_opened_timer_id: 0
}
},
widgetReady: false,
mobile_direct_with_records: false
};
this.beforeReloadVars = {
openLeave: true
};
this.counters = {
directCallAttemptsCounter: 0,
secToCall: 27
};
this.objects = {
directCallResObj: {
enable: false,
version: 2,
qfform: 0,
dcForm: 0,
fields: {}
},
directCallData: {},
curr_els: {},
goals: {},
thcall: {
enable: false,
stop_timer: false,
pairs: {},
but_types: {},
res: {}
}
};
this.timers = {
goals: {
own: {
onScroll: {
id: 0
}
}
},
thcall: {
activityNuller: 0
}
};
this.maps = {};
this.vars = {
curr_sel_type: "",
vid: 0,
session_time: 30,
entered_number_country: 7,
thblock_id: 0,
sid: 0,
cur_action: "call",
inactionPause: 0,
iaForInaction: 0,
qcount: 0,
mob_multiple_factor: 1,
firstWorkHour: 9,
lastWorkHour: 18,
callTrackId: '',
mobile_direct_recheck_time: 10000
};
this.asmChecker = function(){
try {
var shh = getCookie('SCBshh');
if (SmartCallBack.flags.asm.shh == 0){
if (shh && shh > 0){
SmartCallBack.flags.asm.shh = shh;
}else{
SmartCallBack.flags.asm.shh = 1;
setCookie('SCBshh', 1, 10 * 3600000, '/');
}
}else{
if (!shh){
setCookie('SCBshh', SmartCallBack.flags.asm.shh, 10 * 3600000, '/');
}
}
}catch(e){}
};
this.prepareDirectCall = function(){
var formCanPrepare = false,
sendButtonPosition = 0;
if (SmartCallBack.objects.directCallData.forms.length > 0){
for (var i = 0; i < SmartCallBack.objects.directCallData.forms.length; i++){
formCanPrepare = false;
sendButtonPosition = 0;
if (SmartCallBack.objects.directCallData.forms[i].elements.length > 1){
for (var j = 0; j < SmartCallBack.objects.directCallData.forms[i].elements.length; j++){
if (SmartCallBack.objects.directCallData.forms[i].elements[j].type == 6){
formCanPrepare = true;
sendButtonPosition = j;
}
if (SmartCallBack.objects.directCallData.forms[i].elements[j].type == 5
&& SmartCallBack.objects.directCallData.forms[i].elements[j].is_mask_used == 1){
jSCB(document).on('focus', SmartCallBack.objects.directCallData.forms[i].elements[j].selector, function(){
jSCB(this).mask("+7(999)999-99-99");
});
}
}
if (formCanPrepare === true){
jSCB(document).on('click', SmartCallBack.objects.directCallData.forms[i].elements[sendButtonPosition].selector, {formSerialNumber: i}, function(event){
console.log('call');
var element = {}, canSend = true, qtype = '', isConvTimeSetted = false, convTime = '',
fieldValue = '', selectValue = '', optionValue = '', data = {}, ctOpPhone = '';
if (scbCallTrackIntegratorId != '' && scbCallTrackIntegratorId != 'none'){
if (jSCB(scbCallTrackIntegratorId)){
ctOpPhone = jSCB(scbCallTrackIntegratorId).html();
if (ctOpPhone) {
ctOpPhone = ctOpPhone.replace(/[^\d]/gi, "");
if (ctOpPhone.length != 11) {
canSend = false;
}
}
}else{
if (window.location.href.indexOf("my-homes.ru")>0){
if (jSCB("#comagic_phone_72") || jSCB("#comagic_phone_90")){
ctOpPhone = jSCB("#comagic_phone_72").html() || jSCB("#comagic_phone_90").html();
ctOpPhone = ctOpPhone.replace(/[^\d]/gi, "");
if (ctOpPhone.length != 11) {
canSend = false;
}
}
}
}
}
for (var i = 0; i < SmartCallBack.objects.directCallData.forms[event.data.formSerialNumber].elements.length; i++){
element = SmartCallBack.objects.directCallData.forms[event.data.formSerialNumber].elements[i];
if (element.type == 6) continue; // Если это кнопка отправки формы - переходим к следующему элементу
SmartCallBack.objects.directCallResObj.fields[i] = {};
if (element.type == 5 && jSCB(element.selector).length > 0){ // Поле с телефоном
var phoneNumber = jSCB(element.selector).val() || "";
phoneNumber = phoneNumber.length > 0 ? phoneNumber.replace(/[^\d]/gi, "") : phoneNumber;
if ((phoneNumber.length == 11 && (phoneNumber.charAt(0) == 7 || phoneNumber.charAt(0) == 8)) || (phoneNumber.length == 10)){
qtype = 'new_query';
if (phoneNumber.length == 10)
phoneNumber = '7' + phoneNumber;
phoneNumber = '+7(' + phoneNumber.slice(1, 4) + ')' + phoneNumber.slice(4, 7) + '-' + phoneNumber.slice(7, 9) + '-' + phoneNumber.slice(9, 11);
data['phone'] = phoneNumber;
SmartCallBack.objects.directCallResObj.fields[i].name = element.title;
SmartCallBack.objects.directCallResObj.fields[i].val = phoneNumber;
}else{
if (element.is_required == 1){
canSend = false;
}
}
}else if (element.type == 1){ // Текстовое поле
fieldValue = jSCB(element.selector).val() || "";
if (fieldValue.length > 0){
// Заполняем данные
SmartCallBack.objects.directCallResObj.fields[i].name = element.title;
SmartCallBack.objects.directCallResObj.fields[i].val = fieldValue;
}else if (element.is_required == 1){
canSend = false;
}
}else if (element.type == 2){ // Выпадающий список
selectValue = jSCB(element.selector).val() || "";
if (selectValue.length > 0){
optionValue = jSCB(element.selector).find('option[value="' + selectValue + '"]').text() || "";
if (optionValue.length > 0){
selectValue = optionValue;
}
SmartCallBack.objects.directCallResObj.fields[i].name = element.title;
SmartCallBack.objects.directCallResObj.fields[i].val = selectValue;
}else if (element.is_required == 1){
canSend = false;
}
}else if (element.type == 3){ // Переключатель (радиобатон)
}else if (element.type == 4){ // Флажок
}else if (element.type == 7){ // Селектор с удобным временем
convTime = parseInt(jSCB(element.selector).val()) || 0;
if (convTime > 1){
isConvTimeSetted = true;
}
convTime += ':00';
}else if (element.type == 8){ // Поле с email
var emailValue = jSCB(element.selector).val() || "";
if (emailValue.length > 0){
if (qtype == '')
qtype = 'new_email';
data['v_email'] = emailValue;
}else if (element.is_required == 1){
canSend = false;
}
}
}
if (canSend === true && qtype != ''){
SmartCallBack.objects.directCallResObj.enable = true;
SmartCallBack.objects.directCallResObj.qfform = 1;
SmartCallBack.objects.directCallResObj.dcForm = SmartCallBack.objects.directCallData.forms[event.data.formSerialNumber].id;
var date = new Date(),
SCBpages = parseInt(sessionStorage.getItem('SCBpages')),
pages = '';
if (SCBpages > 0) {
for (var j = 1; j <= SCBpages; j++) {
pages = pages + '-+-' + sessionStorage.getItem('SCBpage_' + j);
}
}
data['action'] = qtype;
data['token'] = token;
data['rid'] = scb_rid;
data['vid'] = SmartCallBack.vars.vid;
data['scenario'] = getCookie('SCB_scenario');
data['time_in_site'] = (date.getTime() - parseInt(getCookie('SCBstart')));
data['curUrl'] = window.location.href;
data['firstPage'] = sessionStorage.getItem('SCBpage_1');
data['pages'] = pages;
data['timeZone'] = (-date.getTimezoneOffset() / 60);
data['udobnoe'] = convTime;
data['scb_from'] = getCookie('SCBfrom');
data['openType'] = openTypeGlobal;
data['visit_session'] = visit_session;
data['SCB_cid'] = SCB_cid;
data['directCallRes'] = SmartCallBack.objects.directCallResObj;
data['vsid'] = SmartCallBack.vars.sid;
data['op_phone'] = ctOpPhone;
if (isConvTimeSetted === true){
// Выбрано удобное время
data['scbUdVvod'] = 'yes';
}else{
data['scbUdVvod'] = 'no';
}
jSCB.ajax({
url: main_scb + "?rnd=" + Math.floor(Math.random() * 1000001) + '444',
cache: false,
crossDomain: true,
type: "POST",
data: data,
success: function(response){
SmartCallBack.objects.directCallResObj.enable = false;
SmartCallBack.objects.directCallResObj.qfform = 0;
SmartCallBack.objects.directCallResObj.dcForm = 0;
}
});
}
});
}
}
}
}
};
this.sendSlave = function(data){
var ifr = document.getElementById("scbsidsholder"),
messanger = ifr.contentWindow;
if (typeof messanger.window.postMessage === "function") {
messanger.window.postMessage(data, window.location.protocol + "//smartcallback.ru");
}
};
this.crossListener = function(e){
try{
if (e.origin === window.location.protocol + "//smartcallback.ru") {
if (e.data.action === "sid") {
if (e.data.sid === 0) {
if (token == 'hgjkeGh4jgRldmejgtGbfjk34fd' || true) {
jSCB.ajax({
url: main_scb + "/?rnd=" + Math.floor(Math.random() * 1000001),
cache: false,
crossDomain: true,
type: "POST",
data: {
'action': 'visitor_sid',
'token': token,
'referrer': document.referrer,
'country': SmartCallBack.maps.geolocation.country,
'city': SmartCallBack.maps.geolocation.city,
'region': SmartCallBack.maps.geolocation.region,
'timeZone': -(new Date()).getTimezoneOffset() / 60,
'screenWidth': screen.width,
'screenHeight': screen.height,
'browser': navigator.userAgent,
'platform': navigator.platform,
//'plugins': navigator.plugins,
'GAcid': getCookie('_ga') || "0.0.0.0"
},
success: function (content) {
if (content != '') {
var dat = eval('(' + content + ')');
//console.info(content);
// При получении сида для посетителя - отправляем его в куки iframe и ставим в куки тут
SmartCallBack.vars.sid = dat.sid;
SmartCallBack.sendSlave({action: "sid", sid: dat.sid});
setCookie("scbsid", dat.sid, 20 * 365 * 24 * 3600 * 1000, "/");
setCookie("SCBsession", dat.session, SmartCallBack.vars.session_time * 60 * 1000, "/");
}
},
complete: function () {
//console.info('sid');
}
});
}
} else {
// Уникальный идентификатор уже присвоен
if (getCookie("scbsid") !== e.data.sid) {
setCookie("scbsid", e.data.sid, 10 * 365 * 24 * 3600 * 1000, '/');
}
SmartCallBack.vars.sid = e.data.sid;
}
}
}
}catch(e){}
};
this.callStatus = function (callId, selector){
var SCB_interval=setInterval(function(){
jSCB.ajax({
url:'https://crm.smartcallback.ru/ajax/callstatus.php?callId='+callId+'&rnd='+Math.floor(Math.random() * 1000001) + '666',
cache: false,
crossDomain: true,
type: "POST",
success: function(data){
if(data!=""){
jSCB(selector).text(data);
//console.log(data);
if(data=='Нет ответа'||data=='Завершено оператором'||data=='Завершено посетителем'||data=='Обрыв связи'){
clearInterval(SCB_interval);
}
}else{
jSCB(selector).text('Завершено');
clearInterval(SCB_interval);
}
}
});
},2000);
};
this.THInit = function(){
if (jSCB(".scb_callback_adblock").length > 0){
var th_i = 0;
jSCB(".scb_callback_adblock").each(function(){
if (th_i < 50) {
SmartCallBack.objects.thcall.pairs[jSCB(this).attr("callback_id")] = jSCB(this).attr("callback_type");
SmartCallBack.objects.thcall.but_types[jSCB(this).attr("callback_type")] = jSCB(this).attr("callback_type");
th_i++;
}
});
jSCB.ajax({
url: main_scb + "/?rnd=" + Math.floor(Math.random() * 1000001),
cache: false,
crossDomain: true,
type: "POST",
data: {
'action': 'thcall_init',
'token': token,
'cur_page': window.location.href,
'thcall_pairs': SmartCallBack.objects.thcall.pairs,
'thcall_buttypes': SmartCallBack.objects.thcall.but_types,
'availWidth': screen.availWidth
},
success: function(content){
content = JSON.parse(content);
SmartCallBack.objects.thcall.pairs = {};
th_i = null;
if (content.thcall != "nodata" && typeof content.thcall == "object"){
SmartCallBack.objects.thcall.res = content.thcall;
jSCB(".scb_callback_adblock").each(function(){
jSCB(this).html("");
if (content.thcall[jSCB(this).attr("callback_id")] !== undefined){
jSCB(this).html( content.thcall.buttons[jSCB(this).attr("callback_type")]).click(function(event){
event.preventDefault();
SmartCallBack.THcall(this);
});
}
});
}
}
});
}
};
this.THcall = function(el){
if (jSCB){
SmartCallBack.objects.thcall.stop_timer = false;
var block_id = jSCB(el).attr("callback_id");
var unix_time = Math.round(new Date().getTime() / 1000);
jSCB("#scb_button_wait").text(SmartCallBack.objects.thcall.res[block_id].texts.scb_yes.button_send);
jSCB("#scb_yes .scb_text").text(SmartCallBack.objects.thcall.res[block_id].texts.scb_yes.about);
if (unix_time < parseInt(SmartCallBack.objects.thcall.res[block_id].tstart) || unix_time > parseInt(SmartCallBack.objects.thcall.res[block_id].tend)){
secondsToCall = 1;
scbUdVvod = 'yes';
jSCB('#sample_countdown').css('display', 'none');
jSCB('#scb_left_to_call').css('display', 'none');
jSCB('#scb_udobnoe_block').fadeIn(0);
jSCB("#scb_yes .scb_titles").text(SmartCallBack.objects.thcall.res[block_id].texts.scb_yes.off_hours_title);
var hours = "", i = new Date(parseInt(SmartCallBack.objects.thcall.res[block_id].tstart) * 1000).getHours(),
j = new Date(parseInt(SmartCallBack.objects.thcall.res[block_id].tend) * 1000).getHours();
while (i < j){
hours += '