var _gaq = _gaq || []; 

function _mdfga() {

	try { 
		/* Set the account passed in, this will be different per environment */
		/* These codes (for GWS) should be 'UA-24663350-1' in prod, 'UA-24663350-2' other environments */		
		var wDomainName = window.location.hostname.toLowerCase();	
		var wTrackingAccount = 'UA-24663350-2'; /* Initialize to non-prod as the default */

		/* Check if we are in prod */
		if (wDomainName == "www.globalwinespirits.com" || wDomainName == "globalwinespirits.com") {
			wTrackingAccount = 'UA-24663350-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 _setCustomVarGA( pIndex, pName, pValue, pScope ) { 
	try { 
	    _gaq.push(['_setCustomVar', pIndex, pName, pValue, pScope]);
	} catch (err) { } 
} 

function _linkGA( pTargetURL, pUseHash ) { 
	try { 
	    _gaq.push(['_link', pTargetURL, pUseHash]);
	} catch (err) { } 
}

function _trackSocialGA( pNetwork, pSocialAction, pOptTarget, pOptPagePath ) { 
	try { 
	    _gaq.push(['_trackSocial', pNetwork, pSocialAction, pOptTarget, pOptPagePath]); 
	} catch (err) { } 
} 

function _addItemGA( pOrderId, pSku, pName, pCategory, pPrice, pQuantity) { 
	try { 
	    _gaq.push(['_addItem', pOrderId, pSku, pName, pCategory, pPrice, pQuantity]); 
	} catch (err) { } 
} 

function _addTransGA( pOrderId, pAffiliation, pTotal, pTax, pShipping, pCity, pState, pCountry) { 
	try { 
	    _gaq.push(['_addTrans', pOrderId, pAffiliation, pTotal, pTax, pShipping, pCity, pState, pCountry]); 
	} catch (err) { } 
} 

function _trackTransGA() { 
	try { 
	    _gaq.push(['_trackTrans']); 
	} catch (err) { } 
}
