// This is used for the non education partner info link to seperate the button code
var lpUASsiteName = "marketing site";

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"){
	addPageVar("OrderTotal",lpUASorderTotal);
	addPageVar(lpUASunit + "_OrderTotal",lpUASorderTotal);
	addSessionVar("Conversion",1);
}

if(typeof(lpUASctuOrderTotal) != "undefined"){
	addPageVar("CTUOrderTotal",lpUASctuOrderTotal);
}

if(typeof(lpUASacademyOrderTotal) != "undefined"){
    addPageVar("AcademyOrderTotal",lpUASacademyOrderTotal);
}

if(typeof(lpUASctuRequestInfoOrderTotal) != "undefined"){
    addPageVar("CTURequestInfoOrderTotal",lpUASctuRequestInfoOrderTotal);
}

if(typeof(lpUASacademyRequestInfoOrderTotal) != "undefined"){
    addPageVar("AcademyRequestInfoOrderTotal",lpUASacademyRequestInfoOrderTotal);
}

if(typeof(lpUASsiteName) != "undefined"){
	addSessionVar("SiteName",lpUASsiteName);
}

if(typeof(lpUASctuSection) != "undefined"){
    addPageVar("CTUSection",lpUASctuSection);
}

if(typeof(lpUASacademySection) != "undefined"){
    addPageVar("AcademySection",lpUASacademySection);
}

if(typeof(lpUASctuConversionStage) != "undefined"){
    addPageVar("CTUConversionStage",lpUASctuConversionStage);
}

if(typeof(lpUASacademyConversionStage) != "undefined"){
    addPageVar("AcademyConversionStage",lpUASacademyConversionStage);
}

if(typeof(lpUASctuErrorCounter) != "undefined"){
    addPageVar("CTUErrorCounter",lpUASctuErrorCounter);
}

if(typeof(lpUASacademyErrorCounter) != "undefined"){
    addPageVar("AcademyErrorCounter",lpUASacademyErrorCounter);
}

if(typeof(lpUASctuMicroSiteX) != "undefined"){
    addPageVar("CTUMicroSiteX",lpUASctuMicroSiteX);
}

if(typeof(lpUASctuApplicationType) != "undefined"){
    addPageVar("CTUApplicationType",lpUASctuApplicationType);
}

if(typeof(AcademyApplicationType) != "undefined"){
    addPageVar("AcademyApplicationType",lpUASacademyApplicationType);
}

if(typeof(lpUASctuOrderPayementX) != "undefined"){
    addPageVar("CTUOrderPaymentX",lpUASctuOrderPayementX);
}

if(typeof(lpUASacademyOrderPayementX) != "undefined"){
    addPageVar("AcademyOrderPaymentX",lpUASacademyOrderPayementX);
}

if(typeof(lpUASctuOrderNumber) != "undefined"){
    addPageVar("CTUOrderNumber",lpUASctuOrderNumber);
}

if(typeof(lpUASacademyOrderNumber) != "undefined"){
    addPageVar("AcademyOrderNumber",lpUASacademyOrderNumber);
}

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 = "";
}