function defer(n){window.jQuery?n():setTimeout(function(){defer(n)},200)}function deferTT(n){defer(function(){$(document).ready(function(){n()})})}function valOrDef(n,t){var i=$(n).val();return i.length===0&&(i=t),i}function DoBeforeFollowingALink(n,t,i){var r=n.href;t.preventDefault();i();setTimeout(function(){window.location=r},100)}var TH={},qs=function(n){var r,t,i;if(n=="")return{};for(r={},t=0;t<n.length;++t)i=n[t].split("=",2),r[i[0]]=i.length==1?"":decodeURIComponent(i[1].replace(/\+/g," "));return r}(window.location.search.substr(1).split("&")),ls2={save:function(n,t,i){if(typeof Storage=="undefined")return!1;var r=i*36e5,u={value:JSON.stringify(t),timestamp:(new Date).getTime()+r};return localStorage.setItem(n,JSON.stringify(u)),t},load:function(n){if(typeof Storage=="undefined")return!1;var t=JSON.parse(localStorage.getItem(n));return t?(new Date).getTime()<t.timestamp&&JSON.parse(t.value):!1},remove:function(n){if(typeof Storage=="undefined")return!1;localStorage.removeItem(n)}};TH.GeoLocate=function(){var n,t,i;if(console.log("GeoLocate from header"),n=ls2.load("geo-dismissed"),console.log("geoDismissCookie:"+n),t=Cookies.get("geo-redirUrl"),n||t){console.log("geo=> Already has cookie(s) - dismiss:"+n+", redir:"+t);return}i=$("#apiUrl").val();$.ajax({url:i,data:{domain:"@domain"},type:"GET",dataType:"jsonp",jsonp:"callback",cache:!0,success:function(n){console.log("geo=> data.url="+n.url);n.url?TT.setupGeoNotifyDismiss():console.log("geo=> data.url was NULL")}}).fail(function(n,t){console.log("GeoLocate failed - "+t)})}