function addVar(varScope,varName,varValue){
	if(varValue != ""){
		tagVars = tagVars + '&' + varScope + '!' + varName + '=' + escape(varValue);
	}	
}

function addPageVar(varName, varValue){
	addVar('PAGEVAR',varName,varValue);
}

function addSessionVar(varName, varValue){
	addVar('SESSIONVAR',varName,varValue);	
}

function addVisitorVar(varName, varValue){
	addVar('VISITORVAR', varName, varValue);
}

if (typeof(tagVars)=="undefined")
	tagVars = "";
	
if (typeof(lpUASorderTotal)!="undefined" && lpUASorderTotal!=""){
	addPageVar("OrderTotal",lpUASorderTotal);
	addPageVar(lpUASunit+'_OrderTotal',lpUASorderTotal);
	addSessionVar("Conversion",1);
}

//<Place Vars Here>

if (typeof(lpUASconversionAction) != "undefined"){
	addSessionVar("conversionAction",lpUASconversionAction);
}

if (typeof(lpUASerrorCounter) != "undefined"){
	addPageVar("errorCounter",lpUASerrorCounter);
}

if (typeof(lpUAScardID) != "undefined"){
	addVisitorVar("cartID",lpUAScardID);
}

if (typeof(lpUASsection) != "undefined"){
	addPageVar("section",lpUASsection);
}

if (typeof(lpUASconversionStage) != "undefined"){
	addPageVar("conversionStage",lpUASconversionStage);
}

if (typeof(lpUASorderDetails) != "undefined"){
	addPageVar("orderDetails",lpUASorderDetails);
}

if (typeof(lpUASconversionDetails) != "undefined"){
	addPageVar("conversionDetails",lpUASconversionDetails);
}

if (typeof(lpUASorderNumber) != "undefined"){
	addPageVar("orderNumber",lpUASorderNumber);
}

if (typeof(lpUAScartTotal) != "undefined"){
	addPageVar("cartTotal",lpUAScartTotal);
}

if (typeof(lpUASbackorderDate) != "undefined"){
	addPageVar("backorderDate",lpUASbackorderDate);
}

if (typeof(lpUASsearchResults) != "undefined"){
	addPageVar("searchResults",lpUASsearchResults);
}

if (typeof(lpUASunit_orderTotal) != "undefined"){
    addPageVar("unit_orderTotal",lpUASunit_orderTotal);
}

if (typeof(lpUASpageviewCount) != "undefined"){
	addPageVar("pageviewCount",lpUASpageviewCount);
}

if (typeof(lpUASoriginSite) != "undefined"){
	addSessionVar("originSite",lpUASoriginSite);
}

if (typeof(lpUASsearchText) != "undefined"){
	addPageVar("searchText",lpUASsearchText);
}

if (typeof(lpUASsubsection) != "undefined"){
	addPageVar("subsection",lpUASsubsection);
}

var INITIAL_MAX_SIZE = 300;
var MAX_TAGVARSURL_SIZE = 1600;
var INITIAL_STRING = document.location.toString() + document.title;
var STRING_MAX_SIZE = INITIAL_STRING.length + INITIAL_MAX_SIZE;

if ((typeof(tagVars) == "undefined") || (tagVars == null))
	tagVars = "";
while ((tagVars.length + STRING_MAX_SIZE > MAX_TAGVARSURL_SIZE) && (tagVars.length > 0)) {
	var idx = tagVars.lastIndexOf("&");
	if (idx > 0)
		tagVars = tagVars.substring(0, idx);
	else
		tagVars = "";
}