!function(){function b(){var e,b=a.get("gatheruuid");""!=b&&d(b)||(b=c(),e=new Image,e.onload=null,e.src="http://tongji.leju.com/api/ck/set_ck.json?guid="+b,e.style.display="none"),a.save("gatheruuid",b,180),a.save("newgatheruuid",b,180)}function c(){var d,a="0123456789abcdefghijklmnopqrstuvwxyz",b=(new Date).getTime()+"",c=0;for(d=0;3>d;d++)c=Math.floor(Math.random()*(13+d)),b=b.substr(0,c)+a.substr(Math.floor(36*Math.random()),1)+b.substr(c);return b}function d(a){var b=/^[0-9a-zA-Z]{16}$/;return b.test(a)}var a={db:document.cookie,host:document.location.host,getCookieRootDomain:function(){function e(a){var d,b=document.cookie,c=b.indexOf(a+"=");return-1==c||c&&!~b.indexOf("; "+a+"=")?"":(c=c+a.length+1,d=b.indexOf("; ",c),-1==d&&(d=b.length),decodeURIComponent(b.substring(c,d)))}var b,c,a=location.host.split(":").shift().split("."),d=a.length;if(1==d)return rootDomain="";for(b="TMP"+ +new Date;d-->2&&(c=a.slice(1).join("."),document.cookie=b+"="+b+"; domain="+c,b=e(b),document.cookie=b+"=1; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain="+c,b);)a.shift();return rootDomain=a.join(".")},getDomain:function(){return this.getCookieRootDomain()},save:function(a,b,c){var d=new Date,e=this.getDomain();d.setDate(d.getDate()+c),document.cookie=a+"="+encodeURI(b)+(null==c?"":";expires="+d.toGMTString())+";path=/;"+(""==e?"":"domain="+e)},get:function(a){var b,c;return document.cookie.length>0&&(b=document.cookie.indexOf(a+"="),-1!=b)?(b=b+a.length+1,c=document.cookie.indexOf(";",b),-1==c&&(c=document.cookie.length),decodeURI(document.cookie.substring(b,c))):""}};b()}();!function(){function LejuTj(a){this.items=[],this.protocol=window.location.protocol,this.opt={position:"body",sendUrl:this.protocol+"//tongji.leju.com/h.gif",pvSendUrl:this.protocol+"//tongji.leju.com/g.gif",eventUrl:this.protocol+"//tongji.leju.com/e.gif",limitUrl:["http://m.leju.com/touch/index/","http://m.bch.leju.com/touch/index/"],pvLimitHost:["all"],eventLimitHost:["all"],tjType:{pv:1},statisticsItem:["a","button","body","i"],tid:"",uuid:"",heatmap:!0,pvTj:!0,maxLength:4,localCookieName:"local_lejutj_params"},this.submitUrl="",this.arrImg=[],this.taskQueue=[],this.gatheruuid="",this.newgatheruuid="";for(var b in a)a.hasOwnProperty(b)&&void 0!==a[b]&&(this.opt[b]=a[b]);this.init()}function checkEventParams(a,b){return"string"!=typeof a||""===a.replace(/(^\s*)|(\s*$)/g,"")?(console.error("请以字符串形式传入事件名称!"),!1):"object"!=typeof b?(console.error("请以对象形式传入参数!"),!1):!0}function sendLocalEventData(){var c,a=this,b=COOKIE_UTILS.get(a.opt.localCookieName);if(""!==b)try{c=JSON.parse(b).shift(),c&&(sendImgData(a,c.submitUrl+"?"+getParamUrl(c)),COOKIE_UTILS.save(a.opt.localCookieName,"",-1))}catch(d){console.error(d.message)}}function sendImgData(a,b){function h(a,b){return function(){return b.apply(a,arguments)}}var f,g,i,c=a.arrImg,d=c.length,e=-1;for(f=0;d>f;f++)if(0==c[f].f){e=f;break}if(-1==e){if(d==a.opt.maxLength)return a.taskQueue.push(b),void 0;img=new Image,c.push({f:1,img:img}),e=0==d?0:d}else img=c[e].img;c[e].f=1,img.setAttribute("data-vid",e),g=function(){var b=this.getAttribute("data-vid");b>=0&&(c[b].f=0),a.taskQueue.length>0&&sendImgData(a,a.taskQueue.shift())},i=h(img,g),EventUtil.removeHandler(img,"load",i),EventUtil.removeHandler(img,"error",i),EventUtil.addHandler(img,"load",i),EventUtil.addHandler(img,"error",i),img.src=b}function urlFilter(a){var b,c,d,e;if("heat"===a?(b=location.href.split("?")[0],c=this.opt.limitUrl):"pv"===a?(b=location.host,c=this.opt.pvLimitHost):"event"===a&&(b=location.host,c=this.opt.eventLimitHost),1===c.length&&"all"===c[0])return!0;for(d=0,e=c.length;e>d;d++)if(b===c[d])return!0;return!1}function prepareParams(){var f,g,h,a=[],b=this.items,d=b[b.length-1],e={};switch(d[0]){case"_heatEvent":this.sendProxy("heat")&&a.push({submitUrl:this.opt.sendUrl,guid:this.gatheruuid,x:d[3],y:d[4],width:d[5],height:d[6],refer_url:d[7],url:d[8],uuid:d[9],date:(new Date).getTime()});break;case"_pvEvent":this.sendProxy("pv")&&(e.t=this.opt.tjType.pv,e.submitUrl=this.opt.pvSendUrl,setCommonParams.call(this,e),setFromUrlParams.call(this,e),a.push(e));break;case"_cEvent":if(this.sendProxy("event")){f=d[1],g=d[2];for(h in g)g.hasOwnProperty(h)&&(e["c_"+h]="object"==typeof g[h]?JSON.stringify(g[h]):"function"==typeof g[h]?g[h].toString():g[h]);e.submitUrl=this.opt.eventUrl,e.ename=f,setCommonParams.call(this,e),setFromUrlParams.call(this,e),a.push(e)}}return a}function setCommonParams(a){a.nt=commonParams.getNowtime(),a.ru=commonParams.getReferrer(),a.u=commonParams.getHref(),a.uuid=this.opt.uuid,a.guid=this.gatheruuid,a.tt=commonParams.getTitle(),a.ds=commonParams.getScreenSize(),a.source=commonParams.getSource()}function setFromUrlParams(a){var c,d,e,f,b=window.location.href.split("#");if(b[1])for(c=b[1].split("&"),d=0,e=c.length;e>d;d++)f=c[d].split("="),f[1]&&(a["url_"+f[0]]=f[1])}function bindHeatMapEvent(){function e(a){var c=EventUtil.getEvent(a);if(b={startX:0,startY:0,endX:0,endY:0,endPageX:0,endPageY:0},isMobile){if("undefined"==typeof c.changedTouches)return;c=c.changedTouches[0]}b.startX=c.clientX||0,b.startY=c.clientY||0}function f(a){var f,e=EventUtil.getEvent(a);if(isMobile){if("undefined"==typeof e.changedTouches)return;e=e.changedTouches[0]}b.endX=e.clientX||0,b.endY=e.clientY||0,b.endPageX=e.pageX||0,b.endPageY=e.pageY||0,c=e.srcElement||e.target,isTap(b)&&(f=new Date,canPush.call(d,f.getTime(),b.endPageX,b.endPageY)&&d.push(["_heatEvent",f.getTime(),c.nodeName,b.endPageX,b.endPageY,document.body.scrollWidth,document.body.scrollHeight,document.referrer,location.href,d.opt.uuid]))}var a=$(this.opt.position),b={},c="",d=this;a.length>0?isMobile?(EventUtil.addHandler(a[0],"touchstart",e),EventUtil.addHandler(a[0],"touchend",f)):(EventUtil.addHandler(a[0],"mousedown",e),EventUtil.addHandler(a[0],"mouseup",f)):console.error("position is undefined.")}function bindPageStatistics(){function clickHandler(event){for(var paramsName,paramsStr,params,e=EventUtil.getEvent(event),target=EventUtil.getTarget(e);target&&target.tagName&&!arrayContain(target.tagName.toLowerCase(),that.opt.statisticsItem);)target=target.parentNode;return target?(paramsName=target.getAttribute("data-lejutj-event-name"),paramsStr=target.getAttribute("data-lejutj-event-params"),paramsName&¶msStr&&""!==paramsName&&""!==paramsStr&&(params=eval("("+paramsStr+")"),"object"==typeof params?that.event(paramsName,params):console.error("data-lejutj-event-params 参数错误")),void 0):!1}var $body=$("body"),that=this;$body.length>0?EventUtil.addHandler($body[0],"click",clickHandler):console.error("position is undefined.")}function arrayContain(a,b){for(var c=0,d=b.length;d>c;c++)if(a===b[c])return!0;return!1}function isTap(a){var b=a.endX-a.startX,c=a.endY-a.startY;return Math.pow(b*b+c*c,.5)<=THRESHOLD}function canPush(a,b,c){return this.items.length>0&&b>this.items[0][3]-FILTER_DIS&&bthis.items[0][4]-FILTER_DIS&&c=a?!1:!0}function getParamUrl(a){var e,b="",c=!1,d="";for(e in a)a.hasOwnProperty(e)&&"submitUrl"!==e&&("ru"===e?(c=!0,d=encodeURIComponent(a[e])):b+=e+"="+encodeURIComponent(a[e])+"&");return c?b+"ru="+d:b.substr(0,b.length-1)}function getQueryString(a){var b=new RegExp("(^|&)"+a+"=([^&]*)(&|$)","i"),c=window.location.search.substr(1).match(b);return null!=c?decodeURIComponent(c[2]):""}function getUrlHash(a){var c,d,e,f,g,h,b=window.location.hash;if(""!=b)for(c=b.substring(b.indexOf("#")+1).split("&"),d=0,e=c.length;e>d;d++)if(""!=c[d])for(f=c[d].split("="),g=0,h=f.length;h>g;g++)if(f[0]==a)return f[1];return""}function pvEvent(){this.push(["_pvEvent"])}function getRootDomain(a){var b,c,d;if(!a)return"";if(-1!=a.indexOf("://")&&(a=a.substr(a.indexOf("://")+3)),-1!=a.indexOf("/")&&(a=a.substr(0,a.indexOf("/"))),-1!=a.indexOf("?")&&(a=a.substr(0,a.indexOf("?"))),b=["com","net","org","gov","edu","mil","biz","name","info","mobi","pro","travel","museum","int","areo","post","rec"],c=a.split("."),c.length<=1)return a;if(!isNaN(c[c.length-1]))return a;for(d=0;d2&&(c=a.slice(1).join("."),document.cookie=b+"="+b+"; domain="+c,b=e(b),document.cookie=b+"=1; expires=Thu, 01 Jan 1970 00:00:00 GMT; domain="+c,b);)a.shift();return rootDomain=a.join(".")},getDomain:function(){return this.getCookieRootDomain()},save:function(a,b,c){var d=new Date,e=this.getDomain();d.setDate(d.getDate()+c),document.cookie=a+"="+encodeURI(b)+(null==c?"":";expires="+d.toGMTString())+";path=/;"+(""==e?"":"domain="+e)},get:function(a){var b,c;return document.cookie.length>0&&(b=document.cookie.indexOf(a+"="),-1!=b)?(b=b+a.length+1,c=document.cookie.indexOf(";",b),-1==c&&(c=document.cookie.length),decodeURI(document.cookie.substring(b,c))):""}},EventUtil={addHandler:function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):a["on"+b]=c},removeHandler:function(a,b,c){a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent?a.detachEvent("on"+b,c):a["on"+b]=null},getTarget:function(a){return a.target||a.srcElement},getEvent:function(a){return a||window.event}},commonParams={getNowtime:function(){var a=new Date;return a.getTime()},getReferrer:function(){return document.referrer},getHref:function(){return window.location.href},getTitle:function(){return document.title},getScreenSize:function(){return window.screen.width+"x"+window.screen.height},getSource:function(){var b,a=getQueryString("ljmf_source");return""==a&&(a=getUrlHash("ljmf_source")),b=getQueryString("source"),""==b&&(b=getUrlHash("source")),""!=a?(COOKIE_UTILS.save("source_name",a,1),a):""!=b?(COOKIE_UTILS.save("source_name",b,1),b):COOKIE_UTILS.get("source_name")}};LejuTj.prototype.push=function(a){this.items.push(a),this.sendData()},LejuTj.prototype.init=function(){initId.call(this),this.opt.pvTj&&pvEvent.apply(this),this.opt.heatmap&&bindHeatMapEvent.apply(this),bindPageStatistics.apply(this),sendLocalEventData.apply(this),this.isDomainChanged()},LejuTj.prototype.sendProxy=function(a){return urlFilter.call(this,a)},LejuTj.prototype.sendPv=function(){this.opt.pvTj&&pvEvent.apply(this)},LejuTj.prototype.sendData=function(){var c,a=prepareParams.call(this),b=a.shift();void 0!==b&&(c=b.submitUrl+"?"+getParamUrl(b),sendImgData(this,c)),this.items.length>1&&this.items.shift()},LejuTj.prototype.event=function(a,b){checkEventParams(a,b)&&this.push(["_cEvent",a,b])},LejuTj.prototype.localEvent=function(a,b){if(checkEventParams(a,b)){this.items.push(["_cEvent",a,b]);var c=prepareParams.call(this);COOKIE_UTILS.save(this.opt.localCookieName,JSON.stringify(c),180)}},LejuTj.prototype.isDomainChanged=function(){var a=getRootDomain(commonParams.getReferrer()),b=COOKIE_UTILS.getCookieRootDomain();return""!==a&&b!==a?(COOKIE_UTILS.save("refer_domain",a,180),!0):!1},window.lejuTj||(window.lejuTj=new LejuTj)}(); !function(){function c(c){c.nt=b.getNowtime(),c.ru=b.getReferrer(),c.u=b.getHref(),c.guid=a.get("gatheruuid"),c.tt=b.getTitle(),c.ds=b.getScreenSize()}function d(a){if("undefined"!=typeof leju_analytics)for(var b in leju_analytics)leju_analytics.hasOwnProperty(b)&&leju_analytics[b]&&(a[b]=leju_analytics[b])}function e(a){var e,b="",c=!1,d="";for(e in a)a.hasOwnProperty(e)&&"submitUrl"!==e&&("ru"===e?(c=!0,d=encodeURIComponent(a[e])):b+=e+"="+encodeURIComponent(a[e])+"&");return c?b+"ru="+d:b.substr(0,b.length-1)}function f(a,b){var c=new Image;c.onload=null,c.src=a+"?"+e(b),c.style.display="none"}var a={get:function(a){var b,c;return document.cookie.length>0&&(b=document.cookie.indexOf(a+"="),-1!=b)?(b=b+a.length+1,c=document.cookie.indexOf(";",b),-1==c&&(c=document.cookie.length),decodeURI(document.cookie.substring(b,c))):""}},b={getNowtime:function(){var a=new Date;return a.getTime()},getReferrer:function(){return document.referrer},getHref:function(){return window.location.href},getTitle:function(){return document.title},getScreenSize:function(){return window.screen.width+"x"+window.screen.height}},g="https:"==document.location.protocol?" https://":" http://",h=g+"tongjijs.leju.com/analytics.gif",i={};i.id="",c(i),d(i),f(h,i)}();