var _gaq = _gaq || []; 

function _mdfga() {

	try { 
		/* Set the account passed in, this will be different per environment */
		/* These codes (for HACH) should be 'UA-31707-1' in prod, 'UA-31707-15' other environments */		
		var wDomainName = window.location.hostname.toLowerCase();	
		var wTrackingAccount = 'UA-31707-15'; /* Initialize to non-prod as the default */

		/* Check if we are in prod */
		if (wDomainName == "www.hach.com" || wDomainName == "hach.com") {
			wTrackingAccount = 'UA-31707-1';
		}
	
		/* Set the correct Google Analytics Account */
		_gaq.push([ '_setAccount', wTrackingAccount ] ); 

	
		_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);
		})();
		  
	} catch( e ) {
		/* Ignore exceptions */
	}
}

function _trackEventGA( pCategory, pAction, pLabel, pValue ) { 
	
	try { 
	    _gaq.push(['_trackEvent',pCategory, pAction, pLabel, pValue]); 
	} catch (err) { } 
	
} 

function _addTransGA( pDocId, pTotal, pShippingCharge, pCity, pState, pCountry ) { 
	
	try { 
	    _gaq.push(['_addTrans',
	               pDocId,           // order ID - required
	               null,             // affiliation or store name
	               pTotal,           // total - required
	               '0.00',           // tax
	               pShippingCharge,  // shipping
	               pCity,            // city
	               pState,           // state or province
	               pCountry          // country
	            ]); 
	} catch (err) { } 
} 

function _addItemGA( pDocId, pSku, pProductName, pUnitPrice, pQty ) { 
	
	try { 
        _gaq.push(['_addItem',
                   pDocId,         // order ID - necessary to associate item with transaction
                   pSku,           // SKU/code - required
                   pProductName,   // product name - necessary to associate revenue with product
                   null,           // category or variation
                   pUnitPrice,     // unit price - required
                   pQty            // quantity - required
                ]);
	} catch (err) { } 
} 

function _trackTransGA( pCategory, pAction, pLabel, pValue ) { 
	
	try { 
		_gaq.push(['_trackTrans']); 
	} catch (err) { } 
} 

