function cBrowser() {
var ua = navigator.userAgent;
var bName = function () {
if (ua.search(/MSIE/) > -1) return "ie";
}();
var version = function (bName) {
switch (bName) {
case "ie" : return (ua.split("MSIE ")[1]).split(";")[0];break;
}}(bName);
return [bName];
}
function loadScript_CyF0e(url, callback,id_script)
{
// adding the script tag to the head as suggested before
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.id = id_script;
if(cBrowser()=='ie'){
setTimeout(callback, 100);
}else{
script.onreadystatechange = callback;
script.onload = callback;
}
head.appendChild(script);
}
loadScript_CyF0e((document.location.protocol==='https:'?'https:':'http:')+'//evp.mos.ru//bitrix/templates/.default/static/js/postmessage.js', init_event_banner_CyF0e, 'script_postmessage');
function randomString(len){
charSet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var randomString = '';
for(var i = 0; i < len; i++){
var randomPoz = Math.floor(Math.random() * charSet.length);
randomString += charSet.substring(randomPoz, randomPoz+1);
}
return randomString;
}
function getCookie(name) {
var cookie = " " + document.cookie;
var search = " " + name + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0) {
offset = cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1) {
end = cookie.length;
}
setStr = unescape(cookie.substring(offset, end));
}
}
return(setStr);
}
function setCookie (name, value, expires, path, domain, secure) {
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function init_event_banner_CyF0e(){
pm.bind("resize_frame_banner_CyF0e", function(data) {
data = JSON.parse(data);
if(data['param_h']>0){
var frameElement;
frameElement = document.getElementById('banner_frame_CyF0e');
frameElement.style.height = data['param_h'] + 'px';
frameElement = document.getElementById('evp_adv_banner_container_CyF0e');
frameElement.style.height = data['param_h'] + 'px';
}
if(data['param_w']>0){
var frameElement;
frameElement = document.getElementById('banner_frame_CyF0e');
frameElement.style.width = data['param_w'] + 'px';
frameElement = document.getElementById('evp_adv_banner_container_CyF0e');
frameElement.style.width = data['param_w'] + 'px';
}
return data;
});
pm.bind("add_new_from_CyF0e", function(data){
data = JSON.parse(data);
var el = document.createElement("iframe");
el.id = 'iframe_';
el.src = data['param_url']+'&rand_id=CyF0e';
el.style.top = '0';
el.style.left = '0';
el.style.width = '100%';
el.style.height = '100%';
el.style.border = 'medium none';
el.style.zIndex = 9999;
el.style.overflow = 'hidden';
el.style.position = 'fixed';
el.style.backgroundColor = 'transparent';
document.body.appendChild(el);
});
pm.bind('remove_adver_video_frame_CyF0e', function(){
document.body.removeChild(document.getElementById("iframe_"));
});
pm.bind('remove_adver_frame_CyF0e', function(){
(elem=document.getElementById("evp_adv_banner_container_CyF0e")).parentNode.removeChild(elem);
(elem=document.getElementById("evp_adv_banner_240x115_CyF0e")).parentNode.removeChild(elem);
});
pm.bind('next_frame_load_CyF0e', function(){
if ((typeof(window.addBanners) != 'undefined') && (window.addBanners.length > 0))
{
var func_name = window.addBanners.shift();
eval(func_name);
}
});
}
var scripts = document.getElementsByTagName("script");
var id = 'evp_adv_banner_240x115_CyF0e';
for(var i = 0; i < scripts.length; i++ )
{
e = scripts[i].className;
if(e == 'evp_adv_240x115_ru_n')
{
scripts[i].setAttribute('id', id);
scripts[i].removeAttribute('class');
break;
}
}
var n = document.getElementById(id);
if(typeof(n) != 'undefined' && n !== null)
{
s = document.createElement("div"),
s.id = "evp_adv_banner_container_CyF0e";
s.style.position = "relative";
s.style.height = "400px";
s.style.width = "240px";
//s.style.cssFloat = "left";
s.style.display = "inline-block";
if(typeof(window.firstLoad) == 'undefined')
{
s.innerHTML = '';
window.firstLoad = 'CyF0e';
window.addBanners = [];
}
else
{
window.addBanners.push('show_banner_CyF0e()');
function show_banner_CyF0e () {
id = "evp_adv_banner_container_CyF0e";
var s = document.getElementById(id);
s.innerHTML = '';
}
}
n.parentNode.insertBefore(s, n);
}