Atlas={Go:function(country,project,location,view,unload){var dr=document.referrer;this.m_dataMap.single.project=project;this.m_dataMap.pair.country.value=country;this.m_dataMap.pair.location.value=location;this.m_dataMap.pair.url.value=encodeURIComponent(dr);this.m_dataMap.pair.domain.value=this.GetDomain(dr);this.m_dataMap.pair.keywords.value=this.GetSearchKeywords(dr);this.m_dataMap.pair.search.value=this.GetSearchResult(dr);this.m_dataMap.pair.source.value=this.GetQuerystringValue("source");if(view)this.View();if(unload)this.BindUnloadEvent();document.attachEvent("onmouseup",Atlas.Click)},SetCountry:function(country){this.m_dataMap.pair.country.value=country},SetLocation:function(location){this.m_dataMap.pair.location.value=location},SetLanguage:function(language){this.m_dataMap.pair.language.value=language},SetTimePivot:function(pivot){this.m_timePivot=pivot},GetSearchKeywords:function(i){for(var search in this.m_searchProviders)if(i.indexOf(this.m_searchProviders[search].form)==0)return this.GetQuerystringValue(this.m_searchProviders[search].key,i).replace(/[+]/g,",");return ""},GetSearchResult:function(i){for(var search in this.m_searchProviders)if(i.indexOf(this.m_searchProviders[search].form)==0)return search;return ""},GetDomain:function(i){var regex="(?:http|https)://(.*?)/";if(i&&i.length>0){var matches=i.match(regex);if(matches&&matches.length>1)return encodeURIComponent(matches[1])}return ""},GetQuerystringValue:function(s,u){s+="=";var h=u?u:window.location.href,ss=h.indexOf(s),a="&";q=h.indexOf("?");if(q>0&&ss>q){sh=h.substring(ss+s.length);return sh.indexOf(a)>0?sh.substring(0,sh.indexOf(a)):sh}return ""},m_queue:[],m_actionListeners:[],m_timePivot:5,m_image:new Image,m_dataMap:{single:{url:"switch.atdmt.com",type:"action",project:"",version:"v3"},pair:{language:{value:navigator.language?navigator.language:navigator.browserLanguage},country:{value:""},location:{value:""},action:{value:"",reset:1},actionname:{value:"",reset:1},section:{value:"",reset:1},source:{value:""},time:{value:""},resolution:{value:screen.width+"x"+screen.height},search:{value:""},keywords:{value:""},domain:{value:""},url:{value:""}},buildUrl:function(addStr){var u=["http:/"];for(var s in this.single)u.push(this.single[s]);for(var p in this.pair){var v=this.pair[p].value;if(v!="")u.push(p+"."+v);if(this.pair[p].reset)this.pair[p].value=""}return u.join("/")+addStr}},m_searchProviders:{Live:{form:"http://search.live.com/results.aspx?",key:"q"},Google:{form:"http://www.google.com/search?",key:"q"},Yahoo:{form:"http://search.yahoo.com/search?",key:"p"},Ask:{form:"http://www.ask.com/web?",key:"q"},Baidu:{form:"http://www.baidu.com/s?",key:"wd"}},Click:function(){(new Atlas.Event).Send()},Action:function(action){var oldLocation=this.m_dataMap.pair.location.value;if(arguments.length>1)this.m_dataMap.pair.location.value=arguments[1];var b=this.CleanStringExceptDot(action),x=b.split("|"),addStr="";if(x.length>4)for(i=4;i<x.length;i++)addStr+="/"+x[i];var a=this.CleanString(action),p=a.split("|");for(var i=0;i<p.length;++i)switch(i){case 0:this.m_dataMap.pair.action.value=p[i];break;case 1:this.m_dataMap.pair.actionname.value=escape(p[i]);break;case 2:this.m_dataMap.pair.section.value=escape(p[i]);break;case 3:if(escape(p[i]).length>0)this.m_dataMap.pair.location.value=escape(p[i]);break}var url=this.m_dataMap.buildUrl(addStr);this.LoadImage(url);for(var i=0;i<this.m_actionListeners.length;++i){var cb=this.m_actionListeners[i];if(typeof cb=="function")cb(url)}this.m_dataMap.pair.location.value=oldLocation},View:function(){if(arguments.length>0)this.Action("view",arguments[0]);else this.Action("view")},OnAction:function(callback){this.m_actionListeners.push(callback)},Event:function(){var me=this;me.anchor=getAnchor(event.srcElement);this.Send=function(){var link=me.anchor;if(!link)return;var track=link.getAttribute("track");track=!track||track.length==0?link.id:track;if(!track||track.length==0)return;if(track.indexOf("|")==-1)return;Atlas.Action(track)};function getAnchor(el){while(el&&!(el.tagName=="A"))el=el.parentNode;return el}},BindUnloadEvent:function(a){var then=new Date;window.attachEvent("onunload",function(){var s=Math.round(((new Date).getTime()-then.getTime())/1000);Atlas.m_dataMap.pair.time.value=s;Atlas.Action("unload")})},LoadImage:function(i){Atlas.m_queue.push(i)},CleanString:function(i){return i.replace(/\/|\?|&|\.|#/g,"_")},CleanStringExceptDot:function(i){return i.replace(/\/|\?|&|#/g,"_")}};function __bindEventHdlr(target){if(target&&!target.attachEvent)target.attachEvent=function(type,callback){type=type.substring(2);target.addEventListener(type,GenWindowEvent,false);target.addEventListener(type,callback,false);function GenWindowEvent(e){try{var i=0;while(e.target&&e.target.nodeType!=1&&++i<50)e.target=e.target.parentNode}catch(ex){e.target=null}e.srcElement=e.target;window.event=e}}}__bindEventHdlr(window);__bindEventHdlr(document);var TrackingTimer=window.setTimeout(SendTracking,1000);function SendTracking(){clearTimeout(TrackingTimer);var i=Atlas.m_queue.shift();if(i)Atlas.m_image.src=i+"/?"+Math.random();TrackingTimer=window.setTimeout(SendTracking,1000)}