var hide_evp_poll_on_main;
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_4EdNr(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;
        
        script.onload = script.onerror = callback;
         
        script.onreadystatechange = function() {
          var self = this;
          if (this.readyState == "complete" || this.readyState == "loaded") {
            setTimeout(function() { self.onload() }, 0);// сохранить "this" для onload
            setTimeout(callback, 0);
          }
        };


        head.appendChild(script);
}

loadScript_4EdNr('//poll.mos.ru//bitrix/templates/.default/static/js/postmessage.js',init_event_vote_4EdNr,'script_postmessage_vote');


function init_event_vote_4EdNr(){

if (!this.executed) { // выполнится только один раз
            this.executed = true;
        }


    pm.bind("resaiz_frame_vote_4EdNr", function(data) {
            if(data['param_h']>0){
                var frameElement = document.getElementById('vote_frame_4EdNr'); 
                frameElement.style.height = data['param_h'] + 'px'; 
                var frameElement = document.getElementById('vote_block_4EdNr'); 
                frameElement.style.height = data['param_h'] + 'px'; 
            }
            if(data['param_w']>0){
                var frameElement = document.getElementById('vote_frame_4EdNr'); 
                frameElement.style.width = data['param_w'] + 'px'; 
                var frameElement = document.getElementById('vote_block_4EdNr'); 
                frameElement.style.width = data['param_w'] + 'px'; 
            }
            return data;
    }); 
}

