var GravityInsights=function(b){function g(a,d){var c,e=d||"beacon";c=encodeURIComponent(document.getElementsByTagName("title")[0].innerHTML);var f=new Date,f=f.getMilliseconds()+"-"+f.getSeconds();c=["cbust="+f,"site_guid="+b.site_guid,"action="+e,"user_guid="+a,"referrer="+document.referrer,"browser_useragent="+h(navigator.userAgent),"OS="+h(j()),"href="+location.href,"url="+k(),b.thread_id!==void 0?"thread_id="+b.thread_id:"",b.post_id!==void 0?"post_id="+b.post_id:"",b.forum_id!==void 0?"forum_id="+ b.forum_id:"",b.user_id!==void 0?"user_id="+b.user_id:"",b.username!==void 0?"user_name="+b.username:"",b.post_title!==void 0?"post_title="+b.post_title:"",b.thread_title!==void 0?"thread_title="+b.thread_title:"",b.forum_title!==void 0?"forum_title="+b.forum_title:"",c!==void 0?"article_title="+c:"",b.external_user_id!==void 0?"external_user_id="+b.external_user_id:"",b.article_id!==void 0?"article_id="+b.article_id:"",b.type!==void 0?"type="+b.type:"",b.board!==void 0?"board="+encodeURIComponent(b.board): ""].join("&");e=document.createElement("script");e.src=i+"/log?"+c;e.type="text/javascript";c=document.getElementsByTagName("head")[0]||document.documentElement;c.insertBefore(e,c.firstChild)}function h(a){return window.encodeURIComponent?encodeURIComponent(a):escape(a)}function j(){var a="Unknown OS";navigator.appVersion.indexOf("Win")!==-1&&(a="Windows");navigator.appVersion.indexOf("Mac")!==-1&&(a="MacOS");navigator.appVersion.indexOf("X11")!==-1&&(a="UNIX");navigator.appVersion.indexOf("Linux")!== -1&&(a="Linux");return a}function k(){var a=document.getElementsByTagName("link"),b=a.length,c="";for(x=0;x<b;x++)if((c=a[x].getAttribute("rel"))&&c.indexOf("canonical")===0)return encodeURIComponent(a[x].getAttribute("href"));else if(x===b)break;return encodeURIComponent(location.href)}var i="http://api.gravity.com/v1/beacons";(function(){var a;a=document.cookie;var d=a.indexOf("grvinsights");if(d===-1)a=" ";else{var c=a.indexOf(";",d);if(c===-1)c=a.length;a=unescape(a.substring(d+11+1,c))}if(a=== " "||a==="")d="?u="+b.user_id+"&sg="+b.site_guid,a=document.createElement("script"),a.src=i+"/initialize"+d,a.type="text/javascript",d=document.getElementsByTagName("head")[0]||document.documentElement,d.insertBefore(a,d.firstChild),a=!1;a!==void 0&&a&&g(a,"beacon")})();return{cc:function(a,b){if(a!==""){var c=new Date;c.setTime(c.getTime()+432E8);c="; expires="+c.toGMTString();document.cookie=a+"="+b+c+"; path=/";g(b,"beacon")}}}}(gravityInsightsParams);