function logMsg(n,t){debugFlg>0&&typeof console!="undefined"?(t&&console.group(t),console.log(n),t&&console.groupEnd()):debugFlg&&debugIE&&(document.getElementById("msgLog")||(debug=document.createElement("div"),debug.id="msgLog",debug.style.clear="both",debug.style.color="black",debug.style.backgroundColor="white",document.body.appendChild(debug)),t==null?document.getElementById("msgLog").innerHTML+=n+"<br />":(n=n.replace(/</g,"&lt;"),n=n.replace(/>/g,"&gt;"),document.getElementById("msgLog").innerHTML+=t+"<div style='font-size: 10px; margin-left: 10px;'>"+n+"</div>"))}function setupAdCode(){logMsg("External Ads Enabled"),onAdContStreamStart=function(){logMsg("Video Stream Started"),placeDartAd()},onAdContAdStart=function(){logMsg("Ad preroll started"),placeDartAd()},playAd=function(n){logMsg("External Add Provided in player"),logMsg(n,"Video ad code"),n.indexOf("<expandedBannerURL>")>-1?(logMsg("External Add Supported, placing it in external slot"),new ExternalAd(n)):(logMsg("External Add Not Supported, calling dart code"),callFlash("endExternalAd"),placeDartAd())},placeDartAd=function(){logMsg("Checking External ad slot");if(document.getElementById("expandedBanner")!=null)if(document.getElementById("expandedBanner").innerHTML==""||document.getElementById("expandedBanner").innerHTML.replace(/&nbsp;/gi," ").search(/^\s+$/i)>-1){AddCode="/adj/bn.av/;s1=;s2=;iid=0;;sid=;",config.AdCode!=null&&config.AdCode!=""?AddCode=config.AdCode:document.body&&(adCdBase=document.body.innerHTML,adStrt=adCdBase.search('src="http://ad.doubleclick.net'),adStrt>-1&&(adCdBase=adCdBase.substr(adStrt+30),adCdBase=adCdBase.substr(0,adCdBase.search("pos")),adCdBase.charAt(0)=="/"&&(AddCode=adCdBase))),config.videoId!=null&&config.videoId!=""&&(AddCode=AddCode.replace("sid=;","sid="+config.videoId+";"));var n="http://www.beliefnet.com/";document.domain.indexOf(".dev")>-1&&(n="http://preview.beliefnet.dev/"),dartAdCode="<iframe src='"+n+"video/adLoad.aspx?AddCode="+AddCode+"' frameborder='0' scrolling='no' style='width: 300px; height: 250px;'></iframe>",logMsg(dartAdCode,"Dart Code for External Ad"),document.getElementById("expandedBanner").innerHTML=dartAdCode,logMsg("External ad placed in page"),callFlash("removeEventListener","streamStart","onAdContStreamStart"),callFlash("removeEventListener","adStart","onAdContAdStart")}else logMsg("An ad has already ben placed");else logMsg("No div to place ad in")}}debugFlg=0,debugIE=1,debugFlg==0&&location.search.indexOf("debug=")>-1&&(debugFlg=location.search.substr(location.search.indexOf("debug=")+6,1)),typeof onTemplateLoaded=="function"&&(logMsg("Old Load Function Detected"),oldTemplateLoaded=onTemplateLoaded),onTemplateLoaded=function(n){document.getElementById("expandedBanner")&&(document.getElementById("expandedBanner").innerHTML==""||document.getElementById("expandedBanner").innerHTML.replace(/&nbsp;/gi," ").search(/^\s+$/i)>-1)?(logMsg("Brightcove player loaded"),setupAdCode(),callFlash("enableAdFormats",6),callFlash("addEventListener","streamStart","onAdContStreamStart"),callFlash("addEventListener","adStart","onAdContAdStart")):logMsg("External Ads Not Enabled"),typeof config.onLoad!="undefined"&&config.onLoad!=""&&(logMsg("Calling congfig defined Load Function"),eval(config.onLoad+"(message)")),typeof oldTemplateLoaded=="function"&&(logMsg("Calling Old Load Function"),oldTemplateLoaded(n))}
