<!--
/*
 * cmdatatagutils.js
 *
 * Coremetrics Tag v4.0, 4/18/2004
 * COPYRIGHT 1999-2002 COREMETRICS, INC. 
 * ALL RIGHTS RESERVED. U.S.PATENT PENDING
 *
 * The following functions aid in the creation of Coremetrics data tags.
 *Date			Name			Desc
 *5/16/06		Hutch White		Disable Impression Tagging(remove variable set)
 * 11/14/06		Hutch White		Prepend Motion Point variable to pageID, categoryID,
 *								search term, product ID
 *	050107		MOCHOA			Added the cm_em function
 *	112607		MOCHOA			Added Manual tags functions for flash tagging
 *
 */

// TAG GENERATING FUNCTIONS ---------------------------------------------------
cm_ClientID         = "90073688";
cm_TrackLink        = "A";
cm_referring_url	= null; 
cm_page_prefix		= null;
cm_MotionPoint		= "French";

function cmCheckEmParameter() {
	var emParam
	if (cmIndexOfParameter("cm_em") != -1){
		var emParam="cm_em";
	}
	if (cmIndexOfParameter("cm_lm") != -1){
		var emParam="cm_lm";
	}
	if (emParam){
		var s = document.location.href;
		var begin = s.indexOf("cm_em");
		var end = s.indexOf("&", begin);
		if (end == -1) {
			end = s.length;
		}
		var middle = s.indexOf("=", begin);
	
		var emailAddress = s.substring(middle + 1, end);

		if (emailAddress.indexOf(":") != -1){
			var tempArray = emailAddress.split(":");
			emailAddress = tempArray[1];
		}

		cmCreateRegistrationTag(emailAddress,emailAddress);
	}
}

function cmIndexOfParameter (parameter) {
	return document.location.href.toLowerCase().indexOf(parameter.toLowerCase());
}

/*
 * Calling this function points tags to the production database
 */
function cmSetProduction(){
	cm_HOST="tsc.theshoppingchannel.com/eluminate?"; 
}

function cmCreateManualImpressionTag(pageID, trackSP, trackRE) {
		var cm = new _cm("tid","9","vn2","e4.0");
		cm.pi = pageID;
		cm.cm_sp = trackSP;
		cm.cm_re = trackRE;
		cm.st = cm_ClientTS;
		cm.writeImg();
}

function cmCreateManualLinkClickTag(href,name,pageID) {	
	if (cmCreateLinkTag == null && cM != null) {
		var cmCreateLinkTag = cM;
	}
	if (cmCreateLinkTag != null) {		
		var dt = new Date();
		cmLnkT3 = dt.getTime();
		cmCreateLinkTag(cm_ClientTS, cmLnkT3, name, href, false, pageID);
	}
}

/* manual PageviewTag for off site page tagging.  Allows client to supply URL and Referring URL
*/
function cmCreateManualPageviewTag(pageID, categoryID,DestinationURL,ReferringURL,searchTerm) {
	var cm = new _cm("tid","1","vn2","e4.0");
	cm.pi = pageID;
	cm.cg = categoryID;
	cm.ul = DestinationURL;
	cm.rf = ReferringURL;
	if (searchTerm) {
		cm.se=searchTerm;
	}
	cm.writeImg();
}

/*
 * Creates a Tech Props tag.
 * pageID		: required. Page ID to set on this Pageview tag
 */
