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 = "";

// add OrderTotal
if(typeof(lpUASorderTotal) != "undefined"){
	addPageVar("OrderTotal",lpUASorderTotal);
	addPageVar(lpUASunit + "_OrderTotal",lpUASorderTotal);
	addSessionVar("Conversion",1);
}

// <Place variables here>
if(typeof(lpUASConversionAction) != "undefined"){
    addPageVar("ConversionAction",lpUASConversionAction);
}
if(typeof(lpUASvisitorID) != "undefined"){
    addVisitorVar("VisitorID",lpUASvisitorID);
}
if(typeof(lpUASsection) != "undefined"){
    addPageVar("Section",lpUASsection);
}
if(typeof(lpUASpageID) != "undefined"){
    addPageVar("PageID",lpUASpageID);
}
if(typeof(lpUASproductName) != "undefined"){
    addPageVar("ProductName",lpUASproductName);
}
if(typeof(lpUASsolutionName) != "undefined"){
    addPageVar("SolutionName",lpUASsolutionName);
}

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 = "";
}
