var _gaq = _gaq || []; 

function _mdfga( pVirtualPath ) {

	try { 
		/* Set the account passed in, this will be different per environment */
		/* These codes (for MERX) should be 'UA-19471401-1' in prod, 'UA-19471401-2' other environments */
		/* These codes (for ACI) should be 'UA-19471401-3' in prod, 'UA-19471401-4' other environments */
		var wTrackingAccount = null;
		var wDomainName = window.location.hostname.toLowerCase(); 
		var wQueryString = document.location.search.toUpperCase();
		
		/* Use ACI codes */
		if ( wQueryString.indexOf( 'PORTAL=ACI' ) != -1 || wQueryString.indexOf( 'PORTALID=ACI' ) != -1 ) {
			wTrackingAccount = 'UA-19471401-4'; /* Initialize to non-prod as the default */
			/* Check if we are in prod */
			if (wDomainName == "www.merx.com" || wDomainName == "merx.com") {
				wTrackingAccount = 'UA-19471401-3';
			}
		} else { /* MERX */
			wTrackingAccount = 'UA-19471401-2'; /* Initialize to non-prod as the default */
			/* Check if we are in prod */
			if (wDomainName == "www.merx.com" || wDomainName == "merx.com") {
				wTrackingAccount = 'UA-19471401-1';
				/* Set the ability to track subdomains*/
				_gaq.push(['_setDomainName', '.merx.com']);
				_gaq.push(['_setAllowHash', false]); 
			}
		}
	
		/* Set the correct Google Analytics Account */
		_gaq.push([ '_setAccount', wTrackingAccount ] ); 

		/* Use override path if specified */
		_gaq.push([ '_trackPageview', pVirtualPath ]); 

		(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); 
		})(); 
	} catch( e ) {
		/* Ignore exceptions */
	}
}

function _trackEventGA( pCategory, pAction, pLabel, pValue ) {
try {
    _gaq.push(['_trackEvent',pCategory, pAction, pLabel, pValue]);
} catch (err) { }
} 
