text: ﻿function receiveMessage(n){var i=JSON.parse(n.data),t={},r,u,f;t.Id=i.Id;t.DmGlobalUserId=GetDMGlobalUserID(DmGlobalUserIdKeyNew);r=GetDMGlobalUserID(DMGlobalUserIdKeyOld);u=function(r){r&&(t.DmGlobalUserId=JSON.parse(r).DmGlobalUserId,SetDMGlobalUserID(t.DmGlobalUserId),t.DmGlobalUserConfirmResponse=GetDMGlobalUserID(DmGlobalUserIdKeyNew)?"OK":"TP_ACCESS_DENIED");n.source.postMessage(JSON.stringify(t),i.sender)};!t.DmGlobalUserId&&r?(Cookies.SetValue(DMGlobalUserIdKeyOld,"",1,"/",Cookies.GetDomain(),!1),f={},f.DmGlobalUserId=r,PostToEndpointAndInvokeCallback(DmGlobalUserIdEncryptUrl,JSON.stringify(f),u)):t.DmGlobalUserId?i&&i.sender&&(t.DmGlobalUserConfirmResponse="OK",n.source.postMessage(JSON.stringify(t),i.sender)):PostToEndpointAndInvokeCallback(DmGlobalUserIdUrl,null,u)}function PostToEndpointAndInvokeCallback(n,t,i){var r=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP");server_write_timeout=setTimeout(function(){r.abort()},1e3);r.onreadystatechange=function(){try{r.readyState==4&&(clearTimeout(server_write_timeout),r.status==200?i(r.responseText):i(null))}catch(n){clearTimeout(server_write_timeout);i(null)}};r.open("POST",n,!0);r.setRequestHeader("Content-Type","application/json");r.send(t)}function SetUserTags(){}function GetDMGlobalUserID(n){var t=Cookies.GetValue(n);return!t&&LocalStorage.IsEnabled()&&(t=LocalStorage.GetValue(n)),t}function SetDMGlobalUserID(n){LocalStorage.IsEnabled()&&LocalStorage.SetValue(DmGlobalUserIdKeyNew,n);Cookies.IsEnabled()&&Cookies.SetValue(DmGlobalUserIdKeyNew,n,18250,"/",Cookies.GetDomain(),!1)}var DmGlobalUserIdUrl=window.location.protocol+"//apps.developermedia.com/Ads/GlobalUserIdentification/GetDmGlobalUserId",DmGlobalUserIdEncryptUrl=window.location.protocol+"//apps.developermedia.com/Ads/GlobalUserIdentification/EncryptDmGlobalUserId",DMGlobalUserIdKeyOld="DmGlobalUserId",DmGlobalUserIdKeyNew="dmaduid",Cookies={GetDomain:function(){var t=document.location.hostname,n=/([^.]+\.[^.]{3,})$/i.exec(t);return n!=null?n[1]:(n=/([^.]+\.[^.]+\.[^.]{2})$/i.exec(t),n!=null?n[1]:t)},SetValue:function(n,t,i,r,u,f){var e="",o;e=n+"="+t;i>0&&(o=new Date,o.setTime(o.getTime()+i*864e5))&&(e+="; expires="+o.toGMTString());r&&(e+="; path="+r);u&&u.indexOf(".")!=-1&&(e+="; domain="+u);f&&(e+="; secure");document.cookie=e},GetValue:function(n){var r=document.cookie,u=null,t,i;if(r!="")for(t=r.split(";"),index=0;index<t.length;index++)if(i=t[index].replace(/^\s+/,""),i.substring(0,n.length+1)==n+"="){u=i.substring(n.length+1);break}return u},IsEnabled:function(){return document.cookie="testcookie=test; max-age=10000",document.cookie.indexOf("testcookie=test")>=0}},LocalStorage={IsEnabled:function(){return typeof Storage!="undefined"?!0:!1},GetValue:function(n){localStorage.getItem(n)},SetValue:function(n,t){localStorage.setItem(n,t)}};if(window.addEventListener)window.addEventListener("message",receiveMessage,!1);else try{window.attachEvent("message",receiveMessage)}catch(e){}