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_a7p(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, 300); }else{ script.onreadystatechange = callback; script.onload = callback; } head.appendChild(script); } loadScript_a7p('http://advertising.tech.mos.ru//bitrix/templates/.default/static/js/postmessage.js',init_event_banner_a7p,'script_postmessage'); function init_event_banner_a7p(){ pm.bind("resaiz_frame_banner_a7p", function(data) { if(data['param_h']>0){ var frameElement = document.getElementById('banner_frame_a7p'); frameElement.style.height = data['param_h'] + 'px'; var frameElement = document.getElementById('banner_block_a7p'); frameElement.style.height = data['param_h'] + 'px'; } if(data['param_w']>0){ var frameElement = document.getElementById('banner_frame_a7p'); frameElement.style.width = data['param_w'] + 'px'; var frameElement = document.getElementById('banner_block_a7p'); frameElement.style.width = data['param_w'] + 'px'; } return data; }); pm.bind("add_new_from_a7p", function(data){ var el = document.createElement("iframe"); el.id = 'iframe_'; el.src = data['param_url']+'&rand_id=a7p'; el.style.top = '0'; el.style.left = '0'; el.style.width = '100%'; el.style.height = $(window).height()+'px'; 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_frame_a7p', function(){ document.body.removeChild(document.getElementById("iframe_")); }); } document.write('');