/*
 * cmcustom.js
 * $Id: $
 * $Revision: $
 *
 * Version 4.1.0
 *
 * Coremetrics Tag v4.0, 8/7/2006
 * COPYRIGHT 1999-2002 COREMETRICS, INC. 
 * ALL RIGHTS RESERVED. U.S.PATENT PENDING
 *
 * Date			Name		Desc
 * 09/07/10		JBowser		cdw.com - Conversion to cmcustom for CM-hosted lib compatibility.
 *
 * The following functions aid in the creation of Coremetrics data tags.
 */

var cm_TrackImpressions = "";
var cmAutoCopyAttributesToExtraFields = true;

function cmCreateProductviewTag(productID,productName,categoryID,totalReviewCount,avgRating,searchString,searchResults,attributes) {	
	if (attributes){
		var cm_exAttr=new Array;
		cm_exAttr=attributes.split("-_-");
	}
	cmMakeTag(["tid","5","pi","PRODUCT: "+productName+" ("+productID+")","pr",productID,"pm",productName,"cg",categoryID,"pc","Y","cm_vc",cmExtractParameter("cm_vc",document.location.href),"se",searchString,"sr",searchResults,"li",10300,"ps1",productID,"ps2",productName,"ps3",categoryID,"ps4",totalReviewCount,"ps5",avgRating,"cm_exAttr",cm_exAttr]);
}

function cmCreateBazaarViewTag(productID, productName,categoryID) {
	cmMakeTag(["tid","7","li",10300,"ps1",productID,"ps2",productName,"ps3",categoryID]);
}

function cmCreateRegistrationTag(customerID,customerEmail,customerCity,customerState,customerZIP,country,newsletterName,subscribe,ITincome,ITMaxIncome,extra1,extra2,extra3,extra4,extra5) {
	cmMakeTag(["tid","2","cd",customerID,"em",customerEmail,"ct",customerCity,"sa",customerState,"zp",customerZIP,"cy",country,"nl",newsletterName,"sd",subscribe,"ml",ITincome,"xl",ITMaxIncome,"rg11",extra1,"rg12",extra2,"rg13",extra3,"rg14",extra4,"rg15",extra5]);
}

//Friendly OnLoad Handler
function cmCustomAddEventAfter(elt,type,handle,fName,f) {
      if(handle){
            var event=handle.toString();
            if(event.indexOf(fName)==-1){
                  if(cGU&&event.indexOf("function "+"(")==0){
                        fName=event.substring(event.indexOf("{"),event.length)+";"+fName;
            } else {
                elt["_custom_"+type]=handle;
                fName="if(!e)var e=null;"+fName+";return this._custom_"+type+"("+(cF(5)?"":"e")+");"
            }
                  var newfunc=new Function("e",fName);
                  return newfunc;
            } else {
                  return handle;
            }

      } else {
            return f;
    }
}

