/*
 * cmcustom.js 
 * $Id:
 * $Revision:
 *
 * The following functions and settings override the defaults defined at http://libs.coremetrics.com/eluminate.js
 *
 * Date        Imp Eng       Desc
 * 06/24/10    JBowser       Initial version for all Reebok - North America & EMEA sites
 * 04/28/11    WBird	     Updated shop5/9 to allow attr16-50 collection; added extrafields; removed deprecated li=11000 custom tags 
 */

function cmCreateOrderTag(orderID,orderTotal,orderShipping,customerID,customerCity,customerState,customerZIP,currency,attributes,extraFields) {
	var pattern = /[^\-0-9\.]/gi;
	orderShipping = orderShipping.toString().replace(pattern, "");
	orderTotal = orderTotal.toString().replace(pattern, "");
	if (attributes){
		var cm_exAttr=new Array();
		cm_exAttr=attributes.split("-_-");
	}
	cmMakeTag(["tid","3","osk",cmCalcSKUString(),"on",orderID,"tr",orderTotal,"sg",orderShipping,"cd",customerID,"ct",customerCity,"sa",customerState,"zp",customerZIP,"cc",currency,"cm_exAttr",cm_exAttr,"cmExtraFields",extraFields]);
}

function cmCreateProductviewTag(countryPrefix, productID, productName, categoryID, masterItemCategory, attributes, cm_vc) {
	if (attributes){
		var cm_exAttr=new Array();
		cm_exAttr=attributes.split("-_-");
	}
	cmMakeTag(["tid","5","pi",countryPrefix +": "+"PRODUCT: "+productName+" ("+productID+")","pr",productID,"pm",productName,"cg",categoryID,"pc","Y","cm_vc",cm_vc ? cm_vc : cmExtractParameter("cm_vc",document.location.href),"cm_exAttr",cm_exAttr]);
}
 
function cmCreateHtmlProductviewTag(countryPrefix, productID, productName, categoryID, masterItemCategory, attributes, cm_vc) {
	if (attributes){
		var cm_exAttr=new Array();
		cm_exAttr=attributes.split("-_-");
	}
	cmMakeTag(["tid","5","pi",productName,"pr",productID,"pm",productName,"cg",categoryID,"pc","Y","cm_vc",cm_vc ? cm_vc : cmExtractParameter("cm_vc",document.location.href),"cm_exAttr",cm_exAttr]);
}

function cmCreateCustomProductviewTag(countryPrefix, productID, productName, categoryID, masterItemCategory, attributes, cm_vc, pageId) {
	if (attributes){
		var cm_exAttr=new Array();
		cm_exAttr=attributes.split("-_-");
	}
	cmMakeTag(["tid","5","pi",pageId,"pr",productID,"pm",productName,"cg",categoryID,"pc","Y","cm_vc",cm_vc ? cm_vc : cmExtractParameter("cm_vc",document.location.href),"cm_exAttr",cm_exAttr]);
}

function cmCreateShopAction5Tag(productID,productName,productQuantity,productPrice,categoryID,masterItemCategory,currency,attributes,extraFields) {
    productPrice = productPrice.toString().replace(cmPricePattern, "");
	productID = productID.toString().replace(cmSpacePattern, "");
	var hashValue = "" + (attributes ? attributes + "|||" : "") + (extraFields ? "extra" + extraFields : "");
	cmAddShop(["pr",productID,"pm",productName,"qt",productQuantity,"bp",productPrice,"cg",categoryID,"cmAttributes",attributes,"cmExtraFields",extraFields,"ha1",cm_hex_sha1(hashValue),"cc",currency,"at","5","tid","4","pc","N"]);
}	

function cmCreateShopAction9Tag(productID,productName,productQuantity,productPrice,customerID,orderID,orderTotal,categoryID,masterItemCategory,currency,attributes,extraFields) {
    productPrice = productPrice.toString().replace(cmPricePattern, "");
	orderTotal = orderTotal.toString().replace(cmPricePattern, "");
	productID = productID.toString().replace(cmSpacePattern, "");
	var hashValue = "" + (attributes ? attributes + "|||" : "") + (extraFields ? "extra" + extraFields : "");
	cmAddShop(["pr",productID,"pm",productName,"qt",productQuantity,"bp",productPrice,"cg",categoryID,"cmAttributes",attributes,"cmExtraFields",extraFields,"ha1",cm_hex_sha1(hashValue),"cd",customerID,"on",orderID,"tr",orderTotal,"cc",currency,"at","9","tid","4","pc","N"]);
}

function cmCreateRegistrationTag(customerID, customerEmail, customerCity, customerState, customerZIP,
											newsletterName,subscribe, custAge, custGender, custCountry, favColor, altColor,
											onoffField, language, custFName, custLName, custBday, favSport1, favSport2, favSport3, favSport4, favSport5, attributes) {
	if (attributes){
		var cm_exAttr=new Array();
		cm_exAttr=attributes.split("-_-");
	}
	cmMakeTag(["tid","2","cd",customerID,"em",customerEmail,"ct",customerCity,"sa",customerState,"zp",customerZIP,"nl",newsletterName,"sd",subscribe,"ag",custAge,"gd",custGender,"cy",custCountry,"rg1",favColor,"rg2",altColor,"rg3",onoffField,"rg4",language,"rg5",custFName,"rg6",custLName,"rg7",custBday,"rg11",favSport1,"rg12",favSport2,"rg13",favSport3,"rg14",favSport4,"rg15",favSport5,"cm_exAttr",cm_exAttr]);
}

