window['_top100q'] = window['_top100q'] || [];
window['_top100q'].push(['ae7.setAccount', '3146510']);
(function() {
var pa = document.createElement("script");
pa.type = "text/javascript";
pa.async = true;
pa.src = ("https:" == document.location.protocol ? "https:" : "http:") + "//st.top100.ru/top100/top100.js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(pa, s);
})();
(function() {
if (typeof _montblanc != 'undefined') {
var _mon = true;
} else {
var _mon = false;
console.log('_montblanc doesnt included');
}
if (typeof window['Adf'] != 'undefined') return;
var Adf = {};
Adf.dom = {};
Adf.counter = 1;
Adf.util = {
VERSION: 1,
START_TIME: new Date(),
debugBase: window.location.search.indexOf('adfox_debug=1') !== -1,
debugExtend: window.location.search.indexOf('adfox_debug=2') !== -1,
nolimits: window.location.search.indexOf('adFox_nolimits=1') !== -1,
DOC_READY: false,
CRTG_CONTENT: (typeof crtg_getCookie == 'function') ? crtg_getCookie(crtg_cookiename) : '',
getBodyScrollTop: function(opt_win) {
var _window = opt_win || window;
return _window.pageYOffset || (_window.document.documentElement && _window.document.documentElement.scrollTop) || (_window.document.body && _window.document.body.scrollTop);
},
getBodyScrollLeft: function(opt_win) {
var _window = opt_win || window;
return _window.pageXOffset || (_window.document.documentElement && _window.document.documentElement.scrollLeft) || (_window.document.body && _window.document.body.scrollLeft);
},
trackPixel: function(url) {
var tracking_url = url;
var Pixel_imp = new Image();
if (tracking_url != '') {
Pixel_imp.src = tracking_url;
tracking_url = '';
}
},
getElementPosition: function(id, opt_doc) {
var _document = opt_doc || document,
elem = _document.getElementById(id),
elemPos = {};
if (elem) {
elemPos['width'] = elem.offsetWidth;
elemPos['height'] = elem.offsetHeight;
elemPos['left'] = 0;
elemPos['top'] = 0;
while (elem) {
elemPos['left'] += elem.offsetLeft;
elemPos['top'] += elem.offsetTop;
elem = elem.offsetParent;
}
return elemPos;
} else {
return false;
}
},
createScript: function(src, is_async, opt_doc) {
var _document = opt_doc || document,
el = _document.createElement('script');
el.src = src;
el.type = 'text/javascript';
el.async = !! is_async;
return el;
},
insertScript: function(script, opt_doc) {
var _document = opt_doc || document,
f = _document.getElementsByTagName('script')[0];
f.parentNode.insertBefore(script, f);
},
getProtocol: function(opt_doc) {
var _document = opt_doc || document;
return _document.location.protocol == 'https:' ? 'https:' : 'http:';
},
getScreenSize: function() {
var scrheight = '',
scrwidth = '';
if (self.screen) {
scrwidth = screen.width;
scrheight = screen.height;
} else if (self.java) {
var jkit = java.awt.Toolkit.getDefaultToolkit(),
scrsize = jkit.getScreenSize();
scrwidth = scrsize.width;
scrheight = scrsize.height;
}
if (scrwidth && scrheight) {
return [scrwidth, scrheight]
} else {
return ['', '']
}
},
getWindowSize: function(opt_win) {
var width,
height,
_window = opt_win || window;
if (typeof(_window.innerWidth) == 'number') {
width = _window.innerWidth;
height = _window.innerHeight;
} else if (_window.document.documentElement && (_window.document.documentElement.clientWidth || _window.document.documentElement.clientHeight)) {
width = _window.document.documentElement.clientWidth;
height = _window.document.documentElement.clientHeight;
} else if (_window.document.body && (_window.document.body.clientWidth || _window.document.body.clientHeight)) {
width = _window.document.body.clientWidth;
height = _window.document.body.clientHeight;
}
return {
"width": width,
"height": height
};
},
getDate: function() {
var addate = new Date();
return {
'date': addate.getDate(),
'day': addate.getDay(),
'hour': addate.getHours()
}
},
wrapScript: function(source) {
return '' + source + '';
},
createElement: function(elem, opt_id, opt_class, opt_doc) {
var _document = opt_doc || document,
elm = _document.createElement(elem);
if (typeof opt_id == 'string') elm.setAttribute('id', opt_id);
if (typeof opt_class == 'string') elm.className += opt_class;
return elm;
},
getCodeScript: function(i, src, id, banner_place, opt_callback) {
var frameDocument;
if (i < 10) {
try {
if (document.all && !window.opera) {
frameDocument = window.frames[id].document;
} else if (document.getElementById) {
frameDocument = document.getElementById(id).contentDocument;
}
} catch (e) {}
if (frameDocument && (frameDocument.readyState == 'complete' || frameDocument.readyState == 'interactive')) {
frameDocument.write('<\/scr' + 'ipt>');
Adf.inner.checkBannerLoaded(banner_place, opt_callback, 1);
} else {
setTimeout(function() {
Adf.util.getCodeScript(++i, src, id)
}, 100);
}
} else if (i == 10) {
window.console.log('Can not access to frameDocument && frameWindow; id = ' + id);
Adf.inner.checkBannerLoaded(banner_place, opt_callback, 0);
}
},
createAdIframe: function(id, opt_doc) {
var _document = opt_doc || document,
ifr = _document.createElement('iframe');
ifr.setAttribute('id', id);
ifr.setAttribute('marginwidth', '0');
ifr.setAttribute('marginheight', '0');
ifr.setAttribute('scrolling', 'no');
ifr.setAttribute('frameBorder', '0');
ifr.setAttribute('width', '1');
ifr.setAttribute('height', '1');
ifr.style.position = 'absolute';
return ifr;
},
getReferrer: function() {
if (typeof(document.referrer) != 'undefined') {
if (typeof(afReferrer) == 'undefined') {
var afReferrer = escape(document.referrer);
}
} else {
var afReferrer = '';
}
return afReferrer;
},
ajaxLoad: function(url, callback, data, x) {
try {
x = new(window.XMLHttpRequest || ActiveXObject)('MSXML2.XMLHTTP.3.0');
x.open(data ? 'POST' : 'GET', url, 1);
x.onreadystatechange = function() {
x.readyState > 3 && callback && callback(x.responseText, x);
};
x.send(data)
} catch (e) {
window.console && console.log(e);
}
},
viewAbility: {
create: function (random, url, timing, percent) {
new Object({
createSelf: function (object, url, specialKey, timing, percent) {
var _this = this, stack = Adf.util.viewAbility.stack;
var ff = new Object();
this._mark = true;
this.urlEvent = url;
this.object = object;
this.random = specialKey;
this.time = typeof(timing) !== 'undefined' ? timing : 2000;
this.percentM = typeof(percent) !== 'undefined' ? percent : 50;
this.debugMode = false;
this.debug = function (type, mess, debugBody) {
return this.debugMode && type == 'err' ? console.warn(mess, debugBody) || (function () {
throw new Error('system error')
})() :
this.debugMode && ( type == 'info' || type == 'exit' ) ? console.info(mess, debugBody) : false;
};
//object: parent.document.getElementById('AdFox_banner_%random1%'),
this.win = new Object();
this._cr = new Object();
this._getAbsPercent = function () {
var _s = this.getPercent();
return _s < 0 ? false : _s > 1 ? false : _s
};
this.insertPixel = function (URLs) {
for (var i = 0; i < URLs.length && URLs[i]; i++) {
if (!URLs[i].match(/adfox\.ru\/transparent\.gif$/)) {
(new Image()).src = URLs[i];
}
}
stack[random].viewed = true;
return true;
};
this.getPercent = function () {
return this._cr.innerPosition ? 1 : (this.win.y || this.win.y == 0 ) && (this.win.y < this._cr._top) ?
(this.win.y + this.win.h - this._cr._top) / this._cr.height :
(this.win.y - Math.abs(this._cr._top)) < this.win.y ?
//(Math.abs(this.win._s._top) - Math.abs(this._cr._top)) / this.win._s.height : false
//1 - Math.abs(this._cr._top) / this._cr.height
(this._cr._top + this._cr.height - this.win.y) / this._cr.height : false;
};
this.checkInputVar = function () {
return this.random ? this.urlEvent ? this.object ? (function (_e) {
return _e.debug('info', 'viewAbility: ' + _e.random + ' viewability sript was Inited', _e) || true;
})(this) : this.debug('err', 'viewAbility : Error in setting params of execute \t - \t Out of Parent DIV ', this) :
this.debug('err', 'viewAbility : Error in setting params of execute \t - \t Out of URL VIEW EVENT ', this) :
this.debug('err', 'viewAbility : Error in setting params of execute \t - \t Out of DIV number ', this);
};
this.init = function () {
//var window = parent.window, document = parent.document;
var _f = document.body.getBoundingClientRect(),
_k;
_this._cr = _k = _this.object.getBoundingClientRect();
_this._cr._top = _this._cr.top + window.pageYOffset - document.documentElement.clientTop;
_this.win = {
x: void 0 !== window.pageXOffset ? window.pageXOffset :
(document.documentElement || document.body.parentNode || document.body).scrollLeft,
y: void 0 !== window.pageYOffset ? window.pageYOffset : (document.documentElement ||
document.body.parentNode || document.body).scrollTop,
w: window.innerWidth || document.documentElement.clientWidth ||
document.body.clientWidth,
h: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
_s: _f
};
_this._cr.start = {
banner: _this.win.y + _this._cr.top,
_screen: _this.win.y
};
_this._cr.end = {
banner: _this.win.y + _this._cr.top + _this._cr.height,
_screen: _this.win.y + _this.win.h
};
_this._cr.innerPosition = _this._cr.start.banner > _this._cr.start._screen && _this._cr.end._screen > _this._cr.end.banner;
_this.viewPercent = 100 * _this.getPercent(), _this.viewable = _this.viewPercent > _this.percentM ? true : false;
if (!this._mark) stack[random].veiwPercent = _this.viewPercent < 0 ? '0%' : Math.round(_this.viewPercent) + '%';
return _this.viewable;
};
this.addEvent = function (e, t, n) {
t.addEventListener ? t.addEventListener(e, n, !1) : t.attachEvent ? t.attachEvent("on" + e, n) : t[e] = n;
return true;
};
this.removeEvent = function (e, n, t) {
n.detachEvent ? (n.detachEvent("on" + e, n[e + t]), n[e + t] = null) : n.removeEventListener(e, t, !1);
return true;
};
this.selfInit = function () {
try {
return (function (_s, _f) {
_this.debugMode = _s || _f;
return _this;
})(Adf.util.debugBase, Adf.util.debugExtend) &&
_this.checkInputVar()
&& _this.addEvent('scroll', document, _this.init)
&& _this._time.checkTiming()
&& _this.init() && _this
|| _this;
} catch (e) {
return this.debug('exit', 'viewAbility: I am dead... WHY?? ' + e.message);
}
};
this.checkView = function () {
_this.viewable ? _this._time._vTime < _this.time ? _this._time._vTime += 100 : _this._disableMe() && _this._time.deleteTimer() : _this._time.nullTimer();
};
this._disableMe = function () {
return (this.debugMode && this.debug('info', 'viewAbility: ' + _this.random + ' pixel was Inserted', this)) || this.insertPixel(this.urlEvent.split('|')) && this.removeEvent('scroll', document, this.init) || true;
};
this._time = {
timer: null,
_vTime: 0,
createTimer: function () {
this.timer = setInterval(_this.checkView, 100);
return this.timer;
},
checkTiming: function () {
return this.timer ? true : this.createTimer();
},
deleteTimer: function () {
return this.timer = null !== this.timer ? clearInterval(this.timer) || null : this.timer;
},
nullTimer: function () {
return this._vTime = 0
}
};
stack[random] = {obj: this.selfInit(), viewed: false};
},
preCheck: function (random, url, timing, percent) {
var _this = this;
(function (_e) {
(typeof _e._pc != undefined) ? _this.createSelf(_e.banner.parentNode, url, _e.specialKey, timing, percent) :
_this.createSelf(_e.object, url, _e.specialKey, timing, percent)
})((typeof random != 'object') ? {
_pc: 'adfox',
banner: document.getElementById('AdFox_banner_' + random),
iframe: document.getElementById('AdFox_iframe_' + random),
specialKey: random
} : {object: random.object, specialKey: random.key});
}
}).preCheck(random, url, timing, percent);
},
stack: new Object()
}
};
Adf.init = {
criteo: function(site_id) {
var crtg_nid = site_id,
crtg_cookiename = 'crtg_rta',
crtg_varname = 'crtg_content';
function crtg_getCookie(c_name) {
var i, x, y, ARRCookies = document.cookie.split(";");
for (i = 0; i < ARRCookies.length; i++) {
x = ARRCookies[i].substr(0, ARRCookies[i].indexOf("="));
y = ARRCookies[i].substr(ARRCookies[i].indexOf("=") + 1);
x = x.replace(/^\s+|\s+$/g, "");
if (x == c_name) {
return unescape(y);
}
}
return '';
};
(function() {
var crtg_url = Adf.util.getProtocol() + '//rtax.criteo.com/delivery/rta/rta.js?netId=' + escape(crtg_nid) + '&cookieName=' + escape(crtg_cookiename) + '&rnd=' + Math.floor(Math.random() * 99999999999) + '&varName=' + escape(crtg_varname);
Adf.util.insertScript(Adf.util.createScript(crtg_url, true));
})();
if (Adf.util.debugBase || Adf.util.debugExtend) console.log('Criteo is initialized. Crtg_nid = ' + crtg_nid);
Adf.util.CRTG_CONTENT = crtg_getCookie(crtg_cookiename);
},
begun: function() {
var begun_url = Adf.util.getProtocol() + '//ssp.rambler.ru/autocontext2_async.js';
Adf.util.insertScript(Adf.util.createScript(begun_url, false));
if (Adf.util.debugBase || Adf.util.debugExtend) console.log('Begun is initialized');
}
};
Adf.inner = {
getBegunLevel: function(feed) {
var level = 0,
bannersCount = 0;
for (var bannersType in feed.banners) {
for (i = 0; i < feed.banners[bannersType].length; i++) {
banner = feed.banners[bannersType][i];
bannersCount++;
if (banner.priority && banner.priority > level) {
level = banner.priority;
}
}
}
return bannersCount > 0 ? level + 1 : 0;
},
show_b: function(threshold, startTime, _rand, number, i, div_id, options, options_b, opt_class, win) {
if (div_id == 'begun_test') {
var unicID = Math.floor(Math.random() * 10000000000000),
funcName = 'renderBegunResponse' + unicID;
window[funcName] = function(callback_options) {
options['puid52'] = Adf.inner.getBegunLevel(callback_options);
options['puid53'] = callback_options['params']['impression_id'];
var begunCallbackBeforeAdCall = new Date();
var delta = begunCallbackBeforeAdCall - startTime;
if (threshold) { /* trackPixel */ }
Adf.banner.show(div_id, options, opt_class);
};
var _auctionScriptURL = '//ssp.rambler.ru/context.jsp?pad_id=' + options_b['begun-auto-pad'] + '&block_id=' + options_b['begun-block-id'] + '&json=1&callback=' + funcName + '&first=1&rq_sess=' + unicID + '&secure=' + (document.location.protocol == 'https:' ? '1' : '0') + '&real_refer=' + document.location.href;
var divIdType = typeof div_id;
if (divIdType == 'string') {
var banner_place = document.getElementById(div_id);
} else if (divIdType == 'object') {
var banner_place = div_id;
};
var _auctionScript = Adf.util.createScript(_auctionScriptURL, true);
if (banner_place) {
banner_place.appendChild(_auctionScript);
} else {
console.log('adfox can not insert Begun auction request. Start ordinary adfox adcall');
Adf.banner.show(div_id, options, opt_class);
};
} else {
if (Adf.util.debugExtend) console.log('before_begun_check_call: adCall = ' + number + '; bid = ' + options_b['begun-block-id'] + '; div_id = ' + div_id + '; unic_id = ' + _rand);
if (i < 20) {
if (win.Begun && win.Begun.Autocontext && win.Begun.Autocontext.addBlock) {
Begun.Autocontext.addBlock(options_b, function(level, auction_id, block_id) {
options['puid52'] = level;
options['puid53'] = auction_id;
// debug info
if (Adf.util.debugExtend) console.log('before_ban_call: adCall = ' + number + '; bid = ' + options_b['begun-block-id'] + '; div_id = ' + div_id + '; unic_id = ' + _rand);
var begunCallbackBeforeAdCall = new Date();
var delta = begunCallbackBeforeAdCall - startTime;
if (Adf.util.debugExtend) console.log('begun_callback_time : ' + delta + '; adCall = ' + number + '; bid = ' + options_b['begun-block-id'] + '; div_id = ' + div_id + '; unic_id = ' + _rand);
if (threshold) { /* trackPixel */ }
Adf.banner.show(div_id, options, opt_class, function(b, s) {
var bannerLoadedTime = new Date();
var fullDelta = bannerLoadedTime - startTime;
var bannerLoadDelta = bannerLoadedTime - begunCallbackBeforeAdCall;
if (threshold) { /* trackPixel */ }
});
if (Adf.util.debugExtend) console.log('after_ban_call: adCall = ' + number + '; bid = ' + options_b['begun-block-id'] + '; div_id = ' + div_id + '; unic_id = ' + _rand);
});
} else {
setTimeout(function() {
Adf.inner.show_b(threshold, startTime, _rand, number, ++i, div_id, options, options_b, opt_class, win)
}, 100);
}
} else {
if (Adf.util.debugExtend) console.log('win.Begun.Autocontext.addBlock is not defined.' + '; div_id = ' + div_id);
if (threshold) { /* trackPixel */ }
Adf.banner.show(div_id, options, opt_class);
}
if (Adf.util.debugExtend) console.log('after_begun_check_call: adCall = ' + number + '; bid = ' + options_b['begun-block-id'] + '; div_id = ' + div_id + '; unic_id = ' + _rand);
};
},
ssp: function(time, i, div_id, options, win) {
if (i < 20) {
if (typeof win.Begun != 'undefined') {
if (win.Begun.Autocontext && win.Begun.Autocontext.addBlock) {
Begun.Autocontext.addBlock(options, function(priority, impression_id, block_id) {
var before_ad_call = new Date();
var delta = before_ad_call - time;
Adf.util.trackPixel('//rcounter.rambler.ru/count?v=0.1&id=144&pid=1&path=' + options['params']['p1'] + '.d' + Adf.inner.returnTimeInterval(delta));
Begun.Autocontext.showAd(div_id, impression_id, 0);
});
} else {
setTimeout(function() {
Adf.inner.ssp(time, ++i, div_id, options, win);
}, 100);
}
} else {
setTimeout(function() {
Adf.inner.ssp(time, ++i, div_id, options, win);
}, 100);
}
} else {
if (Adf.util.debugExtend) console.log('win.Begun.Autocontext.addBlock is not defined.' + '; div_id = ' + div_id);
Adf.util.trackPixel('//rcounter.rambler.ru/count?v=0.1&id=143&pid=1&path=' + options['params']['p1']);
Adf.banner.show(div_id, options['params']);
}
},
checkBannerLoaded: function(banner_place, opt_callback, status) {
if (typeof opt_callback === 'function') opt_callback(banner_place, status);
},
getMonblanc: function(key) {
if (_mon) {
return _montblanc.get(key, '');
} else {
return '';
}
},
returnTimeInterval: function(time) {
if (time < 500) {
return '05';
};
if (time >= 500 && time < 1000) {
return '0510';
};
if (time >= 1000 && time < 1500) {
return '1015';
};
if (time >= 1500 && time < 2000) {
return '1520';
};
if (time >= 2000 && time < 2500) {
return '2025';
};
if (time >= 2500 && time < 3000) {
return '2530';
};
if (time >= 3000 && time < 4000) {
return '3040';
};
if (time >= 4000 && time < 5000) {
return '4050';
};
if (time >= 5000) {
return '50';
};
}
};
Adf.banner = {
needReload: false,
account_id: 171817,
pr: Math.floor(Math.random() * 1000000),
dl: escape(document.location),
montblanc: {
'puid3': Adf.inner.getMonblanc('4i'),
'puid4': Adf.inner.getMonblanc('c6'),
'puid11': Adf.inner.getMonblanc('dd'),
'puid22': Adf.inner.getMonblanc('y1'),
'puid33': Adf.inner.getMonblanc('bj'),
'puid37': Adf.inner.getMonblanc('k4'),
'puid38': Adf.inner.getMonblanc('x3'),
'puid55': Adf.inner.getMonblanc('bz'),
'puid56': Adf.inner.getMonblanc('hj'),
'puid57': Adf.inner.getMonblanc('tk'),
'eid1': Adf.inner.getMonblanc('uid')
},
show: function(div_id, options, opt_class, opt_callback) {
var divIdType = typeof div_id;
if (typeof opt_class === 'function') opt_callback = opt_class;
if (divIdType == 'string') {
var banner_place = document.getElementById(div_id);
} else if (divIdType == 'object') {
var banner_place = div_id;
};
if (Adf.util.nolimits) {
options['pli'] = 'a';
options['plp'] = 'a';
options['pop'] = 'a';
};
var pr1 = Math.floor(Math.random() * 1000000),
pr2 = Math.floor(Math.random() * 1000000),
criteo = '',
ban_block = Adf.util.createElement('div', 'AdFox_banner_' + pr1, opt_class),
ifr = Adf.util.createAdIframe('AdFox_iframe_' + pr1),
reloadPr = !Adf.banner.needReload ? Adf.banner.pr : Math.floor(Math.random() * 1000000),
url = Adf.util.getProtocol() + '//ads.adfox.ru/' +
(options['account_id'] ? options['account_id'] : Adf.banner.account_id) +
'/prepareCode?pfc=' +
(options['pfc'] ? options['pfc'] : 'a') +
'&pfb=' +
(options['pfb'] ? options['pfb'] : 'a') +
'&pt=b' +
'&pd=' + Adf.util.getDate()['date'] +
'&pw=' + Adf.util.getDate()['day'] +
'&pv=' + Adf.util.getDate()['hour'] +
'&prr=' + Adf.util.getReferrer() +
'&pdw=' + Adf.util.getScreenSize()[0] +
'&pdh=' + Adf.util.getScreenSize()[1] +
'&dl=' + Adf.banner.dl +
'&pr1=' + pr1 +
'&random=' + pr2 +
'&pr=' + reloadPr;
//include montblanc params
for (var prop in Adf.banner.montblanc) {
url += '&' + prop + '=' + Adf.banner.montblanc[prop]
}
if (typeof af_lpdId != 'undefined' && af_lpdId != null) {
url += '&lpdid=' + af_lpdId;
}
//check banner params
if (typeof options == 'object') {
for (var prop in options) {
if (prop == 'criteo' && options[prop] != null) {
if (Adf.util.CRTG_CONTENT) {
var criteo_init = options[prop].split(',');
var criteo_end = [];
for (var k = 0; k < criteo_init.length; k++) {
if (Adf.util.CRTG_CONTENT.indexOf(criteo_init[k]) != -1) criteo_end.push(criteo_init[k]);
}
if (criteo_end.length) criteo = criteo_end.join(':');
//criteo = ((Adf.util.CRTG_CONTENT.indexOf(options[prop]) != -1)) ? (options[prop]) : ("0");
}
url += '&puid23=' + criteo;
} else {
url += '&' + prop + '=' + options[prop];
}
}
} else {
console.log('options =' + typeof options)
};
//add lib version in puid
url += '&puid59=' + Adf.util.VERSION;
//insert banner
if (banner_place) {
banner_place.appendChild(ban_block);
banner_place.appendChild(ifr);
} else {
console.log('adfox can not access banner_place');
};
if (Adf.util.debugBase || Adf.util.debugExtend) console.log('div_id = ' + div_id);
if (Adf.util.debugBase || Adf.util.debugExtend) console.log(options);
//Adf.util.trackPixel(Adf.util.getProtocol() + '//counter.rambler.ru/top100.scn?3146510&le=1&cv=' + 'ae7slot%3D'+options['p1']+'%26ae7slottype%3D'+options['p2']+'%26ae74i%3D'+encodeURIComponent(Adf.inner.getMonblanc('4i'))+'%26ae7c6%3D'+encodeURIComponent(Adf.inner.getMonblanc('c6'))+'%26ae7y1%3D'+encodeURIComponent(Adf.inner.getMonblanc('y1'))+'%26ae7bj%3D'+encodeURIComponent(Adf.inner.getMonblanc('bj'))+'%26ae7dd%3D'+encodeURIComponent(Adf.inner.getMonblanc('dd'))+'%26ae7k4%3D'+encodeURIComponent(Adf.inner.getMonblanc('k4'))+'%26ae7x3%3D'+encodeURIComponent(Adf.inner.getMonblanc('x3')));
window['_top100q'].push(
['ae7.setCustomVar', 'ae7slot', options['p1']], ['ae7.setCustomVar', 'ae7slottype', options['p2']], ['ae7.setCustomVar', 'ae74i', Adf.inner.getMonblanc('4i')], ['ae7.setCustomVar', 'ae7c6', Adf.inner.getMonblanc('c6')], ['ae7.setCustomVar', 'ae7y1', Adf.inner.getMonblanc('y1')], ['ae7.setCustomVar', 'ae7bj', Adf.inner.getMonblanc('bj')], ['ae7.setCustomVar', 'ae7dd', Adf.inner.getMonblanc('dd')], ['ae7.setCustomVar', 'ae7k4', Adf.inner.getMonblanc('k4')], ['ae7.setCustomVar', 'ae7x3', Adf.inner.getMonblanc('x3')], ['ae7.setCustomVar', 'ae7bz', Adf.inner.getMonblanc('bz')], ['ae7.setCustomVar', 'ae7hj', Adf.inner.getMonblanc('hj')], ['ae7.setCustomVar', 'ae7tk', Adf.inner.getMonblanc('tk')], ['ae7.trackPageview']
);
var inCallTime = new Date();
Adf.util[options['p1']] = inCallTime;
if (document.location.hostname == 'news.rambler.ru') Adf.util.trackPixel('//rcounter.rambler.ru/count?v=0.1&id=146&pid=1&path=adfox.d' + options['p1'] + '.d' + Adf.inner.returnTimeInterval(inCallTime - Adf.util.START_TIME));
Adf.util.getCodeScript(1, url, 'AdFox_iframe_' + pr1, banner_place, opt_callback);
},
reload: function(div_id, options, opt_class, opt_callback) {
Adf.banner.needReload = true;
document.getElementById(div_id).innerHTML = '';
Adf.banner.show(div_id, options, opt_class, opt_callback);
Adf.banner.needReload = false;
},
showScroll: function(div_id, options, opt_class, opt_callback) {
var winPos = Adf.util.getWindowSize(),
winWidth = winPos.width,
winHeight = winPos.height,
scrollY = Adf.util.getBodyScrollTop(),
scrollX = Adf.util.getBodyScrollLeft(),
ltwhPos = Adf.util.getElementPosition(div_id);
var lPos = (ltwhPos) ? ltwhPos.left : 20 * winWidth;
var tPos = (ltwhPos) ? ltwhPos.top : 20 * winHeight;
var rate = 0;
if (typeof options['puid39'] != 'undefined' && options['puid39'] != null) {
rate = options['puid39'] / 100;
}
if (Adf.util.debugExtend) console.log('div_id = ' + div_id + '; elementPosition = ' + ltwhPos);
if (scrollY + winHeight * (1 + rate) + 5 >= tPos && scrollX + winWidth + 5 >= lPos) {
Adf.banner.show(div_id, options, opt_class, opt_callback);
} else {
setTimeout(function() {
Adf.banner.showScroll(div_id, options, opt_class, opt_callback);
}, 100);
}
},
showRich: function(div_id, options, opt_class, opt_callback) {
var winPos = Adf.util.getWindowSize(),
winHeight = winPos.height,
scrollY = Adf.util.getBodyScrollTop();
if (scrollY + 5 >= winHeight) {
Adf.banner.show(div_id, options, opt_class, opt_callback);
} else {
setTimeout(function() {
Adf.banner.showRich(div_id, options, opt_class, opt_callback);
}, 100);
}
},
showScroll_b: function(div_id, options, options_b, opt_class, opt_win) {
var winPos = Adf.util.getWindowSize(),
winWidth = winPos.width,
winHeight = winPos.height,
scrollY = Adf.util.getBodyScrollTop(),
scrollX = Adf.util.getBodyScrollLeft(),
ltwhPos = Adf.util.getElementPosition(div_id);
var lPos = (ltwhPos) ? ltwhPos.left : 20 * winWidth;
var tPos = (ltwhPos) ? ltwhPos.top : 20 * winHeight;
var rate = 0;
if (typeof options['puid39'] != 'undefined' && options['puid39'] != null) {
rate = options['puid39'] / 100;
}
if (Adf.util.debugExtend) console.log('div_id = ' + div_id + '; elementPosition = ' + ltwhPos);
if (scrollY + winHeight * (1 + rate) + 5 >= tPos && scrollX + winWidth + 5 >= lPos) {
Adf.banner.show_b(div_id, options, options_b, opt_class, opt_win);
} else {
setTimeout(function() {
Adf.banner.showScroll_b(div_id, options, options_b, opt_class, opt_win);
}, 100);
}
},
show_b: function(div_id, options, options_b, opt_class, opt_win) {
if (Adf.util.debugExtend) console.log('show_b start; div_id = ' + div_id + '; adCall = ' + Adf.counter);
var _window = opt_win || window;
// debug variables -- start
var startTime = new Date(),
_rand = Math.floor(Math.random() * 100000000),
forPersentageThreshold = Math.floor(Math.random() * 1000),
threshold = (forPersentageThreshold >= 5 && forPersentageThreshold < 55) ? true : false;
// debug variables -- end
options_b['params'] = options_b['params'] || {};
if (typeof options['criteo'] != 'undefined') {
if (Adf.util.CRTG_CONTENT) {
options_b['begun-usertag'] = ((Adf.util.CRTG_CONTENT.indexOf(options['criteo']) != -1)) ? (options['criteo']) : ('');
} else {
options_b['begun-usertag'] = '';
if (Adf.util.debugBase || Adf.util.debugExtend) console.log('Adf.util.CRTG_CONTENT is not defined. Why?!');
}
} else {
options_b['begun-usertag'] = '';
};
for (var prop in options) {
if (prop != 'criteo') {
options_b['params'][prop] = options[prop];
}
};
for (var prop in Adf.banner.montblanc) {
options_b['params'][prop] = Adf.banner.montblanc[prop];
}
if (Adf.util.debugBase || Adf.util.debugExtend) console.log('begun-usertag = ' + options_b['begun-usertag']);
Adf.inner.show_b(threshold, startTime, _rand, Adf.counter, 1, div_id, options, options_b, opt_class, _window);
if (Adf.util.debugExtend) console.log('show_b end; div_id = ' + div_id + '; adCall = ' + Adf.counter);
Adf.counter = Adf.counter + 1;
},
reload_b: function(div_id, options, options_b) {
Adf.banner.needReload = true;
document.getElementById(div_id).innerHTML = '';
Adf.banner.show_b(div_id, options, options_b);
Adf.banner.needReload = false;
},
ssp: function(div_id, options, options_b, opt_class, opt_win) {
var _window = opt_win || window,
div_id_type = typeof div_id,
class_type = typeof opt_class,
startTime = new Date();
options_b['params'] = options_b['params'] || {};
options_b['params']['adfox'] = {};
if (Adf.util.nolimits) {
options['pli'] = 'a';
options['plp'] = 'a';
options['pop'] = 'a';
};
if (div_id_type == 'string') {
var _place = document.getElementById(div_id);
} else if (div_id_type == 'object') {
var _place = div_id;
};
if (class_type == 'object') {
_window = opt_class;
} else if (class_type == 'string') {
_place.className += opt_class;
};
if (typeof options['criteo'] != 'undefined' && options['criteo'] != null) {
if (Adf.util.CRTG_CONTENT) {
var criteo_init = options['criteo'].split(',');
var criteo_end = [];
for (var k = 0; k < criteo_init.length; k++) {
if (Adf.util.CRTG_CONTENT.indexOf(criteo_init[k]) != -1) criteo_end.push(criteo_init[k]);
}
if (criteo_end.length) options_b['begun-usertag'] = criteo_end.join(':');
//options_b['begun-usertag'] = ((Adf.util.CRTG_CONTENT.indexOf(options['criteo']) != -1)) ? (options['criteo']) : ('');
} else {
options_b['begun-usertag'] = '';
if (Adf.util.debugBase || Adf.util.debugExtend) console.log('Adf.util.CRTG_CONTENT is not defined. Why?!');
}
} else {
options_b['begun-usertag'] = '';
};
for (var prop in options) {
if (prop != 'criteo') {
options_b['params'][prop] = options[prop];
options_b['params']['adfox'][prop] = options[prop];
}
};
for (var prop in Adf.banner.montblanc) {
options_b['params'][prop] = Adf.banner.montblanc[prop];
options_b['params']['adfox'][prop] = Adf.banner.montblanc[prop];
}
options_b['params']['adfox']['pfc'] = options['pfc'] ? options['pfc'] : 'a';
options_b['params']['adfox']['pfb'] = options['pfb'] ? options['pfb'] : 'a';
options_b['params']['adfox']['pt'] = 'b';
options_b['params']['adfox']['pd'] = Adf.util.getDate()['date'];
options_b['params']['adfox']['pw'] = Adf.util.getDate()['day'];
options_b['params']['adfox']['pv'] = Adf.util.getDate()['hour'];
options_b['params']['adfox']['prr'] = Adf.util.getReferrer();
options_b['params']['adfox']['pdw'] = Adf.util.getScreenSize()[0];
options_b['params']['adfox']['pdh'] = Adf.util.getScreenSize()[1];
options_b['params']['adfox']['dl'] = Adf.banner.dl;
options_b['params']['adfox']['pr1'] = Math.floor(Math.random() * 1000000);
options_b['params']['adfox']['random'] = Math.floor(Math.random() * 1000000);
options_b['params']['adfox']['pr'] = !Adf.banner.needReload ? Adf.banner.pr : Math.floor(Math.random() * 1000000);
options_b['params']['adfox']['puid59'] = Adf.util.VERSION;
options_b['params']['adfox']['account_id'] = options['account_id'] ? options['account_id'] : Adf.banner.account_id;
if (typeof af_lpdId != 'undefined' && af_lpdId != null) {
options_b['params']['adfox']['lpdid'] = af_lpdId;
} else {
options_b['params']['adfox']['lpdid'] = '';
}
var inCallTime = new Date();
Adf.util[options_b['params']['p1']] = inCallTime;
if (document.location.hostname == 'news.rambler.ru') Adf.util.trackPixel('//rcounter.rambler.ru/count?v=0.1&id=146&pid=1&path=ssp.d' + options_b['params']['p1'] + '.d' + Adf.inner.returnTimeInterval(inCallTime - Adf.util.START_TIME));
Adf.inner.ssp(startTime, 1, div_id, options_b, _window);
},
sspScroll: function(div_id, options, options_b, opt_class, opt_win) {
var winPos = Adf.util.getWindowSize(),
winWidth = winPos.width,
winHeight = winPos.height,
scrollY = Adf.util.getBodyScrollTop(),
scrollX = Adf.util.getBodyScrollLeft(),
ltwhPos = Adf.util.getElementPosition(div_id);
var lPos = (ltwhPos) ? ltwhPos.left : 20 * winWidth;
var tPos = (ltwhPos) ? ltwhPos.top : 20 * winHeight;
var rate = 0;
if (typeof options['puid39'] != 'undefined' && options['puid39'] != null) {
rate = options['puid39'] / 100;
}
if (Adf.util.debugExtend) console.log('div_id = ' + div_id + '; elementPosition = ' + ltwhPos);
if (scrollY + winHeight * (1 + rate) + 5 >= tPos && scrollX + winWidth + 5 >= lPos) {
Adf.banner.ssp(div_id, options, options_b, opt_class, opt_win);
} else {
setTimeout(function() {
Adf.banner.sspScroll(div_id, options, options_b, opt_class, opt_win);
}, 100);
}
}
};
//api
window['Adf'] = {};
window['Adf']['util'] = Adf.util;
window['Adf']['init'] = Adf.init;
window['Adf']['banner'] = Adf.banner;
})();
function AdFox_SetLayerVis(spritename, state) {
document.getElementById(spritename).style.visibility = state;
}
function AdFox_Open(AF_id) {
AdFox_SetLayerVis('AdFox_DivBaseFlash_' + AF_id, "hidden");
AdFox_SetLayerVis('AdFox_DivOverFlash_' + AF_id, "visible");
}
function AdFox_Close(AF_id) {
AdFox_SetLayerVis('AdFox_DivOverFlash_' + AF_id, "hidden");
AdFox_SetLayerVis('AdFox_DivBaseFlash_' + AF_id, "visible");
}
function adfoxSdvigContent(banID, flashWidth, flashHeight) {
var obj = document.getElementById('adfoxBanner' + banID).style;
if (flashWidth == '100%') obj.width = flashWidth;
else obj.width = flashWidth + "px";
if (flashHeight == '100%') obj.height = flashHeight;
else obj.height = flashHeight + "px";
}
function adfoxVisibilityFlash(banName, flashWidth, flashHeight) {
var obj = document.getElementById(banName).style;
if (flashWidth == '100%') obj.width = flashWidth;
else obj.width = flashWidth + "px";
if (flashHeight == '100%') obj.height = flashHeight;
else obj.height = flashHeight + "px";
}
function adfoxStart(banID, FirShowFlNum, constVisFlashFir, sdvigContent, flash1Width, flash1Height, flash2Width, flash2Height) {
if (FirShowFlNum == 1) adfoxVisibilityFlash('adfoxFlash1' + banID, flash1Width, flash1Height);
else if (FirShowFlNum == 2) {
adfoxVisibilityFlash('adfoxFlash2' + banID, flash2Width, flash2Height);
if (constVisFlashFir == 'yes') adfoxVisibilityFlash('adfoxFlash1' + banID, flash1Width, flash1Height);
if (sdvigContent == 'yes') adfoxSdvigContent(banID, flash2Width, flash2Height);
else adfoxSdvigContent(banID, flash1Width, flash1Height);
}
}
function adfoxOpen(banID, constVisFlashFir, sdvigContent, flash2Width, flash2Height) {
var aEventOpenClose = new Image();
var obj = document.getElementById("aEventOpen" + banID);
if (obj) aEventOpenClose.src = obj.title + '&rand=' + Math.random() * 1000000 + '&prb=' + Math.random() * 1000000;
adfoxVisibilityFlash('adfoxFlash2' + banID, flash2Width, flash2Height);
if (constVisFlashFir != 'yes') adfoxVisibilityFlash('adfoxFlash1' + banID, 1, 1);
if (sdvigContent == 'yes') adfoxSdvigContent(banID, flash2Width, flash2Height);
}
function adfoxClose(banID, constVisFlashFir, sdvigContent, flash1Width, flash1Height) {
var aEventOpenClose = new Image();
var obj = document.getElementById("aEventClose" + banID);
if (obj) aEventOpenClose.src = obj.title + '&rand=' + Math.random() * 1000000 + '&prb=' + Math.random() * 1000000;
adfoxVisibilityFlash('adfoxFlash2' + banID, 1, 1);
if (constVisFlashFir != 'yes') adfoxVisibilityFlash('adfoxFlash1' + banID, flash1Width, flash1Height);
if (sdvigContent == 'yes') adfoxSdvigContent(banID, flash1Width, flash1Height);
}