(function () {window._dt_dynad_5550001923_1637852995891679595425='';window._tp_dynad_5550001923_1637852995891679595425={};if(typeof JSON!=="object"){JSON={};JSON.parse=JSON.parse||function(o){return eval('('+o+')')};JSON.stringify=JSON.stringify||function(o){var n;var a;var t=typeof(o);var json=[];if(t!='object'||o===null){if(t=="string"){o='"'+o+'"'}return String(o)}else{a=(o&&o.constructor==Array);for(var key in o){n=o[key];t=typeof(n);if(t=="string"){n='"'+n.replace(/["]/g,"\\\"")+'"'}else if(t=="object"&&n!==null){n=JSON.stringify(n)}json.push((a?"":'"'+key+'":')+String(n))}return(a?"[":"{")+String(json)+(a?"]":"}")}}}
function DADB(t){return DADB.inst instanceof DADB?DADB.inst._rs=t(DADB.inst):(this._if=null,this._ok=!1,this._db=(typeof window['_dynad_tag_protocol_']!=='undefined'?window['_dynad_tag_protocol_']:("http:"!=window.location.protocol?"https://":"http://"))+"s.dynad.net",this._pt="/stack/KMA9C2O70iP6CHSgXk0LGaQ8ML9m6vJE4RIi1Rf61p4.html?v69",this._qu=[],this._rq={},this._id=(new Date).getTime()+Math.floor(1e4*Math.random()),this._ls=this._dg()==this._db,this._rs="",DADB.inst=this,void this.init(function(){"function"==typeof t&&(DADB.inst._rs=t(DADB.inst))}))}"object"!=typeof JSON&&(JSON={},JSON.parse=JSON.parse||function(o){return eval("("+o+")")},JSON.stringify=JSON.stringify||function(t){var i,e,s=typeof t,n=[];if("object"!=s||null===t)return"string"==s&&(t='"'+t+'"'),t+"";e=t&&t.constructor==Array;for(var o in t)i=t[o],s=typeof i,"string"==s?i='"'+i.replace(/["]/g,'\\"')+'"':"object"==s&&null!==i&&(i=JSON.stringify(i)),n.push((e?"":'"'+o+'":')+(i+""));return(e?"[":"{")+(n+"")+(e?"]":"}")}),DADB.prototype={constructor:DADB,init:function(t){var i=this;this._ls||this._if||(this._if=document.createElement("iframe"),this._if.style.cssText="position:absolute;width:1px;height:1px;left:-9999px;",(document.body||document.documentElement||document.getElementsByTagName('body')[0]).appendChild(this._if),window.addEventListener?(this._if.addEventListener("load",function(){i._ild()},!1),window.addEventListener("message",function(t){i._hm(t)},!1)):this._if.attachEvent&&(this._if.attachEvent("onload",function(){i._ild()},!1),window.attachEvent("onmessage",function(t){i._hm(t)})),this._if.src=this._db+this._pt),"function"==typeof t&&t()},getResult:function(){return this._rs},getCk:function(t,i){var e={request:{id:++this._id,type:"gc",key:t},callback:i};this._s(e)},setCk:function(t,i,e,s){"function"==typeof e&&(s=e,e=2592e3);var n={request:{id:++this._id,type:"sc",key:t,value:i,ttl:e},callback:s};this._s(n)},setNav:function(t,i,e,s,n){var o={request:{id:++this._id,type:"snav",key:t,value:i+"|"+e+"|"+s},callback:n};this._s(o)},getNav:function(t,i){var e={request:{id:++this._id,type:"nav",key:t},callback:i};this._s(e)},getItem:function(t,i){if(this._ls)return localStorage[t];var e=this,s={request:{id:++e._id,type:"get",key:t},callback:i};e._s(s)},setItem:function(t,i,e){if(this._ls)return void(localStorage[t]=i);var s=this,n={request:{id:++s._id,type:"set",key:t,value:i},callback:e};s._s(n)},delItem:function(t){if(this._ls)return delete localStorage[t];var i={request:{id:++this._id,type:"unset",key:t}};this._s(i)},_s:function(t){this._ok?this._if&&(this._rq[t.request.id]=t,this._if.contentWindow.postMessage(JSON.stringify(t.request),this._db)):this._qu.push(t)},_ild:function(){if(this._ok=!0,this._qu.length){for(var t=0,i=this._qu.length;i>t;t++)this._s(this._qu[t]);this._qu=[]}},_hm:function(t){if(!/\{.*(\"id\")+.*(\"key\")+.*\}/.test(t.data)||!/s.dynad.net/.test(t.origin)) return;try{if(t.origin==this._db){var i=JSON.parse(t.data);void 0!==this._rq[i.id].deferred&&this._rq[i.id].deferred.resolve(i.value);void 0!==this._rq[i.id]&&"function"==typeof this._rq[i.id].callback&&(this._rs=this._rq[i.id].callback(i.key,i.value)),delete this._rq[i.id]}}catch(t){}},_dg:function(){var t=window.location.href,i=document.createElement("a");return i.href=t,i.hostname}};
window._DADB_5550001923_1637852995891679595425=DADB;
function DAFIFO(e,t,n,r,i){this.s=e;this.t=t;this.db=n;this.it=[];this.ttl=r;this._rs="";var s=this;s.db.getItem(s.t,function(e,t){s.init(e,t);if(typeof i=="function"){s._rs=i(s)}})}DAFIFO.prototype={constructor:DAFIFO,init:function(e,t){if(t==null||t==""){this.it={}}else{this.it=JSON.parse(t)}},commit:function(e){var t=this;var n=0;this.db.setItem(this.t,JSON.stringify(this.it));if(typeof e=="function"){e(n)}},getResult:function(){return this._rs},push:function(e,t){var n=0;if(this.it!=null&&typeof e==="string"&&e!=""){this.it=this._vd();var r=[];r[r.length]={v:e,t:parseInt((new Date).getTime()/1e3)};var i=1;for(k in this.it){if(i++<this.s&&typeof this.it[k]==="object"&&typeof this.it[k]["v"]==="string"&&typeof this.it[k]["t"]==="number"&&this.it[k]["v"]!=e&&this.it[k]["v"]!=""){r[r.length]=this.it[k]}}n=1;this.it=r;if(typeof t=="function"){t(n)}}return n},pop:function(e){var t=null;if(this.it!=null){this.it=this._vd();var n=[];var r=0;for(k in this.it){if(r++>0){n[n.length]=this.it[k]}else{t=this.it[k]["v"]}}this.it=n;if(typeof e=="function"){e(t)}}return t},remove:function(e,t){var n=[];if(this.it!=null){var r=0;var i=[];for(k in this.it){if(this._ia(k)&&this.it[k]["v"]!=e){i[r++]=this.it[k]}}this.it=i;if(typeof t=="function"){t(n)}}return n},list:function(e,t,n){var f=[];if("function"==typeof e&&void 0==t&&(n=e,t=!1,e=this.it.length),"function"==typeof t&&void 0==n&&(n=t,t=!1),null!=this.it){var o=-1;for(k in this.it)if(this._ia(k)){if(++o>=this.s||o>=e)break;f[o]=t?this.it[k]:this.it[k].v}"function"==typeof n&&n(f)}return f},clear:function(e){this.it=[];if(typeof e=="function"){e()}},_vd:function(){var e=[];for(k in this.it){if(this._ia(k))e[k]=this.it[k]}return e},_ct:function(){var e=0;for(k in this.it)e++;return e},_ia:function(e){return(new Date).getTime()/1e3-this.it[e]["t"]<this.ttl}};
window._DAFIFO_5550001923_1637852995891679595425=DAFIFO;
new DADB(function(db){db.getCk('optout',function(k,v){if(v!=='1'){(function(customerId, placementId, campaignId, creativeId, timestamp, lookBackWindow, action){setTimeout(function(){new DADB(function(a){"I"==action?new DAFIFO(100,"d"+customerId+"W",a,15552e3,function(a){a.push(placementId+"|"+campaignId+"|"+creativeId+"|"+timestamp+"|"+(timestamp+24*lookBackWindow*3600),function(){a.commit(function(){a.list(function(b){for(var c in b){var d=b[c].split("|");d[d.length-1]<timestamp&&a.remove(b[c],function(){a.commit()})}})})})}):"D"==action?new DAFIFO(100,"d"+customerId+"W",a,15552e3,function(a){a.list(function(b){for(var c in b)els[els.length-1]<timestamp&&a.remove(b[c],function(){a.commit()}),b[c].indexOf(placementId+"|"+campaignId+"|"+creativeId+"|")>-1&&a.remove(b[c],function(){a.commit()})})}):"R"==action&&new DAFIFO(100,"d"+customerId+"W",a,15552e3,function(a){a.list(function(b){var c="";for(var d in b)c+=(""==c?"":";")+b[d];a.clear(function(){a.commit(function(){callback(c)})})})})});},0,customerId,placementId,campaignId,creativeId,timestamp,lookBackWindow,action);})(20160221,5550001923,5000003610,4000039770,1637853056,30,'I');}else{db.setCk('uid','',0)}})});
var ele=document.createElement("div");ele.setAttribute("id","_dynad_c_I5550001923_1637852995891679595425");ele.setAttribute("style","border:0; z-index:1; margin:0; visibility:visible; display:block; transition:all 1s; background-color:white; overflow:hidden; -webkit-transition:all 1s; width:100%; -o-transition:all 1s; height:0px; -moz-transition:all 1s; ");var target=(function(isIE){if (typeof window['DYNAD_TV_IMPLEMENTATION'] !== 'undefined') {
    if (console && console.log)
        console.log('[dynad.tv] - canceled inarticle impression (detected another active instance in current context)');
    return null;
}
window['DYNAD_TV_IMPLEMENTATION'] = 'INARTICLE';

try {
    if ( typeof window['DynAd_TV_Container'] !== 'undefined' ) {
        var i = document.createElement('img');
        i.setAttribute('src', 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=');
        i.style.display = 'none';
        window['DynAd_TV_Container'].appendChild(i);
        return [ window['DynAd_TV_Container'] , i];
    }
} catch (e) {}

try {
    var dynadTVContainer = document.querySelector('.player_dynad_tv');
    if (dynadTVContainer) {
        var i = document.createElement('img');
        i.setAttribute('src', 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=');
        i.style.display = 'none';
        dynadTVContainer.appendChild(i);
        return [dynadTVContainer, i];
    }
} catch (e) {}

return null;})(false);if(typeof target==='undefined'||target==null||(target.length!=1&&target.length!=2))return;else{try{if(target.length==1)target[0].insertBefore(ele);else target[0].insertBefore(ele,target[1]);}catch(e){if(typeof console!=='undefined'&&typeof console.log!=='undefined')console.log(e);}}var tagParameters=window._tp_dynad_5550001923_1637852995891679595425;var dt_dynad=window._dt_dynad_5550001923_1637852995891679595425;var divAppender=function(s){var n='';var r=s.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){n+=arguments[1]+'\n';return '';});document.getElementById('_dynad_c_I5550001923_1637852995891679595425').innerHTML=r;if(window.execScript&&n!='') window.execScript(n); else if(n!='')eval(n);};try{
var _rp1637852995891679595425=(function(reqid,type,step,containerId,placementId){try{var APPLY_PLAYER_SIZE_POLICY = function (desired_width) {
  var MIN_WIDTH = 256,
    MIN_HEIGHT = 144;
  var initial_area = window.innerWidth * window.innerHeight;
  var window_ratio = initial_area / (window.innerHeight * window.innerHeight);
  var part_window_ratio = window_ratio / 0.3;
  var base_width = Math.sqrt(initial_area / part_window_ratio);
  var base_height = base_width * window_ratio;

  var final_area = base_width * base_height;
  var expected_ratio = 9 / 16;
  var final_width = Math.floor(Math.sqrt(final_area / expected_ratio));
  if (
    window.DYNAD_TV.config &&
    window.DYNAD_TV.config.width &&
    final_width > window.DYNAD_TV.config.width
  ) {
    final_width = window.DYNAD_TV.config.width;
  }
  if (desired_width && desired_width < final_width) {
    if (desired_width < MIN_WIDTH) {
      desired_width = MIN_WIDTH;
    }
    final_width = desired_width;
  }
  var final_height = Math.floor(expected_ratio * final_width);
  if (final_width < MIN_WIDTH || final_height < MIN_HEIGHT) {
    return false;
  }

  return { width: final_width, height: final_height };
};

if (step == 1) {
  if (!APPLY_PLAYER_SIZE_POLICY(null)) {
    return false;
  }
  var isMobile = {
    Android: function () {
      return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function () {
      return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function () {
      return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function () {
      return navigator.userAgent.match(/Opera Mini/i);
    },
    Windows: function () {
      return (
        navigator.userAgent.match(/IEMobile/i) ||
        navigator.userAgent.match(/WPDesktop/i)
      );
    },
    any: function () {
      return (
        isMobile.Android() ||
        isMobile.BlackBerry() ||
        isMobile.iOS() ||
        isMobile.Opera() ||
        isMobile.Windows()
      );
    },
  };

  if (!isMobile.any()) {
    // Auditoria Infomoney Desktop Impressions
    if (document.URL.indexOf("infomoney") > -1) {
      var imgCounter = new Image();
      imgCounter.src = "//t.dynad.net/pc/?dc=5550007859;ord=" + Date.now();
    }
  }

  if (isMobile.any()) {
    // Auditoria Infomoney Mobile Impressions
    if (document.URL.indexOf("infomoney") > -1) {
      var imgCounter = new Image();
      imgCounter.src = "//t.dynad.net/pc/?dc=5550007855;ord=" + Date.now();
    }

    if (isMobile.iOS()) {
      if (
        navigator.userAgent.toLowerCase().indexOf(" os 10_") == -1 &&
        navigator.userAgent.toLowerCase().indexOf(" os 11_") == -1
      ) {
        if (console && console.log)
          console.log("[dynad-tv] - iOS inferior ao 10 nao e suportado");

        try {
          var imgCounter = new Image();
          imgCounter.src = "//t.dynad.net/pc/?dc=5550003217;ord=" + Date.now();

          // Auditoria Cybercook Device
          if (document.URL.indexOf("cybercook") > -1) {
            setTimeout(function () {
              var imgCounter = new Image();
              imgCounter.src =
                "//t.dynad.net/pc/?dc=5550003314;ord=" + Date.now();
            }, 20);
          }

          // Auditoria Infomoney Device
          if (document.URL.indexOf("infomoney") > -1) {
            var imgCounter = new Image();
            imgCounter.src =
              "//t.dynad.net/pc/?dc=5550007853;ord=" + Date.now();
          }
        } catch (e) {}
        return false;
      }
      return false;
    } else if (isMobile.Android()) {
    } else {
      if (console && console.log)
        console.log("[dynad-tv] - plataforma movel nao suportada.");

      try {
        var imgCounter = new Image();
        imgCounter.src = "//t.dynad.net/pc/?dc=5550003217;ord=" + Date.now();

        if (document.URL.indexOf("cybercook") > -1) {
          setTimeout(function () {
            var imgCounter = new Image();
            imgCounter.src =
              "//t.dynad.net/pc/?dc=5550003314;ord=" + Date.now();
          }, 20);
        }
      } catch (e) {}
      return false;
    }
  }
}

if (step == 2) {
  if (typeof window.DYNAD_TV === "undefined")
    window.DYNAD_TV = {
      config: {
        URL_VAST:
          "https://pubads.g.doubleclick.net/gampad/ads?slotname=/8804/teste/inread&sz=640x480&ciu_szs=&url=%5Breferrer_url%5D&unviewed_position_start=1&output=xml_vast3&impl=s&env=vp&gdfp_req=1&ad_rule=0&video_url_to_fetch=%5Bdescription_url%5D&vad_type=linear&vpos=preroll&pod=1&min_ad_duration=0&max_ad_duration=999999000&ppos=1&lip=true&correlator=" +
          new Date().getTime() +
          Math.random(),
      },
    };

  var deviceIsMobile = (function (a) {
    if (
      /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(
        a
      ) ||
      /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
        a.substr(0, 4)
      )
    ) {
      return true;
    } else {
      return false;
    }
  })(navigator.userAgent || navigator.vendor || window.opera);

  function DynAdTvKeeper(container) {
    var actual_width = null;
    var actual_height = null;
    var videoSize = null;

    resize();

    var callPlayerSize = function callPlayerSize() {
      if (window.DYNAD_TV.config.URL_VAST.match("videoplayersize%3D") == null) {
        var sizeSmall = function sizeSmall() {
          videoSize = "small";
        };

        var sizeLarge = function sizeLarge() {
          videoSize = "large";
        };

        // mobile
        if (deviceIsMobile) {
          var deviceSize = window.screen.availWidth * window.screen.availHeight;
          var playerSize = actual_width * actual_height;

          if (playerSize >= deviceSize * 0.2) {
            sizeLarge();
          } else {
            sizeSmall();
          }
        }
        // desktop
        else {
          if (actual_height < 300 || actual_width < 400) {
            sizeSmall();
          } else {
            sizeLarge();
          }
        }
      }
    };

    var idTimeout = null;
    var STATUS = {
      INITIALIZED: 0,
      LOADED: 1,
      PLAYING: 2,
      PAUSED: 3,
      CLOSED: 5,
      TIMEOUT: 4,
    };

    var status = STATUS.INITIALIZED,
      height = 0,
      width = 0,
      vHeight = 0,
      vWidth = 0;
    var isMouseOverIfrm = false,
      isInVitrineMode = false,
      isVitrineExpanded = false;

    var idAdSystem = "",
      idCreativeId = "",
      idAdId = "";

    function addAdServerCounter(id) {
      if (
        window.location.hostname.indexOf("m.cifraclub") > -1 &&
        id == 5550003219
      ) {
        //player visible
        id = 5550004701;
      }
      if (
        window.location.hostname.indexOf("m.cifraclub") > -1 &&
        id == 5550003220
      ) {
        //vast loaded
        id = 5550004713;
      }

      // Auditoria Infomoney Player Visible
      if (document.URL.indexOf("infomoney") > -1 && id == 5550003219) {
        id = 5550007856;
      }

      // Auditoria Infomoney Data Loaded
      if (document.URL.indexOf("infomoney") > -1 && id == 5550003220) {
        id = 5550007852;
      }

      // Auditoria Infomoney Empty Vast/Timeout
      if (
        (document.URL.indexOf("infomoney") > -1 && id == 5550003218) ||
        (document.URL.indexOf("infomoney") > -1 && id == 5550001578)
      ) {
        id = 5550007854;
      }

      var imgCounter = new Image();
      imgCounter.src = "//t.dynad.net/pc/?dc=" + id + ";ord=" + Date.now();
    }

    function dispatchEventListener(eventName, eventData) {
      if (status === STATUS.CLOSED) return;

      if (eventName == "nodata") {
        if (document.URL.indexOf("cybercook") > -1)
          addAdServerCounter(5550003315);
      }

      if (
        typeof window.DYNAD_TV !== "undefined" &&
        typeof window.DYNAD_TV.eventListener !== "undefined"
      ) {
        if (typeof eventData !== "undefined")
          window.DYNAD_TV.eventListener(eventName, eventData);
        else window.DYNAD_TV.eventListener(eventName);
      }
      if (eventName == "closed" || eventName == "nodata")
        status = STATUS.CLOSED;
    }

    function passbackVitrine() {
      var _cid_ = "";
      try {
        _cid_ = tagParameters["afilio"];
      } catch (e) {
        console.log("WARNING:id afiliado nao informado");
        return;
      }
      if (typeof _cid_ === "undefined" && _cid_ == "") {
        console.log("WARNING:id afiliado nao informado");
        return;
      }
      status = STATUS.CLOSED;
      isInVitrineMode = true;
      ifrm.parentNode.removeChild(ifrm);
      var scriptVitrine = document.createElement("iframe");
      scriptVitrine.setAttribute("scrolling", "no");
      scriptVitrine.setAttribute("frameborder", "no");
      scriptVitrine.setAttribute("width", "100%");
      scriptVitrine.setAttribute("height", "250px");
      scriptVitrine.setAttribute("style", "width: 100%; height: 250px;");
      scriptVitrine.setAttribute(
        "src",
        "//t.dynad.net/script/?dc=" +
          _cid_ +
          ";ord=" +
          Date.now() +
          ";srctype=ifrm;click="
      );
      divContainer.appendChild(scriptVitrine);
      container = scriptVitrine;
      vWidth = divContainer.parentNode.offsetWidth;
      vHeight = 250;
      if (isElementVisible(container, vHeight, vWidth) && !isVitrineExpanded) {
        divContainer.style.width = "100%";
        divContainer.style.animationDuration = "1s";
        divContainer.style.WebkitTransitionDuration = "1s";
        divContainer.style.WebkitTransition = "1s";
        divContainer.style.MozTransition = "1s";
        divContainer.style.height = "250px";
        divContainer.height = "250px";
        isVitrineExpanded = true;
      }
    }

    function notifyMetricsMonitor() {
      try {
        if (Math.random() < 0.1) {
          var script = document.createElement("script");
          script.setAttribute("async", "true");
          script.setAttribute("type", "text/javascript");
          var foreignKeys = ["key1", "key2"].toString();
          window["callback"] = function (result) {};
          script.setAttribute(
            "src",
            "//metrics.dynad.net/resources/counter/jsonp/incWithFk/dynadtv/monitor/delivery/" +
              placementId +
              "?ord=" +
              Date.now() +
              "&callback=callback"
          );
          (
            document.head ||
            document.getElementsByTagName("head")[0] ||
            document.body ||
            document.documentElement ||
            document.getElementsByTagName("body")[0]
          ).appendChild(script);
        }
      } catch (e) {
        if (console && console.error)
          console.error("failed to append metrics monitoring pixel", e);
      }
    }

    function getPrebidVastURL(adUnit) {
      return pbjs.adServers.dfp.buildVideoUrl({
        adUnit: adUnit,
        params: {
          iu: window.DYNAD_TV.config.pathDFP
            ? window.DYNAD_TV.config.pathDFP
            : "/8804/teste/inread",
          cust_params: {
            videoplayertype: "dynad_in-article",
            keyword: "video-auto-play",
          },
          output: "xml_vast4",
          ad_rule: "0",
        },
      });
    }

    function checkForVideoBids(cb) {
      try {
        var videoBids = window.UOLPD.TagManager.Prebid.videoBids;
        if (
          videoBids &&
          typeof videoBids === "object" &&
          videoBids.constructor === Array
        ) {
          if (videoBids.length) {
            window.DYNAD_TV.config.URL_VAST = getPrebidVastURL(videoBids[0]);
          }
          cb();
        } else {
          window.DYNAD_TV.config.bidTimeout =
            window.DYNAD_TV.config.bidTimeout * 1000 ||
            (window.innerWidth <= 767 ? 6500 : 4500); //in seconds
          window.UOLPD.TagManager.Prebid.attachVideoListener(
            reqid,
            function (adUnit) {
              window.DYNAD_TV.config.timeoutId &&
                clearTimeout(window.DYNAD_TV.config.timeoutId);
              window.DYNAD_TV.config.URL_VAST = getPrebidVastURL(adUnit);
              cb();
            }
          );
          window.DYNAD_TV.config.timeoutId = setTimeout(function () {
            window.UOLPD.TagManager.Prebid.detachVideoListener(reqid);
            cb();
          }, window.DYNAD_TV.config.bidTimeout);
        }
      } catch (ex) {
        window.DYNAD_TV.config.timeoutId &&
          clearTimeout(window.DYNAD_TV.config.timeoutId);
        window.UOLPD.TagManager.Prebid &&
          window.UOLPD.TagManager.Prebid.detachListener(reqid);
        cb();
      }
    }

    function handle(e) {
      if (
        typeof e.data === "undefined" ||
        e.data == null ||
        typeof e.data !== "string"
      )
        return;

      if (
        e.data.indexOf("dynad-tv") == -1 ||
        status == STATUS.TIMEOUT ||
        status == STATUS.CLOSED
      )
        return;

      if (window.console) console.log("dynad.tv - core:", e.data);

      if (e.data.indexOf("dynad-tv-protocol/loaded/") == 0) {
        // player foi carregado
        try {
          if (idTimeout != null) {
            clearTimeout(idTimeout);
            idTimeout = null;
          }
        } catch (e) {}

        addAdServerCounter(5550003220);
        if (document.URL.indexOf("cybercook") > -1)
          addAdServerCounter(5550003316);

        var dm = e.data.substr("dynad-tv-protocol/loaded/".length).split("/");
        var avWidth = divContainer.parentNode.offsetWidth,
          avHeight = document.documentElement.clientHeight * 0.6;

        (height = parseInt(dm[1])), (width = parseInt(dm[0]));
        if (
          dm[0] == "" ||
          dm[0] == "undefined" ||
          dm[0] == null ||
          dm[0] == "null" ||
          isNaN(width) ||
          width <= 0 ||
          width < avWidth
        ) {
          width = avWidth;
          height = Math.round(avWidth * 0.5625); //16x9
        }

        try {
          dispatchEventListener("loaded", {
            w: width,
            h: height,
          });
        } catch (exEvent) {}

        status = STATUS.LOADED;
        resize();
        follow();
        notifyMetricsMonitor();
      } else if (e.data.indexOf("dynad-tv-protocol/click/") == 0) {
        // player nao contem data
        try {
          if (idTimeout != null) {
            clearTimeout(idTimeout);
            idTimeout = null;
          }
        } catch (e) {}
        try {
          dispatchEventListener("click");
        } catch (exEvent) {}
        addAdServerCounter(5550001579);
      } else if (e.data.indexOf("dynad-tv-protocol/no_data/") == 0) {
        // player nao contem data
        try {
          if (idTimeout != null) {
            clearTimeout(idTimeout);
            idTimeout = null;
          }
        } catch (e) {}
        var m = e.data.substr("dynad-tv-protocol/no_data/".length).split("/");
        try {
          dispatchEventListener("nodata", m);
        } catch (exEvent) {}
        //passbackVitrine();
        addAdServerCounter(5550003218);
        notifyMetricsMonitor();
      } else if (e.data == "dynad-tv-protocol/close") {
        try {
          dispatchEventListener("closed");
        } catch (exEvent) {}

        try {
          if (idTimeout != null) {
            clearTimeout(idTimeout);
            idTimeout = null;
          }
        } catch (e) {}

        divContainer.style.height = "0px";
        divContainer.style.width = "0%";
        divContainer.height = "0px";
        setTimeout(function () {
          container.parentNode.removeChild(container);
        }, 1000);

        dispose();
      } else if (e.data == "dynad-tv-protocol/init") {
        checkForVideoBids(function () {
          sendLoadMessage();
          sendActiveViewMessage(isElementVisible(container, vHeight, vWidth));
        });
      } else if (e.data == "dynad-tv-protocol/user_close") {
        container.contentWindow.postMessage(
          "dynad-tv-protocol/force_close_linear",
          "*"
        );
        window["callbackiruol_user_close"] = function (d) {};
        var e = document.createElement("script");
        e.setAttribute("type", "text/javascript");
        e.setAttribute("async", "true");
        e.setAttribute(
          "src",
          "//metrics.dynad.net/resources/counter/jsonp/multipleIncWithFk/dynadtv/behavior/close_button/override/?callback=callbackiruol_user_close&ord=" +
            Date.now() +
            "&override_0=" +
            encodeURIComponent(idAdSystem + "/" + idAdId + "/" + idCreativeId)
        );
        divContainer.appendChild(e);
      } else if (e.data.indexOf("dynad-tv-protocol/impression_data/") == 0) {
        var op = e.data
          .substr("dynad-tv-protocol/impression_data/".length)
          .split("/");
        (idAdSystem = op[1]), (idCreativeId = op[0]), (idAdId = op[2]);
        try {
          if (op.length > 3) {
            adVideoDuration = Number(op[3]) * 1000;
            if (adVideoDuration < 15000) adVideoDuration = 15000;
          }
        } catch (exTimer) {}
      } else if (e.data == "dynad-tv-protocol/dispatch_timeout_mobile") {
        startTimeoutCounter();
      } else if (e.data == "dynad-tv-protocol/state_skip") {
        var op = e.data.substr("dynad-tv-protocol/state_skip/".length);
        divContainer.setAttribute(
          "state_skip",
          op == "true" ? "none" : "block"
        );
      } else if (e.data == "dynad-tv-protocol/expand") {
        divContainer.style.width = "100%";
        container.style.height = vHeight + 20 + "px";
        container.height = vHeight + 20 + "px";
        divContainer.style.animationDuration = "1s";
        divContainer.style.WebkitTransitionDuration = "1s";
        divContainer.style.WebkitTransition = "1s";
        divContainer.style.MozTransition = "1s";
        divContainer.style.height = vHeight + 20 + "px";
        divContainer.height = vHeight + 20 + "px";
        sendStartCounterMessage();
        try {
          dispatchEventListener("expanded", {
            w: vWidth,
            h: vHeight,
          });
        } catch (exEvent) {}
        addAdServerCounter(5550003219);

        /****
                //DESLIGADO EM 23/08 a pedido do Andre
                var bc = document.createElement('div');
                bc.setAttribute('id', 'inarticle_parceiros_bt_close_dynadtv_unique');
                bc.setAttribute('style', "width:30px; text-align: right; line-height:17px; height:17px; position:absolute; top:0px; right:0px; cursor:pointer; z-index:10; color: black; font-size: 12px; display: block");
                bc.setAttribute("onclick", "window.postMessage('dynad-tv-protocol/user_close', '*');");
                bc.innerHTML = '[ x ]';
                divContainer.style.position = 'relative';
                divContainer.appendChild(bc);

                var listIds = [];

                if (listIds.length > 0) {
                    for (var i = 0; i < listIds.length; i++) {
                        if (idCreativeId === listIds[i]) {
                            bc.setAttribute('display', 'none');
                            bc.style.setProperty('display', 'none');
                            return;
                        }
                    }
                }
                ****/

        if (DYNAD_TV.config.container.removeOnClose == false) {
          var applyHeight = vHeight;
          if (
            typeof window.DYNAD_TV.config.container !== "undefined" &&
            typeof window.DYNAD_TV.config.container.height !== "undefined"
          )
            applyHeight = window.DYNAD_TV.config.container.height;
          var close_button = document.createElement("div");
          close_button.style.setProperty("width", "34px");
          close_button.style.setProperty("height", "34px");
          close_button.style.setProperty("background-position", "center");
          close_button.style.setProperty("background-repeat", "no-repeat");
          close_button.style.setProperty("background-size", "24px");
          close_button.style.setProperty(
            "background-image",
            "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAADMElEQVR42sVYv4saQRS+RZFrbLY7IY0WadzSJoggXJHKRlJuKx4kf0DstAkpbFPZpNcmgRQWEis5C5ukUMQUsbNXRDw2+8k8eY4zu6O7dxl4KPPjzbff++bNj5ub6MWS7MWLpbCEMOulAKomvxWWlozqVSBjBZNgAO58cwaDQWO1Wn1Zr9eDzWbzC4b/vn1dLpcfxuPxKwYuMigVkFyz2XyYzWZ/PMMCgPP5/G1UYDKYu2Kx+G4ymTzSRNvtdtfv971Go+G5rutVKpWD4T/q0Oazt+XABGMXg+JgjqyQc/y2220vn8972Ww20NAHfWnsbrf7K9i6CNQJmFqt9hlswCG+ulAohAKRDWMwlpiVQBmBQZhyCBN9XbfbvRiIbPBBoKbT6eswUEThrVhF9yTe4XAYGQwZMQVNibm0oSN27GQy+QahIs1cE6YgXS0Wiyf4DgodZyfnm0vsQJRxgSGDTxTkLR1LSnb8ZR6qB5W2gtrI4DuIJa6daq/X+43OnU5H65AXPjHG8KIbT/2Q6RlLZ4Ac346ZGEkujHYqmEAGExRu+FaE7UQ/aYTL//1ISz1MzDIoUzCUmygFiJx3DNuJfgCIEqFJNlaBMl0IVDC3EhByTyqV+rTf759MAclhCtMeN5onFJBpyFRgTEHhY1nI9IAQMhI1dm9TMCpRB4GCbyZqJaCjqGnZB2lBN7HpsscRReS6R1nUZ8veT4w/whIjTaxiIaiNDPsjCk6dApClAnTYNriO6vV67FsH5SChn5wuMZ7oqNVq/Yx7p5fZGY1G32T9qDbXQ9g4S3GcheR9Dr7FXGndEeSMpVKp1KUkCRFGBUNCRv7BsVjHju4IUgVLJPCoTBEzQuzfJe1YJudphwQOPRFTiP8lQkdf0gyYEWAc1VIPu3HYHBTCx681mAR5qlwun4FAHdoICGkG5yzh077k5qECVYWmZLZ4QZ2uXrBSvQaM9m4mhP5AwKAtZFnOGmcDbQCfyWTei7E5KUyRb6/EFpy7HBw31Ik2V/QlVmK541sKtmzxtY7Y++65iTpH9LEVrFjP8RzDn2FsyfizzLM8xwQ9ViU09l9e1awQu6r8A4hH+I8+sga+AAAAAElFTkSuQmCC)"
          );
          close_button.style.setProperty(
            "margin",
            "-" +
              (applyHeight + 17) +
              "px 0 0 " +
              (divContainer.offsetWidth - 17) +
              "px"
          );
          close_button.style.setProperty("cursor", "pointer");
          close_button.style.setProperty("position", "relative");
          close_button.style.setProperty("z-index", "9999");
          close_button.style.setProperty("opacity", "1");
          close_button.onclick = function () {
            window.postMessage("dynad-tv-protocol/close", "*");
            this.style.display = "none";
          };

          divContainer.style.overflow = "visible";
          divContainer.appendChild(close_button);
        }
      }
    }

    function resize() {
      if (width == 0 || height == 0) return;

      var avWidth = divContainer.parentNode.offsetWidth,
        avHeight = document.documentElement.clientHeight * 0.6;
      if (
        Math.abs(width - avWidth) < Math.abs(height - avHeight) ||
        width > avWidth
      ) {
        var ratio = width / avWidth;
        vWidth = Math.round(width / ratio);
        vHeight = Math.round(height / ratio);
      } else {
        var ratio = height / avHeight;
        vWidth = Math.round(width / ratio);
        vHeight = Math.round(height / ratio);
      }
      if (vWidth > avWidth) {
        var ratio = vWidth / avWidth;
        vWidth = Math.round(vWidth / ratio);
        vHeight = Math.round(vHeight / ratio);
      }
      if (vHeight > avHeight) {
        var ratio = vHeight / avHeight;
        vWidth = Math.round(vWidth / ratio);
        vHeight = Math.round(vHeight / ratio);
      }
      var sizing = APPLY_PLAYER_SIZE_POLICY(vWidth);
      if (sizing) {
        vWidth = sizing.width;
        vHeight = sizing.height;

        actual_width = vWidth;
        actual_height = vHeight;

        container.contentWindow.postMessage(
          "dynad-tv-protocol/resize/" + vWidth + "/" + vHeight,
          "*"
        );
      } else {
        window.postMessage("dynad-tv-protocol/close", "*");
      }
    }

    function isElementVisible(el, vdHeight, vdWidth) {
      if (isNaN(vdHeight)) vdHeight = 0;
      if (isNaN(vdWidth)) vdWidth = 0;
      var rect = el.getBoundingClientRect();
      var windowHeight =
        window.innerHeight || document.documentElement.clientHeight;
      var vertInView =
        rect.top + vdHeight * 0.1 <= windowHeight &&
        rect.top + vdHeight * 0.1 >= 0;
      return vertInView;
    }

    function getExposedElementVisible() {
      return function () {
        return isElementVisible(container, vHeight, vWidth);
      };
    }

    window["DYNAD_TV_ElementWatcher"] = getExposedElementVisible();

    //
    // acompanha evento de scroll
    //
    function follow() {
      if (isElementVisible(container, vHeight, vWidth)) {
        sendActiveViewMessage(true);
        if (status == STATUS.INITIALIZED) {
        } else if (status == STATUS.LOADED) {
          status = STATUS.PLAYING;
          sendPlayMessage();
        } else if (status == STATUS.PAUSED) {
          status = STATUS.PLAYING;
          sendPlayMessage();
        }
      } else {
        sendActiveViewMessage(false);
        if (status == STATUS.PLAYING) {
          status = STATUS.PAUSED;
          sendPauseMessage();
        }
      }
    }

    function dispose() {
      if (window.addEventListener) {
        removeEventListener("scroll", follow);
        removeEventListener("touchstart", follow);
        removeEventListener("touchend", follow);
        removeEventListener("resize", resize);
        removeEventListener("focus", sendFocusMessage);
        removeEventListener("blur", sendBlurMessage);
      } else {
        detachEvent("onscroll", follow);
        detachEvent("ontouchstart", follow);
        detachEvent("ontouchend", follow);
        detachEvent("onresize", resize);
        detachEvent("onfocus", sendFocusMessage);
        detachEvent("onblur", sendBlurMessage);
      }
    }

    function sendStartCounterMessage() {
      container.contentWindow.postMessage(
        "dynad-tv-protocol/start-counter",
        "*"
      );
      try {
        dispatchEventListener("counting");
      } catch (exEvent) {}
    }

    function sendLoadMessage() {
      var pattern = new RegExp("(\\?|\\&)(sz=).*?(&|$)");
      DYNAD_TV.config.URL_VAST = DYNAD_TV.config.URL_VAST.replace(
        pattern,
        "$1$2480x360$3"
      );

      var params =
        "&videoplayertype=dynad_in-article&videoplayersize=" +
        videoSize +
        "&keyword=video-auto-play";

      /**SOLICITACAO FELIPE NERE EM 18/10, ATENDER UMA CAMPANHA DE VIDEO QUE UTILIZA O KEYWORD COMO TARGET, NAO ERA POSSIVEL CONFIGURAR VIA ORIGIN**/
      if (document.location.hostname == "cybercook.uol.com.br") {
        if (
          typeof window.universal_variable !== "undefined" &&
          typeof window.universal_variable.dfp !== "undefined" &&
          typeof window.universal_variable.dfp.custom_params !== "undefined" &&
          typeof window.universal_variable.dfp.custom_params.keyword !==
            "undefined" &&
          typeof window.universal_variable.dfp.custom_params.keyword ===
            "string" &&
          window.universal_variable.dfp.custom_params.keyword != "" &&
          window.universal_variable.dfp.custom_params.keyword != null
        )
          params += "," + window.universal_variable.dfp.custom_params.keyword;
      }

      if (
        typeof UOLPD !== "undefined" &&
        typeof UOLPD.dataLayer !== "undefined"
      ) {
        try {
          for (var key in UOLPD.dataLayer) {
            params += "&" + key + "=" + UOLPD.dataLayer[key];
          }
        } catch (exDL) {
          if (typeof UOLPD.dataLayer.tt_age !== "undefined")
            params += "&tt_age=" + UOLPD.dataLayer.tt_age;
          if (typeof UOLPD.dataLayer.tt_cluster !== "undefined")
            params += "&tt_cluster=" + UOLPD.dataLayer.tt_cluster;
          if (typeof UOLPD.dataLayer.tt_customaudience !== "undefined")
            params += "&tt_customaudience=" + UOLPD.dataLayer.tt_customaudience;
          if (typeof UOLPD.dataLayer.tt_gender !== "undefined")
            params += "&tt_gender=" + UOLPD.dataLayer.tt_gender;
          if (typeof UOLPD.dataLayer.tt_lists !== "undefined")
            params += "&tt_lists=" + UOLPD.dataLayer.tt_lists;
          if (typeof UOLPD.dataLayer.tt_microsegments !== "undefined")
            params += "&tt_microsegments=" + UOLPD.dataLayer.tt_microsegments;
          if (typeof UOLPD.dataLayer.tt_socialclass !== "undefined")
            params += "&tt_socialclass=" + UOLPD.dataLayer.tt_socialclass;
          if (typeof UOLPD.dataLayer.tt_subjects !== "undefined")
            params += "&tt_subjects=" + UOLPD.dataLayer.tt_subjects;
          if (typeof UOLPD.dataLayer.tt_team !== "undefined")
            params += "&tt_team=" + UOLPD.dataLayer.tt_team;
        }
      }

      if (params != "") {
        if (window.DYNAD_TV.config.URL_VAST.indexOf("&cust_params=") > -1) {
          var temp = window.DYNAD_TV.config.URL_VAST.split("&cust_params=");
          window.DYNAD_TV.config.URL_VAST =
            temp[0] +
            "&cust_params=" +
            encodeURIComponent(params.substr(1) + "&") +
            temp[1];
        } else callPlayerSize();
        params = params.replace(
          "videoplayersize=null",
          "videoplayersize=" + videoSize
        );

        window.DYNAD_TV.config.URL_VAST +=
          "&cust_params=" + encodeURIComponent(params.substr(1));
      }

      if (typeof window.DYNAD_TV.config.settings === "undefined")
        window.DYNAD_TV.config.settings = new Array();
      window.DYNAD_TV.config.settings.push({
        key: "containerId",
        value: containerId,
      });

      if (typeof window.DYNAD_TV.config.settings !== "undefined") {
        var st = "";
        for (var x = 0; x < window.DYNAD_TV.config.settings.length; x++) {
          st +=
            (st != "" ? "/" : "") +
            window.DYNAD_TV.config.settings[x].key +
            "=" +
            window.DYNAD_TV.config.settings[x].value;
        }
        if (st != "")
          container.contentWindow.postMessage(
            "dynad-tv-protocol/settings/" + st,
            "*"
          );
      }
      container.contentWindow.postMessage(
        "dynad-tv-protocol/load/" + window.DYNAD_TV.config.URL_VAST,
        "*"
      );
    }

    function sendActiveViewMessage(status) {
      if (
        status != STATUS.CLOSED &&
        typeof container !== "undefined" &&
        typeof container.contentWindow !== "undefined"
      )
        container.contentWindow.postMessage(
          "dynad-tv-protocol/active_display/" + status,
          "*"
        );
    }

    function sendFocusMessage() {
      if (
        status == STATUS.PLAYING &&
        typeof container !== "undefined" &&
        typeof container.contentWindow !== "undefined"
      )
        container.contentWindow.postMessage("dynad-tv-protocol/win-focus", "*");
    }

    function sendBlurMessage() {
      console.log("will dispatch blur:", status);
      if (
        status == STATUS.PLAYING &&
        typeof container !== "undefined" &&
        typeof container.contentWindow !== "undefined"
      )
        container.contentWindow.postMessage("dynad-tv-protocol/win-blur", "*");
    }

    function sendPlayMessage() {
      container.contentWindow.postMessage("dynad-tv-protocol/play", "*");
    }

    function sendPauseMessage() {
      container.contentWindow.postMessage("dynad-tv-protocol/pause", "*");
    }

    if (window.addEventListener) {
      addEventListener("scroll", follow, false);
      addEventListener("touchstart", follow, false);
      addEventListener("touchend", follow, false);
      addEventListener("resize", resize, false);
      addEventListener("focus", sendFocusMessage, false);

      addEventListener(
        "blur",
        function () {
          if (isMouseOverIfrm === false) sendBlurMessage();
        },
        false
      );

      addEventListener("message", handle, false);
      container.addEventListener(
        "mouseenter",
        function (e) {
          isMouseOverIfrm = true;
        },
        false
      );
      container.addEventListener(
        "mouseleave",
        function (e) {
          isMouseOverIfrm = false;
        },
        false
      );
    } else {
      attachEvent("onscroll", follow);
      attachEvent("ontouchstart", follow, false);
      attachEvent("ontouchend", follow, false);
      attachEvent("onresize", resize, false);
      attachEvent("onfocus", sendFocusMessage, false);
      attachEvent(
        "onblur",
        function () {
          if (!isMouseOverIfrm) sendBlurMessage();
        },
        false
      );
      attachEvent("onmessage", handle);
      container.attachEvent(
        "onmouseenter",
        function (e) {
          isMouseOverIfrm = true;
        },
        false
      );
      container.attachEvent(
        "onmouseleave",
        function (e) {
          isMouseOverIfrm = false;
        },
        false
      );
    }

    follow();

    function startTimeoutCounter() {
      if (idTimeout != null) return;

      idTimeout = setTimeout(function () {
        //change status for timeout
        status = STATUS.TIMEOUT;
        setTimeout(function () {
          //remove container
          try {
            divContainer.parentNode.removeChild(divContainer);
          } catch (e) {}
        }, 1000);
        //dispatch nodata event
        dispatchEventListener("nodata", "timeout operation");
        //dispose listeners
        dispose();
        //add event counter
        addAdServerCounter(5550001578);
      }, window.DYNAD_TV.config.timeout || 8000);

      if (window.addEventListener)
        removeEventListener("touchstart", startTimeoutCounter, false);
      else detachEvent("ontouchstart", startTimeoutCounter, false);
    }

    /**** if( !isMobile.any() ) startTimeoutCounter(); ****/
  }

  var divContainer = document.getElementById(containerId),
    ifrm = document.getElementById(reqid.replace("I", "IF"));
  try {
    try {
      divContainer.style.width = "0%";
      ifrm.style.width = "100%";
      ifrm.width = "100%";

      divContainer.style.height = "0px";
      ifrm.style.height = "0px";
      ifrm.height = 0;
    } catch (e) {
      return false;
    }
    DynAdTvKeeper(ifrm);
  } catch (e) {
    return false;
  }
}
return true;}catch(e){if(typeof console!=='undefined'&&typeof console.log!=='undefined'){console.log('DynAd Error:');console.log(e);}}})('I5550001923_1637852995891679595425', 'H', 1,'_dynad_c_I5550001923_1637852995891679595425','5550001923');if(_rp1637852995891679595425==true||typeof _rp1637852995891679595425==='undefined'){divAppender("<iframe id='IF5550001923_1637852995891679595425' name='I5550001923_1637852995891679595425' src='https://s.dynad.net/stack/928W5r5IndTfocT3VdUV-AB8UVlc0JbnGWyFZsei5gU.html' style='border:0; visibility:visible; -webkit-transition:all 1s; width:100%; -o-transition:all 1s; transition:all 1s; height:0px; -moz-transition:all 1s; ' marginwidth='0' marginwidth='0' width='88' height='31' marginheight='0' align='top' scrolling='No' bordercolor='#000000' frameborder='0' hspace='0' vspace='0'></iframe>");(function(){var theIframe=document.getElementById('IF5550001923_1637852995891679595425');var dyndata=(function(){var t=dt_dynad;if(typeof t==="object")return JSON.stringify(t);else if(typeof t==="undefined"||t==null||t=="")return"{}";else return (function(e){var t=function(e){var t="";for(var n=e.length-1;n>=0;n--)if(e[n]>="0"&&e[n]<="9")t+=e[n];else break;return[e.substring(0,n+1),t]};var n=e.replace(/"/g,"'").split(/&(?!([#a-z0-9]{1,4})(;))/gi);var r="";var i="";var s="";for(var o=0;o<n.length;o++){if(typeof n[o]==="undefined")continue;var u=n[o].split("=");if(u[0]=="_nofobjs"||u[0]=="_dyn_hash_"||u.length!=2)continue;var a=t(u[0]);if(a[1]!=r&&i!=""){s+=(s==""?"":",")+"{"+i+"}";i=""}if(a[0]!=""){r=a[1];i+=(i==""?"":",")+'"'+a[0]+'":"'+decodeURIComponent(u[1])+'"'}}s+=(s==""?"":",")+"{"+i+"}";return"["+s+"]"})(t.toString())})();var data='{"target":"_blank","clickTAG":"https://t.dynad.net/c/?dc=5550001923;ct=1;ci=5000003610;cr=4000039770.0;cb=4000020066.0;ord=0;tid=TB-FE13;bid=;iid=NDNGMjBBN0Y5MkFBNzdFNcI0GPOhE9o/cRUYc/5nmwbG1a/bHiHz3ynB1O66U5Wv0AXUBKHGvIeD1y2WzPoIN/6LIVSf68AgJTns9vem4jE=;;","clickTAG2":"https://t.dynad.net/c/?dc=5550001923;ct=2;ci=5000003610;cr=4000039770.0;cb=4000020066.0;ord=0;tid=TB-FE13;bid=;iid=NDNGMjBBN0Y5MkFBNzdFNcI0GPOhE9o/cRUYc/5nmwbG1a/bHiHz3ynB1O66U5Wv0AXUBKHGvIeD1y2WzPoIN/6LIVSf68AgJTns9vem4jE=;;","clickTAG3":"https://t.dynad.net/c/?dc=5550001923;ct=3;ci=5000003610;cr=4000039770.0;cb=4000020066.0;ord=0;tid=TB-FE13;bid=;iid=NDNGMjBBN0Y5MkFBNzdFNcI0GPOhE9o/cRUYc/5nmwbG1a/bHiHz3ynB1O66U5Wv0AXUBKHGvIeD1y2WzPoIN/6LIVSf68AgJTns9vem4jE=;;","clickTAG4":"https://t.dynad.net/c/?dc=5550001923;ct=4;ci=5000003610;cr=4000039770.0;cb=4000020066.0;ord=0;tid=TB-FE13;bid=;iid=NDNGMjBBN0Y5MkFBNzdFNcI0GPOhE9o/cRUYc/5nmwbG1a/bHiHz3ynB1O66U5Wv0AXUBKHGvIeD1y2WzPoIN/6LIVSf68AgJTns9vem4jE=;;","clickTAG5":"https://t.dynad.net/c/?dc=5550001923;ct=5;ci=5000003610;cr=4000039770.0;cb=4000020066.0;ord=0;tid=TB-FE13;bid=;iid=NDNGMjBBN0Y5MkFBNzdFNcI0GPOhE9o/cRUYc/5nmwbG1a/bHiHz3ynB1O66U5Wv0AXUBKHGvIeD1y2WzPoIN/6LIVSf68AgJTns9vem4jE=;;","_d_site_id":"3000000127","_d_placement_id":"5550001923","_d_campaign_id":"5000003610","_d_creative_id":"4000039770","eventsMap":{},"domain":"https://t.dynad.net","tagParameters":'+JSON.stringify(tagParameters)+',"data":'+dyndata+'}';if(window.addEventListener){
theIframe.addEventListener('load',function(){theIframe.contentWindow.postMessage(JSON.stringify((function(dynamicData){return dynamicData;})(JSON.parse(data))),'https://s.dynad.net')});}else{theIframe.attachEvent('onload', function(){theIframe.contentWindow.postMessage(JSON.stringify((function(dynamicData){return dynamicData;})(JSON.parse(data))),'https://s.dynad.net')});}window._dd_st_vl_1637852995891679595425=JSON.parse(data);})();(function(reqid,type,step,containerId,placementId,siteId,campaignId,creativeId,dynamicData){try{var APPLY_PLAYER_SIZE_POLICY = function (desired_width) {
  var MIN_WIDTH = 256,
    MIN_HEIGHT = 144;
  var initial_area = window.innerWidth * window.innerHeight;
  var window_ratio = initial_area / (window.innerHeight * window.innerHeight);
  var part_window_ratio = window_ratio / 0.3;
  var base_width = Math.sqrt(initial_area / part_window_ratio);
  var base_height = base_width * window_ratio;

  var final_area = base_width * base_height;
  var expected_ratio = 9 / 16;
  var final_width = Math.floor(Math.sqrt(final_area / expected_ratio));
  if (
    window.DYNAD_TV.config &&
    window.DYNAD_TV.config.width &&
    final_width > window.DYNAD_TV.config.width
  ) {
    final_width = window.DYNAD_TV.config.width;
  }
  if (desired_width && desired_width < final_width) {
    if (desired_width < MIN_WIDTH) {
      desired_width = MIN_WIDTH;
    }
    final_width = desired_width;
  }
  var final_height = Math.floor(expected_ratio * final_width);
  if (final_width < MIN_WIDTH || final_height < MIN_HEIGHT) {
    return false;
  }

  return { width: final_width, height: final_height };
};

if (step == 1) {
  if (!APPLY_PLAYER_SIZE_POLICY(null)) {
    return false;
  }
  var isMobile = {
    Android: function () {
      return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function () {
      return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function () {
      return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function () {
      return navigator.userAgent.match(/Opera Mini/i);
    },
    Windows: function () {
      return (
        navigator.userAgent.match(/IEMobile/i) ||
        navigator.userAgent.match(/WPDesktop/i)
      );
    },
    any: function () {
      return (
        isMobile.Android() ||
        isMobile.BlackBerry() ||
        isMobile.iOS() ||
        isMobile.Opera() ||
        isMobile.Windows()
      );
    },
  };

  if (!isMobile.any()) {
    // Auditoria Infomoney Desktop Impressions
    if (document.URL.indexOf("infomoney") > -1) {
      var imgCounter = new Image();
      imgCounter.src = "//t.dynad.net/pc/?dc=5550007859;ord=" + Date.now();
    }
  }

  if (isMobile.any()) {
    // Auditoria Infomoney Mobile Impressions
    if (document.URL.indexOf("infomoney") > -1) {
      var imgCounter = new Image();
      imgCounter.src = "//t.dynad.net/pc/?dc=5550007855;ord=" + Date.now();
    }

    if (isMobile.iOS()) {
      if (
        navigator.userAgent.toLowerCase().indexOf(" os 10_") == -1 &&
        navigator.userAgent.toLowerCase().indexOf(" os 11_") == -1
      ) {
        if (console && console.log)
          console.log("[dynad-tv] - iOS inferior ao 10 nao e suportado");

        try {
          var imgCounter = new Image();
          imgCounter.src = "//t.dynad.net/pc/?dc=5550003217;ord=" + Date.now();

          // Auditoria Cybercook Device
          if (document.URL.indexOf("cybercook") > -1) {
            setTimeout(function () {
              var imgCounter = new Image();
              imgCounter.src =
                "//t.dynad.net/pc/?dc=5550003314;ord=" + Date.now();
            }, 20);
          }

          // Auditoria Infomoney Device
          if (document.URL.indexOf("infomoney") > -1) {
            var imgCounter = new Image();
            imgCounter.src =
              "//t.dynad.net/pc/?dc=5550007853;ord=" + Date.now();
          }
        } catch (e) {}
        return false;
      }
      return false;
    } else if (isMobile.Android()) {
    } else {
      if (console && console.log)
        console.log("[dynad-tv] - plataforma movel nao suportada.");

      try {
        var imgCounter = new Image();
        imgCounter.src = "//t.dynad.net/pc/?dc=5550003217;ord=" + Date.now();

        if (document.URL.indexOf("cybercook") > -1) {
          setTimeout(function () {
            var imgCounter = new Image();
            imgCounter.src =
              "//t.dynad.net/pc/?dc=5550003314;ord=" + Date.now();
          }, 20);
        }
      } catch (e) {}
      return false;
    }
  }
}

if (step == 2) {
  if (typeof window.DYNAD_TV === "undefined")
    window.DYNAD_TV = {
      config: {
        URL_VAST:
          "https://pubads.g.doubleclick.net/gampad/ads?slotname=/8804/teste/inread&sz=640x480&ciu_szs=&url=%5Breferrer_url%5D&unviewed_position_start=1&output=xml_vast3&impl=s&env=vp&gdfp_req=1&ad_rule=0&video_url_to_fetch=%5Bdescription_url%5D&vad_type=linear&vpos=preroll&pod=1&min_ad_duration=0&max_ad_duration=999999000&ppos=1&lip=true&correlator=" +
          new Date().getTime() +
          Math.random(),
      },
    };

  var deviceIsMobile = (function (a) {
    if (
      /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(
        a
      ) ||
      /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
        a.substr(0, 4)
      )
    ) {
      return true;
    } else {
      return false;
    }
  })(navigator.userAgent || navigator.vendor || window.opera);

  function DynAdTvKeeper(container) {
    var actual_width = null;
    var actual_height = null;
    var videoSize = null;

    resize();

    var callPlayerSize = function callPlayerSize() {
      if (window.DYNAD_TV.config.URL_VAST.match("videoplayersize%3D") == null) {
        var sizeSmall = function sizeSmall() {
          videoSize = "small";
        };

        var sizeLarge = function sizeLarge() {
          videoSize = "large";
        };

        // mobile
        if (deviceIsMobile) {
          var deviceSize = window.screen.availWidth * window.screen.availHeight;
          var playerSize = actual_width * actual_height;

          if (playerSize >= deviceSize * 0.2) {
            sizeLarge();
          } else {
            sizeSmall();
          }
        }
        // desktop
        else {
          if (actual_height < 300 || actual_width < 400) {
            sizeSmall();
          } else {
            sizeLarge();
          }
        }
      }
    };

    var idTimeout = null;
    var STATUS = {
      INITIALIZED: 0,
      LOADED: 1,
      PLAYING: 2,
      PAUSED: 3,
      CLOSED: 5,
      TIMEOUT: 4,
    };

    var status = STATUS.INITIALIZED,
      height = 0,
      width = 0,
      vHeight = 0,
      vWidth = 0;
    var isMouseOverIfrm = false,
      isInVitrineMode = false,
      isVitrineExpanded = false;

    var idAdSystem = "",
      idCreativeId = "",
      idAdId = "";

    function addAdServerCounter(id) {
      if (
        window.location.hostname.indexOf("m.cifraclub") > -1 &&
        id == 5550003219
      ) {
        //player visible
        id = 5550004701;
      }
      if (
        window.location.hostname.indexOf("m.cifraclub") > -1 &&
        id == 5550003220
      ) {
        //vast loaded
        id = 5550004713;
      }

      // Auditoria Infomoney Player Visible
      if (document.URL.indexOf("infomoney") > -1 && id == 5550003219) {
        id = 5550007856;
      }

      // Auditoria Infomoney Data Loaded
      if (document.URL.indexOf("infomoney") > -1 && id == 5550003220) {
        id = 5550007852;
      }

      // Auditoria Infomoney Empty Vast/Timeout
      if (
        (document.URL.indexOf("infomoney") > -1 && id == 5550003218) ||
        (document.URL.indexOf("infomoney") > -1 && id == 5550001578)
      ) {
        id = 5550007854;
      }

      var imgCounter = new Image();
      imgCounter.src = "//t.dynad.net/pc/?dc=" + id + ";ord=" + Date.now();
    }

    function dispatchEventListener(eventName, eventData) {
      if (status === STATUS.CLOSED) return;

      if (eventName == "nodata") {
        if (document.URL.indexOf("cybercook") > -1)
          addAdServerCounter(5550003315);
      }

      if (
        typeof window.DYNAD_TV !== "undefined" &&
        typeof window.DYNAD_TV.eventListener !== "undefined"
      ) {
        if (typeof eventData !== "undefined")
          window.DYNAD_TV.eventListener(eventName, eventData);
        else window.DYNAD_TV.eventListener(eventName);
      }
      if (eventName == "closed" || eventName == "nodata")
        status = STATUS.CLOSED;
    }

    function passbackVitrine() {
      var _cid_ = "";
      try {
        _cid_ = tagParameters["afilio"];
      } catch (e) {
        console.log("WARNING:id afiliado nao informado");
        return;
      }
      if (typeof _cid_ === "undefined" && _cid_ == "") {
        console.log("WARNING:id afiliado nao informado");
        return;
      }
      status = STATUS.CLOSED;
      isInVitrineMode = true;
      ifrm.parentNode.removeChild(ifrm);
      var scriptVitrine = document.createElement("iframe");
      scriptVitrine.setAttribute("scrolling", "no");
      scriptVitrine.setAttribute("frameborder", "no");
      scriptVitrine.setAttribute("width", "100%");
      scriptVitrine.setAttribute("height", "250px");
      scriptVitrine.setAttribute("style", "width: 100%; height: 250px;");
      scriptVitrine.setAttribute(
        "src",
        "//t.dynad.net/script/?dc=" +
          _cid_ +
          ";ord=" +
          Date.now() +
          ";srctype=ifrm;click="
      );
      divContainer.appendChild(scriptVitrine);
      container = scriptVitrine;
      vWidth = divContainer.parentNode.offsetWidth;
      vHeight = 250;
      if (isElementVisible(container, vHeight, vWidth) && !isVitrineExpanded) {
        divContainer.style.width = "100%";
        divContainer.style.animationDuration = "1s";
        divContainer.style.WebkitTransitionDuration = "1s";
        divContainer.style.WebkitTransition = "1s";
        divContainer.style.MozTransition = "1s";
        divContainer.style.height = "250px";
        divContainer.height = "250px";
        isVitrineExpanded = true;
      }
    }

    function notifyMetricsMonitor() {
      try {
        if (Math.random() < 0.1) {
          var script = document.createElement("script");
          script.setAttribute("async", "true");
          script.setAttribute("type", "text/javascript");
          var foreignKeys = ["key1", "key2"].toString();
          window["callback"] = function (result) {};
          script.setAttribute(
            "src",
            "//metrics.dynad.net/resources/counter/jsonp/incWithFk/dynadtv/monitor/delivery/" +
              placementId +
              "?ord=" +
              Date.now() +
              "&callback=callback"
          );
          (
            document.head ||
            document.getElementsByTagName("head")[0] ||
            document.body ||
            document.documentElement ||
            document.getElementsByTagName("body")[0]
          ).appendChild(script);
        }
      } catch (e) {
        if (console && console.error)
          console.error("failed to append metrics monitoring pixel", e);
      }
    }

    function getPrebidVastURL(adUnit) {
      return pbjs.adServers.dfp.buildVideoUrl({
        adUnit: adUnit,
        params: {
          iu: window.DYNAD_TV.config.pathDFP
            ? window.DYNAD_TV.config.pathDFP
            : "/8804/teste/inread",
          cust_params: {
            videoplayertype: "dynad_in-article",
            keyword: "video-auto-play",
          },
          output: "xml_vast4",
          ad_rule: "0",
        },
      });
    }

    function checkForVideoBids(cb) {
      try {
        var videoBids = window.UOLPD.TagManager.Prebid.videoBids;
        if (
          videoBids &&
          typeof videoBids === "object" &&
          videoBids.constructor === Array
        ) {
          if (videoBids.length) {
            window.DYNAD_TV.config.URL_VAST = getPrebidVastURL(videoBids[0]);
          }
          cb();
        } else {
          window.DYNAD_TV.config.bidTimeout =
            window.DYNAD_TV.config.bidTimeout * 1000 ||
            (window.innerWidth <= 767 ? 6500 : 4500); //in seconds
          window.UOLPD.TagManager.Prebid.attachVideoListener(
            reqid,
            function (adUnit) {
              window.DYNAD_TV.config.timeoutId &&
                clearTimeout(window.DYNAD_TV.config.timeoutId);
              window.DYNAD_TV.config.URL_VAST = getPrebidVastURL(adUnit);
              cb();
            }
          );
          window.DYNAD_TV.config.timeoutId = setTimeout(function () {
            window.UOLPD.TagManager.Prebid.detachVideoListener(reqid);
            cb();
          }, window.DYNAD_TV.config.bidTimeout);
        }
      } catch (ex) {
        window.DYNAD_TV.config.timeoutId &&
          clearTimeout(window.DYNAD_TV.config.timeoutId);
        window.UOLPD.TagManager.Prebid &&
          window.UOLPD.TagManager.Prebid.detachListener(reqid);
        cb();
      }
    }

    function handle(e) {
      if (
        typeof e.data === "undefined" ||
        e.data == null ||
        typeof e.data !== "string"
      )
        return;

      if (
        e.data.indexOf("dynad-tv") == -1 ||
        status == STATUS.TIMEOUT ||
        status == STATUS.CLOSED
      )
        return;

      if (window.console) console.log("dynad.tv - core:", e.data);

      if (e.data.indexOf("dynad-tv-protocol/loaded/") == 0) {
        // player foi carregado
        try {
          if (idTimeout != null) {
            clearTimeout(idTimeout);
            idTimeout = null;
          }
        } catch (e) {}

        addAdServerCounter(5550003220);
        if (document.URL.indexOf("cybercook") > -1)
          addAdServerCounter(5550003316);

        var dm = e.data.substr("dynad-tv-protocol/loaded/".length).split("/");
        var avWidth = divContainer.parentNode.offsetWidth,
          avHeight = document.documentElement.clientHeight * 0.6;

        (height = parseInt(dm[1])), (width = parseInt(dm[0]));
        if (
          dm[0] == "" ||
          dm[0] == "undefined" ||
          dm[0] == null ||
          dm[0] == "null" ||
          isNaN(width) ||
          width <= 0 ||
          width < avWidth
        ) {
          width = avWidth;
          height = Math.round(avWidth * 0.5625); //16x9
        }

        try {
          dispatchEventListener("loaded", {
            w: width,
            h: height,
          });
        } catch (exEvent) {}

        status = STATUS.LOADED;
        resize();
        follow();
        notifyMetricsMonitor();
      } else if (e.data.indexOf("dynad-tv-protocol/click/") == 0) {
        // player nao contem data
        try {
          if (idTimeout != null) {
            clearTimeout(idTimeout);
            idTimeout = null;
          }
        } catch (e) {}
        try {
          dispatchEventListener("click");
        } catch (exEvent) {}
        addAdServerCounter(5550001579);
      } else if (e.data.indexOf("dynad-tv-protocol/no_data/") == 0) {
        // player nao contem data
        try {
          if (idTimeout != null) {
            clearTimeout(idTimeout);
            idTimeout = null;
          }
        } catch (e) {}
        var m = e.data.substr("dynad-tv-protocol/no_data/".length).split("/");
        try {
          dispatchEventListener("nodata", m);
        } catch (exEvent) {}
        //passbackVitrine();
        addAdServerCounter(5550003218);
        notifyMetricsMonitor();
      } else if (e.data == "dynad-tv-protocol/close") {
        try {
          dispatchEventListener("closed");
        } catch (exEvent) {}

        try {
          if (idTimeout != null) {
            clearTimeout(idTimeout);
            idTimeout = null;
          }
        } catch (e) {}

        divContainer.style.height = "0px";
        divContainer.style.width = "0%";
        divContainer.height = "0px";
        setTimeout(function () {
          container.parentNode.removeChild(container);
        }, 1000);

        dispose();
      } else if (e.data == "dynad-tv-protocol/init") {
        checkForVideoBids(function () {
          sendLoadMessage();
          sendActiveViewMessage(isElementVisible(container, vHeight, vWidth));
        });
      } else if (e.data == "dynad-tv-protocol/user_close") {
        container.contentWindow.postMessage(
          "dynad-tv-protocol/force_close_linear",
          "*"
        );
        window["callbackiruol_user_close"] = function (d) {};
        var e = document.createElement("script");
        e.setAttribute("type", "text/javascript");
        e.setAttribute("async", "true");
        e.setAttribute(
          "src",
          "//metrics.dynad.net/resources/counter/jsonp/multipleIncWithFk/dynadtv/behavior/close_button/override/?callback=callbackiruol_user_close&ord=" +
            Date.now() +
            "&override_0=" +
            encodeURIComponent(idAdSystem + "/" + idAdId + "/" + idCreativeId)
        );
        divContainer.appendChild(e);
      } else if (e.data.indexOf("dynad-tv-protocol/impression_data/") == 0) {
        var op = e.data
          .substr("dynad-tv-protocol/impression_data/".length)
          .split("/");
        (idAdSystem = op[1]), (idCreativeId = op[0]), (idAdId = op[2]);
        try {
          if (op.length > 3) {
            adVideoDuration = Number(op[3]) * 1000;
            if (adVideoDuration < 15000) adVideoDuration = 15000;
          }
        } catch (exTimer) {}
      } else if (e.data == "dynad-tv-protocol/dispatch_timeout_mobile") {
        startTimeoutCounter();
      } else if (e.data == "dynad-tv-protocol/state_skip") {
        var op = e.data.substr("dynad-tv-protocol/state_skip/".length);
        divContainer.setAttribute(
          "state_skip",
          op == "true" ? "none" : "block"
        );
      } else if (e.data == "dynad-tv-protocol/expand") {
        divContainer.style.width = "100%";
        container.style.height = vHeight + 20 + "px";
        container.height = vHeight + 20 + "px";
        divContainer.style.animationDuration = "1s";
        divContainer.style.WebkitTransitionDuration = "1s";
        divContainer.style.WebkitTransition = "1s";
        divContainer.style.MozTransition = "1s";
        divContainer.style.height = vHeight + 20 + "px";
        divContainer.height = vHeight + 20 + "px";
        sendStartCounterMessage();
        try {
          dispatchEventListener("expanded", {
            w: vWidth,
            h: vHeight,
          });
        } catch (exEvent) {}
        addAdServerCounter(5550003219);

        /****
                //DESLIGADO EM 23/08 a pedido do Andre
                var bc = document.createElement('div');
                bc.setAttribute('id', 'inarticle_parceiros_bt_close_dynadtv_unique');
                bc.setAttribute('style', "width:30px; text-align: right; line-height:17px; height:17px; position:absolute; top:0px; right:0px; cursor:pointer; z-index:10; color: black; font-size: 12px; display: block");
                bc.setAttribute("onclick", "window.postMessage('dynad-tv-protocol/user_close', '*');");
                bc.innerHTML = '[ x ]';
                divContainer.style.position = 'relative';
                divContainer.appendChild(bc);

                var listIds = [];

                if (listIds.length > 0) {
                    for (var i = 0; i < listIds.length; i++) {
                        if (idCreativeId === listIds[i]) {
                            bc.setAttribute('display', 'none');
                            bc.style.setProperty('display', 'none');
                            return;
                        }
                    }
                }
                ****/

        if (DYNAD_TV.config.container.removeOnClose == false) {
          var applyHeight = vHeight;
          if (
            typeof window.DYNAD_TV.config.container !== "undefined" &&
            typeof window.DYNAD_TV.config.container.height !== "undefined"
          )
            applyHeight = window.DYNAD_TV.config.container.height;
          var close_button = document.createElement("div");
          close_button.style.setProperty("width", "34px");
          close_button.style.setProperty("height", "34px");
          close_button.style.setProperty("background-position", "center");
          close_button.style.setProperty("background-repeat", "no-repeat");
          close_button.style.setProperty("background-size", "24px");
          close_button.style.setProperty(
            "background-image",
            "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAADMElEQVR42sVYv4saQRS+RZFrbLY7IY0WadzSJoggXJHKRlJuKx4kf0DstAkpbFPZpNcmgRQWEis5C5ukUMQUsbNXRDw2+8k8eY4zu6O7dxl4KPPjzbff++bNj5ub6MWS7MWLpbCEMOulAKomvxWWlozqVSBjBZNgAO58cwaDQWO1Wn1Zr9eDzWbzC4b/vn1dLpcfxuPxKwYuMigVkFyz2XyYzWZ/PMMCgPP5/G1UYDKYu2Kx+G4ymTzSRNvtdtfv971Go+G5rutVKpWD4T/q0Oazt+XABGMXg+JgjqyQc/y2220vn8972Ww20NAHfWnsbrf7K9i6CNQJmFqt9hlswCG+ulAohAKRDWMwlpiVQBmBQZhyCBN9XbfbvRiIbPBBoKbT6eswUEThrVhF9yTe4XAYGQwZMQVNibm0oSN27GQy+QahIs1cE6YgXS0Wiyf4DgodZyfnm0vsQJRxgSGDTxTkLR1LSnb8ZR6qB5W2gtrI4DuIJa6daq/X+43OnU5H65AXPjHG8KIbT/2Q6RlLZ4Ac346ZGEkujHYqmEAGExRu+FaE7UQ/aYTL//1ISz1MzDIoUzCUmygFiJx3DNuJfgCIEqFJNlaBMl0IVDC3EhByTyqV+rTf759MAclhCtMeN5onFJBpyFRgTEHhY1nI9IAQMhI1dm9TMCpRB4GCbyZqJaCjqGnZB2lBN7HpsscRReS6R1nUZ8veT4w/whIjTaxiIaiNDPsjCk6dApClAnTYNriO6vV67FsH5SChn5wuMZ7oqNVq/Yx7p5fZGY1G32T9qDbXQ9g4S3GcheR9Dr7FXGndEeSMpVKp1KUkCRFGBUNCRv7BsVjHju4IUgVLJPCoTBEzQuzfJe1YJudphwQOPRFTiP8lQkdf0gyYEWAc1VIPu3HYHBTCx681mAR5qlwun4FAHdoICGkG5yzh077k5qECVYWmZLZ4QZ2uXrBSvQaM9m4mhP5AwKAtZFnOGmcDbQCfyWTei7E5KUyRb6/EFpy7HBw31Ik2V/QlVmK541sKtmzxtY7Y++65iTpH9LEVrFjP8RzDn2FsyfizzLM8xwQ9ViU09l9e1awQu6r8A4hH+I8+sga+AAAAAElFTkSuQmCC)"
          );
          close_button.style.setProperty(
            "margin",
            "-" +
              (applyHeight + 17) +
              "px 0 0 " +
              (divContainer.offsetWidth - 17) +
              "px"
          );
          close_button.style.setProperty("cursor", "pointer");
          close_button.style.setProperty("position", "relative");
          close_button.style.setProperty("z-index", "9999");
          close_button.style.setProperty("opacity", "1");
          close_button.onclick = function () {
            window.postMessage("dynad-tv-protocol/close", "*");
            this.style.display = "none";
          };

          divContainer.style.overflow = "visible";
          divContainer.appendChild(close_button);
        }
      }
    }

    function resize() {
      if (width == 0 || height == 0) return;

      var avWidth = divContainer.parentNode.offsetWidth,
        avHeight = document.documentElement.clientHeight * 0.6;
      if (
        Math.abs(width - avWidth) < Math.abs(height - avHeight) ||
        width > avWidth
      ) {
        var ratio = width / avWidth;
        vWidth = Math.round(width / ratio);
        vHeight = Math.round(height / ratio);
      } else {
        var ratio = height / avHeight;
        vWidth = Math.round(width / ratio);
        vHeight = Math.round(height / ratio);
      }
      if (vWidth > avWidth) {
        var ratio = vWidth / avWidth;
        vWidth = Math.round(vWidth / ratio);
        vHeight = Math.round(vHeight / ratio);
      }
      if (vHeight > avHeight) {
        var ratio = vHeight / avHeight;
        vWidth = Math.round(vWidth / ratio);
        vHeight = Math.round(vHeight / ratio);
      }
      var sizing = APPLY_PLAYER_SIZE_POLICY(vWidth);
      if (sizing) {
        vWidth = sizing.width;
        vHeight = sizing.height;

        actual_width = vWidth;
        actual_height = vHeight;

        container.contentWindow.postMessage(
          "dynad-tv-protocol/resize/" + vWidth + "/" + vHeight,
          "*"
        );
      } else {
        window.postMessage("dynad-tv-protocol/close", "*");
      }
    }

    function isElementVisible(el, vdHeight, vdWidth) {
      if (isNaN(vdHeight)) vdHeight = 0;
      if (isNaN(vdWidth)) vdWidth = 0;
      var rect = el.getBoundingClientRect();
      var windowHeight =
        window.innerHeight || document.documentElement.clientHeight;
      var vertInView =
        rect.top + vdHeight * 0.1 <= windowHeight &&
        rect.top + vdHeight * 0.1 >= 0;
      return vertInView;
    }

    function getExposedElementVisible() {
      return function () {
        return isElementVisible(container, vHeight, vWidth);
      };
    }

    window["DYNAD_TV_ElementWatcher"] = getExposedElementVisible();

    //
    // acompanha evento de scroll
    //
    function follow() {
      if (isElementVisible(container, vHeight, vWidth)) {
        sendActiveViewMessage(true);
        if (status == STATUS.INITIALIZED) {
        } else if (status == STATUS.LOADED) {
          status = STATUS.PLAYING;
          sendPlayMessage();
        } else if (status == STATUS.PAUSED) {
          status = STATUS.PLAYING;
          sendPlayMessage();
        }
      } else {
        sendActiveViewMessage(false);
        if (status == STATUS.PLAYING) {
          status = STATUS.PAUSED;
          sendPauseMessage();
        }
      }
    }

    function dispose() {
      if (window.addEventListener) {
        removeEventListener("scroll", follow);
        removeEventListener("touchstart", follow);
        removeEventListener("touchend", follow);
        removeEventListener("resize", resize);
        removeEventListener("focus", sendFocusMessage);
        removeEventListener("blur", sendBlurMessage);
      } else {
        detachEvent("onscroll", follow);
        detachEvent("ontouchstart", follow);
        detachEvent("ontouchend", follow);
        detachEvent("onresize", resize);
        detachEvent("onfocus", sendFocusMessage);
        detachEvent("onblur", sendBlurMessage);
      }
    }

    function sendStartCounterMessage() {
      container.contentWindow.postMessage(
        "dynad-tv-protocol/start-counter",
        "*"
      );
      try {
        dispatchEventListener("counting");
      } catch (exEvent) {}
    }

    function sendLoadMessage() {
      var pattern = new RegExp("(\\?|\\&)(sz=).*?(&|$)");
      DYNAD_TV.config.URL_VAST = DYNAD_TV.config.URL_VAST.replace(
        pattern,
        "$1$2480x360$3"
      );

      var params =
        "&videoplayertype=dynad_in-article&videoplayersize=" +
        videoSize +
        "&keyword=video-auto-play";

      /**SOLICITACAO FELIPE NERE EM 18/10, ATENDER UMA CAMPANHA DE VIDEO QUE UTILIZA O KEYWORD COMO TARGET, NAO ERA POSSIVEL CONFIGURAR VIA ORIGIN**/
      if (document.location.hostname == "cybercook.uol.com.br") {
        if (
          typeof window.universal_variable !== "undefined" &&
          typeof window.universal_variable.dfp !== "undefined" &&
          typeof window.universal_variable.dfp.custom_params !== "undefined" &&
          typeof window.universal_variable.dfp.custom_params.keyword !==
            "undefined" &&
          typeof window.universal_variable.dfp.custom_params.keyword ===
            "string" &&
          window.universal_variable.dfp.custom_params.keyword != "" &&
          window.universal_variable.dfp.custom_params.keyword != null
        )
          params += "," + window.universal_variable.dfp.custom_params.keyword;
      }

      if (
        typeof UOLPD !== "undefined" &&
        typeof UOLPD.dataLayer !== "undefined"
      ) {
        try {
          for (var key in UOLPD.dataLayer) {
            params += "&" + key + "=" + UOLPD.dataLayer[key];
          }
        } catch (exDL) {
          if (typeof UOLPD.dataLayer.tt_age !== "undefined")
            params += "&tt_age=" + UOLPD.dataLayer.tt_age;
          if (typeof UOLPD.dataLayer.tt_cluster !== "undefined")
            params += "&tt_cluster=" + UOLPD.dataLayer.tt_cluster;
          if (typeof UOLPD.dataLayer.tt_customaudience !== "undefined")
            params += "&tt_customaudience=" + UOLPD.dataLayer.tt_customaudience;
          if (typeof UOLPD.dataLayer.tt_gender !== "undefined")
            params += "&tt_gender=" + UOLPD.dataLayer.tt_gender;
          if (typeof UOLPD.dataLayer.tt_lists !== "undefined")
            params += "&tt_lists=" + UOLPD.dataLayer.tt_lists;
          if (typeof UOLPD.dataLayer.tt_microsegments !== "undefined")
            params += "&tt_microsegments=" + UOLPD.dataLayer.tt_microsegments;
          if (typeof UOLPD.dataLayer.tt_socialclass !== "undefined")
            params += "&tt_socialclass=" + UOLPD.dataLayer.tt_socialclass;
          if (typeof UOLPD.dataLayer.tt_subjects !== "undefined")
            params += "&tt_subjects=" + UOLPD.dataLayer.tt_subjects;
          if (typeof UOLPD.dataLayer.tt_team !== "undefined")
            params += "&tt_team=" + UOLPD.dataLayer.tt_team;
        }
      }

      if (params != "") {
        if (window.DYNAD_TV.config.URL_VAST.indexOf("&cust_params=") > -1) {
          var temp = window.DYNAD_TV.config.URL_VAST.split("&cust_params=");
          window.DYNAD_TV.config.URL_VAST =
            temp[0] +
            "&cust_params=" +
            encodeURIComponent(params.substr(1) + "&") +
            temp[1];
        } else callPlayerSize();
        params = params.replace(
          "videoplayersize=null",
          "videoplayersize=" + videoSize
        );

        window.DYNAD_TV.config.URL_VAST +=
          "&cust_params=" + encodeURIComponent(params.substr(1));
      }

      if (typeof window.DYNAD_TV.config.settings === "undefined")
        window.DYNAD_TV.config.settings = new Array();
      window.DYNAD_TV.config.settings.push({
        key: "containerId",
        value: containerId,
      });

      if (typeof window.DYNAD_TV.config.settings !== "undefined") {
        var st = "";
        for (var x = 0; x < window.DYNAD_TV.config.settings.length; x++) {
          st +=
            (st != "" ? "/" : "") +
            window.DYNAD_TV.config.settings[x].key +
            "=" +
            window.DYNAD_TV.config.settings[x].value;
        }
        if (st != "")
          container.contentWindow.postMessage(
            "dynad-tv-protocol/settings/" + st,
            "*"
          );
      }
      container.contentWindow.postMessage(
        "dynad-tv-protocol/load/" + window.DYNAD_TV.config.URL_VAST,
        "*"
      );
    }

    function sendActiveViewMessage(status) {
      if (
        status != STATUS.CLOSED &&
        typeof container !== "undefined" &&
        typeof container.contentWindow !== "undefined"
      )
        container.contentWindow.postMessage(
          "dynad-tv-protocol/active_display/" + status,
          "*"
        );
    }

    function sendFocusMessage() {
      if (
        status == STATUS.PLAYING &&
        typeof container !== "undefined" &&
        typeof container.contentWindow !== "undefined"
      )
        container.contentWindow.postMessage("dynad-tv-protocol/win-focus", "*");
    }

    function sendBlurMessage() {
      console.log("will dispatch blur:", status);
      if (
        status == STATUS.PLAYING &&
        typeof container !== "undefined" &&
        typeof container.contentWindow !== "undefined"
      )
        container.contentWindow.postMessage("dynad-tv-protocol/win-blur", "*");
    }

    function sendPlayMessage() {
      container.contentWindow.postMessage("dynad-tv-protocol/play", "*");
    }

    function sendPauseMessage() {
      container.contentWindow.postMessage("dynad-tv-protocol/pause", "*");
    }

    if (window.addEventListener) {
      addEventListener("scroll", follow, false);
      addEventListener("touchstart", follow, false);
      addEventListener("touchend", follow, false);
      addEventListener("resize", resize, false);
      addEventListener("focus", sendFocusMessage, false);

      addEventListener(
        "blur",
        function () {
          if (isMouseOverIfrm === false) sendBlurMessage();
        },
        false
      );

      addEventListener("message", handle, false);
      container.addEventListener(
        "mouseenter",
        function (e) {
          isMouseOverIfrm = true;
        },
        false
      );
      container.addEventListener(
        "mouseleave",
        function (e) {
          isMouseOverIfrm = false;
        },
        false
      );
    } else {
      attachEvent("onscroll", follow);
      attachEvent("ontouchstart", follow, false);
      attachEvent("ontouchend", follow, false);
      attachEvent("onresize", resize, false);
      attachEvent("onfocus", sendFocusMessage, false);
      attachEvent(
        "onblur",
        function () {
          if (!isMouseOverIfrm) sendBlurMessage();
        },
        false
      );
      attachEvent("onmessage", handle);
      container.attachEvent(
        "onmouseenter",
        function (e) {
          isMouseOverIfrm = true;
        },
        false
      );
      container.attachEvent(
        "onmouseleave",
        function (e) {
          isMouseOverIfrm = false;
        },
        false
      );
    }

    follow();

    function startTimeoutCounter() {
      if (idTimeout != null) return;

      idTimeout = setTimeout(function () {
        //change status for timeout
        status = STATUS.TIMEOUT;
        setTimeout(function () {
          //remove container
          try {
            divContainer.parentNode.removeChild(divContainer);
          } catch (e) {}
        }, 1000);
        //dispatch nodata event
        dispatchEventListener("nodata", "timeout operation");
        //dispose listeners
        dispose();
        //add event counter
        addAdServerCounter(5550001578);
      }, window.DYNAD_TV.config.timeout || 8000);

      if (window.addEventListener)
        removeEventListener("touchstart", startTimeoutCounter, false);
      else detachEvent("ontouchstart", startTimeoutCounter, false);
    }

    /**** if( !isMobile.any() ) startTimeoutCounter(); ****/
  }

  var divContainer = document.getElementById(containerId),
    ifrm = document.getElementById(reqid.replace("I", "IF"));
  try {
    try {
      divContainer.style.width = "0%";
      ifrm.style.width = "100%";
      ifrm.width = "100%";

      divContainer.style.height = "0px";
      ifrm.style.height = "0px";
      ifrm.height = 0;
    } catch (e) {
      return false;
    }
    DynAdTvKeeper(ifrm);
  } catch (e) {
    return false;
  }
}
return true;}catch(e){if(typeof console!=='undefined'&&typeof console.log!=='undefined'){console.log('DynAd Error:');console.log(e);}}})('I5550001923_1637852995891679595425','H',2,'_dynad_c_I5550001923_1637852995891679595425','5550001923','3000000127','5000003610','4000039770',window._dd_st_vl_1637852995891679595425);}}catch(e){if(typeof console!=='undefined'&&typeof console.log!=='undefined'){console.log('DynAd Error:');console.log(e);}localCache="";var v='<A HR';v+='EF="https://t.dynad.net/c/?dc=5550001923;ci=5000003610;cr=4000020066.0;ord=0;tid=TB-FE13;srctype=bkp;C=0;tp=HTML;st=1;er=';v+=encodeURI(e.message);v+='" TARGET="_blank" STYLE="" ><IMG ID="I5550001923_1637852995891679595425" S';v+='RC="https://s.dynad.net/stack/EtKfbEG_smAp1XI2-14J_1Ai4M7WYkpLb2egkg2fTzU.png" WIDTH="88" HEIGHT="31" ALT="" BORDER="0"></a><IMG SRC="https://t.dynad.net/n/?dc=5550001923;ci=5000003610;bi=4000020066.0;cr=4000039770.0;srctype=bkp;1637852995891679595425" STYLE="display:none;" WIDTH="0" HEIGHT="0" BORDER="0" />';divAppender(v);}
})();