<!--
/*
 * Calling this function points tags to the production database
 */
function cmSetProduction(){
	cm_HOST="data.coremetrics.com/eluminate?";
}
/*
 * Creates a Tech Props tag.
 * pageID		: required. Page ID to set on this Pageview tag
 */
function cmCreateTechPropsTag(pageID,categoryID) {
	if (pageID) {
		var cm=new _cm("tid", "6", "vn2", "e3.1");
		cm.pc="Y";
		cm.pi = pageID;
		cm.cg = categoryID;
		// if available, override the referrer with the frameset referrer
		if (parent.cm_ref != null) {
			cm.rf = parent.cm_ref;
			parent.cm_ref = document.URL;
		}
		if (typeof cmAccountNumber != "undefined") {
			cm.pv1 = cmAccountNumber;
		}
		if (typeof cmMTN != "undefined") {
			cm.pv2 = cmMTN;
		}
		if (typeof cmOrderNumber != "undefined") {
			cm.pv3 = cmOrderNumber;
		}
		if (typeof cmOrderLocation != "undefined") {
			cm.pv4 = cmOrderLocation;
		}
		cm.addTP();
		cm.writeImg();
	}
}
/*
 * Creates a Pageview tag with the given Page ID
 *
 * pageID		: required. The Page Name as it should appear in Coremetrics.
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreatePageviewTag(pageID,searchstr,numResults,categoryID) {
	var cm = new _cm("tid", "1", "vn2", "e3.1");
	cm.pi = pageID;
	cm.cg = categoryID;
	if (typeof cmAccountNumber != "undefined") {
		cm.pv1 = cmAccountNumber;
	}
	if (typeof cmMTN != "undefined") {
		cm.pv2 = cmMTN;
	}
	if (typeof cmOrderNumber != "undefined") {
		cm.pv3 = cmOrderNumber;
	}
	if (typeof cmOrderLocation != "undefined") {
		cm.pv4 = cmOrderLocation;
	}
	cm.se = searchstr;
	cm.sr = numResults;
	cm.writeImg();
}
/*
 * Creates a Pageview tag with the default value for Page ID. Automatically
 * builds a Page ID based on the URL.
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateDefaultPageviewTag() {
	cmCreatePageviewTag(getFileNameFromURL());
}
/*
 * Creates a Registration tag.  This sends user profile information to Coremetrics.
 *
 * customerID		: Email address or Session ID if no email
 * customerEmail	: Email of customer (or empty if none)
 * customerCity		: Customer's City
 * customerState	: Customer's State (two letter)
 * customerZIP		: Customer's ZIP
 * customerMarket	: Customer's Market
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateRegistrationTag(customerID, customerEmail, customerCity, customerState, customerZIP, customerMarket, customerRegion, customerArea, collectionsIndicator, workState) {
	var cm = new _cm("tid", "2", "vn2", "e3.1");
	cm.cd = customerID
	cm.em = customerEmail;
	cm.sa = customerState;
	cm.ct = customerCity;
	cm.zp = customerZIP;
	cm.rg11 = customerMarket;
	cm.rg12 = customerRegion;
	cm.rg13 = customerArea;
	cm.rg9 = collectionsIndicator;
	cm.rg10 = workState;
	cm.writeImg();
}
/*
 * Creates a Registration tag.  This sends user profile information to Coremetrics.
 *
 * customerID		: Email address or Session ID if no email
 * customerEmail	: Email of customer (or empty if none)
 * customerCity		: Customer's City
 * customerState	: Customer's State (two letter)
 * customerZIP		: Customer's ZIP
 * customerMarket	: Customer's Market
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateZIPTag(customerCity, customerState, customerZIP, customerMarket, customerRegion, customerArea,frmZIP,frmCity,frmState) {
	var cm=new _cm("tid", "7", "vn2", "e3.1");  //DO NOT CHANGE THESE PARAMETERS
	cm.li=2;
	cm.ps1=customerCity;
	cm.ps2=customerState;
	cm.ps3=customerZIP;
	cm.ps4=customerMarket;
	cm.ps5=customerRegion;
	cm.ps6=customerArea;
	cm.ps7=frmZIP;
	cm.ps8=frmCity;
	cm.ps9=frmState;
	cm.writeImg();
}
/*
 * Creates a Shop tag with Action 5 (Shopping Cart)
 *
 * productName	: required. Product ID to set on this Shop tag
 * productQuantity	: required. Quantity to set on this Shop tag
 * productPrice	: required. Price of one unit of this product
 * categoryID	: optional. Category to set on this Shop tag
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateShopAction5Tag(productName, productQuantity, productPrice, categoryID){
	if (productName && productQuantity && productPrice) {
		var cm = new _cm("tid", "4", "vn2", "e3.1");
		cm.at = "5";
		cm.pr = productName;
		cm.pm = productName;
		cm.qt = productQuantity;
		cm.bp = productPrice;
		if (categoryID) {
			cm.cg = categoryID;
		}
		cm.writeImg();
	}
}
/*
 * Creates a Shop tag with Action 9 (Order Receipt / Confirmed)
 *
 * productName	: required. Product Name to set on this Shop tag
 * quantity	: required. Quantity to set on this Shop tag
 * productPrice	: required. Price of one unit of this product
 * customerID	: required. Email Address or Session ID (if no email) of Customer placing order
 * orderID	: required. Order Number for this lineitem
 * orderTotal	: required. Handset + Accessories - Shipping Charges - Tax
 * categoryID	: optional. Category to set on this Shop tag
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateShopAction9Tag(productName, quantity,
				productPrice, customerID, orderID,
				orderTotal, categoryID) {
	if (productName && quantity && productPrice && customerID &&
		orderID && orderTotal) {
		var cm = new _cm("tid", "4", "vn2", "e3.1");
		cm.at = "9";
		cm.pr = productName;
		cm.qt = quantity;
		cm.pm = productName;
		cm.bp = productPrice;
		cm.cd = customerID;
		cm.on = orderID;
		cm.tr = orderTotal;
		if (categoryID) {
			cm.cg = categoryID;
		}
		cm.writeImg();
	}
}
/*
 * Creates an Order tag
 *
 * orderID		: required. Order Number
 * orderTotal		: required. Handset + Accessories - Tax - Shipping
 * orderSKUData		: required. String representation of all lineitems
 * orderShipping	: required. Shipping charge for this order
 * orderDeposit		: required. Deposit amount set with this order.
 * customerID		: required. Email Address of customer or Session ID if none
 * customerCity		: optional. City of Customer that placed this order
 * customerState	: optional. State of Customer that placed this order
 * customerZIP		: optional. Zipcode of Customer that placed this order
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateOrderTag(orderID, orderTotal, orderSKUData, orderShipping, orderDeposit,
  			customerID, customerCity, customerState, customerZIP) {
	if (orderID && orderTotal && orderSKUData && customerID) {
		var cm = new _cm("tid", "3", "vn2", "e3.1");
		cm.on = orderID;
		cm.tr = orderTotal;
		cm.osk = orderSKUData;
		cm.sg = orderShipping;
		cm.or1 = orderDeposit;
		cm.cd = customerID;
		cm.sa = customerState;
		cm.ct = customerCity;
		cm.zp = customerZIP;
		cm.writeImg();
	}
}
/*
 * Creates a Productview Tag
 * Also creates a Pageview Tag by setting pc="Y"
 * Format of Page ID is "PRODUCT: <Product Name> (<Product ID>)"
 *
 * productName	: required. Product Name to set on this Productview tag
 * categoryID	: optional. Category ID to set on this Productview tag
 * productType  : required. Prefix for Pageview tag.  For example "PHONE: " or "FEATURE: "
 * setPageview  : optional. Default "Y".  set to "N" and no pageview tag thrown.
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateProductviewTag(productName, categoryID, productType,setPageview) {
	if (productName && productType) {
		var cm = new _cm("tid", "5", "vn2", "e3.1");
		// if available, override the referrer with the frameset referrer
		if (parent.cm_ref != null) {
			cm.rf = parent.cm_ref;
			parent.cm_ref = document.URL;
		}
		cm.pr = productName;
		cm.pm = productName;
		cm.cg = categoryID;
		if (setPageview && setPageview=="N") {
			cm.pc="N";
		} else {
			cm.pc = "Y";
		}
		cm.pi = productType + productName;
		cm.writeImg();
	}
}
// HELPER FUNCTIONS -----------------------------------------------------------
/* These functions are used by the tag-generating functions and/or may be used
 * in in general as convenience functions
 */
