var referer = document.referrer, utm = '', lastTextId = 1, noclickevent = false, superhider = 0, zvonim = 0, millisec = 0, onSiteTimer = null,
leaveShown = false, seconds = 29, timer, viewport = '', autoShown = false, sendPerezvonokMail = function() { };
function clb_send22(form) {
var f = $("#"+form);
$.ajax({
method: 'get',
url: Yii.app.createUrl('site/miniZayavkaAdvert'),
data: f.serialize(),
success: function(html){
console.log(html);
showPanel(0);
}
});
}
function magicc(type, textId, auto, yandexEvent) {
if(jQuery("#clb_div").css('display') != 'none') return;
auto = auto || false;
textId = textId || 1;
if(noclickevent) {
noclickevent = false;
return;
}
//console.log(document.getElementById("clb_div").style.display);
if(document.getElementById("clb_div").style.display == 'block') {
return;
}
var altag = document.body.childNodes;
for(var v in altag) {
altag[v].className = altag[v].className + ' iblur';
}
jQuery("#clb_div").fadeIn(250);
jQuery('.perezvonok-mobile').addClass('perezvonok-mobile-open').removeClass('perezvonok-mobile');
document.querySelector("#wicontainer").className = "";
jQuery('.perezvonok-knopka, .perezvonok-text').hide();
lastTextId = textId;
jQuery('#perezvonok-text-' + textId).show();
}
function whide(type) {
var elems = document.body.childNodes;
for (var i in elems) {
if (elems[i].className) {
elems[i].className = elems[i].className.replace('iblur', '');
}
}
jQuery('#clb_div').fadeToggle(200);
jQuery('.perezvonok-knopka').show();
}
var element = document.createElement('div');
element.id = 'wicontainer';
element.innerHTML = '
';
if (superhider == 0) {
document.body.appendChild(element);
}
function addOnloadEvent(fnc){
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", fnc, false );
else if ( typeof window.attachEvent != "undefined" ) {
window.attachEvent( "onload", fnc );
}
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
window[fnc]();
};
}
else
window.onload = fnc;
}
}
setInterval(function() {
var s = 1, h = 0;
if(jQuery('.perezvonok-btn-container .perezvonok-btn-slide').eq(0).css('display') == 'none') {
s = 0; h = 1;
}
jQuery('.perezvonok-btn-container .perezvonok-btn-slide').eq(h).fadeOut('fast');
jQuery('.perezvonok-btn-container .perezvonok-btn-slide').eq(s).fadeIn('fast');
}, 3000);
var zvonok = document.getElementsByClassName('perezvonok-knopka').length > 0 ? document.getElementsByClassName('perezvonok-knopka')[0] : null;
if(zvonok) {
zvonok.style.position = 'fixed';
zvonok.ondragstart = function() { return false; };
}
function showPanel(number) {
var panels = document.getElementsByClassName('panels');
for(var i = 0; i < panels.length; ++i) {
panels[i].style.display = 'none';
}
document.getElementById('clb-panel_' + number).style.display = 'block';
}
$.mask.definitions["h"] = "[0-9]";
$(".telefon2").mask("+7 (hhh) hhh-hh-hh");
$('#perezvon_common').click(function(){
magicc(0);
return false;
});
$('#clb_banner_delay_link').click(function(){
$('#clb_phone2').val($('#clb_phone').val());
});
$('#clb_banner_delay_link2').click(function(){
$('#clb_phone').val($('#clb_phone2').val());
});