function SETCLIENTID(jsonObj){
	if (jsonObj.coremetrics.enabled) {
		cmSetClientID(jsonObj.coremetrics.clientID, false, jsonObj.coremetrics.dataCollectionDomain, jsonObj.coremetrics.domain);
	}
}

function PAGEVIEWTAG(pageId, categoryId, searchString, searchResults){
	if(cmTracking){
		cmCreatePageviewTag(titleUID + ' - ' + pageId, categoryId, searchString, searchResults);
	}
}

function REGISTRATIONTAG(pageId, categoryId) {

if (cmTracking) {
	//In CR10504 we migrated to a new verion of Coremetrics eluminate.js
	//The custom version on cmCreateRegistrationTag() was not copied across.
	//The following attributes are the missing variables that need to be passed to the
	//new Java script function to capture the additional parameters.
	//"rg1", CurrentBalance, "rg2", InArrearsIndicator, "rg3", CreditAccountIndicator, "rg4", GenderIndicator, "rg5", DateOfBirth, "rg6", MobileTelNo, "rg7", AccountTradingTitle, "rg8", PreviousOrderIndicator, "rg9", PreviousWebOrderIndicator, "rg10", NumberofPaymentstoDate, "rg11", AdminCharge, "rg12", ValueofCirculatingOrders, "rg13", CreditLimit, "rg14", AccountCreditMonths, "rg15", AvailableCredit	
	var attributes = CurrentBalance + '-_-' + InArrearsIndicator + '-_-' + CreditAccountIndicator + '-_-' + GenderIndicator + '-_-' + DateOfBirth + '-_-' + MobileTelNo + '-_-' + AccountTradingTitle + '-_-' + PreviousOrderIndicator + '-_-' + PreviousWebOrderIndicator + '-_-' + NumberofPaymentstoDate + '-_-' + AdminCharge + '-_-' + ValueofCirculatingOrders + '-_-' + CreditLimit + '-_-' + AccountCreditMonths + '-_-' + AvailableCredit;

	cmCreatePageviewTag(titleUID + ' - ' + pageId, categoryId);	
	cmCreateRegistrationTag(AcctUid ,custEmail,custCity,custState,custPostCode,null,attributes);	
	}
}

function PRODUCTVIEWTAG(productId, productDesc, cmCategory){

	if(cmTracking){
		cmCreateProductviewTag(titleUID + ' - ' + productId, productDesc, cmCategory);
	}
}


function PRODUCTDETAILS(pageId, categoryId){

	if (cmTracking) {
		if(jCode == ""){
			PAGEVIEWTAG(titleUID + ' - ' + pageId, categoryId);
		}
	}
}

function SHOP_ACTION_5(prodId, productName, quantity, unitPrice, categoryId){
	
	if (cmTracking) {
		cmCreateShopAction5Tag(prodId,productName,quantity,unitPrice,categoryId);
		cmDisplayShop5s();
	}
}

function MULTI_SHOP_ACTION_5(prodId, productName, quantity, unitPrice, categoryId){
	
	if (cmTracking) {
		cmCreateShopAction5Tag(prodId,productName,quantity,unitPrice,categoryId);
	}
}

function SEND_SHOP_5_TO_SERVER() {
	if(cmTracking) {
		cmDisplayShop5s();
	}
}

function MULTI_SHOP_ACTION_9(productID,productName,productQuantity,
	     productPrice,customerID,orderID,orderTotal,categoryID) {

	if(cmTracking) {
	cmCreateShopAction9Tag(productID,productName,productQuantity,
	     productPrice,customerID,orderID,orderTotal,categoryID);
	
	}
}

function SEND_SHOP_9_TO_SERVER() {
	if(cmTracking) {
		cmDisplayShop9s();
	}
}

function CONVERSIONTAG(eventID, actionType, categoryID, points) {
	if(cmTracking) {
		cmCreateConversionEventTag(eventID, actionType, categoryID, points);	
	}
}

function ADD_QOF_ITEMS(thisCategory){
		
	if(cmTracking) {
	  	var aCategory = thisCategory;
		for (x in cmuid)
		{
			var index = x % 4;
			SHOP_ACTION_5(cmuid[index],cmName[index],cmQuantity[index],cmPrice[index],aCategory);
		}
	}
}

function ERRORTAG(pageID, categoryID) {
	if(cmTracking) {
		cmCreateErrorTag(pageID, categoryID);	
	}
}

function ORDERTAG(orderID,orderTotal,orderShipping,customerID,customerCity,customerState,customerZIP) {

	if(cmTracking) {
		cmCreateOrderTag(orderID,orderTotal,orderShipping,customerID,customerCity,customerState,customerZIP);

	}
}

function MANUAL_LINK_CLICK(Href, linkName) {
	if(cmTracking) {
		cmCreateManualLinkClickTag(Href, linkName);	
	}
}

function MANUAL_LINK_CLICK_EX(Href, linkName, pageID) {
	if(cmTracking) {
		cmCreateManualLinkClickTag(Href, linkName, pageID);	
	}
}


