/*! formstone v0.7.12 [analytics.js] 2015-08-12 | MIT License | formstone.it */

!function(a,b,c){"use strict";function d(){t=b.$body}function e(){q.scrollDepth&&l()}function f(){return arguments.length&&"object"!==a.type(arguments[0])?"destroy"===arguments[0]?h.apply(this):n.apply(this,arguments):g.apply(this,arguments),null}function g(b){!w&&t.length&&(w=!0,D="function"===a.type(r.ga),E="undefined"!==a.type(r.dataLayer)&&"function"===a.type(r.dataLayer.push),q=a.extend(q,b||{}),q.autoEvents&&t.find("a").not("["+y+"]").each(i),q.scrollDepth&&(l(),s.on(v.scroll,j),s.one(v.load,e)),t.on(v.click,"*["+y+"]",m))}function h(){w&&t.length&&(s.off(v.namespace),t.off(v.namespace))}function i(){if(q.autoEvents){var b,d=a(this),e="undefined"!==a.type(d[0].href)?d[0].href:"",f=document.domain.split(".").reverse(),g=null!==e.match(f[1]+"."+f[0]);if(e.match(/^mailto\:/i))b="Email, Click, "+e.replace(/^mailto\:/i,"");else if(e.match(/^tel\:/i))b="Telephone, Click, "+e.replace(/^tel\:/i,"");else if(e.match(q.filetypes)){var h=/[.]/.exec(e)?/[^.]+$/.exec(e):c;b="File, Download:"+h[0]+", "+e.replace(/ /g,"-")}else g||(b="ExternalLink, Click, "+e);b&&d.attr(y,b)}}function j(){u.startTimer(A,250,k)}function k(){for(var a,c=b.$window.scrollTop()+b.windowHeight,d=1/q.scrollStops,e=d,f=1;f<=q.scrollStops;f++)a=Math.round(100*e).toString(),!z[B][a].passed&&c>z[B][a].edge&&(z[B][a].passed=!0,n("ScrollDepth",B,a)),e+=d}function l(){var b,c=a.mediaquery("state"),d=t.outerHeight(),e={},f=1/q.scrollStops,g=f,h=0;c.minWidth&&(B="MinWidth:"+c.minWidth+"px");for(var i=1;i<=q.scrollStops;i++)h=parseInt(d*g),b=Math.round(100*g).toString(),e[b]={edge:"100"===b?h-10:h,passsed:z[B]&&z[B][b]?z[B][b].passed:!1},g+=f;z[B]=e}function m(b){if(D||E){var c=a(this),d=c.attr("href"),e=c.data(x).split(",");q.eventCallback&&b.preventDefault();for(var f in e)e.hasOwnProperty(f)&&(e[f]=a.trim(e[f]));n(e[0],e[1],e[2]||d,e[3],e[4],c)}}function n(b,d,e,f,g,h){if(D||E){var i={hitType:"event",location:r.location,title:r.document.title};if(i.eventCategory=b||c,i.eventAction=d||c,i.eventLabel=e||c,i.eventValue=f||c,i.nonInteraction=g||c,"undefined"!==a.type(h)&&!h.attr("data-analytics-stop")){var j="undefined"!==a.type(h[0].href)?h[0].href:"",k=!j.match(/^mailto\:/i)&&!j.match(/^tel\:/i)&&j.indexOf(":")<0?r.location.protocol+"//"+r.location.hostname+"/"+j:j;if(""!==j)if(h.attr("target"))r.open(k,h.attr("target"));else if(q.eventCallback){var l="hitCallback";i[l]=function(){C&&(u.clearTimer(C),o(k))},C=u.startTimer(C,q.eventTimeout,i[l])}}for(var m=r.ga.getAll(),n=0,p=m.length;p>n;n++)r.ga(m[n].get("name")+".send",i)}}function o(a){document.location=a}var p=b.Plugin("analytics",{methods:{_setup:d,_resize:e},utilities:{_delegate:f}}),q={autoEvents:!1,filetypes:/\.(zip|exe|dmg|pdf|doc.*|xls.*|ppt.*|mp3|txt|rar|wma|mov|avi|wmv|flv|wav)$/i,eventCallback:!1,eventTimeout:1e3,scrollDepth:!1,scrollStops:5,trackerName:"all"},r=b.window,s=b.$window,t=null,u=p.functions,v=p.events,w=!1,x="analytics-event",y="data-"+x,z={},A=null,B="Site",C=null,D=!1,E=!1}(jQuery,Formstone);