function cmCreateTechPropsTag(pageID, categoryID) {

	if(pageID == null) {
		pageID = cmGetDefaultPageID();
	}
	if (cm_page_prefix)
	{  pageID = cm_page_prefix + pageID
	}
    if (cm_MotionPoint){
		pageID=cm_MotionPoint+":"+pageID		
    }

	var cm=new _cm("tid", "6", "vn2", "e4.0");
	cm.pc="Y";
	cm.pi = pageID;
	if (categoryID) {
		if (cm_MotionPoint){
			cm.cg=cm_MotionPoint+":"+categoryID		
		}
		else {
			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 parent had mmc variables and this is the first pageview, add mmc to this url
	if(parent.cm_set_mmc) {
		cm.ul = document.location.href + 
				((document.location.href.indexOf("?") < 0) ? "?" : "&") + 
				parent.cm_mmc_params; 
		parent.cm_ref = cm.ul;
		parent.cm_set_mmc = false;
	}
    
	// if parameter cm_referring_url is set then over ride because client redirect was used
	if (cm_referring_url)
	{  cm.rf = cm_referring_url;
	}
	cm.addTP();
	cmCheckEmParameter();
	cm.writeImg();
	
}
/*
 * Creates a Pageview tag with the given Page ID
 *
 * pageID	: required. Page ID to set on this Pageview tag
 * categoryID	: optional. Category ID to set on this Pageview tag
 * searchString	: optional. Internal search string enterred by user to reach
 *				  this page.
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreatePageviewTag(pageID, categoryID, searchString, searchResults) {
	if (pageID == null) {
		pageID = cmGetDefaultPageID();
	}

	if (cm_page_prefix)	{  
		pageID = cm_page_prefix + pageID;
	}
    if (cm_MotionPoint){
		pageID=cm_MotionPoint+":"+pageID;
	}

	var cm = new _cm("tid", "1", "vn2", "e4.0");
	cm.pi = pageID;

	if (searchString) {
		if (cm_MotionPoint){
			cm.se=cm_MotionPoint+":"+searchString;
		}
		else {
			cm.se = searchString;
		}
	}

	cm.sr = searchResults;
	if (categoryID) {
		if (cm_MotionPoint){
			cm.cg=cm_MotionPoint+":"+categoryID;		
		}
		else {
			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 parent had mmc variables and this is the first pageview, add mmc to this url
	if(parent.cm_set_mmc) {
		cm.ul = document.location.href + 
				((document.location.href.indexOf("?") < 0) ? "?" : "&") + 
				parent.cm_mmc_params; 
		parent.cm_ref = cm.ul;
		parent.cm_set_mmc = false;
	}
    
	// if parameter cm_referring_url is set then over ride because client redirect was used
	if (cm_referring_url)
	{  cm.rf = cm_referring_url;
	}

	cmCheckEmParameter();
	cm.writeImg();
}

/*
 * Creates a Pageview tag with the default value for Page ID. 
 * Format of Page ID is "x/y/z/MyPage.asp"
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateDefaultPageviewTag(categoryID) {
    if (cm_MotionPoint){
		pageID=cm_MotionPoint+":"+pageID		
		cmCreatePageviewTag(cm_MotionPoint+":"+cmGetDefaultPageID(), cm_MotionPoint+":"+categoryID, null);
	}
	else{
		cmCreatePageviewTag(cmGetDefaultPageID(), categoryID, null);
    }
}

/*
 * Creates a Productview Tag
 * Also creates a Pageview Tag by setting pc="Y"
 * Format of Page ID is "PRODUCT: <Product Name> (<Product ID>)"
 *
 * productID	: required. Product ID to set on this Productview tag
 * productName	: required. Product Name to set on this Productview tag
 * categoryID	: optional. Category ID to set on this Productview tag 
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateProductviewTag(productID, productName, categoryID) {
	var cm = new _cm("tid", "5", "vn2", "e4.0");

	if (productName == null) {
		productName = "";
	}

	// 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 parent had mmc variables and this is the first pageview, add mmc to this url
	if(parent.cm_set_mmc) {
		cm.ul = document.location.href + 
				((document.location.href.indexOf("?") < 0) ? "?" : "&") + 
				parent.cm_mmc_params; 
		parent.cm_ref = cm.ul;
		parent.cm_set_mmc = false;
	}

	cm.pr = productID;
	cm.pm = productName;
	if (categoryID) {
		if (cm_MotionPoint){
			cm.cg=cm_MotionPoint+":"+categoryID		
		}
		else {
			cm.cg = categoryID;
		}
	}
	cm.pc = "Y";
	cm.pi = "PRODUCT: " + productName + " (" + productID + ")";
    if (cm_MotionPoint){
		cm.pi=cm_MotionPoint+":"+cm.pi		
    }
    // if parameter cm_referring_url is set then over ride because client redirect was used
	if (cm_referring_url)
	{  cm.rf = cm_referring_url;
	}
	
	cmCheckEmParameter();
	cm.writeImg();
}

/*
 * Variables and Arrays to support Lineitem Aggregation
 */

var cmShopProducts = new Array();
var cmShopColors = new Array();
var cmShopSizes = new Array();
var cmShopIds = new Array();
var cmShopCats = new Array();
var cmShopQtys = new Array();
var cmShopPrices = new Array();
var cmShopCounter = 0;
var cmShopOrderIds = new Array();
var cmShopCustomerIds = new Array();
var cmShopOrderPrices = new Array();
var cmShopSKUs = "";

/* Internal, to support aggregation */
function cmGetProductIndex(id){
	var i =0;
	for (i=0; i<cmShopCounter; i++)
	{
		if (id==cmShopIds[i])
		{
			return i;
		}
	}
	return -1;
}

/*
 * Creates a Shop tag with Action 5 (Shopping Cart)
 *
 * productID	: required. Product ID to set on this Shop tag
 * quantity	: 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(productID, productName, productQuantity, productPrice, categoryID, color, size) {
	productID = productID.toUpperCase();
	color     = color.toUpperCase();
	size      = size.toUpperCase();
	var index = cmGetProductIndex(productID);
	if(index!=-1){
		var oldPrice = cmShopPrices[index];
		var oldQty = cmShopQtys[index];
		var newQty = oldQty + parseInt(productQuantity);
		var newPrice = (oldPrice*oldQty + parseInt(productQuantity)*parseFloat(productPrice))/(newQty);
		cmShopPrices[index] = newPrice;
		cmShopQtys[index] = newQty;
	} else {
		if (!categoryID) {
			categoryID = "";
		}
		cmShopProducts[cmShopCounter] = productName;
		cmShopIds[cmShopCounter] = productID;
		
		if (cm_MotionPoint){
			cmShopCats[cmShopCounter] = cm_MotionPoint+":"+categoryID;
		}
		else{
			cmShopCats[cmShopCounter] = categoryID;
		}
		cmShopQtys[cmShopCounter] = parseInt(productQuantity);
		cmShopPrices[cmShopCounter] = parseFloat(productPrice);
		cmShopColors[cmShopCounter] = color;
		cmShopSizes[cmShopCounter] = size;
		cmShopCounter++;
	}
	cmShopSKUs = cmGetOSK();
}

/* render the aggregated cart lineitems with Shop 5 tags*/
function cmDisplayShop5s(){
	var i;
	for(i=0; i<cmShopCounter;i++){
		var cm = new _cm("tid", "4", "vn2", "e4.0");
		cm.at = "5";
		cm.pr = cmShopIds[i]; 
		cm.pm = cmShopProducts[i];
		cm.cg = cmShopCats[i];
		cm.qt = cmShopQtys[i] ;
		cm.bp = cmShopPrices[i];
		cm.sx1 = cmShopColors[i];
		cm.sx2 = cmShopSizes[i];
		cm.pc = "N";
		cm.writeImg();
	}
	cmShopSKUs = cmGetOSK();

	cmShopCounter=0;
}

/*
 * Creates a Shop tag with Action 9 (Order Receipt / Confirmed)
 *
 * productID	: required. Product ID to set on this Shop tag
 * 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. ID of customer making the purchase
 * orderID	: required. ID of order this lineitem belongs to
 * orderTotal	: required. Total price of order this lineitem belongs to
 * categoryID	: optional. Category to set on this Shop tag
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateShopAction9Tag(productID, productName, productQuantity,
				productPrice, customerID, orderID,
				orderTotal, categoryID, color, size) {

	productID = productID.toUpperCase();
	color     = color.toUpperCase();
	size      = size.toUpperCase();

	var index = cmGetProductIndex(productID);
	if(index!=-1){
		var oldPrice = cmShopPrices[index];
		var oldQty = cmShopQtys[index];
		var newQty = oldQty + parseInt(productQuantity);
		var newPrice = (oldPrice*oldQty + parseInt(productQuantity)*parseFloat(productPrice))/(newQty);

		cmShopPrices[index] = newPrice;
		cmShopQtys[index] = newQty;
	} else {
		if (!categoryID) {
			categoryID = "";
		}
		cmShopProducts[cmShopCounter] = productName;
		cmShopIds[cmShopCounter] = productID;
		cmShopOrderIds[cmShopCounter] = orderID;
		cmShopOrderPrices[cmShopCounter] = orderTotal;
		cmShopCustomerIds[cmShopCounter] = customerID;
		if (cm_MotionPoint){
			cmShopCats[cmShopCounter] = cm_MotionPoint+":"+categoryID;
		}
		else{
			cmShopCats[cmShopCounter] = categoryID;
		}
		cmShopQtys[cmShopCounter] = parseInt(productQuantity);
		cmShopPrices[cmShopCounter] = parseFloat(productPrice);
		cmShopQtys[index] = newQty;
		cmShopColors[cmShopCounter] = color;
		cmShopSizes[cmShopCounter] = size;
		cmShopCounter++;
	}
	cmShopSKUs = cmGetOSK();

}


/* render the aggregated order lineitems with Shop 9 tags*/
function cmDisplayShop9s(){
	var i;
	for(i=0; i<cmShopCounter;i++){
		var cm = new _cm("tid", "4", "vn2", "e4.0");
		cm.at = "9";
		cm.pr = cmShopIds[i]; 
		cm.pm = cmShopProducts[i];
		cm.cg = cmShopCats[i];
		cm.qt = cmShopQtys[i] ;
		cm.bp = cmShopPrices[i];
		cm.cd = cmShopCustomerIds[i];
		cm.on = cmShopOrderIds[i];
		cm.tr = cmShopOrderPrices[i];
		cm.sx1 = cmShopColors[i];
		cm.sx2 = cmShopSizes[i];
		cm.pc = "N";
		cm.writeImg();

	}
	cmShopSKUs = cmGetOSK();

	cmShopCounter=0;
}

/*
 * Creates an Order tag
 *
 * orderID			: required. Order ID of this order
 * orderTotal		: required. Total of this order (minus tax and shipping)
 * orderShipping	: required. Shipping charge for this order
 * customerID		: required. Customer ID that placed this order
 * 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, orderShipping, customerID, 
			  customerCity, customerState, customerZIP) {
	
		var cm = new _cm("tid", "3", "vn2", "e4.0");
		cm.on = orderID;
		cm.tr = orderTotal;
		cm.osk = cmShopSKUs;
		cm.sg = orderShipping;
		cm.cd = customerID;
		cm.sa = customerState;
		cm.ct = customerCity;
		cm.zp = customerZIP;

		cmCheckEmParameter();
		cm.writeImg();
	
}

function cmGetOSK() {
	var i =0;
	var result = "";
	for (i=0; i<cmShopCounter; i++)
	{
		result += "|" + cmShopIds[i] + "|" + cmShopPrices[i] + "|" + cmShopQtys[i] + "|";
	}
	return result;
}

/*
 * Creates a Registration tag and/or a Newsletter tag
 *
 * customerID		: required for Registration. ID of Customer to register.
 * customerEmail	: required for Newsletters. Optional for Registration.
 * 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
 * newsletterName	: required for Newsletters. The name of the Newsletter.
 * subscribe		: required for Newsletters. Either "Y" or "N"
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateRegistrationTag( customerID     // String (256)
                                , customerEmail  // String (256)
								, customerCity   // String (256)
								, customerState  // String (256)
								, customerZIP	 // String (256)
								, newsletterName // String (256)
								, subscribe		 // String (1) Y or N only
								, firstName		 // String (256)
								, age			 // Number (3) 
								, gender		 // String (1) M or F only
								, country		 // String (256)
								, minIncome		 // Number (14,2)
								, maxIncome		 // Number (14,2)
								, educationLevel // String (256)
								, extraField11	 // String (100)
								, extraField12	 // String (100)
								, extraField13	 // String (100)
								, extraField14	 // String (100)
								, extraField15	 // String (100)
								) {
	var cm = new _cm("tid", "2", "vn2", "e4.0");
	cm.cd = customerID;
	cm.em = customerEmail;
	cm.sa = customerState;
	cm.ct = customerCity;
	cm.zp = customerZIP;
	cm.fn = firstName;
	cm.ag = age;
	cm.gd = gender;
	cm.cy = country;
	cm.ml = minIncome;
	cm.xl = maxIncome;
	cm.ed = educationLevel;
    cm.rg11 = extraField11;
	cm.rg12 = extraField12;
	cm.rg13 = extraField13;
	cm.rg14 = extraField14;
	cm.rg15 = extraField15;

	if (newsletterName && subscribe) {
		cm.nl = newsletterName;
		cm.sd = subscribe;
	}
	
	cm.writeImg();
}

/* Creates an Error Tag
 *
 * returns nothing, causes a document.write of an image request for this tag.
 */
function cmCreateErrorTag(pageID, categoryID) {
	var cm=new _cm("tid", "404", "vn2", "e4.0");  //DO NOT CHANGE THESE PARAMETERS
	
	// get the referrer from the frameset
	if (parent.cm_ref != null) {
		cm.rf = parent.cm_ref;
		parent.cm_ref = document.URL;
	}

	// if parent had mmc variables and this is the first pageview, add mmc to this url
	if(parent.cm_set_mmc) {
		cm.ul = document.location.href + 
				((document.location.href.indexOf("?") < 0) ? "?" : "&") + 
				parent.cm_mmc_params; 
		parent.cm_ref = cm.ul;
		parent.cm_set_mmc = false;
	}

	cm.pc = "Y";
	if(pageID == null) {
		cm.pi = cmGetDefaultPageID();
	}
	if (cm_MotionPoint){
		cm.pi=cm_MotionPoint+":"+cm.pi		
    }

	if (categoryID) {
		if (cm_MotionPoint){
			cm.cg=cm_MotionPoint+":"+categoryID		
		}
		else {
			cm.cg = categoryID;
		}
	}

	// if parameter cm_referring_url is set then over ride because client redirect was used
	if (cm_referring_url)
	{  cm.rf = cm_referring_url;
	}

	cmCheckEmParameter();
	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 cmGetDefaultPageID() { 
	var pageName = window.location.pathname; 

	// eliminates everything after "?" (for Opera browswers)
	var tempIndex1 = pageName.indexOf("?");
	if (tempIndex1 != -1) {
		pageName = pageName.substr(0, tempIndex1);
	}
	// eliminates everything after "#" (for Opera browswers)
	var tempIndex2 = pageName.indexOf("#");
	if (tempIndex2 != -1) {
		pageName = pageName.substr(0, tempIndex2);
	}
	// eliminates everything after ";"
	var tempIndex3 = pageName.indexOf(";");
	if (tempIndex3 != -1) {
		pageName = pageName.substr(0, tempIndex3);
	}

	var slashPos = pageName.lastIndexOf("/");
	if (slashPos == pageName.length - 1) {
		pageName = pageName + "default.asp"; /****************** SET TO DEFAULT DOC NAME */
	}

	while (pageName.indexOf("/") == 0) {
		pageName = pageName.substr(1,pageName.length);
	}

	return(pageName); 
} 

if (defaultNormalize == null) { var defaultNormalize = null; }

/* This normalization function takes a list of parameters and parses out
   all url parameters that ARE in that list.  This only handles the simple case of 
   basic url parameters in the query string.  */
function myNormalizeURL(url, isHref) {

    var newURL = url;
    
    if (isHref) {
	    var blackList = ["lang="];
	    var paramString;
	    var paramIndex = newURL.indexOf("?");
	    var params;
	    var keepParams = new Array();
	    var goodParam;
	
	    if (paramIndex > 0) {
		paramString = newURL.substring(paramIndex+1);
		newURL = newURL.substring(0, paramIndex);
		params = paramString.split("&");
	
		for(var i=0; i<params.length; i++) {
			goodParam = true;
			for(var j=0; j<blackList.length; j++) {
				if (params[i].indexOf(blackList[j]) == 0) {
					goodParam = false;
				}
			}
			if(goodParam == true) {
				keepParams[keepParams.length] = params[i];
			}
		}
		
		newURL += "?" + keepParams.join("&");
	
	    }
	 
	    if (defaultNormalize != null) {
	        newURL = defaultNormalize(newURL, isHref);
	    }
	}	
    return newURL;
} // end myNormalizeURL()

// install normalization
if (document.cmTagCtl != null) {
    var func = "" + document.cmTagCtl.normalizeURL;
    if (func.indexOf('myNormalizeURL') == -1) {
        defaultNormalize = document.cmTagCtl.normalizeURL;
        document.cmTagCtl.normalizeURL = myNormalizeURL;
    }
}

var cmEndecaSearchTerm = new Array();
var cmEndecaDimension = new Array();
var cmEndecaDimensionValue = new Array();
var cmEndecaCounter = 0;

function cmCreateEndecaSearch(searchTerm, dimension, dimensionValue) {
	if (cm_MotionPoint){
		cmEndecaSearchTerm[cmEndecaCounter] = cm_MotionPoint+":"+searchTerm;
		cmEndecaDimension[cmEndecaCounter] = cm_MotionPoint+":"+dimension;
		cmEndecaDimensionValue[cmEndecaCounter] = cm_MotionPoint+":"+dimensionValue;
	}
	else {
		cmEndecaSearchTerm[cmEndecaCounter] = searchTerm;
		cmEndecaDimension[cmEndecaCounter] = dimension;
		cmEndecaDimensionValue[cmEndecaCounter] = dimensionValue;
	}

	cmEndecaCounter++;
}

function cmDisplayEndecaSearch() {

	var i;

	var datestamp = new Date();
	var stamp = (Math.floor(Math.random() * 11111111)) + datestamp.valueOf();

	for(i=0; i<cmEndecaCounter;i++){
		var cm = new _cm("tid", "7", "vn2", "e4.0");

		cm.li = 10100;
		cm.ps1 = cmEndecaSearchTerm[i];
		cm.ps2 = cmEndecaDimension[i];
		cm.ps3 = cmEndecaDimensionValue[i];
		cm.ps4 = stamp;
		cm.writeImg();
	}

	cmEndecaCounter = 0;
}

function cmCreateEndecaClick(searchTerm, dimension, dimensionValue) {

	if (cm_MotionPoint){
		cmEndecaSearchTerm[cmEndecaCounter] = cm_MotionPoint+":"+searchTerm;
		cmEndecaDimension[cmEndecaCounter] = cm_MotionPoint+":"+dimension;
		cmEndecaDimensionValue[cmEndecaCounter] = cm_MotionPoint+":"+dimensionValue;
	}
	else {
		cmEndecaSearchTerm[cmEndecaCounter] = searchTerm;
		cmEndecaDimension[cmEndecaCounter] = dimension;
		cmEndecaDimensionValue[cmEndecaCounter] = dimensionValue;
	}
	cmEndecaCounter++;
}

function cmDisplayEndecaClick() {

	var i;

	var datestamp = new Date();
	var stamp = (Math.floor(Math.random() * 11111111)) + datestamp.valueOf();

	for(i=0; i<cmEndecaCounter;i++){
		var cm = new _cm("tid", "7", "vn2", "e4.0");

		cm.li = 10101;
		cm.ps1 = cmEndecaSearchTerm[i];
		cm.ps2 = cmEndecaDimension[i];
		cm.ps3 = cmEndecaDimensionValue[i];
		cm.ps4 = stamp;
		cm.writeImg();
	}

	cmEndecaCounter = 0;
}



//-->