<!-- 

/* CHANNEL ADVISOR */

/* Check to see if they are on a secure page */

if (document.location.toString().indexOf('https://') != -1) {

	/* grab the page name from the url */
	var sPath = window.location.pathname;
	var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	
	if (sPage=='thankyoumain.jsp' && tid != '') {

		/* Order Tracking Pixel */
		document.write("<img src=https://tracking.searchmarketing.com/thankyou.asp?SMCID=1285&oVal=" + escape(val) + "&OrderID=" + escape(tid) + " width=1 height=1 border=0>")
	}


} else {
	
	/* Natural Search Pixel */
	document.write("<img src=http://tracking.searchmarketing.com/welcome.asp?SMCID=1285&x=" + escape(document.referrer) + " width=1 height=1>");
}

/* CHANNEL ADVISOR */

/* ACERNO */

var TTA_PATHNAME = document.location.pathname.toLowerCase();
var TTA_URL_PATH = "" + document.location.href.toLowerCase();


if(TTA_PATHNAME=="/" || TTA_PATHNAME=="/index.jsp" || TTA_URL_PATH.indexOf(".territoryahead.com/jump.jsp?itemid=0&itemtype=home_page")>=0)
	{
	var imi_mid='9fke1Qyr';
	var imi_ptid='HOME';
	}
else if(TTA_GetValueFromUrl(TTA_URL_PATH, "itemtype") == 'category')
	{
	var imi_mid='9fke1Qyr';
	var imi_did=TTA_GetValueFromUrl(TTA_URL_PATH, "itemid");
	}
else if(TTA_PATHNAME.indexOf("/thankyoumain.jsp")>=0)
	{
	var imi_mid='9fke1Qyr';
	var imi_tid=tid
	
		if (s.products.indexOf("event9") >= 0)
		{
		var imi_sale=TTA_GetValueFromString(s.products, "event9");
		} else {
		var imi_sale=val
		}
		
	}

function TTA_GetValueFromUrl(pUrl, pKey)
{

	var start = pUrl.indexOf('&' + pKey + '=');
	start = (start == -1) ? pUrl.indexOf('?' + pKey + '=') : start;
	if (start >= 0)
	{
		start = start + pKey.length;
		var end = pUrl.indexOf("&", start);
		if(end == -1) 
			end = pUrl.length;
		var middle = pUrl.indexOf("=", start);
		return pUrl.substring(middle + 1, end);
	}
	return null;
}

function TTA_GetValueFromString(pString, pKey)
{
	
	var start = pString.indexOf(pKey);
	
	if (start >= 0)
	{
		start = start + pKey.length;
		var end = pString.indexOf("|", start);
		if(end == -1) 
			end = pString.length;
		var middle = pString.indexOf("=", start);
		return pString.substring(middle + 1, end);
	}
	return null;
}



// (c) Copyright 2005-2006 aCerno Inc.
// All Rights Reserved

if (typeof(imi_mid) != 'undefined' && imi_mid) { 
  var url="//www.imiclk.com/cgi/r.cgi?m=3&mid=" + imi_mid;
  if (typeof(imi_ptid) != 'undefined' && imi_ptid) { url=url + "&ptid=" + imi_ptid; }
  if (typeof(imi_did)  != 'undefined' && imi_did)  { url=url + "&did="  + imi_did;  }
  if (typeof(imi_cid)  != 'undefined' && imi_cid)  { url=url + "&cid="  + imi_cid;  }
  if (typeof(imi_sale) != 'undefined' && imi_sale) { url=url + "&sale=" + imi_sale; }
  if (typeof(imi_tid)  != 'undefined' && imi_tid)  { url=url + "&tid="  + imi_tid;  }
  if (typeof(imi_tot)  != 'undefined' && imi_tot)  { url=url + "&tot="  + imi_tot;  }
  if (typeof(imi_zip)  != 'undefined' && imi_zip)  { url=url + "&zip="  + imi_zip;  }
  if (typeof(imi_muid) != 'undefined' && imi_muid) { url=url + "&muid=" + imi_muid; }

  document.write('<iframe' +
                 ' width="0"' +
                 ' height="0"' +
                 ' frameborder="0"' +
                 ' src="' + url +
                 ' " marginwidth="0"' +
                 ' marginheight="0"' +
                 ' vspace="0"' +
                 ' hspace="0"' +
                 ' allowtransparency="true"' +
	         ' scrolling="no">' +
	         '</iframe>');
}

/* ACERNO */

//--> 
