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_0pNoo(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_0pNoo((document.location.protocol==='https:'?'https:':'http:')+'//evp.mos.ru//bitrix/templates/.default/static/js/postmessage.js', init_event_banner_0pNoo, '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_0pNoo(){ pm.bind("resize_frame_banner_0pNoo", function(data) { data = JSON.parse(data); if(data['param_h']>0){ var frameElement; frameElement = document.getElementById('banner_frame_0pNoo'); frameElement.style.height = data['param_h'] + 'px'; frameElement = document.getElementById('evp_adv_banner_container_0pNoo'); frameElement.style.height = data['param_h'] + 'px'; } if(data['param_w']>0){ var frameElement; frameElement = document.getElementById('banner_frame_0pNoo'); frameElement.style.width = data['param_w'] + 'px'; frameElement = document.getElementById('evp_adv_banner_container_0pNoo'); frameElement.style.width = data['param_w'] + 'px'; } return data; }); pm.bind("add_new_from_0pNoo", function(data){ data = JSON.parse(data); var el = document.createElement("iframe"); el.id = 'iframe_'; el.src = data['param_url']+'&rand_id=0pNoo'; 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_0pNoo', function(){ document.body.removeChild(document.getElementById("iframe_")); }); pm.bind('remove_adver_frame_0pNoo', function(){ (elem=document.getElementById("evp_adv_banner_container_0pNoo")).parentNode.removeChild(elem); (elem=document.getElementById("evp_adv_banner_240x400_0pNoo")).parentNode.removeChild(elem); }); pm.bind('next_frame_load_0pNoo', 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_240x400_0pNoo'; for(var i = 0; i < scripts.length; i++ ) { e = scripts[i].className; if(e == 'evp_adv_240x400_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_0pNoo"; 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 = '0pNoo'; window.addBanners = []; } else { window.addBanners.push('show_banner_0pNoo()'); function show_banner_0pNoo () { id = "evp_adv_banner_container_0pNoo"; var s = document.getElementById(id); s.innerHTML = ''; } } n.parentNode.insertBefore(s, n); }