//Have split the Google Analytics tracking snippet as server variables aren't 
//initialized until the bottom of the page

var gaAccount;

var currentURL = document.URL
    if (currentURL.toLowerCase().indexOf("localhost",0) != -1)
    {
        //Development machines. 
        //Don't write any GA data for the test site atm
        gaAccount="UA-25536507-1";
    }
    else if (currentURL.toLowerCase().indexOf("testservice",0) != -1)
    {
        
        //Write to test GA profile        
        gaAccount="UA-25536507-1";
    }
    else
    {
        //Production site. Write to production WebTrends profile
        gaAccount="UA-25534290-1";
    }

//alert(gaAccount);



var _gaq = _gaq || [];
_gaq.push(['_setAccount', gaAccount]);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);

//Using the WebTrends custom variable for the moment as I don't want to be re-writing code
//Will create more GA specific custom variables in the future
function SendGAInfo(){
//alert(DCSext.userrole);
_gaq.push(['_setCustomVar',1,'User Role',DCSext.userrole,2]); // User role
_gaq.push(['_setCustomVar',2,'Country Site',DCSext.countrysite,2]); // User language
_gaq.push(['_setCustomVar',3,'Site Brand',DCSext.brandsite,2]); // User brand choice
_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);
    })();
