/*
 * Healthy Activity Message Detection Module
 * Version: 1.1
 * Author: tdeater@biggs-gilmore.com
 *
 * Detects if user has viewed the Healthy Activity Message during the current session.
 * If not, it loads Google Analytics to cache external referrer data,
 * then redirects user to the URL passed to the HAM.detect() method, or to the default
 * URL (/healthymessage/index.html) if no URL is specified.
 */
 
if(typeof HAM=="undefined"){var HAM=(function(){var B=function(E,M,P){if(typeof M!="undefined"){P=P||{};if(M===null){M="";P.expires=-1;}var H="";if(P.expires&&(typeof P.expires=="number"||P.expires.toUTCString)){var I;if(typeof P.expires=="number"){I=new Date();I.setTime(I.getTime()+(P.expires*24*60*60*1000));}else{I=P.expires;}H="; expires="+I.toUTCString();}var O=P.path?"; path="+P.path:"";var K=P.domain?"; domain="+P.domain:"";var D=P.secure?"; secure":"";document.cookie=[E,"=",encodeURIComponent(M),H,O,K,D].join("");}else{var G=null;if(document.cookie&&document.cookie!==""){var N=document.cookie.split(";");for(var L=0,J=N.length;L<J;L++){var F=N[L].replace(/^\s+|\s+$/g,"");if(F.substring(0,E.length+1)==(E+"=")){G=decodeURIComponent(F.substring(E.length+1));break;}}}return G;}};var C=function(){var E=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");var D=escape('try { _gat._getTracker("UA-0-0")._trackPageview(); HAM.redirect(); } catch (err) { HAM.redirect(); }');document.write(unescape("%3Cscript src='"+E+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));document.write(unescape("%3Cscript%3E"+D+"%3C/script%3E"));};var A="/healthymessage/index.html";return{detect:function(D){var E=new RegExp(location.hostname.replace(/\./g,"\\."),"i");A=D||A;if(!B("hamdisplayed")){if(document.referrer&&!E.test(document.referrer)){C();}else{HAM.redirect();}}},redirect:function(){B("hamredirect",location.href,{path:"/"});location.replace(A);}};})();}