var livestats={init:function(site_id){livestats.pageview_fired=0;livestats.domain="http://livestats.4spots.com";if(document.location.protocol=="https:"){livestats.domain="https://livestats.4spots.com";livestats.secure=1;}livestats.base=livestats.pingbase=livestats.domain+"/in.php?site_id="+site_id;livestats.base+="&res="+screen.width+"x"+screen.height+"&lang="+(navigator.language||navigator.browserLanguage||'en').substr(0,2)+(livestats.secure?"&secure=1":"");if(livestats_custom.session){for(var i in livestats_custom.session){livestats.base+="&custom["+livestats.enc(i)+"]="+livestats.enc(livestats_custom.session[i]);}}if(livestats_custom.async){setTimeout(livestats.advanced,1000);}else livestats.add_event(window,'load',livestats.advanced);livestats.ref=RegExp("^https?://[^/]*"+location.host.replace(/^www\./i,"")+"/","i").test(document.referrer)?"":livestats.enc(document.referrer);if(!livestats_custom.pageview_disable){if(window.olark){olark('api.boot.onIdentityReady',function(s,v,c){livestats.olark(s,v,c,1);});setTimeout(livestats.pageview,2000);}else{livestats.pageview();}}},olark:function(s,v,c,do_pageview){var o=s+','+v+','+c,c=livestats.get_cookie('livestats_olark');if(c&&c==o){if(do_pageview)livestats.pageview();return;}else{if(c)livestats.set_cookie('livestats_olark',c,-3600);livestats.set_cookie('livestats_olark',o,600);c=livestats.get_cookie('livestats_olark');}if(do_pageview||!livestats.pageview_fired){livestats.pageview('&olark='+o);}else if(c){livestats.beacon('&type=ping&olark='+o,1);}},pageview:function(extra){if(livestats.pageview_fired)return;livestats.pageview_fired=1;if(location.hash.match(/utm_/i)){var href=location.pathname+(location.search?location.search+'&':'?')+location.hash.substr(1);}else{var href=location.pathname+location.search;}livestats.beacon("&href="+livestats.enc(livestats_custom.href||href)+"&title="+livestats.enc(livestats_custom.title||document.title)+"&ref="+livestats.ref+(extra||''));},log:function(href,title,type){if(type=="pageview")href=href.replace(/^https?:\/\/([^\/]+)/i,"");livestats.beacon("&type="+(type||'click')+"&href="+livestats.enc(href)+"&title="+livestats.enc(title||'')+"&ref="+livestats.ref);if(type=="download"||type=="outbound")livestats.pause();},video:function(action,time,url,title){if(!url||!action)return false;livestats.beacon('&type=video&video[action]='+action+'&video[time]='+(time||0)+'&href='+livestats.enc(url)+(title?'&title='+livestats.enc(title):''));},goal:function(id,revenue){if(!id)return;var goal=(typeof id=='number'||id.match(/^[0-9]+$/))?"[id]="+id:"[name]="+livestats.enc(id);livestats.beacon("&type=goal&goal"+goal+(revenue?"&goal[revenue]="+revenue:""));},beacon:function(x,ping){if(livestats.get_cookie('no_tracky'))return;var jsuid='',goal='',split='';if(!livestats_custom.no_cookies&&!livestats_custom.cookies_disable){jsuid=livestats.get_cookie('_jsuid');if(!jsuid){livestats.set_cookie('_jsuid',livestats.randy());jsuid=livestats.get_cookie('_jsuid');}}if(livestats_custom.goal){if(typeof livestats_custom.goal=='object'){for(var i in livestats_custom.goal){goal+="&goal["+livestats.enc(i)+"]="+livestats.enc(livestats_custom.goal[i]);}}else{goal="&goal="+livestats.enc(livestats_custom.goal);}livestats_custom.goal="";}if(livestats_custom.split){for(var i in livestats_custom.split){if(i=='goal'&&typeof livestats_custom.split.goal=='object'){for(var j=0,l=livestats_custom.split.goal.length;j<l;j++){split+='&split[goal][]='+livestats_custom.split.goal[j];}}else split+="&split["+livestats.enc(i)+"]="+livestats.enc(livestats_custom.split[i]);}livestats_custom.split="";}var s=document.createElement('script');s.type='text/javascript';s.async=true;s.src=(ping?livestats.pingbase:livestats.base)+x+goal+split+'&jsuid='+jsuid+'&mime=js&x='+Math.random();(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(s);livestats.ref="";livestats.ping_start();},ping:function(){livestats.beacon("&type=ping",1);},ping_set:function(interval,stop){if(!interval||!stop)return;var pingy=setInterval(livestats.ping,interval*1000);setTimeout("clearInterval("+pingy+")",stop*1000);livestats.ping();},ping_start:function(){if(livestats.pinging||livestats_custom.ping_disable)return;livestats.pinging=1;var last_timeout=(livestats_custom.timeout&&livestats_custom.timeout>=5&&livestats_custom.timeout<=240)?((livestats_custom.timeout-2)*60)+5:405;setTimeout("livestats.ping()",60*1000);setTimeout("livestats.ping_set(100,"+last_timeout+")",120*1000);},get_cookie:function(name){var ca=document.cookie.split(';');for(var i=0,l=ca.length;i<l;i++){if(eval("ca[i].match(/\\b"+name+"=/)"))return decodeURIComponent(ca[i].split('=')[1]);}return'';},set_cookie:function(name,value,expires){var ex=new Date;ex.setTime(ex.getTime()+(expires||20*365*86400)*1000);document.cookie=name+"="+value+";expires="+ex.toGMTString()+";path=/;domain="+(livestats_custom.cookie_domain||"."+location.hostname.replace(/^www\./i,""))+";";},randy:function(){var r=0,s="",c="0123456789";for(var i=0,l=c.length;i<19;i++){r=Math.floor(Math.random()*l);s+=c.substring(r,r+1);}return s.replace(/^0+/,"");},pause:function(x){var now=new Date();var stop=now.getTime()+(x||livestats_custom.timer||500);while(now.getTime()<stop)var now=new Date();},isset:function(e){return(typeof(window[e])!="undefined");},enc:function(e){return window.encodeURIComponent?encodeURIComponent(e):escape(e);},add_event:function(e,type,func){if(e.addEventListener){e.addEventListener(type,func,false);}else if(e.attachEvent){e.attachEvent("on"+type,func);}},download:function(e){livestats.img_src(e,"download");},outbound:function(e){livestats.img_src(e,"outbound");},click:function(e){livestats.img_src(e,"click");},img_src:function(e,type){obj=livestats.get_target(e);livestats.log(livestats.get_href(obj),livestats.get_text(obj),type);},get_text:function(e){do{var txt=e.text?e.text:e.innerText;if(txt)return txt;if(e.alt)return e.alt;if(e.title)return e.title;if(e.src)return e.src;e=livestats.get_parent(e);}while(e);return"";},get_href:function(e){do{if(e.href&&!e.src)return e.href;e=livestats.get_parent(e);}while(e);return"";},get_parent:function(e){return e.parentElement||e.parentNode;},get_target:function(e){if(!e)var e=window.event;var t=e.target?e.target:e.srcElement;if(t.nodeType&&t.nodeType==3)t=t.parentNode;return t;},advanced:function(){if(livestats_custom.advanced_disable)return;var is_download=new RegExp("\\.(7z|aac|avi|cab|csv|dmg|doc(x|m|b)?|exe|flv|gif|gz|jpe?g|js|m4a|mp(3|4|e?g)|mov|msi|ods|pdf|phps|png|ppt(x|m|b)?|rar|rtf|sea|sit|tar|torrent|txt|wma|wmv|xls(x|m|b)?|xml|zip)$","i");var is_link=new RegExp("^(https?|ftp|telnet|mailto):","i");var is_link_internal=new RegExp("^https?:\/\/(.*)"+location.host.replace(/^www\./i,""),"i");var a=document.getElementsByTagName("a");for(var i=0;i<a.length;i++){if(a[i].className.match(/livestats_log/i)){if(a[i].className.match(/livestats_log_download/i)){livestats.add_event(a[i],"mousedown",livestats.download);}else if(a[i].className.match(/livestats_log_outbound/i)){livestats.add_event(a[i],"mousedown",livestats.outbound);}else{livestats.add_event(a[i],"mousedown",livestats.click);}}else{if(is_link.test(a[i].href)&&!a[i].className.match(/livestats_ignore/i)){if(is_download.test(a[i].href)){livestats.add_event(a[i],"mousedown",livestats.download);}else if(!is_link_internal.test(a[i].href)){livestats.add_event(a[i],"mousedown",livestats.outbound);}}}}}};if(!livestats.isset("livestats_custom"))livestats_custom={};if(livestats.isset("livestats_page_title"))livestats_custom.title=livestats_page_title;if(livestats.isset("livestats_advanced_disable"))livestats_custom.advanced_disable=1;if(livestats.isset("livestats_pause_timer"))livestats_custom.timer=livestats_pause_timer;if(livestats.isset("livestats_custom_session"))livestats_custom.session=livestats_custom_session;if(livestats.isset("livestats_goal"))livestats_custom.goal=livestats_goal;if(livestats.isset("async_site_id"))var livestats_site_id=async_site_id;if(livestats.isset("livestats_site_id")){livestats_custom.async=1;livestats.init(livestats_site_id);}function statsgoyes(site_id){livestats.init(site_id);}var videogoyes=livestats.video;
