
var GAM=GAM||[];GAM['subRollupDomains']=new Array('paloalto.com','businessplanpro.com','marketingplanpro.com','start-run-grow.com','businessplanpro.ca','bizplans.com','freebusinessplan.com','hurdlebook.com','pasware.com','sampleplans.com','cashflowcalculator.com');GAM['subRollupUKDomains']=new Array('paloalto.co.uk','businessplanpro.co.za','businessplanpro.co.uk','paloalto.com.au','businessplanpro.ie');GAM['fileTypes']=new RegExp(/\.(docx*|xlsx*|pptx*|exe|zip|pdf|xpi)$/i);GAM['customVariables']=GAM['customVariables']||[];GAM['overridePage']=GAM['overridePage']||'';GAM['domainName']=getRootDomain(document.location.hostname);GAM['subRollup']=GAM['subRollup']||isSubRollup(GAM,GAM['domainName']);GAM['accountID']=GAM['accountID']||getAccountID(GAM);GAM['skipRollup']=GAM['skipRollup']||0;GAM['skipAddons']=GAM['skipAddons']||0;var _gaq=_gaq||[];_gaq.push(['_setAccount',GAM['accountID']]);_gaq.push(['_setDomainName',GAM['domainName']]);_gaq.push(['_setAllowHash',false]);if(GAM['subRollup']>0||GAM['accountID']=='UA-90231-46'){_gaq.push(['_setAllowLinker',true]);_gaq.push(['_setAllowAnchor',true]);}
for(var i=0;i<=4;i++){if(GAM['customVariables'][i]!==undefined){_gaq.push(['_setCustomVar',GAM['customVariables'][i][0],GAM['customVariables'][i][1],GAM['customVariables'][i][2],GAM['customVariables'][i][3]]);}}
if(GAM['overridePage'].length>1){_gaq.push(['_trackPageview',GAM['overridePage']]);}
else{_gaq.push(['_trackPageview']);}
(function(){var ga=document.createElement('script');ga.type='text/javascript';ga.async=true;ga.src='//stats.g.doubleclick.net/dc.js'
var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(ga,s);})();waitForDocumentReady();function getRootDomain(domain){if(domain=='entrepreneur.businessplanpro.com'){return domain;}
var parts=domain.toString().split('.'.toString());if(parts.length>=2){if(parts[parts.length-2].length<4&&parts.length>=3){return parts[parts.length-3]+'.'+parts[parts.length-2]+'.'+parts[parts.length-1];}
else{return parts[parts.length-2]+'.'+parts[parts.length-1];}}
else{return'';}}
function isSubRollup(GAM,domain){if(GAM['domainName']==domain&&GAM['accountID']&&GAM['accountID']!=='UA-90231-14'){return 0;}
for(var i in GAM['subRollupDomains']){if(domain==GAM['subRollupDomains'][i]){return 1;}}
for(var i in GAM['subRollupUKDomains']){if(domain==GAM['subRollupUKDomains'][i]){return 2;}}
return 0;}
function getAccountID(GAM){if(GAM['subRollup']===1){return'UA-90231-14';}
else if(GAM['subRollup']===2){return'UA-1393652-1';}
else{switch(GAM['domainName']){case'bplans.com':return'UA-90231-11';case'bplans.co.uk':return'UA-1393652-5';case'mplans.com':return'UA-90231-9';case'liveplan.com':return'UA-90231-47';case'emailcenterpro.com':return'UA-3402106-2';case'entrepreneur.businessplanpro.com':return'UA-90231-46';default:return'UA-90231-14';}}}
function waitForDocumentReady(){if(document.readyState==="complete"){onDocumentReady();return;}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);onDocumentReady();return;},false);}else if(document.attachEvent){if(document.documentElement.doScroll&&window==window.top)(function(){try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}
onDocumentReady();return;})();}
window.onLoad=function(){onDocumentReady();};}
function onDocumentReady(){if(GAM['skipRollup']==0){addRollupIframe();}
if(GAM['skipAddons']==0){GAMaddons();}}
function addRollupIframe(){GAM['customVariables']=GAM['customVariables']||[];var qs='';if(document.location.search.length>1){var qs=document.location.search;}
if(document.location.protocol=='https:'){var rollupUrl='https://www.secureplan.com/ga/rollup.html'+qs;}
else{var rollupUrl='http://www.secureplan.com/ga/rollup.html'+qs;}
if(GAM['overridePage'].length>1){rollupUrl=rollupUrl+'#page='+encodeURIComponent(document.location.hostname)+encodeURIComponent(GAM['overridePage']);}
else{rollupUrl=rollupUrl+'#page='+encodeURIComponent(document.location.hostname)+encodeURIComponent(document.location.pathname)+encodeURIComponent(document.location.search);}
rollupUrl=rollupUrl+'&ref='+encodeURIComponent(document.referrer);if(GAM['subRollup']==2||GAM['domainName']=='bplans.co.uk'){rollupUrl=rollupUrl+'&uk=1';}
for(var i=0;i<=4;i++){if(GAM['customVariables'][i]!==undefined){var slot=GAM['customVariables'][i][0];rollupUrl=rollupUrl+"&cv"+slot+"name="+encodeURIComponent(GAM['customVariables'][i][1])+"&cv"+slot+"value="+encodeURIComponent(GAM['customVariables'][i][2])+"&cv"+slot+"scope="+encodeURIComponent(GAM['customVariables'][i][3]);}}
var rollup=document.createElement('iframe');rollup.src=rollupUrl;rollup.width=1;rollup.height=1;rollup.style.position='absolute';rollup.style.top='-40px';document.getElementsByTagName('body')[0].appendChild(rollup);}
var openSubRollupLink=function(link){_gaq.push(function(){var tracker=_gaq._getAsyncTracker();window.location=tracker._getLinkerUrl(link,true);return false;});return true;}
var GAMaddons=function(){var startListening=function(obj,evnt,func){if(obj.addEventListener)obj.addEventListener(evnt,func,false);else if(obj.attachEvent)obj.attachEvent("on"+evnt,func);}
var trackDocument=function(evnt){evnt=evnt||event;var elmnt=evnt.srcElement||evnt.target;if(elmnt){while(elmnt.tagName!="A")elmnt=elmnt.parentNode;}
var pathname=("/"+elmnt.pathname).replace(/\/\//,'');_gaq.push(['_trackEvent',"download","click",pathname]);}
var trackExternalLink=function(evnt){evnt=evnt||event;var elmnt=evnt.srcElement||evnt.target;if(elmnt){while(elmnt.tagName!="A")elmnt=elmnt.parentNode;if(/http/.test(elmnt.protocol)){var url=elmnt.href.substr(elmnt.href.indexOf('//')+2,Infinity);_gaq.push(['_trackEvent',"outbound","click",url]);}
if(elmnt.protocol=="mailto:")_gaq.push(['_trackEvent',"mailto","click",elmnt.href.replace(/mailto:/,"")]);}
else{if(/http/.test(this.protocol)){var url=this.href.substr(this.href.indexOf('//')+2,Infinity);_gaq.push(['_trackEvent',"outbound","click",url]);}
if(this.protocol=="mailto:")_gaq.push(['_trackEvent',"mailto","click",this.href.replace(/mailto:/,"")]);}}
var trackCartLink=function(evnt){evnt=evnt||event;var elmnt=evnt.srcElement||evnt.target;if(elmnt){while(elmnt.tagName!="A")elmnt=elmnt.parentNode;if(/http/.test(elmnt.protocol)){var url=elmnt.href.substr(elmnt.href.indexOf('//')+2,Infinity);_gaq.push(['_trackEvent',"addtocart","click",url]);}}
if(/http/.test(this.protocol)){var url=this.href.substr(this.href.indexOf('//')+2,Infinity);_gaq.push(['_trackEvent',"addtocart","click",url]);}}
var trackSubRollupLink=function(evnt){evnt=evnt||event;var elmnt=evnt.srcElement||evnt.target;if(elmnt){while(elmnt.tagName!="A")elmnt=elmnt.parentNode;if(/http/.test(elmnt.protocol)){var url=elmnt.href.substr(elmnt.href.indexOf('//')+2,Infinity);_gaq.push(['_trackEvent',"crosssite","click",url]);_gaq.push(['_link',url,true]);return false;}}
if(/http/.test(this.protocol)){var url=this.href.substr(this.href.indexOf('//')+2,Infinity);_gaq.push(['_trackEvent',"crosssite","click",url]);_gaq.push(['_link',url,true]);return false;}}
var trackCrossSiteLink=function(evnt){evnt=evnt||event;var elmnt=evnt.srcElement||evnt.target;if(elmnt){while(elmnt.tagName!="A")elmnt=elmnt.parentNode;if(/http/.test(elmnt.protocol)){var url=elmnt.href.substr(elmnt.href.indexOf('//')+2,Infinity);_gaq.push(['_trackEvent',"crosssite","click",url]);}}
if(/http/.test(this.protocol)){var url=this.href.substr(this.href.indexOf('//')+2,Infinity);_gaq.push(['_trackEvent',"crosssite","click",url]);}}
if(document.getElementsByTagName){var hrefs=document.getElementsByTagName('a');for(var l=0,m=hrefs.length;l<m;l++){if(GAM['fileTypes'].test(hrefs[l].pathname)){startListening(hrefs[l],"click",trackDocument);}
else if(GAM['subRollup']&&getRootDomain(hrefs[l].hostname)!=GAM['domainName']&&isSubRollup(GAM,getRootDomain(hrefs[l].hostname))==GAM['subRollup']){hrefs[l].setAttribute('onclick',"openSubRollupLink('"+hrefs[l].href+"'); return false;");}
else if(GAM['subRollup']==2&&GAM['domainName']!='paloalto.com'&&hrefs[l].hostname=='www.paloalto.com'&&hrefs[l].pathname.substr(0,3)=='/uk'){hrefs[l].setAttribute('onclick',"openSubRollupLink('"+hrefs[l].href+"'); return false;");}
else if(GAM['domainName']=='entrepreneur.businessplanpro.com'&&hrefs[l].hostname=='store.paloalto.com'){hrefs[l].setAttribute('onclick',"openSubRollupLink('"+hrefs[l].href+"'); return false;");}
else if(getRootDomain(hrefs[l].hostname)!==GAM['domainName']&&(isSubRollup(GAM,getRootDomain(hrefs[l].hostname))||(hrefs[l].hostname.search('bplans.co')>-1||hrefs[l].hostname.search('mplans.co')>-1||hrefs[l].hostname.search('liveplan.co'))>-1))startListening(hrefs[l],"click",trackCrossSiteLink);else if(hrefs[l].hostname!=location.hostname)startListening(hrefs[l],"click",trackExternalLink);}}}
