/* instead of actually calling trackpageview, provide functions for the initialization
var ga_account = 'UA-218852-1';
var _gaq = _gaq || [];
_gaq.push(['_setAccount', ga_account]);
_gaq.push(['_setDomainName', '.net-temps.com']);
_gaq.push(['_trackPageview']);
 
/* Changed by Josh 2/9/2010, breaking the Google Analytics tracking into two pieces. This one should be included 
 * at the top of the <body> element
 */

/* Old version of second half of snippet - this doesn't seem to be quite right - Josh 2/9/10
(function() {
    var ga = document.createElement('script');
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 
	      'http://www') + '.google-analytics.com/ga.js';
    ga.setAttribute('async', 'true');
    document.documentElement.firstChild.appendChild(ga);
})();
*/

// populate the _gaq w/ account & domain but don't track a pageview

function initGaq() {
	var ga_account = 'UA-218852-1';
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', ga_account]);
	_gaq.push(['_setDomainName', '.net-temps.com']);
	//return _gaq;
	window._gaq = _gaq;
}

// Get the default url that ga would track, this makes it easy to add on to
function defaultGAUrl() {
	return String.concat(document.location.pathname, document.location.search);
}

// returns an associative array of query parameters & values
// taken from http://stevenbenner.com/2010/03/javascript-regex-trick-parse-a-query-string-into-an-object/
// TODO: put this somewhere more general, it could be useful in other places
function getQueryStringHash(str) {
	var url = "" + str;
	var queryString = {};
		url.replace(
		    new RegExp("([^?=&]+)(=([^&]*))?", "g"),
		    function($0, $1, $2, $3) { queryString[$1] = $3; }
		);
	return queryString;
}