/*
 * Creates an acceptable default Page ID value to use for Pageview tags.
 * The default Page ID is based on the URL, and consists of the path and
 * filename (without the protocol, domain and query string).
 *
 * example:
 * returns "x/y/MyPage.asp" for the URL http://www.mysite.com/x/y/MyPage.asp
 */
function getFileNameFromURL() {
	var pageName = window.location.pathname;
	// eliminates everything after "?"
	var tempIndex1 = pageName.indexOf("?");
	if (tempIndex1 != -1) {
		pageName = pageName.substr(0, tempIndex1-1);
	}
	// eliminates everything after ";"
	var tempIndex2 = pageName.indexOf(";");
	if (tempIndex2 != -1) {
		pageName = pageName.substr(0, tempIndex2-1);
	}
	var slashPos = pageName.lastIndexOf("/");
	if (slashPos == pageName.length - 1) {
		if (pageName.indexOf("jsp") > -1) {
			pageName = pageName + "index.jsp"; /****************** SET TO DEFAULT DOC NAME */
		} else {
			pageName = pageName + "index.html"; /****************** SET TO DEFAULT DOC NAME */
		}
	}
	while (pageName.indexOf("/") == 0) {
		pageName = pageName.substr(1,pageName.length);
	}
	return(pageName);
}
/** BELOW WAS ADDED TO SUPPORT EXTERNAL LINK TRACKING **/
/*
 * Throw a pageview when user clicks a link that will leave the site.
 * This function serves as an onclick handler for external links.,
 */
function cmPageviewOnClick(pageID, theURL, categoryID) {
    var imgRequest = new Image();
    //Load the image
    //Getting Tag Src, passing pageID, ul and rf
    var tsrc = cmGetPageviewTagSrc(pageID, theURL, categoryID);
    imgRequest.src = tsrc;
    return true;
}
/* Support for the onclick handler above.  Returns URL of a pageview tag
 * rather than directly requesting the tag.
 */
function cmGetPageviewTagSrc(pageID, theURL, categoryID){
    if (pageID) {
        var cm = new _cm("tid", "1", "vn2", "e3.1");
        cm.pi = pageID;
        if (theURL)
        {
            cm.ul = theURL;
        }
		if (categoryID) {
			cm.cg = categoryID;
		}
        return cm.getImgSrc();
    } else {
        return "";
    }
}
/* Support for the tracking navigation via drop downs */
function cmLIVEviewClick(href,name) {
	if (cmHandleLinkClick == null && C9 != null) {
	    var cmHandleLinkClick = C9;		
	}
	if (cmHandleLinkClick != null) {
		var link = new Object();
		link.tagName = "A";
		link.name = name;
		link.href = href;
		cmHandleLinkClick(link);
	}
}
cmSetProduction();
//-->
