/*
 * Analytics
 * 
 * Functions to control Analytics packages (e.g. Google Analytics). Wrapped in this
 * controller object so allow control of updates for Ajax calls etc.
 * 
 */

/*
 * JSLint Configuration:
 */  
/* Hide JSLint errors about Google variables starting with an underscore: */
/*jslint nomen: false */
/*global $, tv, _gat, mx */

mx.analytics = (function () {
	return {
		tracker: null,

		init: function () {
			var url = ('https:' === document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

			$.getScript(url, function () {
				mx.analytics.tracker = _gat._getTracker(mx.googleAnalyticsCode);
				mx.analytics.tracker._setAllowHash(false);
				mx.analytics.tracker._setAllowLinker(true);
				mx.analytics.tracker._setDomainName(mx.domain);
				mx.analytics.tracker._trackPageview();
			});
		}
	};
}());


/* Re-enable JS Lint naming convention errors */
/*jslint nomen: true */

