function Utmz(a){this.v=unescape(a);this.sr="(direct)";this.cn="(direct)";this.cmd="(none)";this.s="utmcsr="+this.sr+"|utmccn="+this.cn+"|utmcmd="+this.cmd;if(a!=null){this.s=a.replace(/^[0-9\.]*/,"");a.replace(/utmcsr=([^\|]*)\|utmccn=([^\|]*)\|utmcmd=([^|]*)/,function(){this.sr=arguments[1];this.cn=arguments[2];this.cmd=arguments[3]})}this.sv=function(){extga._sc("__utmz",this.v,182)};this.isNew=function(){return this.v=="null"};this._setCampName=function(b){this.v=this.v.replace(/utmccn=([^\|]*)/,"utmccn="+b);this.sv()};this._setCampSource=function(b){this.v=this.v.replace(/utmcsr=([^\|]*)/,"utmcsr="+b);this.sv()};this._setCampMedium=function(b){this.v=this.v.replace(/utmcmd=([^\|]*)/,"utmcmd="+b);this.sv()};this._setCampTerm=function(b){this.v=this.v.match(/utmctr=/)?this.v.replace(/utmctr=([^\|]*)/,"utmctr="+b):this.v+"|utmctr="+b;this.sv()};this._setCampContent=function(b){this.v=this.v.match(/utmcct=/)?this.v.replace(/utmcct=([^|]*)/,"utmcct="+b):this.v+"|utmcct="+b;this.sv()};this._reset=function(){this.v=this.v.replace(/^([0-9\.]*).*$/,"$1utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)")}}var extga={_fm:false,_fr:false,_rc:function(b){var c=new RegExp(b+"=([^;]*)","i");var a=document.cookie.match(c);return(a&&a.length==2)?a[1]:null},_Ua:function(a){if(a!=""){return" domain="+a}else{if(document.domain.match(/^www/)!=null){return" domain="+document.domain.replace(/^www/,"")}else{return" domain="+document.domain}}},_sc:function(g,i,h){var a=new Date();a.setTime(a.getTime()+(((typeof(h)!="undefined")?h:3)*24*60*60*1000));var d=g+"="+i+"; expires="+a.toGMTString()+"; path=/;"+this._Ua(this.domain);document.cookie=d},_reset:false,_setCampValues:function(l,d,i,c,j,k){extga.domain=k||"";extga.outmz=new Utmz(extga._rc("__utmz"));_gaq.push(["_initData"]);extga.nutmz=new Utmz(extga._rc("__utmz"));if(extga.outmz.s!=extga.nutmz.s){extga._fr=true;extga.outmz=new Utmz(extga._rc("__utmz"))}else{if(extga.outmz.isNew()){extga._direct=true}}if(extga._getCampValues().medium=="referral"){extga._fm=true}if(extga._fm||!extga._fr){if(extga._reset){extga.nutmz._reset()}if(l){extga.nutmz._setCampSource(l)}if(d){extga.nutmz._setCampMedium(d)}if(i){extga.nutmz._setCampName(i)}if(c){extga.nutmz._setCampTerm(c)}if(j){extga.nutmz._setCampContent(j)}}},_getCampValues:function(){var b={sr:"source",cn:"name",md:"medium",ct:"content",tr:"term"};var c=unescape(extga._rc("__utmz"));var a={source:"",medium:"",name:"",term:"",content:"",isDirect:function(){return(a.content==""&&a.medium=="(none)"&&a.name=="(direct)"&&a.source=="(direct)"&&a.term=="")},isOrganic:function(){return(a.medium=="organic"&&a.name=="(organic)")},isCampaign:function(d){var e=new RegExp("("+d+")");return a.name.match(e)!=null}};if(c!=null){c.replace(/utmc([a-z]{2})=([^\|]*)/g,function(d,f,e){a[b[f]]=e})}return a}};

function extractParamFromUri(uri, paramName) {if (!uri) {return; } var uri = uri.split('#')[0]; var parts = uri.split('?'); if (parts.length == 1) {return;} var query = decodeURI(parts[1]); paramName += '='; var params = query.split('&'); for (var i = 0, param; param = params[i]; ++i) {if (param.indexOf(paramName) === 0) {return unescape(param.split('=')[1]);}}}

function trackEvent(eCategory, eAction, eLabel) {
	_gaq.push(['_trackEvent', eCategory, eAction, eLabel]);
}

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-664439-5']);  
_gaq.push(['_setDomainName', 'expressivecounseling.com']);
_gaq.push(['_setAllowHash', false]);
_gaq.push(['_addIgnoredOrganic', 'www.expressivegriefcounseling.com']);
_gaq.push(['_addIgnoredOrganic', 'www.expressivecounseling.com']);
_gaq.push(['_addIgnoredOrganic', 'expressivecounseling.com']);
_gaq.push(['_addIgnoredRef', 'expressivecounseling.com']);
_gaq.push(['_addIgnoredRef', 'www.expressivecounseling.com']);
_gaq.push(['_addIgnoredRef', 'expressivegriefcounseling.com']);
_gaq.push(['_addIgnoredRef', 'www.expressivegriefcounseling.com']);
_gaq.push(['_addIgnoredRef', 'southlaketherapist.com']);
_gaq.push(['_addIgnoredRef', 'www.southlaketherapist.com']);
_gaq.push(['_addIgnoredRef', 'orlando-therapist.com']);
_gaq.push(['_addIgnoredRef', 'www.orlando-therapist.com']);
_gaq.push(['_trackPageview']);  

