!function(){function a(){if(0===b.length)return null;if(e)for(var c=b.length;c--;)if(b[c]&&"interactive"===b[c].readyState)return b[c];return"function"==typeof f&&a.doNotDeferToNativeMethod!==!0?f.call(document)||null:null}var b=document.getElementsByTagName("script"),c="readyState"in(b[0]||document.createElement("script")),d=!window.opera||"[object Opera]"!==window.opera.toString(),e=c&&d,f=function(b){function c(){var c,d=!0;return f&&(c=Object.getOwnPropertyDescriptor(b,"currentScript")||void 0,c&&"function"==typeof c.get&&c.get===a&&(d=!1)),d?b.currentScript:null}function d(a){var b;return null!=a&&(b=g?Object.getPrototypeOf(a):h?a.__proto__:null!=a.constructor?a.constructor.prototype:void 0),b}var e="currentScript"in b,f="function"==typeof Object.getOwnPropertyDescriptor,g="function"==typeof Object.getPrototypeOf,h="object"==typeof"test".__proto__,i=function j(b,g){var h,i;return e&&f&&b&&b!==Object.prototype&&g&&g!==Object.prototype&&(f&&(h=Object.getOwnPropertyDescriptor(b,"currentScript")||void 0,h&&"function"==typeof h.get&&(i=h.get)),i||(i=j(d(b),g))),i?i===a&&(i=void 0):i=c,i}(b,b);return i}(document);a.doNotDeferToNativeMethod=!1;var g=!("currentScript"in document),h="function"==typeof Object.defineProperty&&function(){var a;try{Object.defineProperty(document,"_xyz",{get:function(){return"blah"},configurable:!0}),a="blah"===document._xyz,delete document._xyz}catch(b){a=!1}return a}();document._currentScript=a,g&&h&&"undefined"!=typeof e&&e&&Object.defineProperty(document,"currentScript",{get:a})}();(function(){'use strict';(function datasetModule(global,definition){var amd='amd',exports='exports';if(typeof define==='function'&&define[amd]){define(function definer(){return definition(global);});}else if(typeof module==='function'&&module[exports]){module[exports]=definition(global);}else{definition(global);}}(this,function datasetPolyfill(global){'use strict';var
attribute,attributes,counter,dash,dataRegEx,hasEventListener,length,match,mutationSupport,test=document.createElement('_'),DOMAttrModified='DOMAttrModified';function clearDataset(event){delete event.target._datasetCache;}
function toCamelCase(string){return string.replace(dash,function(m,letter){return letter.toUpperCase();});}
function getDataset(){var
dataset={};attributes=this.attributes;for(counter=0,length=attributes.length;counter<length;counter+=1){attribute=attributes[counter];match=attribute.name.match(dataRegEx);if(match){dataset[toCamelCase(match[1])]=attribute.value;}}
return dataset;}
function mutation(){if(hasEventListener){test.removeEventListener(DOMAttrModified,mutation,false);}else{test.detachEvent('on'+DOMAttrModified,mutation);}
mutationSupport=true;}
if(test.dataset!==undefined){return;}
dash=/\-([a-z])/ig;dataRegEx=/^data\-(.+)/;hasEventListener=!!document.addEventListener;mutationSupport=false;if(hasEventListener){test.addEventListener(DOMAttrModified,mutation,false);}else{test.attachEvent('on'+DOMAttrModified,mutation);}
test.setAttribute('foo','bar');Object.defineProperty(Element.prototype,'dataset',{get:mutationSupport?function get(){if(!this._datasetCache){this._datasetCache=getDataset.call(this);}
return this._datasetCache;}:getDataset});if(mutationSupport&&hasEventListener){document.addEventListener(DOMAttrModified,clearDataset,false);}}));var getJSON=function(url,callback,context){var request=new XMLHttpRequest();request.open('GET',url,true);request.onload=function(){if(request.status>=200&&request.status<400){var data=JSON.parse(request.responseText);if(!!data.success&&data.status=="OK"){return callback.call((context||window),data);}
var data={success:false,error:"not the right format"};return callback.call((context||window),data);}else{var data={success:false,error:"couldn't get the JSON file"};return callback.call((context||window),data);}};request.onerror=function(){return{success:false,error:"couldn't get the JSON file"}};request.send();};var Lightbox=function(elem){this.trigger=elem;var data=elem.dataset;this.el=document.querySelector('.magisto-lightbox');this.body=document.querySelector('.magisto-lightbox .body');this.content=document.querySelector('.magisto-lightbox .content');this.type=elem.getAttribute('lightbox');this.href=elem.getAttribute('url')||elem.getAttribute('href');this.aspectratio=elem.getAttribute('aspectratio')||'16:9';this.width=(!!data.fwidth?data.fwidth:(this.aspectratio=='3:4'?400:(this.aspectratio=='9:16'?350:(this.aspectratio=='1:1'?500:800))));this.height=(!!data.fheight?data.fheight:((this.aspectratio=='3:4'||this.aspectratio=='9:16')?532:(this.aspectratio=='1:1'?500:450)));this.image=null;this.video=null;if(!document.getElementById('magisto_lightbox_style')){var loader_animation="data:image/svg+xml,%3Csvg%20class%3D%22fp-loading-rounded-fill%22%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20100%20100%22%20preserveAspectRatio%3D%22xMidYMid%22%20class%3D%22fp-loading-rounded-fill%22%20%3E%0A%20%20%20%20%3Ccircle%20cx%3D%2250%22%20cy%3D%2250%22%20fill%3D%22none%22%20stroke%3D%22rgba%2850%25%2C50%25%2C50%25%2C0.3%29%22%20stroke-width%3D%2215%22%20r%3D%2235%22%20stroke-dasharray%3D%22164.93361431346415%2056.97787143782138%22%20transform%3D%22rotate%286%2050%2050%29%22%3E%0A%20%20%20%20%20%20%20%20%3CanimateTransform%20attributeName%3D%22transform%22%20type%3D%22rotate%22%20calcMode%3D%22linear%22%20values%3D%220%2050%2050%3B360%2050%2050%22%20keyTimes%3D%220%3B1%22%20dur%3D%221s%22%20begin%3D%220s%22%20repeatCount%3D%22indefinite%22%3E%3C/animateTransform%3E%0A%20%20%20%20%3C/circle%3E%3C/svg%3E%0A";var css='a.magisto-lightbox-close{display:block;width:50px;height:50px;box-sizing:border-box;background:white;color:black;text-decoration:none;position:absolute;top:-80px;right:0;-webkit-transition:.5s ease-in-out;-moz-transition:.5s ease-in-out;-o-transition:.5s ease-in-out;transition:.5s ease-in-out}'
+'a.magisto-lightbox-close:before{content:"";display:block;height:30px;width:1px;background:black;position:absolute;left:26px;top:10px;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}'
+'a.magisto-lightbox-close:after{content:"";display:block;height:30px;width:1px;background:black;position:absolute;left:26px;top:10px;-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg)}a.magisto-lightbox-close{top:0px}.magisto-lightbox,.magisto-lightbox .backdrop{top:0;left:0;width:100%;height:100%}'
+'.magisto-lightbox{ direction:ltr; position:fixed;z-index:10001;display:none;opacity:0;-webkit-transition:opacity .2s linear;transition:opacity .2s linear}.magisto-lightbox .backdrop,.magisto-lightbox .close,.magisto-lightbox .content{position:absolute}.magisto-lightbox .backdrop{z-index:9998;background:#000;opacity:.7;cursor:pointer}'
+'.magisto-lightbox .content{max-height:90%;background: #101010 url('+loader_animation+') no-repeat center center; background-size:51px 51px; top:0;left:0;bottom:0;right:0;max-width:80%;width:'+this.width+'px;height:'+this.height+'px;z-index:9999;margin:auto;}.magisto-lightbox .body,.magisto-lightbox iframe{width:100%;height:100%}'
+'.magisto-lightbox.portrait .content{width:400px;height:533px;}'
+'.magisto-lightbox iframe{border:0;display:block}.magisto-lightbox img,.magisto-lightbox video{max-width:100%;max-height:100%}.magisto-lightbox .close{right:-50px;color:#FFF;font-size:18px;z-index:3;background:#000;cursor:pointer;}.magisto-lightbox.show{display:block}.magisto-lightbox.open{opacity:1}'
+'@media screen and (max-width: 420px){.magisto-lightbox .close{right: 0px;}}';var head=document.head||document.getElementsByTagName('head')[0];var style=document.createElement('style');style.id="magisto_lightbox_style";style.type='text/css';style.appendChild(document.createTextNode(css));if(!!head){head.appendChild(style);}}
this.init();}
Lightbox.prototype.init=function(){var _this=this;if(!this.el)
this.create();this.trigger.addEventListener('click',function(e){e.preventDefault();_this.open();});}
Lightbox.prototype.create=function(){var _this=this,cl=document.createElement('div'),bd=document.createElement('div');this.el=document.createElement('div');this.content=document.createElement('div');this.body=document.createElement('div');this.el.classList.add('magisto-lightbox');if(this.aspectratio=='3:4'){this.el.classList.add('portrait');}
if(this.aspectratio=='9:16'){this.el.classList.add('portrait','narrow_portrait');}
bd.classList.add('backdrop');cl.classList.add('close');this.content.classList.add('content');this.body.classList.add('body');cl.innerHTML='<a class="magisto-lightbox-close"></a><!--i class="fa fa-times"></i-->';if(!!this.el)
this.el.appendChild(bd);if(!!this.el){this.content.appendChild(cl);this.content.appendChild(this.body);}
if(!!this.el)
this.el.appendChild(this.content);if(!!document&&!!document.body)
document.body.appendChild(this.el);cl.addEventListener('click',function(){_this.close();});bd.addEventListener('click',function(){_this.close();});var f=function(e){if(_this.isOpen())return;_this.el.classList.remove('show');_this.body.innerHTML='';}
this.el.addEventListener('transitionend',f,false);this.el.addEventListener('webkitTransitionEnd',f,false);this.el.addEventListener('mozTransitionEnd',f,false);this.el.addEventListener('msTransitionEnd',f,false);}
Lightbox.prototype.loadImage=function(){var _this=this;this.setDimensions(this.width,this.height);if(!this.image){this.image=new Image();this.image.addEventListener('load',function(){var dim=_this.fitToSize(this.naturalWidth,this.naturalHeight,_this.width,_this.height);_this.setDimensions(dim.width,dim.height);});this.image.src=this.href;}
if(!!this.body)
this.body.appendChild(this.image);}
Lightbox.prototype.loadVideo=function(){var _this=this;this.setDimensions(this.width,this.height);if(!this.video){this.video=document.createElement('video');this.video.addEventListener('loadedmetadata',function(){var dim=_this.fitToSize(this.videoWidth,this.videoHeight,_this.width,_this.height);_this.setDimensions(dim.width,dim.height);});this.video.src=this.href;this.video.autoplay=true;if(this.isMobile)this.video.mutedAutoplay=false;this.video.controls=true;}
if(!!this.body)
this.body.appendChild(this.video);}
Lightbox.prototype.loadIframe=function(){this.setDimensions(this.width,this.height);if(!!this.body)
this.body.innerHTML='<iframe src="'+this.href+'" frameborder="0" allowfullscreen allow="autoplay"></iframe>';else{var div=document.querySelectorAll('div');div[0].innerHTML='<iframe src="'+this.href+'" frameborder="0" allowfullscreen allow="autoplay"></iframe>';}}
Lightbox.prototype.open=function(){switch(this.type){case'image':this.loadImage();break;case'video':this.loadVideo();break;default:this.loadIframe();}
this.el.classList.add('show');this.el.offsetHeight;this.el.classList.add('open');var _this=this;this.handler_down=function(e){e.stopPropagation();return false;}
this.handler_up=function(e){e.stopPropagation();if((e.key=='Escape'||e.key=='Esc'||e.keyCode==27)){_this.close();_this.popup_open=false;}}
var magisto_popup_overlay=document.getElementById("magisto_popup_overlay");this.addKeysEvents([document.body,this.el,magisto_popup_overlay]);}
Lightbox.prototype.addKeysEvents=function(elements){for(var i=0;i<elements.length;i++){var element=elements[i];if(!!element){element.addEventListener('keydown',this.handler_down,true);element.addEventListener('keyup',this.handler_up,true);}}}
Lightbox.prototype.removeKeysEvents=function(elements){for(var i=0;i<elements.length;i++){var element=elements[i];if(!!element){element.removeEventListener('keydown',this.handler_down,false);element.removeEventListener('keyup',this.handler_up,false);}}}
Lightbox.prototype.close=function(){this.el.classList.remove('open');var magisto_popup_overlay=document.getElementById("magisto_popup_overlay");this.removeKeysEvents([document.body,this.el,magisto_popup_overlay]);}
Lightbox.prototype.isOpen=function(){return this.el.classList.contains('open');}
Lightbox.prototype.setDimensions=function(w,h){this.width=w;this.height=h;this.content.style.width=w+'px';this.content.style.height=h+'px';}
Lightbox.prototype.fitToSize=function(w,h,maxW,maxH){var r=h/w;if(w>=maxW&&r<=1){w=maxW;h=w*r;}else if(h>=maxH){h=maxH;w=h/r;}
return{width:w,height:h,}}
var MagistoPlayerFrame=function(container){this.data=[];var rnd=Math.random().toString(36).substring(3);this.randId=rnd;if(typeof document!=='undefined'){this.getScriptParams();if(!!this.pidCode){this.createMagistoEmbedElement();}else{console.log('had a problem finding video hash');}
var bodies=document.getElementsByTagName('body');if(!!bodies&&bodies.length>0){if(!!bodies[1]){console.log(bodies[1]);bodies[1].remove();}}}};MagistoPlayerFrame.prototype.populateContainer=function(container){if(!!this.embed_element){this.container=this.embed_element;}else if(!!this.pidCode){this.container=document.querySelector('#mgsto_embd_'+this.itemID);}else if(!!container){this.container=(typeof container==='string')?document.querySelector('#'+container):container;}else{return false;}
if(!!this.container&&!!this.container.parentNode){var parentElement=this.container.parentNode;if(!!parentElement&&parentElement.nodeName=="P"){parentElement.style.margin=0;parentElement.style.padding=0;}}
return this.container;}
MagistoPlayerFrame.prototype.getScriptParams=function(){this.currentScriptTag=document.currentScript||document._currentScript();if(!!this.currentScriptTag&&!!this.currentScriptTag.src&&this.currentScriptTag.src.indexOf('spf=1')>=0){var scriptTags=document.querySelectorAll('[data-magisto=""]')
for(var i=0;i<scriptTags.length;i++){var scriptTag=document.querySelectorAll('[data-magisto=""]')[i];if(scriptTag.getAttribute("data-done")!="true"){this.currentScriptTag=scriptTag;this.currentScriptTag.setAttribute("data-done","true");break;}}}
var src=null;var protocol=null;if(!!this.currentScriptTag&&!!this.currentScriptTag.src){src=this.currentScriptTag.src;protocol=src.split("/")[0];}else{var myTags=document.getElementsByTagName("script");for(var i=myTags.length-1;i>=0;i--){if(!!myTags[i].dataset&&!myTags[i].dataset['magisto_processed']&&(myTags[i].dataset['magisto']||myTags[i].src.toLowerCase().indexOf('magisto.com/media/new/js/embed/embed_code.js')>=0||myTags[i].src.toLowerCase().indexOf('magisto.com/e/player/')>=0)){this.currentScriptTag=myTags[i];this.currentScriptTag.dataset['magisto_processed']=1;break;}}}
if(this.currentScriptTag==null){console.log('cant find magisto embed code script');return;}else{src=this.currentScriptTag.src;protocol=src.split("/")[0];}
this.data=this.currentScriptTag.dataset;this.env_server=(!!this.data&&!!this.data.server?this.data.server:'www.magisto.com');this.env_protocol=(protocol=='https:'||protocol=='http:')?protocol:'https:';this.frameWidth=(!!this.data&&!!this.data.width?this.data.width:'100%');this.aspectRatio=(!!this.data&&!!this.data.aspectratio?this.data.aspectratio:'16:9');this.frameHeight=(!!this.data&&!!this.data.height?this.data.height:'100%');this.bgcolor=(!!this.data&&!!this.data.bgcolor?this.data.bgcolor:'#000000');this.controlsColor=(!!this.data&&!!this.data.controlsColor?this.data.controlsColor:'#ffffff');this.bigSplashButton=(!!this.data&&!!this.data.bigSplashButton?this.data.bigSplashButton:'rgba(0, 0, 0, 0.4)');this.progressColor=(!!this.data&&!!this.data.progressColor?this.data.progressColor:'#51eab2');var aspectRatioPoster=(!!this.data&&(this.data.aspectratio=='3:4'||this.data.aspectratio=='9:16')?'default_portrait_poster':'default_poster');this.posterImg=(!!this.data&&!!this.data.poster?this.data.poster:(this.env_protocol?this.env_protocol:'https:')+'//'+this.env_server+'/media/new/img/'+aspectRatioPoster+'.jpg');var unesc=unescape(src);var pid=null;if(unesc.indexOf('/e/player/')>=0){var start=unesc.indexOf('/e/player/')+'/e/player/'.length;var end=unesc.indexOf('?',start);pid=end>=0?unesc.substring(start,end):unesc.substring(start);if(pid.slice(-1)=='/')
pid=pid.slice(0,-1);}else{pid=unesc.split("h=")[1]?unesc.split("h=")[1].split("&")[0]:false;}
var app=unesc.split("app=")[1]?unesc.split("app=")[1].split("&")[0]:false;if(!!app){this.app=app;}
if(!!pid){this.pidCode=pid;this.itemID=this.pidCode+'_'+this.randId;var lightbox=unesc.split("lightbox=")[1]?unesc.split("lightbox=")[1].split("&")[0]:false;if(!lightbox){lightbox=(!!this.data&&(this.data.popup==''||this.data.popup=='true')?true:false)}
this.lightbox=lightbox;}
var _this=this;var setting_height=false;this.setPlayerHeight=function(type){if(!!setting_height)return true
setting_height=true;if(!this.container){this.container=this.currentScriptTag;if(!this.container){this.container=document.getElementById('mgsto_embd_thumb_'+this.itemID);if(!this.container){this.container=document.getElementById('mgsto_embd_'+this.itemID);}}}
var parentElement=null;if(!!this.container&&!!this.container.parentNode){parentElement=this.container.parentNode;if(!!parentElement&&parentElement.nodeName=="P"&&!!parentElement.parentNode){parentElement=parentElement.parentNode;}}
var isAutoHeight=isElementAutoHeight(parentElement);if(!!this.container&&!!parentElement&&parentElement.tagName!=="HEAD"){var o_w=this.container.offsetWidth;var o_h=this.container.offsetHeight;if(window.innerHeight<o_h){o_h=window.innerHeight}
if((!!this.frameWidth&&this.frameWidth!=='100%')&&(!!this.frameHeight)){o_w=this.frameWidth;o_h=this.frameHeight;}else{if(!!isAutoHeight&&(!this.frameHeight||this.frameHeight=='100%')){o_w=this.container.offsetWidth;o_h=(o_w/(16/9));if(this.aspectRatio=='3:4'){o_h=(o_w/(3/4));}
if(this.aspectRatio=='9:16'){o_h=(o_w/(9/16));}
if(this.aspectRatio=='1:1'){o_h=o_w;}
this.container.style.width=o_w+'px';this.container.style.height=o_h+'px';}else if(!isAutoHeight&&(!this.frameHeight||this.frameHeight=='100%')){var o_w=this.container.offsetWidth;var o_h=this.container.offsetHeight;var p_o_h=parentElement.clientHeight;if(!!this.data.fill||this.data.fill==''&&this.data.fill!=='false'){o_h=p_o_h;}else if(o_w>p_o_h&&this.aspectRatio=='3:4'){o_h=p_o_h;o_w=(p_o_h/4)*3;}else if(p_o_h>o_w&&this.aspectRatio=='3:4'){o_h=(o_w/(3/4));}else if(p_o_h>o_w&&this.aspectRatio=='9:16'){o_h=(o_w/(9/16));}else if(p_o_h>o_w&&this.aspectRatio=='16:9'){o_h=o_w/(16/9);}else if(p_o_h<o_w&&this.aspectRatio=='16:9'){o_h=o_w/(16/9);}}
if(o_w==0||o_h==0){if(this.aspectRatio=='3:4'||this.aspectRatio=='9:16'){o_h=320;o_w=180;}else if(this.aspectRatio=='1:1'){o_h=180;o_w=180;}else{o_h=180;o_w=320;}}}
this.container.style.height=o_h+'px';this.container.style.width=o_w+'px';if(type=='popup'&&o_w<=200){this.container.classList.add('small_player');}
setting_height=false;}}
window.addEventListener("orientationchange",function(){this.setPlayerHeight('player');}.bind(this));}
MagistoPlayerFrame.prototype.populateThumbnail=function(){var dataAttrs="";var img_params="";var attrs={};if(!!this.data.fwidth){attrs.fwidth=this.data.fwidth;}
if(!!this.data.fheight){attrs.fheight=this.data.fheight;}
if(!!this.data.aspectratio){attrs.aspectratio=this.data.aspectratio;}
var svg_style='';var rect_style='';if(!!this.data.biggerplaybtn){rect_style="fill: rgba(61, 224, 166, 0.7);";}
var svgPlayBtn='<svg style="'+svg_style+'" class="fp-play-rounded-fill" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 51 51" style="enable-background:new 0 0 51 51;" xml:space="preserve"><rect style="'+rect_style+'" id="Rectangle_1233" width="100" height="100" class="svg_bg"/><path id="Path_34" class="svg_icon" d="M34,26.2v-1.3L20.3,17h-1.3V34h1.3L34,26.2L34,26.2z"/></svg>';if(!!this.data.aspectratio){attrs.aspectratio=this.data.aspectratio;}
var posterImg=false;if(this.data.button=='false'){svgPlayBtn='';}
var posterAlt=this.data.posterAlt?'alt="'+this.data.posterAlt+'"':'';if(this.data.posterImg=='true'){posterImg='<img src="'+this.posterImg+'" '+posterAlt+'/><div class="play_icon"></div>';}
var lightbox_thumbnail='<a lightbox="iframe"  url="'+this.getFrameParams()+'" id="'+this.itemID+'_clicker'+'" data-itemid="'+this.itemID+'" '+dataAttrs+'>'
+svgPlayBtn+(posterImg?posterImg:'')
+'</a>';var d=document.createElement('a');d.setAttribute("lightbox","iframe");d.setAttribute("url",this.getFrameParams());d.setAttribute("id",this.itemID+'_clicker');for(var key in attrs){d.setAttribute(key,attrs[key]);}
d.innerHTML=svgPlayBtn+(posterImg?posterImg:'');this.thumbnail_el=document.createElement('div');this.thumbnail_el.setAttribute("id",'mgsto_embd_thumb_'+this.itemID);this.thumbnail_el.setAttribute("class",'mgsto_embd_container');if(this.currentScriptTag.parentNode.tagName=="HEAD"){this.thumbnail_el.appendChild(d);if(document.body){document.body.appendChild(this.thumbnail_el);}else{document.body=document.createElement("body");document.body.appendChild(this.thumbnail_el);}}else{if(!!this.currentScriptTag&&!!this.currentScriptTag.parentNode){if(!!this.thumbnail_el){this.currentScriptTag.parentNode.appendChild(this.thumbnail_el);this.thumbnail_el.appendChild(d);}}}}
MagistoPlayerFrame.prototype.createMagistoEmbedElement=function(){var _this=this;var callback=function(){_this.populateContainer();_this.initializeIFrame();};if(!!this.lightbox){this.populateThumbnail();var lightbox_embdID='mgsto_embd_lightbox_'+this.itemID;this.embed_lightbox=document.createElement('div');this.embed_lightbox.setAttribute("id",lightbox_embdID);var body=document.getElementsByTagName('body')[0];if(!!body)
body.appendChild(this.embed_lightbox);if(!this.embed_container){this.embed_container=document.querySelector('#'+this.thumbnail_el.id);this.populateLightboxElement();}}else{if(!document.querySelector('#mgsto_embd_'+this.itemID)){this.embed_element=document.createElement('div');this.embed_element.setAttribute("id",'mgsto_embd_'+this.itemID);this.embed_element.setAttribute("class",'mgsto_embd_container');if(!!this.currentScriptTag&&!!this.currentScriptTag.parentNode&&this.currentScriptTag.parentNode.tagName=="HEAD"){var _this=this;setTimeout(function(){if(document.body){document.body.appendChild(_this.embed_element);callback();}else{document.body=document.createElement("body");document.body.appendChild(_this.embed_element);callback();}},100);}else{if(!!this.currentScriptTag&&!!this.currentScriptTag.parentNode){this.currentScriptTag.parentNode.appendChild(this.embed_element);callback();}}}}}
MagistoPlayerFrame.prototype.populateLightboxElement=function(){if(!this.container){if(!this.thumbnail_el){this.container=document.getElementById('mgsto_embd_thumb_'+this.itemID);}else{this.container=this.thumbnail_el;}}
this.bigSplashButton=(!!this.data.bigSplashButton?this.data.bigSplashButton:'rgba(0, 0, 0, 0.4)');var wh_params='width:100%; height:100%;';if(this.frameWidth!=='100%'){wh_params='width:'+this.frameWidth+'px;';if(this.frameHeight!=='100%'){wh_params+='height:'+this.frameHeight+'px;';}}
var lightbox_html='<style>'
+'#mgsto_embd_thumb_'+this.itemID+'{padding:0;direction:ltr;width:100%;height:100%;max-width:100%; max-height:100%;min-width: 100px;min-height:100px; display:inline-block;position:relative;}'
+'#mgsto_embd_thumb_'+this.itemID+' a{position: relative;display:inline-block; background: url("'+this.posterImg+'") no-repeat center center; background-size: cover; '+wh_params+'}'
+'#mgsto_embd_thumb_'+this.itemID+' a:hover{box-shadow:0 0 0 transparent; -moz-box-shadow:0 0 0 transparent;-webkit-box-shadow:0 0 0 transparent; border:0px solid transparent;}'
+'#mgsto_embd_thumb_'+this.itemID+' img{max-width:100%;}'
+'#mgsto_embd_thumb_'+this.itemID+' svg{position: absolute; pointer-events: none; right: 0;bottom: 0;top: 50%;left: 50%; width: 51px;height:51px;max-height: 100px;padding:0;fill:#fff;margin: 0;-o-transform: translate(-50%,-50%) scale(1); -moz-transform: translate(-50%,-50%) scale(1); -webkit-transform: translate(-50%,-50%) scale(1); -ms-transform: translate(-50%,-50%) scale(1); transform: translate(-50%,-50%) scale(1);}'
+'#mgsto_embd_thumb_'+this.itemID+'.small_player svg{width: 30px;height:30px;}'
+'#mgsto_embd_thumb_'+this.itemID+' svg .svg_bg {fill: '+this.bigSplashButton+';}'
+'.flowplayer.medium .fp-play svg, .flowplayer.medium .fp-pause svg, .flowplayer.medium .fp-waiting svg{width:70px;height:70px;}'
+'.flowplayer.small .fp-play svg, .flowplayer.small .fp-pause svg, .flowplayer.small .fp-waiting svg{width:50px;height:50px;}'
+'.flowplayer.xsmall .fp-play svg, .flowplayer.xsmall .fp-pause svg, .flowplayer.xsmall .fp-waiting svg{width:35px;height:35px;}'
+'@media screen and (max-width: 200px){.flowplayer .fp-play svg, .flowplayer .fp-pause svg, .flowplayer .fp-waiting svg{width:30px;height:30px;}#mgsto_embd_thumb_'+this.itemID+' svg{width:30px; height:30px;}}'
+'</style>';if(!!this.embed_container){var d=document.createElement('div');d.innerHTML=lightbox_html;if(!!this.embed_container){this.embed_container.appendChild(d);}}else{if(!!this.currentScriptTag){var d=document.createElement('div');d.innerHTML=lightbox_html;this.currentScriptTag.parentNode.appendChild(d);if(!!this.thumbnail_el){this.currentScriptTag.parentNode.appendChild(this.thumbnail_el);}}else{console.log('cant find this.embed_container');}}
var _this=this;setTimeout(function(){_this.setPlayerHeight('popup');},1000);[].forEach.call(document.querySelectorAll('[lightbox]'),function(el){el.lightbox=new Lightbox(el);});var aLink=document.querySelector('#'+this.itemID+'_clicker');if(!!aLink){aLink.setAttribute("url",this.iframe_src);}else{console.log("no link to video");}}
MagistoPlayerFrame.prototype.destroyIFrame=function(){var frameCloseLink=document.querySelector('#'+this.itemID+'_close_clicker');frameCloseLink.removeEventListener("click",function(){return});this.container.innerHTML='';}
MagistoPlayerFrame.prototype.getFrameParams=function(iframe){this.isMobile=/iphone|ipod|ipad|android|blackberry|opera mini|opera mobi|skyfire|maemo|windows phone|palm|iemobile|symbian|symbianos|fennec/i.test(navigator.userAgent.toLowerCase());var iframe_params='';if(!this.data)
this.data=this.currentScriptTag.dataset;if(!!Object.keys(this.data).length>0){for(var data_index in this.data){if(!!iframe&&(data_index=='width'||data_index=='height')){iframe.setAttribute(data_index,this.data[data_index]);}else{if(data_index=='autoplay'&&!!this.lightbox){var value=((this.data[data_index]=='0'||this.data[data_index]=='false')?'0':'1');}else{var value=this.data[data_index].replace('#','%23');if(value==''||value=='1'){value='1';}}
iframe_params+='&'+data_index+'='+value;if(data_index=='autoplay'&&!this.isMobile){iframe_params+='&splash=0';}}}
if(!!this.lightbox){iframe_params+='&splash=0';}}else{if(!!this.lightbox){iframe_params+='&autoplay=1&splash=0';}}
this.iframe_src=this.env_protocol+'//'+this.env_server+(this.app=="chant"?'/chant/':'/')+'embed/player/'+this.pidCode+'?embed=true'+encodeURI(iframe_params);return this.env_protocol+'//'+this.env_server+(this.app=="chant"?'/chant/':'/')+'embed/player/'+this.pidCode+'?embed=true'+encodeURI(iframe_params);}
MagistoPlayerFrame.prototype.initializeIFrame=function(cb){var html=[];var iframe=document.createElement('iframe');iframe.src=this.getFrameParams(iframe);iframe.setAttribute('allowfullscreen','true');iframe.setAttribute('allow','autoplay');html.push(iframe.outerHTML);var _this=this;setTimeout(function(){_this.setPlayerHeight('player');},1000);this.container.innerHTML+='<div class="magisto_player_wrap">'+html.join('')+'</div>';var css=[];css.push('#mgsto_embd_'+this.itemID+'{padding:0;direction:ltr;position: relative;width: 100%;height:100%;max-width:100%;}');css.push('#mgsto_embd_'+this.itemID+' div{padding-top:0;}');css.push('.magisto_player_wrap{height:100%;width:100%;max-width:100%;}');css.push('#mgsto_embd_'+this.itemID+' iframe{border:none; max-width:100%;}');if(this.frameWidth=="100%"){css.push('#mgsto_embd_'+this.itemID+' iframe{position: relative;width: 100%;max-width:100%;height: 100%;left: 0; top: 0; }');}
var stylingDiv=document.createElement('div');stylingDiv.innerHTML+='<style>'+css.join('')+'</style>';if(!!this.container){this.container.appendChild(stylingDiv);}
if(!!cb&&typeof cb==="function"){cb();}};function isElementAutoHeight(element){if(!!element){var inHeight=element.clientHeight;var inOverflow=!!element.style.overflow?element.style.overflow:null;element.style.overflow='hidden';var tempDiv=document.createElement('div');tempDiv.style.height=element.clientHeight+'px';element.appendChild(tempDiv);var isAutoHeight=null;if(element.clientHeight!==inHeight||(element.clientHeight==inHeight&&tempDiv.style.height=='0px')){isAutoHeight=true;}else{isAutoHeight=false;}
element.removeChild(tempDiv);element.style.overflow=inOverflow;return isAutoHeight}}
window.MagistoPlayerFrame=MagistoPlayerFrame;var player=new MagistoPlayerFrame();})();