if(window.Evri===undefined){window.Evri={};}
if(window.Evri.defineNamespace===undefined){window.Evri.defineNamespace=function(root,namespace,items){items=items||{};if(root[namespace]===undefined){root[namespace]=items;}};window.Evri.extendNamespace=function(namespace,extensions){for(var i in extensions){if(namespace[i]===undefined){namespace[i]=extensions[i];}}};window.Evri.defineClass=function(root,className,constructor){if(root[className]===undefined){root[className]=function(){constructor.apply(this,arguments);};}};window.Evri.extendClass=function(klass,extensions){for(var i in extensions){if(klass.prototype[i]===undefined){klass.prototype[i]=extensions[i];}}};};Evri.defineNamespace(Evri,"Widget");Evri.defineNamespace(Evri.Widget,"Utilities");Evri.extendNamespace(Evri.Widget.Utilities,{loadFrame:function(widget,parentId,options){options=options||{};Evri.extendNamespace(options,{environment:"www.evri.com",url:window.location.href,height:"185px"});var widgets={"ZiffDavis":"/widget/ZiffDavis/widget.html","ZeroDestruction":"/widget/ZeroDestruction/widget.html","Gamera":"/widget/Gamera/widget.html","Jirafa":"/widget/jirafa/widget.html","Popover":"/widget/contentRecommendation/widget.html"};var source="http://"+options.environment+widgets[widget]+"?url="+encodeURIComponent(options.url);if(options.sourceConstraintsLabel&&options.sourceConstraints){source=source+"&sourceConstraintsLabel="+options.sourceConstraintsLabel+"&sourceConstraints="+options.sourceConstraints;}
var frame=document.createElement("iframe");frame.setAttribute("frameBorder",0);frame.setAttribute("scrolling","no");frame.setAttribute("src",source);frame.style.width="100%";frame.style.height=options.height;frame.style.border="none";var p=document.getElementById(parentId);p.innerHTML="";p.appendChild(frame);return frame;}});var hostname=window.location.hostname;if(hostname.match(/.*\.evri\.corp$/)||hostname==="portal-pre.evri.com"||hostname==="localhost"){var stageMatch=hostname.match(/^portal-(dev|perf|beta)/);var stage=(stageMatch===null?'beta':stageMatch[1]);switch(stage){case'perf':Evri.API.Environment.set("apiHost",'rd-pre.evri.corp');Evri.API.Environment.set("apiPort",25000);Evri.API.Environment.set("portalHost","portal-perf.evri.corp");break;case'dev':Evri.API.Environment.set("apiHost",'api-dev.evri.corp');Evri.API.Environment.set("portalHost","portal-dev.evri.corp");break;case'beta':Evri.API.Environment.set("apiHost",'rd-pre.evri.corp');Evri.API.Environment.set("apiPort",25000);Evri.API.Environment.set("portalHost","portal-beta.evri.corp");break;default:break;};Evri.API.Environment.set("staticAssetBaseUrl","http://"+Evri.API.Environment.portalHost+"/widget");}