function getAfpadgCurrentDayId(){var e=new Date,t=(e.getFullYear()+"").substring(2),a=e.getMonth()+1;a<10&&(a="0"+a);var r=e.getDate();r<10&&(r="0"+r);var o=e.getHours();return o<10&&(o="0"+o),parseInt(t+""+a+r+o)}var pixel=document.getElementById("sid_adg_native_iftp"),accessFlag=null,divId=null;null==pixel&&(accessFlag=(pixel=document.getElementById("afpftpPixel_156_1559746703157")).getAttribute("data-accessMode"),divId=pixel.getAttribute("data-divId"));var isDfpAppFlag=pixel.getAttribute("data-isDfpApp"),refUrl=pixel.getAttribute("data-refUrl");null!=refUrl&&""!=refUrl||(refUrl=window.location.href);var adgsrvrUrl="";adgsrvrUrl=(void 0!==isDfpAppFlag&&null!=isDfpAppFlag&&1==isDfpAppFlag||window.location.protocol,"https://adgebra.co.in");var pubId=pixel.getAttribute("data-pubid"),headerPixel=document.getElementById("adg_pixel_header_script");if(void 0===headerPixel||null==headerPixel){var srcNode=document.createElement("script");srcNode.src=adgsrvrUrl+"/afpf/afphChild.js?p1="+pubId+"&p2=0&p3=0&rnd="+getAfpadgCurrentDayId(),srcNode.id="adg_pixel_header_script",srcNode.type="text/javascript",srcNode.async=!0,document.head.appendChild(srcNode)}var adgebrademoFlagIBN=!1,demoDomainIBN=window.location!=window.parent.location?document.referrer:document.location.href;if(-1!=demoDomainIBN.indexOf("adgebrademo=true")){adgebrademoFlagIBN=!0;var DemodomainArrayIBN=demoDomainIBN.substring(demoDomainIBN.indexOf("adgebrademo")),tempDemodomainArray=DemodomainArrayIBN.toLowerCase();-1!=tempDemodomainArray.indexOf("dcid")&&(DemodomainArrayIBN=tempDemodomainArray.replace("dcid","dcId")),-1!=tempDemodomainArray.indexOf("bannerid")&&(DemodomainArrayIBN=DemodomainArrayIBN.replace("bannerid","bannerId")),-1!=tempDemodomainArray.indexOf("templateid")&&(DemodomainArrayIBN=DemodomainArrayIBN.replace("templateid","templateId"));var subDemoDomainArrayIBN=DemodomainArrayIBN.split("&")}var adgebrademoFlagIBNTemplateId=!1,tempaletIdTOcheck=void 0,siteId=pixel.getAttribute("data-siteid");if(adgebrademoFlagIBN&&-1!=subDemoDomainArrayIBN[3].indexOf("templateId")){var substr=subDemoDomainArrayIBN[3].indexOf("="),res=subDemoDomainArrayIBN[3].substring(substr+1,subDemoDomainArrayIBN[3].lenght);tempaletIdTOcheck=res}var templateId=pixel.getAttribute("data-templateId"),domain=pixel.getAttribute("data-domain"),slotId=pixel.getAttribute("data-slotId"),dataGeoId=pixel.getAttribute("data-geoId"),isDfpApp=pixel.getAttribute("data-isDfpApp"),tpTemplateId=pixel.getAttribute("data-tpTemplateId");if(""!=domain&&null!=domain){var domainSplit=domain.split("amp-spike.html?domain=");domainSplit.length>1&&(domain=String(domainSplit[1].split("#")[0]));var domainSplitAmp=domain.split("/v/s/");domainSplitAmp.length>1&&(domain=domainSplitAmp[1])}void 0!==slotId&&null!=slotId&&""!=slotId||(slotId=0),void 0!==templateId&&null!=templateId&&""!=templateId||(templateId=0),void 0!==dataGeoId&&null!=dataGeoId&&""!=dataGeoId||(dataGeoId=0),void 0!==isDfpApp&&null!=isDfpApp&&""!=isDfpApp||(isDfpApp=0),void 0!==tpTemplateId&&null!=tpTemplateId&&""!=tpTemplateId||(tpTemplateId=0),1382==siteId&&(templateId=1,accessFlag="0",divId="adg_native_iftp",isDfpApp=0);var isMobileDevice={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)},Uc:function(){return navigator.userAgent.match(/UCWEB|UCBrowser|OBUA UCBrowser/i)},Ucmini:function(){return navigator.userAgent.match(/UC Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},any:function(){return isMobileDevice.Android()||isMobileDevice.BlackBerry()||isMobileDevice.iOS()||isMobileDevice.Opera()||isMobileDevice.Uc()}};function getAfpfTPTemplate(e,t,a,r,o,n,i,l,d,s){var p,m=new XMLHttpRequest,c=fetchKeywords(),u="",g=(c=(c=c.replace(/(\r\n|\n|\r)/gm,"")).replace(/ +/g," ")).split("!");null!=g[1]&&""!=g[1]&&null!=g[1]||(g[1]="");if(p=g[0].length,0==g[0].length){var f=new XMLHttpRequest;f.open("GET",adgsrvrUrl+"/Adg_Analytics/GetMetaDetails?docurl="+r+"&rand="+Math.floor(30*Math.random()+1),!0),f.setRequestHeader("Content-type","application/x-www-form-urlencoded"),f.onload=function(){if("NA"==this.responseText||""==this.responseText)"";else{var e=JSON.parse(this.responseText).meta;null==e&&""==e&&null==e||(g[0]=e,u=g[0]+"!"+g[1])}},f.send()}setTimeout((function(){m.onreadystatechange=function(){if(4==this.readyState&&200==this.status){var e=this.responseText;if(null!=e&&e.length>0){var t=JSON.parse(e),r=t.template;r=(r=(r=(r=r.replace("#SLOT_ID_PLACE_HOLDER#",o)).replace("#TEMPLATE_ID_PLACE_HOLDER#",a)).replace("#GEOIP_PLACE_HOLDER#",l)).replace("#ISDFPAPP_PLACE_HOLDER#",d);var n=t.templateSize;n=n.split("X");var s=document.createElement("iframe");if(1==t.displayFlag?s.style.display="block":s.style.display="none",s.id="ibniframe_"+i,document.getElementById(i).appendChild(s),p>0){var m=fetchKeywords();console.log("keywordIBN: "+m),m=(m=m.replace(/(\r\n|\n|\r)/gm,"")).replace(/ +/g," "),r=r.replace("##KEYWORD_HOLDER##",m)}else console.log("mongoKeyword: "+u),r=r.replace("##KEYWORD_HOLDER##",u);s.frameBorder=0,isMobileDevice.any()?(s.width="100%",s.height=n[1]+"px",document.getElementById(i).style.width="100%"):(s.width=n[0]+"px",s.height=n[1]+"px"),s.srcdoc=r}}},1==adgebrademoFlagIBN&&tempaletIdTOcheck==a?m.open("GET",adgsrvrUrl+"/afpf/TPHtmlTemplate?p1="+e+"&p2="+t+"&p3="+o+"&p6="+a+"&p7="+n+"&p8="+s+"&p4="+r+"&adgebrademoFlagIBN=true&"+subDemoDomainArrayIBN[2]+"&refUrl="+refUrl,!0):m.open("GET",adgsrvrUrl+"/afpf/TPHtmlTemplate?p1="+e+"&p2="+t+"&p3="+o+"&p6="+a+"&p7="+n+"&p8="+s+"&refUrl="+refUrl+"&p4="+r,!0),m.send()}),500)}function getMetaTitleContentkeys(){for(var e=document.getElementsByTagName("meta"),t="",a="",r=0;r0&&(i=document.getElementsByTagName("title")[0].value),void 0!==i&&(a=i)}return(t+"!"+a).replace(/[?\/_|&\/_|#\/_]/g," ").replace(";",",").substr(0,1800)}function extractKeysFromText(e){var t=new Set(["the","and","is","in","a","to","of","it","that","this","with","as","co","com","in"]);let a=e.toLowerCase();["https","http","www","com","org","edu","gov","net","://"].forEach((e=>{a=a.split(e).join(" ")}));return a.replace(/[^a-zA-Z0-9\s/-]/g,"").trim().split(/[\s/-]+/).filter((e=>!t.has(e.toLowerCase())))}function fetchKeysFromTitleAndUrl(){const e=document.title||"",t=window.location.href||"",a=extractKeysFromText(e),r=new URL(t).pathname,o=extractKeysFromText(r);return console.log("titleKeys:"+a),console.log("urlPath:"+r),console.log("urlKeys:"+o),{titleKeys:a,urlKeys:o}}function fetchKeysFromUrl(){const e=window.location.href||"",t=new URL(e).pathname,a=extractKeysFromText(t);return console.log("urlPath:"+t),console.log("urlKeys:"+a),{urlKeys:a}}function fetchKeysFromTitle(){const e=extractKeysFromText(document.title||"");return console.log("titleKeys:"+e),{titleKeys:e}}function combineAndEncodeKeys(e,t,a){const r=a?a.split(","):[];console.log("titleKeys1:"+e),console.log("urlKeys1:"+t),console.log("metaContentKeys1:"+a);const o=[...e,...t,...r];console.log("combinedKeys:"+o);const n=o.join(",");return console.log("combinedArrayKeys:"+n),encodeURIComponent(n)}function getMetaContentkeys(){const e=[...document.getElementsByTagName("meta")];let t="";return e.some((e=>!!e.name.includes("news_keywords")&&(t=e.getAttribute("content"),!0))),t||e.forEach((e=>{e.name.includes("keyword")&&(t+=`,${e.getAttribute("content")}`)})),t?t.substring(1):""}function fetchKeywords(){const e=getMetaContentkeys(),{titleKeys:t}=fetchKeysFromTitle(),{urlKeys:a}=fetchKeysFromUrl();return combineAndEncodeKeys(t,a,e)}getAfpfTPTemplate(pubId,siteId,templateId,domain,slotId,accessFlag,divId,dataGeoId,isDfpApp,tpTemplateId);