var stats = { init:function() { if( document.location.protocol == "https:" ) { stats.domain = "https://static.getclicky.com"; stats.secure = 1; } else { stats.domain = "http://static.getclicky.com"; stats.secure = 0; } stats.img = new Image(); stats.img_base = stats.domain + "/in.php?site_id=144629&srv=db20"+ "&res="+screen.width+"x"+screen.height+ "&lang="+( navigator.language || navigator.browserLanguage ).substr(0,2)+ "&secure="+stats.secure; if( stats_custom.session ) { for( var i in stats_custom.session ) { stats.img_base += "&custom[" + stats.enc( i ) + "]=" + stats.enc( stats_custom.session[i] ); } } if( stats_custom.goal ) { for( var i in stats_custom.goal ) { stats.img_base += "&goal[" + stats.enc( i ) + "]=" + stats.enc( stats_custom.goal[i] ); } } var r = RegExp( "^https?://[^/]*"+location.host.replace( /^www\./i, "")+"/", "i").test( document.referrer ) ? "" : stats.enc( document.referrer ); if( stats_custom.pageview_disable ) { stats.img_base += "&ref=" + r; } else { stats.img.src = stats.img_base + "&ref=" + r + "&title="+stats.enc( stats_custom.title ? stats_custom.title : document.title ) + "&href=" +stats.enc( stats_custom.href ? stats_custom.href : location.pathname + location.search ) + "&x="+Math.random(); } stats.add_event( window, 'load', stats.advanced ); }, isset:function( e ) { return( typeof( window[e] ) != "undefined" ); }, enc:function( e ) { return window.encodeURIComponent ? encodeURIComponent( e ) : escape( e ); }, log:function( href, title, type ) { type = type || "click"; if( type == "pageview" ) href = href.replace( /^https?:\/\/([^\/]+)/i, ""); stats.img.src = stats.img_base + "&type=" + type + "&title=" + stats.enc( title ) + "&href=" + stats.enc( href ) + "&x=" + Math.random(); stats.pause(); }, pause:function( x ) { var now = new Date(); var stop = now.getTime() + ( x || stats_custom.timer || 500 ); while( now.getTime() < stop ) var now = new Date(); }, goal:function( id, revenue ) { stats.img.src = stats.img_base + "&type=goal&goal[id]="+id+"&goal[revenue]="+revenue+"&x="+Math.random(); }, 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 ) { stats.img_src( e, "download" ); }, outbound:function( e ) { stats.img_src( e, "outbound" ); }, click:function( e ) { stats.img_src( e, "click" ); }, img_src:function( e, type ) { obj = stats.get_target( e ); stats.log( stats.get_href( obj ), stats.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 = stats.get_parent( e ); } while( e ); return ""; }, get_href:function( e ) { do { if( e.href && !e.src ) return e.href; e = stats.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( stats_custom.advanced_disable ) return; var is_download = new RegExp("\\.(7z|aac|avi|cab|csv|doc(x|m)?|exe|flv|gif|gz|jpe?g|js|m4a|mp(3|4|e?g)|mov|msi|ods|pdf|phps|png|ppt(x|m)?|rar|rtf|sea|sit|tar|torrent|txt|wma|wmv|xls(x|m)?|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(/stats_log/i)) { if( a[i].className.match(/stats_log_download/i)) { stats.add_event( a[i], "mousedown", stats.download ); } else if( a[i].className.match(/stats_log_outbound/i)) { stats.add_event( a[i], "mousedown", stats.outbound ); } else { stats.add_event( a[i], "mousedown", stats.click ); } } else { if( is_link.test( a[i].href ) && !a[i].className.match(/stats_ignore/i)) { if( is_download.test( a[i].href )) { stats.add_event( a[i], "mousedown", stats.download ); } else if( !is_link_internal.test( a[i].href )) { stats.add_event( a[i], "mousedown", stats.outbound ); } } } } } }; if( !stats.isset("stats_custom")) stats_custom = {}; if( stats.isset("stats_page_title")) stats_custom.title = stats_page_title; if( stats.isset("stats_advanced_disable")) stats_custom.advanced_disable = 1; if( stats.isset("stats_pause_timer")) stats_custom.timer = stats_pause_timer; if( stats.isset("stats_custom_session")) stats_custom.session = stats_custom_session; if( stats.isset("stats_goal")) stats_custom.goal = stats_goal; stats.init();