(function() {    
	var ga = document.createElement('script'); 
	ga.type = 'text/javascript'; 
	ga.async = true;    
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';    
	var s = document.getElementsByTagName('script')[0]; 
	s.parentNode.insertBefore(ga, s);  
})();



jQuery(document).ready(function($) {
    // helper function - allow regex as jQuery selector
    $.expr[':'].regex = function(e, i, m) {
        var mP = m[3].split(','),
            l = /^(data|css):/,
            a = {
                method: mP[0].match(l) ? mP[0].split(':')[0] : 'attr',
                property: mP.shift().replace(l, '')
            },
            r = new RegExp(mP.join('').replace(/^\s+|\s+$/g, ''), 'ig');
        return r.test($(e)[a.method](a.property));
    };

    $('a:regex(href,"\\.(zip|mp\\d+|mpe*g|pdf|docx*|pptx*|xlsx*|jpe*g|png|gif|tiff*)")$').live('click', function(e) {
        _gaq.push(['_trackEvent', 'download', 'click', this.href.replace(/^.*\/\//, '')]);
    });
});

jQuery(document).ready(function($) {
    $('a[href^="mailto"]').live('click', function(e) {
        _gaq.push(['_trackSocial', 'email', 'send', this.href.replace(/^mailto:/i, '')]);
    });
});

jQuery(document).ready(function($) {
    $('a[href^="http"]:not([href*="//' + location.host + '"])').live('click', function(e) {
		var dest = this.href.match(/\/\/([^\/]+)/)[1];
		var intSites = 'www.sixflags.com|feedback.sixflags.com|sixflags.com|content.sixflags.com|sixflagsjobs.com|www.sixflagsjobs.com|hotels.sixflags.com|investors.sixflags.com';
		if(intSites.indexOf(dest,0)<0) {
	        _gaq.push(['_trackEvent', 'Outbound Traffic', 'click', this.href.match(/\/\/([^\/]+)/)[1]]);
		}
    });
});


jQuery(document).ready(function($) {
	var _ga = _ga || {};
	var div = document.createElement('div');
	div.id = 'fb-root';
	if (document.body.firstChild) {
			document.body.insertBefore(div, document.body.firstChild);
	} else {
			document.body.appendChild(div);
	}
	(function() {
	   var e = document.createElement('script'); e.async = true;
		e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
		document.getElementById('fb-root').appendChild(e);
	}());
	window.fbAsyncInit = function() {
		FB.init({appId: '146917552078012', status: true, cookie: true, xfbml: true});
		_ga.trackFacebook();
	};
	_ga.buildTrackerName_ = function(opt_trackerName) {return opt_trackerName ? opt_trackerName + '.' : '';};
	_ga.trackFacebook = function(opt_pageUrl, opt_trackerName) {
		var trackerName = _ga.buildTrackerName_(opt_trackerName);
		try {
		   if (FB && FB.Event && FB.Event.subscribe) {
				FB.Event.subscribe('edge.create', function(targetUrl) {
					_gaq.push([trackerName + '_trackSocial', 'facebook', 'like', targetUrl, opt_pageUrl]);});
				FB.Event.subscribe('edge.remove', function(targetUrl) {
					_gaq.push([trackerName + '_trackSocial', 'facebook', 'unlike', targetUrl, opt_pageUrl]);});
				FB.Event.subscribe('message.send', function(targetUrl) {
					_gaq.push([trackerName + '_trackSocial', 'facebook', 'send', targetUrl, opt_pageUrl]);});
				FB.Event.subscribe('comment.create', function(targetUrl) {
					_gaq.push([trackerName + '_trackSocial', 'facebook', 'comment', targetUrl, opt_pageUrl]);});
				FB.Event.subscribe('comment.remove', function(targetUrl) {
					_gaq.push([trackerName + '_trackSocial', 'facebook', 'comment-remove', targetUrl, opt_pageUrl]);});
			}
		} catch (e) {}
	};
	var e = document.createElement('script'); e.type="text/javascript"; e.async = true; 
	e.src = 'http://platform.twitter.com/widgets.js';
	var opt_pageUrl = document.URL.toLowerCase();
	(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(e);
	$(e).load(function() {
		function clickEventToAnalytics(intent_event) {if (intent_event) {var label = intent_event.region;_gaq.push(['_trackSocial', 'twitter', intent_event.type, label, opt_pageUrl]);};}       
		function tweetIntentToAnalytics(intent_event) {if (intent_event) {var label = intent_event.data.tweet_id; _gaq.push(['_trackSocial', 'twitter', intent_event.type, label, opt_pageUrl]);};}       
		function favIntentToAnalytics(intent_event) {tweetIntentToAnalytics(intent_event);}       
		function retweetIntentToAnalytics(intent_event) {if (intent_event) {var label = intent_event.data.source_tweet_id;_gaq.push(['_trackSocial', 'twitter', intent_event.type, label, opt_pageUrl]);};}       
		function followIntentToAnalytics(intent_event) {if (intent_event) {var label = intent_event.data.user_id + " (" + intent_event.data.screen_name + ")";_gaq.push(['_trackSocial', 'twitter', intent_event.type, label, opt_pageUrl]);};}       
		twttr.events.bind('click',    clickEventToAnalytics);
		twttr.events.bind('tweet',    tweetIntentToAnalytics);
		twttr.events.bind('retweet',  retweetIntentToAnalytics);
		twttr.events.bind('favorite', favIntentToAnalytics);
		twttr.events.bind('follow',   followIntentToAnalytics);
	});
});





