var LogTree={token:function(b){LogTree._token=b},autofill:function(b){LogTree._autofill=b},clickTags:function(b){if(b){b=b.toLowerCase();if(!b.match(/[^a-z]/)){LogTree._clickTagAttr=b;var c=this;LogTree._ready(function(){c._bindTags()})}}},impressionTags:function(b){if(b){b=b.toLowerCase();if(!b.match(/[^a-z]/)){LogTree._impressionTagAttr=b;var c=this;LogTree._ready(function(){c._bindTags()})}}},userId:function(b){if(b==true)LogTree._userId=1;else if(b!="")LogTree._userId=b},track:function(b,c){if(!(LogTree._token==
undefined||b==undefined)){var d={};if(c&&typeof c=="string")d=LogTree._propsFromStr(c);else if(c&&typeof c=="object")for(var a in c)if(c.hasOwnProperty(a))d[a]=c[a];if(b.indexOf(":")!=-1){var f=b.split(":",2);b=f[0];f=LogTree._propsFromStr(f[1]||"");for(a in f)if(f.hasOwnProperty(a))d[a]=f[a]}a={};f={};for(var g in d)if(d.hasOwnProperty(g)){var e=g.toLowerCase().replace(/\s+/g,"");a[e]=d[g];f[e]=g}if(a.__autofill==undefined)a.__autofill=LogTree._autofill;if(a.__autofill){if(a.ip==undefined){a.ip=
1;f.ip="IP"}if(a.browser==undefined)a.browser=1;if(a.browserversion==undefined){a.browserversion=1;f.browserversion="browser version"}if(a.os==undefined){a.os=1;f.os="OS"}if(a.osversion==undefined){a.osversion=1;f.osversion="OS version"}if(a.mobile==undefined)a.mobile=1;if(a.sessionid==undefined){a.sessionid=1;f.sessionid="session ID"}if(a.userid==undefined){a.userid=1;f.userid="user ID"}if(a.url==undefined){a.url=1;f.url="URL"}if(a.referrer==undefined)a.referrer=1;if(a.referrerurl==undefined){a.referrerurl=
1;f.referrerurl="referrer URL"}if(a.keyword==undefined)a.keyword=1;if(a.city==undefined)a.city=1;if(a.province==undefined)a.province=1;if(a.country==undefined)a.country=1}a.__autofill!=undefined&&delete a.__autofill;if(LogTree._userId!=undefined){a.userid=LogTree._userId;f.userid="user id"}a.__c=(""+Math.random()).substr(2,6)+(""+Math.random()).substr(2,6);a.__img=1;d="?__token="+encodeURIComponent(LogTree._token)+"&eventname="+encodeURIComponent(b);f.eventname="event name";a.__eventid!=undefined&&
delete a.__eventid;a.__timestamp!=undefined&&delete a.__timestamp;if(a.__img!=undefined){d+="&__img="+a.__img;delete a.__img}if(a.__test!=undefined){d+="&__test="+encodeURIComponent(a.__test);delete a.__test}if(a.ip!=undefined){d+="&ip="+encodeURIComponent(a.ip);delete a.ip}if(a.sessionid!=undefined){if(a.sessionid!=1)e=a.sessionid;else(e=LogTree._getCookie("LTSID"))||(e="S"+(""+Math.random()).substr(2,6)+(""+Math.random()).substr(2,6)+(""+Math.random()).substr(2,6)+(""+Math.random()).substr(2,6));
LogTree._setCookie("LTSID",e,LogTree._sessionIdExpiration);d+="&sessionid="+encodeURIComponent(e);delete a.sessionid}if(a.userid!=undefined){if(a.userid!=1)e=a.userid;else(e=LogTree._getCookie("LTUID"))||(e="U"+(""+Math.random()).substr(2,6)+(""+Math.random()).substr(2,6)+(""+Math.random()).substr(2,6)+(""+Math.random()).substr(2,6));LogTree._setCookie("LTUID",e,LogTree._userIdExpiration);d+="&userid="+encodeURIComponent(e);delete a.userid}if(a.url!=undefined){d+="&url="+encodeURIComponent(a.url==
1?document.location||"":a.url);delete a.url}if(a.referrer!=undefined){if(a.referrer!=1){e=a.referrer;d+="&referrer="+encodeURIComponent(e)}else{e=LogTree._getCookie("LTURF")||document.referrer||"-";LogTree._setCookie("LTURF",e,LogTree._userIdExpiration);if(e=LogTree._domainFromUrl(e))d+="&referrer="+encodeURIComponent(e)}delete a.referrer}if(a.referrerurl!=undefined){if(e=a.referrerurl!=1?a.referrerurl:LogTree._getCookie("LTURF")||document.referrer||"-"){LogTree._setCookie("LTURF",e,LogTree._userIdExpiration);
d+="&referrerurl="+encodeURIComponent(e)}delete a.referrerurl}if(a.keyword!=undefined){if(a.keyword==1){e=LogTree._keywordFromUrl(document.referrer||"")||LogTree._getCookie("LTKRF")||"";LogTree._setCookie("LTKRF",e,LogTree._userIdExpiration)}else e=a.keyword;if(e)d+="&keyword="+encodeURIComponent(e);delete a.keyword}for(g in a)if(a[g]!=null)d+="&"+encodeURIComponent(g)+"="+encodeURIComponent(LogTree._trim(a[g]));for(var h in f)d=d.replace("&"+h+"=","&"+encodeURIComponent(LogTree._trim(f[h]))+"=");
g="http://api.logtree.com/track"+d;if(!LogTree._didTrack[g]){LogTree._didTrack[g]=1;(new Image).src=g}}},_userIdExpiration:432E5,_sessionIdExpiration:1200,_autofill:0,_didTrack:{},_userId:undefined,_clickTagAttr:undefined,_impressionTagAttr:undefined,_trim:function(b){if(typeof b!="string")return b;return b.replace(/^\s+|\s+$/g,"")},_getCookie:function(b){var c=document.cookie.split(";");b=RegExp("^ ?"+b+"=(.+)");for(var d=0;d<c.length;d++){var a=c[d].match(b);if(a)return a[1]}return null},_setCookie:function(b,
c,d){if(d!=undefined){var a=new Date;a.setTime(a.getTime()+d*1E3);document.cookie=""+b+"="+c+";expires="+a.toGMTString()+"; path=/"}else document.cookie=""+b+"="+c+"; path=/"},_propsFromStr:function(b){b=b||"";var c={};b=b.split(";");for(var d=0;d<b.length;d++){var a=b[d].split("=",2);if(a.length!=0){var f=a[0];a=decodeURIComponent(a[1]||"");c[f]=a}}return c},_domainFromUrl:function(b){if(b=="-")return"-";if(b=b.match(/^http:\/\/([A-Za-z0-9\-_\.]+)/)){b=b[1];var c=b.match(/([A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]{2,4}\.[A-Za-z0-9\-_]{2})$/);
if(c)return c[1];if(b=b.match(/([A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+)$/))return b[1]}return""},_keywordFromUrl:function(b){var c="";if(b.match(/^https?:\/\/[^\/]*google\..{2,6}\//)||b.match(/^https?:\/\/[^\/]*ask\..{2,6}\//)||b.match(/^https?:\/\/[^\/]*conduit\..{2,6}\//)||b.match(/^https?:\/\/[^\/]*altavista\..{2,6}\//)||b.match(/^https?:\/\/[^\/]*100searchengines\.com\//)||b.match(/^https?:\/\/[^\/]*search.aol\..{2,6}\//)){if(b=b.match(/[\?&]q=([^&]+)/))c=b[1]}else if(b.match(/^https?:\/\/[^\/]*google\..{2,6}\//)||
b.match(/^https?:\/\/[^\/]*ask\..{2,6}\//)||b.match(/^https?:\/\/[^\/]*conduit\..{2,6}\//)||b.match(/^https?:\/\/[^\/]*altavista\..{2,6}\//)||b.match(/^https?:\/\/[^\/]*search.aol\..{2,6}\//)){if(b=b.match(/[\?&]q=([^&]+)/))c=b[1]}else if(b.match(/^https?:\/\/[^\/]*yahoo\..{2,6}\//)||b.match(/^https?:\/\/[^\/]*bing\..{2,6}\//)){if(b=b.match(/[&\?](?:p|q|Q)=([^&]+)/))c=b[1]}else if(b.match(/^https?:\/\/[^\/]*blekko\..{2,6}\//)){if(b=b.match(/ws\/([^&]+)/))c=b[1]}else if(b.match(/^https?:\/\/search\./))if(b=
b.match(/[\?&](?:q|query|searchfor)=([^&]+)/))c=b[1];c=c.replace(/\+/g," ");try{c=decodeURIComponent(c)}catch(d){c=""}return c},_processAsync:function(){var b=function(d){if(!(!d.length||typeof d.length!="number"||d.length<1)){var a=d.shift();LogTree[a]&&LogTree[a].apply(LogTree,d)}};if(!window._ltq)window._ltq=[];for(var c;c=_ltq.shift();)b(c);_ltq.push=b},_addEventListener:function(b,c,d,a){if(document.addEventListener)b.addEventListener(c,d,a);else document.attachEvent&&b.attachEvent("on"+c,d)},
_elementsWithAttr:function(b){var c=[];if(document.querySelectorAll)return document.querySelectorAll("* ["+b+"]");else{var d=document.getElementsByTagName("*");if((!d||d.length==0)&&document.all)d=document.all;for(var a=0;d&&a<d.length;a++){var f=d[a];f.getAttribute(b)!=undefined&&c.push(f)}}return c},_bindTags:function(){if(LogTree._clickTagAttr||LogTree._impressionTagAttr){for(var b=LogTree._elementsWithAttr(LogTree._clickTagAttr),c=0;c<b.length;c++){var d=b[c];if(LogTree._clickTagAttr){var a=d.getAttribute(LogTree._clickTagAttr);
if(a){var f=this,g=function(){var e=a;return function(){f.track(e,"event type=click")}}();LogTree._addEventListener(d,"mousedown",g,true)}}}b=LogTree._elementsWithAttr(LogTree._impressionTagAttr);for(c=0;c<b.length;c++){d=b[c];if(LogTree._impressionTagAttr)(a=d.getAttribute(LogTree._impressionTagAttr))&&LogTree.track(a,"event type=impression")}}LogTree._clickTagAttr=null;LogTree._impressionTagAttr=null},_didBindReady:false,_isReady:false,_readyList:[],_ready:function(b){LogTree._bindReady();if(!b)LogTree._isReady=
true;if(LogTree._isReady){b&&b();if(LogTree._readyList){var c=0,d=LogTree._readyList;for(LogTree._readyList=null;b=d[c++];)b()}}else LogTree._readyList&&LogTree._readyList.push(b);return this},_doScrollCheck:function(){if(!LogTree._isReady){try{document.documentElement.doScroll("left")}catch(b){setTimeout(this._doScrollCheck,10);return}LogTree._ready()}},_bindReady:function(){if(!LogTree._didBindReady){LogTree._didBindReady=true;var b=this;if(document.readyState==="complete")return setTimeout(function(){b._ready()},
1);if(document.addEventListener){document.addEventListener("DOMContentLoaded",b._DOMContentLoaded,false);window.addEventListener("load",function(){b._ready()},false)}else if(document.attachEvent){document.attachEvent("onreadystatechange",b._DOMContentLoaded);window.attachEvent("onload",function(){b._ready()});var c=false;try{c=window.frameElement==null}catch(d){}document.documentElement.doScroll&&c&&LogTree._doScrollCheck()}}}};
if(document.addEventListener)LogTree._DOMContentLoaded=function(){document.removeEventListener("DOMContentLoaded",LogTree._DOMContentLoaded,false);LogTree._ready(null)};else if(document.attachEvent)LogTree._DOMContentLoaded=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",LogTree._DOMContentLoaded);LogTree._ready()}};LogTree._ready(LogTree._processAsync);

