﻿
var googleSites = [
    {site:'www.albertapci.ca', id:'UA-18822463-1'}, 
    {site:'pcntest.albertapci.ca', id:'UA-18822463-2'},
    {site:'www.bigcountrypcn.com', id:'UA-18822463-3'},
    {site:'nwpcn.albertapci.ca', id:'UA-18822463-4'},
    {site:'www.edmontonsouthsidepcn.ca', id:'UA-18822463-5'},
    {site:'www.hpcn.ca', id:'UA-18822463-6'},
    {site:'www.crpcn.ca', id:'UA-18822463-7'},
    {site:'www.lbdpcn.com', id:'UA-18822463-8'},
    {site:'www.palliserpcn.ca', id:'UA-18822463-9'},
    {site:'pcnsample.albertapci.ca', id:'UA-18822463-10'},
    {site:'www.albertaheartlandpcn.com', id:'UA-18822463-11'},
    {site:'heart.albertapci.ca', id:'UA-18822463-11'},
    {site:'stpaul-aspenpcn.albertapci.ca', id:'UA-18822463-12'},
    {site:'chinook.albertapci.ca', id:'UA-18822463-13'},
    {site:'www.wolfcreekpcn.com', id:'UA-18822463-14'},
    {site:'www.bowvalleypcn.ca', id:'UA-18822463-15'},
    {site:'www.prpcn.ca', id:'UA-18822463-16'},
    {site:'www.sherwoodparkpcn.com', id:'UA-18822463-17'},
    {site:'athpcn.albertapci.ca', id:'UA-18822463-18'},
    {site:'www.athabascapcn.ca', id:'UA-18822463-18'},    
    {site:'eopcn.albertapci.ca', id:'UA-18822463-19'},
    {site:'cwc.albertapci.ca', id:'UA-18822463-20'},
    {site:'www.makinghealthhappen.com', id:'UA-18822463-20'},
    {site:'www.coldlakepcn.ca',id:'UA-18822463-21'},
    {site:'www.mosaicpcn.ca',id:'UA-18822463-22'},
    {site:'www.wppcn.ca',id:'UA-18822463-23'},
    {site:'www.smsrpcn.ca',id:'UA-18822463-24'},
    {site:'www.wetaskiwinpcn.ca',id:'UA-18822463-25'},
    {site:'www.lloydpcn.ca',id:'UA-18822463-26'},
    {site:'www.gp-pcn.org',id:'UA-18822463-27'}
    
];

var hostname = window.location.hostname;
//if the www is missing from albertapci.ca or this is not a albertapci.ca domain and the www is missing add it back so the site matches a tracking site.
if(
    (hostname == 'albertapci.ca') ||
    (hostname.substring(0,4) != 'www.' && hostname.indexOf('.albertapci.ca') == -1)
  )
{
    hostname= 'www.' + hostname;
}

var siteProfile = {site:'', id:''};

jQuery.each(googleSites, function(index, value)
    {
        if(value.site == hostname)
            siteProfile= value;
    });

if(siteProfile.id == '')
{
	//site reporting is not setup do nothing
	//console.log('Site not setup');
}
else
{
	//console.log('Site: ' + siteProfile.id + '-' + siteProfile.site);	
	//setup the GA reporting.
	
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', siteProfile.id]);
	_gaq.push(['_trackPageview']);
	_gaq.push(function()
	{
	    _gat._createTracker(siteProfile.id, 'myTracker');
	});
	    
	    
	(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);
	})();
}

