//Contact Forms Javascript
//Last updated by:
//REY  Cant remember...

// Function to apply the custom non-cfa Priority Codes drop down value to the CFA Priority Code textfield.  This function is a workaround to make the priority codes dropdown dynamic by creating a non-cfa dropdown list and append the value in a hidden cfa textfield.  * even though cfa textfields are hidden in the form, they will be visible in the lead emails.

function OnChange(dropdown) //test
{
    var myindex  = document.form1.priorityCodesTemp.selectedIndex;
    var SelValue = document.form1.priorityCodesTemp.options[myindex].value; // set value when customer selects value in dropdown
    document.getElementById('txtPriorityCodesTxtField').value = SelValue; // set value in the hidden cfa textfield.
    
    return true;
}

//for default form with Current Customer radio buttons - change value of producttype on click
function OnClickCurrentCustomer(radioButton, changeCCversion)
{
    document.getElementById('ddlProducts').value = radioButton;
	
	document.getElementById('currentVersion').value = changeCCversion;

	
    
    return true;
}


//function for CCH University form, apply totalCost value to the asp.net field


function totalCostOnChange(textfield)
{
    var myindex  = document.form1.txtuserLicensesTemp.value;
    var SelValue = document.form1.txtuserLicensesTemp.value; // set value when customer selects value in dropdown
    document.getElementById('txtuserLicenses').value = SelValue; // set value in the hidden cfa textfield.
	var totalPrice;
	
	if (SelValue > 1 && SelValue < 5){
		totalPrice = "$" +(SelValue *300) + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else if (SelValue > 4 && SelValue <10){
		totalPrice = "$" + (SelValue * 290) + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else if (SelValue > 9 && SelValue < 15){
		totalPrice = "$" +(SelValue * 280) + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else if (SelValue > 14 && SelValue < 20){
		totalPrice = "$" + (SelValue * 270) + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else if (SelValue == 20 || SelValue > 20){
		totalPrice = "For 20 or more users, please contact your Account Manager";
	} else if (SelValue == 1){
		totalPrice = "$" + 300 + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else {
		totalPrice = "Invalid number of users";
	}
	document.getElementById('totalCost').style.color = "red";
	document.getElementById('totalCost').innerHTML = totalPrice;
	
	document.getElementById('txtcchuTotalCost').value = totalPrice;
    
    return true;
}


function totalCostOnChangeLarge(textfield)
{
    var myindex  = document.form1.txtuserLicensesTemp.value;
    var SelValue = document.form1.txtuserLicensesTemp.value; // set value when customer selects value in dropdown
    document.getElementById('txtuserLicenses').value = SelValue; // set value in the hidden cfa textfield.
	var totalPrice;
	
	if (SelValue > 2 && SelValue < 5){
		totalPrice = "$" +(SelValue *300) + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else if (SelValue > 4 && SelValue <10){
		totalPrice = "$" + (SelValue * 290) + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else if (SelValue > 9 && SelValue < 15){
		totalPrice = "$" +(SelValue * 280) + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else if (SelValue > 14 && SelValue < 20){
		totalPrice = "$" + (SelValue * 270) + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else if (SelValue == 20 || SelValue > 20){
		totalPrice = "For 20 or more users, please contact your Account Manager";
	} else if (SelValue == 1){
		totalPrice = "$" + 300 + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else if (SelValue == 2){
		totalPrice = "$" + 600 + "<i> (Plus applicable State and local tax when your order is billed)</i>";
	} else {
		totalPrice = "Invalid number of users";
	}
	document.getElementById('totalCost').style.color = "red";
	document.getElementById('totalCost').innerHTML = totalPrice;
	
	document.getElementById('txtcchuTotalCost').value = totalPrice;
    
    return true;
}




// function for Select Products checkboxes.  Combine all Products checkbox value and set this value in the Selected Products Textfield.  This function is used in forms with Selected Products checkboxes.  Setting value of non-cfa checkboxes value to the hidden CFA Selected Products textbox.  * even though cfa textfields are hidden in the form, they will be visible in the lead emails.

function OnChangeCB(checkbox)
{
	var cbResults = "";
	// get the values of all checked boxes then append in one variable
      for (var i = 0; i < document.form1.elements.length; i++ ) {  
            if (document.form1.elements[i].checked == true) {
                cbResults += document.form1.elements[i].value + ' ';
            }
        }

    document.getElementById('txtproductsSelected').value = cbResults; // set value in hidden textfield
	
    
    return true;
}


// a fix to the dropdown width issue in IE.  IE does not expand the width of the dropdown in expanded view if the options characters are longer than the dropdown.
function maxWidth()
{
	var maxlength = 410;
	var mySelect = document.getElementById('ddlProducts');
	for (var i=0; i<mySelect.options.length;i++)
	{
		if (mySelect[i].text.length > maxlength)
		{
			maxlength = mySelect[i].text.length;
		}
	}
	//mySelect.style.width = maxlength * 7;
	mySelect.style.width = maxlength;
}

function restoreWidth()
{
var mySelect = document.getElementById('ddlProducts');
mySelect.style.width="200px";
}



// This function decodes the any string
// that's been encoded using URL encoding technique
function URLDecode(psEncodeString)
{
  // Create a regular expression to search all +s in the string
  var lsRegExp = /\+/g;
  // Return the decoded string
  return unescape(String(psEncodeString).replace(lsRegExp, " "));
}


	function getQueryVariable(variable) {
	  var query = window.location.search.substring(1);
	  var vars = query.split("&");
	  for (var i=0;i<vars.length;i++) {
		var pair = vars[i].split("=");
		if (pair[0].toLowerCase()== variable.toLowerCase()) {
		  return URLDecode(pair[1]);
		}
	  }
	 //alert('Query Variable ' + variable + ' not found');
	}

var leadSource = getQueryVariable('leadSource');  // get the product ID variable



// if no query string in the url
if (leadSource == undefined || leadSource == ""){
}else {	
leadSource = leadSource.toUpperCase();
}


var cmPageID = window.location.toString(); //get url for coremetrics page ID
var urlAddress = cmPageID.replace("http://", ""); //remove http for PageID


// function to update the values from xml data when the form loads

function changeValues() {
	
	//declare variables
	
	var imagesFolder;
	var headerImage;
	var confirmationPage;
	var pageTitle;
	var bodyBackgroundColor;
	var backgroundColor;
	var leadSourceText;
	var productName;
	var productCode;
	var defaultProductCode;
	var headerText;
	// var productCategory;
	var productNameNoHTML;
	var headerAltTag;
	var cssFile;
	var cpContent;
	var eventCategory;
	var eventIDname;
	var SLXtext;
	var ccVersion = "1";
	
	
	
	// load XML document cforms.xml
	var xmlDoc;
	var xmlURL = "/cforms/scripts/cforms.xml";
	new Ajax.Request(xmlURL, {
	method: "get",
	asynchronous: false,
	onSuccess: function(resp, jsonObj) {
	xmlDoc = resp.responseXML;
	}
	});
	
	var x=  xmlDoc.documentElement;
	var xa = xmlDoc.documentElement.childNodes;
	var xb = xmlDoc.getElementsByTagName("PRODUCTCODE");




	// Load the default values for the productCategory if no query string defined in the URL
	var CurrentCFAProduct;	
	
	productCategory.toUpperCase();
	
	function loadTheDefault(){  // function to load the default xml data if no leadSource variable in url
		
		
		switch (productCategory){
			
			case "DEFAULT":
			leadSource = "Default";
			break;
	
			case "PROSYSTEM":
			leadSource = "Pfx-Default";
			break;
			
			case "CORPSYSTEM":
			leadSource = "Corp-Default";
			break;
			
			case "CORPINCOMETAX":
			leadSource = "CorpIncomeTax-Default";
			break;
			
			case "CORPSALESTAX":
			leadSource = "CorpSalesTax-Default";
			break;
			
			case "RESEARCH":
			leadSource = "Research-Default";
			break;
						
			case "STORE":
			leadSource = "Store-Default";
			break;
			
			case "CCHUNIVERSITY":
			leadSource = "CCHUniversity-Default";
			break;
			
			case "NEWSLETTER":
			leadSource = "Newsletter-Default";
			break;
		
		}
		
		//loop through the xml document and load the default values
		for (var j=0; j<xb.length; j++)						
			{			
				
				xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue = xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue.toUpperCase();	
				leadSource = leadSource.toUpperCase();	
					if (xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue === leadSource)						
					{						
						CurrentCFAProduct = j;
						break;						
					}						
			}	
			
				confirmationPage = xb[CurrentCFAProduct].getElementsByTagName("CONFIRMATIONPAGE")[0].childNodes[0].nodeValue;
				imagesFolder = xb[CurrentCFAProduct].getElementsByTagName("IMAGESFOLDER")[0].childNodes[0].nodeValue;
				productName = xb[CurrentCFAProduct].getElementsByTagName("PRODUCTNAME")[0].childNodes[0].nodeValue;
				leadSourceText = xb[CurrentCFAProduct].getElementsByTagName("LEADSOURCE")[0].childNodes[0].nodeValue;
				headerText = xb[CurrentCFAProduct].getElementsByTagName("HEADERTEXT")[0].childNodes[0].nodeValue;
				headerImage = xb[CurrentCFAProduct].getElementsByTagName("HEADERIMAGE")[0].childNodes[0].nodeValue;
				bodyBackgroundColor = "white"
				backgroundColor = xb[CurrentCFAProduct].getElementsByTagName("BACKGROUNDCOLOR")[0].childNodes[0].nodeValue;
				pageTitle = xb[CurrentCFAProduct].getElementsByTagName("PAGETITLE")[0].childNodes[0].nodeValue;
				cssFile = xb[CurrentCFAProduct].getElementsByTagName("CSSFILE")[0].childNodes[0].nodeValue;
				eventCategory = xb[CurrentCFAProduct].getElementsByTagName("EVENTCATEGORY")[0].childNodes[0].nodeValue;
				
				if (productCategory == "STORE" ){  // there are currently no default values in the xml file for the Store CFA form.  Set leadSource value from the query string
					leadSource = getQueryVariable('leadSource'); 
				}
	}
	
	
	
	if (leadSource == undefined || leadSource == ""){  // if query string leadSource undefined or null, load default values based on productCategory.  
		
		loadTheDefault();
	   
	   } else {		// if there is a query variable leadSource defined in the URL..
			
			var foundLeadSource = new Boolean();
			foundLeadSource = false;
			//loop through the xml document		
			for (var j=0; j<xb.length; j++)						
			{						
				xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue = xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue.toUpperCase();	
				leadSource = leadSource.toUpperCase();	
					if (xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue === leadSource)						
					{						
						CurrentCFAProduct = j;	
						foundLeadSource = true;
						break;				
						
					} 
			}
			
	}
	
	
	if(foundLeadSource){  // if leadSource variable doesn't match any of the productCodes in the xml, load the defaults
		//
	} else {
		loadTheDefault();
	}

	
	
	// load the default values after finding the productID in the xml.  
	switch (productCategory){
		
			case "DEFAULT":
			defaultProductCode = "Default";
			break;
	
			case "PROSYSTEM":
			defaultProductCode = "Pfx-Default";
			break;
			
			case "CORPSYSTEM":
			defaultProductCode = "Corp-Default";
			break;
			
			case "RESEARCH":
			defaultProductCode = "Research-Default";
			break;
			
			case "CORPINCOMETAX":
			defaultProductCode = "CorpIncometax-Default";
			break;
			
			case "CORPSALESTAX":
			defaultProductCode = "CorpSalestax-Default";
			break;
			
			case "STORE":
			defaultProductCode = "Store-Default";
			break;
			
			case "CCHUNIVERSITY":
			defaultProductCode = "CCHUniversity-Default";
			break;
			
			case "NEWSLETTER":
			defaultProductCode = "Newsletter-Default";
			break;
		
	}
	
	// loop through the xml document and find the values when node matches the defaultProductCode
	for (var m=0; m<xb.length; m++)						
	{						
				xmlDoc.getElementsByTagName("PRODUCTCODE")[m].attributes.getNamedItem("id").nodeValue = xmlDoc.getElementsByTagName("PRODUCTCODE")[m].attributes.getNamedItem("id").nodeValue.toUpperCase();	
					
					defaultProductCode = defaultProductCode.toUpperCase();
					
					if (xmlDoc.getElementsByTagName("PRODUCTCODE")[m].attributes.getNamedItem("id").nodeValue === defaultProductCode)						
					{						
						CurrentDefaultProduct = m;
						confirmationPage = xb[CurrentDefaultProduct].getElementsByTagName("CONFIRMATIONPAGE")[0].childNodes[0].nodeValue;
						imagesFolder = xb[CurrentDefaultProduct].getElementsByTagName("IMAGESFOLDER")[0].childNodes[0].nodeValue;
						productName = xb[CurrentDefaultProduct].getElementsByTagName("PRODUCTNAME")[0].childNodes[0].nodeValue;
						leadSourceText = xb[CurrentDefaultProduct].getElementsByTagName("LEADSOURCE")[0].childNodes[0].nodeValue;
						headerText = xb[CurrentDefaultProduct].getElementsByTagName("HEADERTEXT")[0].childNodes[0].nodeValue;
						headerImage = xb[CurrentDefaultProduct].getElementsByTagName("HEADERIMAGE")[0].childNodes[0].nodeValue;
						bodyBackgroundColor = "white";
						backgroundColor = xb[CurrentDefaultProduct].getElementsByTagName("BACKGROUNDCOLOR")[0].childNodes[0].nodeValue;
						pageTitle = xb[CurrentDefaultProduct].getElementsByTagName("PAGETITLE")[0].childNodes[0].nodeValue;
						cssFile = xb[CurrentDefaultProduct].getElementsByTagName("CSSFILE")[0].childNodes[0].nodeValue;
						eventCategory = xb[CurrentDefaultProduct].getElementsByTagName("EVENTCATEGORY")[0].childNodes[0].nodeValue;
						break;						
					}						
	}	
	
	// productCategory = xb[CurrentCFAProduct].parentNode.nodeName;
	
	
	// identify the form
	//productCode = xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue; // required
	
	
	// if no LEADSOURCE in xml, load the leadSourceText from the default.  If there is, load the value from xml.
	if (productCategory == "PROSYSTEM" || productCategory == "DEFAULT" || productCategory == "NEWSLETTER" || productCategory == "CORPSALESTAX"){  // if the form is ProSystem or Newsletter Category (both forms use different leadSource textfields than the other forms), set the leadSource textfield value
		if (xb[CurrentCFAProduct].getElementsByTagName("LEADSOURCE")[0] == null) {
			//
		   }else {
				leadSourceText = xb[CurrentCFAProduct].getElementsByTagName("LEADSOURCE")[0].childNodes[0].nodeValue;
				document.getElementById('txtleadSourceNonDB').value = leadSourceText;
		}
	} else {
		if (xb[CurrentCFAProduct].getElementsByTagName("LEADSOURCE")[0] == null) {
			//
		   }else {
				leadSourceText = xb[CurrentCFAProduct].getElementsByTagName("LEADSOURCE")[0].childNodes[0].nodeValue;
				document.getElementById('txtleadSource').value = leadSourceText;
		}
	}
	
	if (productCategory == "PROSYSTEM" || productCategory == "NEWSLETTER" || productCategory == "DEFAULT" || productCategory == "CORPSALESTAX"){ // Both ProSystem and Newsletter forms use a CFA leadSource textfield that gets sent to SalesLogix Database.
		if (xb[CurrentCFAProduct].getElementsByTagName("SLX")[0] == null) {
			//
		   }else {
				SLXtext = xb[CurrentCFAProduct].getElementsByTagName("SLX")[0].childNodes[0].nodeValue;
				document.getElementById('txtleadSource').value = SLXtext;
		}
	}
	
	
	if (productCategory == "STORE" ){  // testing the Store form for Gregg, if no query string in url, set the default value of the leadSource variable
		if (leadSource == undefined || leadSource == ""){
			leadSource = "CCH Books, Journals and Newsletters";
		}
		leadSourceText = leadSource;
		document.getElementById('txtleadSource').value = "web-online-store";
	}
	
	// if no PRODUCTNAME in xml, Use the leadSourcetext.  If there is, load the value from xml, also use this productName as the page title.
	if (document.getElementById('productsTextBox').style.display == 'none') {

		if (xb[CurrentCFAProduct].getElementsByTagName("PRODUCTNAME")[0] == null) {
				// if products text box is visible, make the textfield blank.
				document.getElementById('txtProductsTextbox').value = leadSourceText;
		   }else {
				productName = xb[CurrentCFAProduct].getElementsByTagName("PRODUCTNAME")[0].childNodes[0].nodeValue;
				productNameNoHTML = productName.replace(/<\/?[^>]+(>|$)/g, "");
				document.getElementById('txtProductsTextbox').value = productNameNoHTML;
		}
	
	}
	
	if (productCategory == "STORE" ){ // testing for the Store form, set the hidden Product textfield value to the leadSource value, remove all html tags, and set the value of the textfield.
			productName = leadSource;
			productNameNoHTML = productName.replace(/<\/?[^>]+(>|$)/g, "");
			document.getElementById('txtProductsTextbox').value = productNameNoHTML;	
	}
	

	
	// if no CONFIRMATIONPAGE in xml, use the default confirmation page.  If there is, load the value from xml.
	if (xb[CurrentCFAProduct].getElementsByTagName("CONFIRMATIONPAGE")[0] == null) {
		
		document.getElementById('redirectLink').value = confirmationPage + "?leadSource=" + leadSource;
		
	   }else {
			confirmationPage = xb[CurrentCFAProduct].getElementsByTagName("CONFIRMATIONPAGE")[0].childNodes[0].nodeValue;
			document.getElementById('redirectLink').value = confirmationPage + "?leadSource=" + leadSource;
	}
	


	
	// if no CCVERSION in xml, use the default VERSION.  If there is, load the value from xml.
	if (xb[CurrentCFAProduct].getElementsByTagName("CCVERSION")[0] == null) {
		
		//
		
	   }else {
			ccVersion = xb[CurrentCFAProduct].getElementsByTagName("CCVERSION")[0].childNodes[0].nodeValue;
			document.getElementById('currentVersion').value = ccVersion;
	}
	
	
		// if NUMPROFESSIONALS in xml, hide field.  Otherwise, show field.
	if (productCategory == "DEFAULT"){
		if (xb[CurrentCFAProduct].getElementsByTagName("NUMPROFESSIONALS")[0] == null) {
			
			//
			
		   }else {
				document.getElementById('numProfessionalsField').style.display = "none";
				document.getElementById('txtNumberProfessionalsTextbox').value = "not applicable";
		}
	}
	
	//show Current Customer radio buttons for NextGen form
	if (productCategory == "DEFAULT"){
		if (xb[CurrentCFAProduct].getElementsByTagName("CURRENTCUSTOMER")[0] == null) {
			
			//
			
		   }else {
				document.getElementById('currentCustomerDiv').style.display = "block";
		}
	}
	
	
	// if STREETFIELD in xml, hide field.  Otherwise, show field.
	if (productCategory == "DEFAULT"){
		if (xb[CurrentCFAProduct].getElementsByTagName("STREETFIELD")[0] == null) {
			
			//
			
		   }else {
				document.getElementById('streetField').style.display = "none";
				document.getElementById('txtStreet1').value = "not applicable";
		}
	}
	
	// if cityfield in xml, hide field.  Otherwise, show field.
	if (productCategory == "DEFAULT"){
		if (xb[CurrentCFAProduct].getElementsByTagName("CITYFIELD")[0] == null) {
			
			//
			
		   }else {
				document.getElementById('cityField').style.display = "none";
				document.getElementById('txtCity').value = "not applicable";
		}
	}
	
	// if cityfield in xml, hide field.  Otherwise, show field.
	if (productCategory == "DEFAULT"){
		if (xb[CurrentCFAProduct].getElementsByTagName("STATEFIELD")[0] == null) {
			
			//
			
		   }else {
				document.getElementById('stateField').style.display = "none";
				document.getElementById('txtState').value = "not applicable";
		}
	}
	
	
	if (productCategory == "NEWSLETTER"){  // currently testing for newsletter form, set the confirmation page as the subscribe confirmation page.  Using the email address the customer put in the email address textfield.

		
		switch (leadSource){
			case "FOCUSONTAX-NEWSLETTER":
			confirmationPage = 'https://support.cch.com/emailpreferences/public/email_preferences.asp?email=' + document.getElementById('txtEmailAddress').value + '&news_level=10&newsletter_id=10000186&cfu_id=10000000&category_description=Focus on Tax Newsletter&opt_in=Y';
			break;
			
			case "INTELLIGENCE-NEWSLETTER":
			confirmationPage = 'https://support.cch.com/emailpreferences/public/email_preferences.asp?email=' + document.getElementById('txtEmailAddress').value + '&news_level=10&newsletter_id=10000187&cfu_id=10000000&category_description=Intelligencefor Taxation Newsletter&opt_in=Y';
			break;
			
			case "AUDIOSEMINARS-NEWSLETTER":
			confirmationPage = 'https://support.cch.com/emailpreferences/public/email_preferences.asp?email=' + document.getElementById('txtEmailAddress').value + '&eos_level=20&eos_level_id=20000026&genre_id=0&opt_in=Y';
			break;
			
			case "TAXNEWS-NEWSLETTER":
			confirmationPage ='http://support.cch.com/emailpreferences/public/email_preferences.asp?email=' + document.getElementById('txtEmailAddress').value + '&news_level=10&newsletter_id=10000185&cfu_id=10000000&category_description=TaxNews Headlines&opt_in=Y';
			break;
			
			case "E-FIRST-NEWSLETTER":
			confirmationPage ='http://support.cch.com/emailpreferences/public/email_preferences.asp?email=' + document.getElementById('txtEmailAddress').value + '&eos_level=30&eos_level_id=30000363&genre_id=0&opt_in=Y';
			break;
			
			case "E-FIGURES-NEWSLETTER":
						confirmationPage ='http://support.cch.com/emailpreferences/public/email_preferences.asp?email=' + document.getElementById('txtEmailAddress').value + '&eos_level=30&eos_level_id=30000362&genre_id=0&opt_in=Y';
			break;
		}
		
		if(leadSource == "ENEWSLETTER-FEEDBACK"){
			if (xb[CurrentCFAProduct].getElementsByTagName("CONFIRMATIONPAGE")[0] == null) {
		
				document.getElementById('redirectLink').value = confirmationPage + "?leadSource=" + leadSource;
				
			   }else {
					confirmationPage = xb[CurrentCFAProduct].getElementsByTagName("CONFIRMATIONPAGE")[0].childNodes[0].nodeValue;
					document.getElementById('redirectLink').value = confirmationPage + "?leadSource=" + leadSource;
			};
		} else {
		document.getElementById('redirectLink').value = confirmationPage;
		}
	}
		
	
	// if no BACKGROUNDCOLOR in xml, use the default background color.  If there is, load the value from xml.		
	if (xb[CurrentCFAProduct].getElementsByTagName("BACKGROUNDCOLOR")[0] == null) {
		
			document.getElementById('CFA-mainDiv').style.backgroundColor = backgroundColor;
			
		} else {
				backgroundColor = xb[CurrentCFAProduct].getElementsByTagName("BACKGROUNDCOLOR")[0].childNodes[0].nodeValue;
				document.getElementById('CFA-mainDiv').style.backgroundColor = backgroundColor;
	}
	
	// if no BODYBACKGROUNDCOLOR in xml, use the default background color.  If there is, load the value from xml.		
	if (xb[CurrentCFAProduct].getElementsByTagName("BODYBACKGROUNDCOLOR")[0] == null) {
		
			//
			
		} else {
				bodyBackgroundColor = xb[CurrentCFAProduct].getElementsByTagName("BODYBACKGROUNDCOLOR")[0].childNodes[0].nodeValue;
				document.body.style.background = bodyBackgroundColor;
	}
		
	// if no PAGETITLE, use the productName for the html page title.  If present, load the value from xml.
	if (xb[CurrentCFAProduct].getElementsByTagName("PAGETITLE")[0] == null) {
			productNameNoHTML = productName.replace(/<\/?[^>]+(>|$)/g, "");	// remove html tags, no html allowed for html title.
			pageTitle = productNameNoHTML;
			document.title = pageTitle; // apply page title
			headerAltTag = pageTitle;  // use pagetitle for the header image ALT tag
	} else {
			var pageTitle = xb[CurrentCFAProduct].getElementsByTagName("PAGETITLE")[0].childNodes[0].nodeValue;
			productNameNoHTML = pageTitle.replace(/<\/?[^>]+(>|$)/g, "");
			document.title = pageTitle;
			headerAltTag = pageTitle;
	}
	
	if (productCategory == "STORE" ){ // testing for Store form, set the html page title to the product name value.  Set the header image alt tag to the page title value.
		pageTitle = productName;
		document.title = pageTitle;
		headerAltTag = pageTitle;
	}
			
	
	// if FOOTERTEXT is not present, hide the div container, else display the div and load the text from xml.
	if (xb[CurrentCFAProduct].getElementsByTagName("FOOTERTEXT")[0] == null) {
			document.getElementById('footerText').style.display = 'none';
	} else {
			document.getElementById('footerText').style.display = '';
			document.getElementById('lbvLabelSep1').innerHTML = xb[CurrentCFAProduct].getElementsByTagName("FOOTERTEXT")[0].childNodes[0].nodeValue;
	}
	
	// If IMAGESFOLDER is present, load the new value from the xml for the images folder path.  If not, load the default.
	if (xb[CurrentCFAProduct].getElementsByTagName("IMAGESFOLDER")[0] == null) {
		
			document.getElementById('headerContainer').innerHTML = "<IMG BORDER=\"0\" ALT=\"" + productName + "\" SRC=\"" + imagesFolder  + headerImage + "\">"
			
		} else {
			
			imagesFolder = xb[CurrentCFAProduct].getElementsByTagName("IMAGESFOLDER")[0].childNodes[0].nodeValue;
			document.getElementById('headerContainer').innerHTML = "<IMG BORDER=\"0\" ALT=\"" + productName + "\" SRC=\"" + imagesFolder  + headerImage + "\">"		
	}
		
	//same as IMAGESFOLDER	
	if (xb[CurrentCFAProduct].getElementsByTagName("HEADERIMAGE")[0] == null) {
	
			document.getElementById('headerContainer').innerHTML = "<IMG BORDER=\"0\" ALT=\"" + headerAltTag + "\" SRC=\"" + imagesFolder  + headerImage + "\">"
	
		} else {
			
			headerImage = xb[CurrentCFAProduct].getElementsByTagName("HEADERIMAGE")[0].childNodes[0].nodeValue;
			document.getElementById('headerContainer').innerHTML = "<IMG BORDER=\"0\" ALT=\"" + headerAltTag + "\" SRC=\"" + imagesFolder  + headerImage + "\">"		
	}
	
		// if HEADERTEXT is present, load the value from xml and apply to the form label.  If not, load the default.
	if (productCategory == "RESEARCH" || productCategory == "DEFAULT" || productCategory == "CORPSYSTEM" || productCategory == "CORPINCOMETAX" || productCategory == "CORPSALESTAX"){
		if (xb[CurrentCFAProduct].getElementsByTagName("HEADERTEXT")[0] == null) {
				headerText = "Thank you for your interest in " + productName + ".  Please fill out the form and submit the information below.";
				document.getElementById('lbvLabel3').innerHTML = headerText ;
			} else {
				headerText = xb[CurrentCFAProduct].getElementsByTagName("HEADERTEXT")[0].childNodes[0].nodeValue;
				document.getElementById('lbvLabel3').innerHTML = headerText ;
				
		}
	} else {
		if (xb[CurrentCFAProduct].getElementsByTagName("HEADERTEXT")[0] == null) {
				//headerText = "Thank you for your interest in " + productName + ".  Please fill out the form and submit the information below.";
				document.getElementById('lbvLabel3').innerHTML = headerText ;
			} else {
				headerText = xb[CurrentCFAProduct].getElementsByTagName("HEADERTEXT")[0].childNodes[0].nodeValue;
				document.getElementById('lbvLabel3').innerHTML = headerText ;
				
		}
	}
	
	if (productCategory == "STORE"){  // testing, header text for the store.  
			headerText = "Thank you for your interest in " + productName + ".  Please fill out the form and submit the information below.";
			document.getElementById('lbvLabel3').innerHTML = headerText ;
	}
			

	//if CSSFILE is present, change the css stylsheet to the specified value.  If not, load default.
	if (xb[CurrentCFAProduct].getElementsByTagName("CSSFILE")[0] == null) {
		//
		} else {
			cssFile = xb[CurrentCFAProduct].getElementsByTagName("CSSFILE")[0].childNodes[0].nodeValue;
			changeStyle(cssFile);
	}
	
	// Hide/unhide COMMENTSBOX		
	if (xb[CurrentCFAProduct].getElementsByTagName("COMMENTSBOX")[0] == null) {
		document.getElementById('commentsBox').style.display = 'none';
	} else {
		document.getElementById('commentsBox').style.display = '';
		document.getElementById('lblComments').innerHTML = xb[CurrentCFAProduct].getElementsByTagName("COMMENTSBOX")[0].childNodes[0].nodeValue;
	}
	
	
	
	if (productCategory == "PROSYSTEM" || productCategory == "DEFAULT" || productCategory == "CORPSYSTEM" ){ // Both Pfx and CorpSystem forms have license agreement checkbox that can be hidden or shown.  
	// if LICENSEAGREEMENT is not present, hide the div container, else display the div.
		if (xb[CurrentCFAProduct].getElementsByTagName("LICENSEAGREEMENT")[0] == null) {
			if(document.getElementById('rblLicenseAgreementRadio') == null){
				// do nothing
			} else {
				document.getElementById('rblLicenseAgreementRadio').value = 'not applicable';
			}
		} else {
				document.getElementById('licenseBox').style.display = '';
				document.getElementById('licenseAgreementBox').style.display = '';
		}
	}
	
	if (productCategory == "RESEARCH" || productCategory == "DEFAULT"){ // for Research form only
	// if HIDECCHACCOUNTNUM is present, hide the CCH Account Number field, else display it.
		if (xb[CurrentCFAProduct].getElementsByTagName("CCHACCOUNTNUM")[0] == null) {
				//
		} else {
				document.getElementById('cchAccountNumber').style.display = '';
		}
	}
	
	if (xb[CurrentCFAProduct].getElementsByTagName("HIDEPFXACCOUNTNUM")[0] == null) {
				//
		} else {
				document.getElementById('pfxAccountNumber').style.display = 'none';
		}
	
	

	if (productCategory == "PROSYSTEM" || productCategory == "NEWSLETTER" || productCategory == "DEFAULT" || productCategory == "CORPSYSTEM"){ //
	// if PRODUCTTYPE is present, hide the product type dropdown, else display the dropdown.
		if (xb[CurrentCFAProduct].getElementsByTagName("PRODUCTTYPE")[0] == null) {
				//
		} else {
				document.getElementById('productTypeDropDown').style.display = 'none';
				document.getElementById('ddlProducts').value = xb[CurrentCFAProduct].getElementsByTagName("PRODUCTTYPE")[0].childNodes[0].nodeValue;
		}
	}
	
	
	
	if (productCategory == "STORE"){ //
	
		if(document.getElementById('ddlProducts') == null){
			//
		} else {
	
		document.getElementById('ddlProducts').value = 440;
		}
	
	}
	
	
	
	//replace default Submit button with an image in xml
	if (xb[CurrentCFAProduct].getElementsByTagName("BUTTONIMAGE")[0] == null) {
		//
	} else {
		document.getElementById('buttonContainer').style.display = 'none';
		document.getElementById('buttonContainer2').style.display = '';
		document.getElementById('btnSubmitImage').src = xb[CurrentCFAProduct].getElementsByTagName("BUTTONIMAGE")[0].childNodes[0].nodeValue;
		
	}
	
	

	

	
	
	if (xb[CurrentCFAProduct].getElementsByTagName("EVENTCATEGORY")[0] == null) {  // for coremetrics event tagging.
		
			//
			
		} else {
			

			eventCategory = xb[CurrentCFAProduct].getElementsByTagName("EVENTCATEGORY")[0].childNodes[0].nodeValue;
			
	}
	
	
	
	// Coremetrics code Event Tagging.  I love Coremetrics!
	
		switch (productCategory){
			
			case "Default":
			eventIDname = "Default - ";
			break;
	
			case "PROSYSTEM":
			eventIDname = "ProSystem fx - ";
			break;
			
			case "CORPSYSTEM":
			eventIDname = "CorpSystem - ";
			break;
			
			case "RESEARCH":
			eventIDname = "CCH Research - ";
			break;
			
			case "CORPINCOMETAX":
			eventIDname = "CorpSystem Income Tax - ";
			break;
			
			case "CORPSALESTAX":
			eventIDname = "CorpSystem Sales Tax - ";
			break;
			
			case "STORE":
			eventIDname = "Online Store - ";
			break;
			
			case "CCHUNIVERSITY":
			eventIDname = "CCHUniversity - ";
			break;
			
			case "NEWSLETTER":
			eventIDname = "Newsletters - ";
			break;
		
		}
	cmCreateConversionEventTag(eventIDname + productNameNoHTML,"1",eventCategory, "0");
	
	
	// currently for Prosystem-Default2 form only. if PRODUCTCHECKBOX is in xml, create products checkbox list.
		if (xb[CurrentCFAProduct].getElementsByTagName("PRODUCTCHECKBOX")[0] == null) { 
			if(document.getElementById('txtproductsSelected') == null){
			} else {
			document.getElementById('txtproductsSelected').value = "not applicable";
			}
			
		} else {
			
			document.getElementById('productCheckBoxTemp').style.display = "";
			
			document.getElementById('productCheckBoxTitle').innerHTML = xb[CurrentCFAProduct].getElementsByTagName("PRODUCTCHECKBOXTITLE")[0].childNodes[0].nodeValue;
			
			var pBoxes = xb[CurrentCFAProduct].getElementsByTagName("PRODUCTCHECKBOX");
			for (var pb=0; pb<pBoxes.length; pb++) {
			document.getElementById('productCheckBoxElement').innerHTML += "<input type=\"checkbox\" value=\"" + pBoxes[pb].childNodes[0].nodeValue + "\" onclick=OnChangeCB(this)>" + pBoxes[pb].childNodes[0].nodeValue + "<BR>";
				}
		}
	
	
	
	
	// for Research forms; hide/unhide Priority Codes dropdown and add options if they are present in the xml.
	if (productCategory == "RESEARCH" || productCategory == "DEFAULT"){
	
		if (xb[CurrentCFAProduct].getElementsByTagName("SELECT")[0] == null) {
				
			document.getElementById('txtPriorityCodesTxtField').value = "none";
				
			} else {
				document.getElementById('priorityCodesDiv').style.display = '';
				document.getElementById('txtPriorityCodesTxtField').value = "";
				function addOption(selectbox,text,value )
				{
				var optn = document.createElement("OPTION");
				optn.text = text;
				optn.value = value;
				document.form1.priorityCodesTemp.options.add(optn);
				}
				
				function removeAllOptions (selectbox)
				
				{
				
					var count;
				
					for (count = selectbox.options.length - 1 ; count >=0 ; count--){
				
					selectbox.remove (count);
				
					}
				
				}
		
				var pCodes = xb[CurrentCFAProduct].getElementsByTagName("SELECT");
				
				//removeAllOptions(document.getElementById('ddlPriorityCodes'));
				
				for (var pc=0; pc<pCodes.length; pc++) {
					addOption(document.form1.priorityCodesTemp,  pCodes[pc].childNodes[0].nodeValue, pCodes[pc].childNodes[0].nodeValue);
				}
				
				
				
			}
	}
	
}



// function to change values in the confirmation page
function changeValuesConf() {

//declare variables
	var imagesFolder;
	var headerImage;
	var pageTitle;
	var bodyBackgroundColor;
	var backgroundColor;
	var leadSourceText;
	var productName;
	var productCode;
	var defaultProductCode;
	// var productCategory;
	var productNameNoHTML;
	var headerAltTag;
	var cpContent;
	var cssFile;
	var eventCategory;
	var eventIDname;
	
	
	// This function decodes the any string
	// that's been encoded using URL encoding technique
	function URLDecode(psEncodeString)
	{
	  // Create a regular expression to search all +s in the string
	  var lsRegExp = /\+/g;
	  // Return the decoded string
	  return unescape(String(psEncodeString).replace(lsRegExp, " "));
	}
	
	
		function getQueryVariable(variable) {
		  var query = window.location.search.substring(1);
		  var vars = query.split("&");
		  for (var i=0;i<vars.length;i++) {
			var pair = vars[i].split("=");
			if (pair[0].toLowerCase()== variable.toLowerCase()) {
			  return URLDecode(pair[1]);
			}
		  }
		 //alert('Query Variable ' + variable + ' not found');
		}
	
	var leadSource = getQueryVariable('leadSource'); 
	

	
	//load XML
	var xmlDoc;
	var xmlURL = "/cforms/scripts/cforms.xml";
	new Ajax.Request(xmlURL, {
	method: "get",
	asynchronous: false,
	onSuccess: function(resp, jsonObj) {
	xmlDoc = resp.responseXML;
	}
	});
	
	var x=  xmlDoc.documentElement;
	var xa = xmlDoc.documentElement.childNodes;
	var xb = xmlDoc.getElementsByTagName("PRODUCTCODE");
		
	var CurrentCFAProduct;	
	
	productCategory.toUpperCase();
	
	function loadTheDefault(){
		switch (productCategory){
			
			case "DEFAULT":
			leadSource = "Default";
			break;
	
			case "PROSYSTEM":
			leadSource = "Pfx-Default";
			break;
			
			case "CORPSYSTEM":
			leadSource = "Corp-Default";
			break;
			
			case "RESEARCH":
			leadSource = "Research-Default";
			break;
			
			case "CORPINCOMETAX":
			leadSource = "CorpIncomeTax-Default";
			break;
			
			case "CORPSALESTAX":
			leadSource = "CorpSalesTax-Default";
			break;
			
			case "STORE":
			leadSource = "Store-Default";
			break;
			
			case "CCHUNIVERSITY":
			leadSource = "CCHUniversity-Default";
			break;
			
			case "NEWSLETTER":
			leadSource = "Newsletter-Default";
			break;
		
		}
		
		for (var j=0; j<xb.length; j++)						
			{			
				
				xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue = xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue.toUpperCase();	
				leadSource = leadSource.toUpperCase();	
					if (xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue === leadSource)						
					{						
						CurrentCFAProduct = j;	
						break;						
					}						
			}	
				imagesFolder = xb[CurrentCFAProduct].getElementsByTagName("IMAGESFOLDER")[0].childNodes[0].nodeValue;
				productName = xb[CurrentCFAProduct].getElementsByTagName("PRODUCTNAME")[0].childNodes[0].nodeValue;
				leadSourceText = xb[CurrentCFAProduct].getElementsByTagName("LEADSOURCE")[0].childNodes[0].nodeValue;
				headerImage = xb[CurrentCFAProduct].getElementsByTagName("HEADERIMAGE")[0].childNodes[0].nodeValue;
				bodyBackgroundColor = "white";
				backgroundColor = xb[CurrentCFAProduct].getElementsByTagName("BACKGROUNDCOLOR")[0].childNodes[0].nodeValue;
				pageTitle = xb[CurrentCFAProduct].getElementsByTagName("PAGETITLE")[0].childNodes[0].nodeValue;
				cpContent = xb[CurrentCFAProduct].getElementsByTagName("CPCONTENT")[0].childNodes[0].nodeValue;
				cssFile = xb[CurrentCFAProduct].getElementsByTagName("CSSFILE")[0].childNodes[0].nodeValue;
				eventCategory = xb[CurrentCFAProduct].getElementsByTagName("EVENTCATEGORY")[0].childNodes[0].nodeValue;
				
	}
	
	
	
	//if no query variable in the URL, load defaults.
	if (leadSource == undefined || leadSource == ""){
		
		loadTheDefault();
	   
	   } else {	 //if query variable is present, loop through xml document to identify the form	
			
			var foundLeadSource = new Boolean();
			foundLeadSource = false;
			//loop through the xml document		
			for (var j=0; j<xb.length; j++)						
			{						
				xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue = xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue.toUpperCase();	
				leadSource = leadSource.toUpperCase();	
					if (xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue === leadSource)						
					{						
						CurrentCFAProduct = j;	
						foundLeadSource = true;
						break;				
						
					} 
			}
			
	}
	
	if(foundLeadSource){  // if leadSource variable doesn't match any of the productCodes in the xml, load the defaults
		//
	} else {
		loadTheDefault();
	}
	
	
	if (productCategory == "STORE"){
		if(foundLeadSource){  // if leadSource variable doesn't match any of the productCodes in the xml, load the defaults
			//
		} else {
			loadTheDefault();
			var leadSource = getQueryVariable('leadSource');
		}
	}
	
	//load default values
	switch (productCategory){
		
			case "DEFAULT":
			defaultProductCode = "Default";
			break;
	
			case "PROSYSTEM":
			defaultProductCode = "Pfx-Default";
			break;
			
			case "CORPSYSTEM":
			defaultProductCode = "Corp-Default";
			break;
			
			case "RESEARCH":
			defaultProductCode = "Research-Default";
			break;
			
			case "CORPSALESTAX":
			defaultProductCode = "CorpSalesTax-Default";
			break;
			
			case "CORPINCOMETAX":
			defaultProductCode = "CorpIncomeTax-Default";
			break;
			
			case "STORE":
			defaultProductCode = "Store-Default";
			break;
			
			case "CCHUNIVERSITY":
			defaultProductCode = "CCHUniversity-Default";
			break;
			
			case "NEWSLETTER":
			defaultProductCode = "Newsletter-Default";
			break;
			

		
	}
	
	for (var m=0; m<xb.length; m++)						
	{						
				xmlDoc.getElementsByTagName("PRODUCTCODE")[m].attributes.getNamedItem("id").nodeValue = xmlDoc.getElementsByTagName("PRODUCTCODE")[m].attributes.getNamedItem("id").nodeValue.toUpperCase();	
					
					defaultProductCode = defaultProductCode.toUpperCase();
					
					if (xmlDoc.getElementsByTagName("PRODUCTCODE")[m].attributes.getNamedItem("id").nodeValue === defaultProductCode)						
					{						
						CurrentDefaultProduct = m;
						imagesFolder = xb[CurrentDefaultProduct].getElementsByTagName("IMAGESFOLDER")[0].childNodes[0].nodeValue;
						productName = xb[CurrentDefaultProduct].getElementsByTagName("PRODUCTNAME")[0].childNodes[0].nodeValue;
						leadSourceText = xb[CurrentDefaultProduct].getElementsByTagName("LEADSOURCE")[0].childNodes[0].nodeValue;
						headerImage = xb[CurrentDefaultProduct].getElementsByTagName("HEADERIMAGE")[0].childNodes[0].nodeValue;
						bodyBackgroundColor = "white";
						backgroundColor = xb[CurrentDefaultProduct].getElementsByTagName("BACKGROUNDCOLOR")[0].childNodes[0].nodeValue;
						pageTitle = xb[CurrentDefaultProduct].getElementsByTagName("PAGETITLE")[0].childNodes[0].nodeValue;
						cpContent = xb[CurrentDefaultProduct].getElementsByTagName("CPCONTENT")[0].childNodes[0].nodeValue;
						cssFile = xb[CurrentDefaultProduct].getElementsByTagName("CSSFILE")[0].childNodes[0].nodeValue;
						eventCategory = xb[CurrentDefaultProduct].getElementsByTagName("EVENTCATEGORY")[0].childNodes[0].nodeValue;
						break;						
					}		
				
	}	
	
	// productCategory = xb[CurrentCFAProduct].parentNode.nodeName;
	
	
	// identify the form
	//productCode = xmlDoc.getElementsByTagName("PRODUCTCODE")[j].attributes.getNamedItem("id").nodeValue; // required
	
	if (xb[CurrentCFAProduct].getElementsByTagName("LEADSOURCE")[0] == null) {
		//
	   }else {
			leadSourceText = xb[CurrentCFAProduct].getElementsByTagName("LEADSOURCE")[0].childNodes[0].nodeValue;
	}
	
	if (productCategory == "STORE"){
		leadSourceText = leadSource;
	}
	
	
	if (xb[CurrentCFAProduct].getElementsByTagName("PRODUCTNAME")[0] == null) {
	//
	   }else {
			productName = xb[CurrentCFAProduct].getElementsByTagName("PRODUCTNAME")[0].childNodes[0].nodeValue;
	}
	
	if (productCategory == "STORE"){
		productName = leadSource;
	}
		
	if (xb[CurrentCFAProduct].getElementsByTagName("BODYBACKGROUNDCOLOR")[0] == null) {
		
			//
			
		} else {
				bodyBackgroundColor = xb[CurrentCFAProduct].getElementsByTagName("BODYBACKGROUNDCOLOR")[0].childNodes[0].nodeValue;
				document.body.style.background = bodyBackgroundColor;
	}
	
			
	if (xb[CurrentCFAProduct].getElementsByTagName("BACKGROUNDCOLOR")[0] == null) {
		
			document.getElementById('CFA-mainDiv').style.backgroundColor = backgroundColor;
			
		} else {
				backgroundColor = xb[CurrentCFAProduct].getElementsByTagName("BACKGROUNDCOLOR")[0].childNodes[0].nodeValue;
				document.getElementById('CFA-mainDiv').style.backgroundColor = backgroundColor;
	}
		
		
		
	if (xb[CurrentCFAProduct].getElementsByTagName("PAGETITLE")[0] == null) {
			productNameNoHTML = productName.replace(/<\/?[^>]+(>|$)/g, "");	
			pageTitle = productNameNoHTML;
			document.title = pageTitle;
			headerAltTag = pageTitle;
	} else {
			var pageTitle = xb[CurrentCFAProduct].getElementsByTagName("PAGETITLE")[0].childNodes[0].nodeValue;
			productNameNoHTML = pageTitle.replace(/<\/?[^>]+(>|$)/g, "");
			document.title = pageTitle;
			headerAltTag = pageTitle;
	}
	
	
	if (productCategory == "STORE"){
		pageTitle = leadSource;
		productNameNoHTML = pageTitle.replace(/<\/?[^>]+(>|$)/g, "");
		document.title = pageTitle;
		headerAltTag = pageTitle;
	}
			
	
	
	if (xb[CurrentCFAProduct].getElementsByTagName("IMAGESFOLDER")[0] == null) {
		
			document.getElementById('headerContainer').innerHTML = "<IMG BORDER=\"0\" ALT=\"" + productName + "\" SRC=\"" + imagesFolder  + headerImage + "\">"
			
		} else {
			
			imagesFolder = xb[CurrentCFAProduct].getElementsByTagName("IMAGESFOLDER")[0].childNodes[0].nodeValue;
			document.getElementById('headerContainer').innerHTML = "<IMG BORDER=\"0\" ALT=\"" + productName + "\" SRC=\"" + imagesFolder  + headerImage + "\">"		
	}
			
	if (xb[CurrentCFAProduct].getElementsByTagName("HEADERIMAGE")[0] == null) {
	
			document.getElementById('headerContainer').innerHTML = "<IMG BORDER=\"0\" ALT=\"" + headerAltTag + "\" SRC=\"" + imagesFolder  + headerImage + "\">"
	
		} else {
			
			headerImage = xb[CurrentCFAProduct].getElementsByTagName("HEADERIMAGE")[0].childNodes[0].nodeValue;
			document.getElementById('headerContainer').innerHTML = "<IMG BORDER=\"0\" ALT=\"" + headerAltTag + "\" SRC=\"" + imagesFolder  + headerImage + "\">"		
	}
	
	
	
	
	// load confirmation page content
	if (xb[CurrentCFAProduct].getElementsByTagName("CPCONTENT")[0] == null) {
		document.getElementById('confirmationContent').innerHTML = cpContent;
	} else {
		cpContent = xb[CurrentCFAProduct].getElementsByTagName("CPCONTENT")[0].childNodes[0].nodeValue;
		document.getElementById('confirmationContent').innerHTML = cpContent;
	}
	
	
	if (productCategory == "STORE"){ // testing for store.  Automatic Confirmation page content.
		cpContent = "Thank you for you interest in " + productName + ".<BR>  Your CCH Account Representative will contact you shortly.<BR><BR>If you need more information, please visit the <a href='http://tax.cchgroup.com/Books/default.htm'>Books Home Page</a>.<BR><BR>You can now close this browser window.<BR><BR><BR><BR>";
		document.getElementById('confirmationContent').innerHTML = cpContent;
	}
	
	
	
	if (xb[CurrentCFAProduct].getElementsByTagName("CSSFILE")[0] == null) {
		//
		} else {
			cssFile = xb[CurrentCFAProduct].getElementsByTagName("CSSFILE")[0].childNodes[0].nodeValue;
			changeStyle(cssFile);
	}
	
	if (xb[CurrentCFAProduct].getElementsByTagName("EVENTCATEGORY")[0] == null) { // for coremetrics
		
			//
			
		} else {
			
			eventCategory = xb[CurrentCFAProduct].getElementsByTagName("EVENTCATEGORY")[0].childNodes[0].nodeValue;
	}
	
	
		switch (productCategory){ // for coremetrics
		
			case "DEFAULT":
			eventIDname = "Default - ";
			break;
	
			case "PROSYSTEM":
			eventIDname = "ProSystem fx - ";
			break;
			
			case "CORPSYSTEM":
			eventIDname = "CorpSystem - ";
			break;
			
			case "RESEARCH":
			eventIDname = "CCH Research - ";
			break;
			
			case "CORPINCOMETAX":
			eventIDname = "CorpSystem Income Tax - ";
			break;
			
			case "CORPSALESTAX":
			eventIDname = "CorpSystem Sales Tax - ";
			break;
		
			case "STORE":
			eventIDname = "Online Store - ";
			break;
			
			case "CCHUNIVERSITY":
			eventIDname = "CCHUniversity - ";
			break;
			
			case "NEWSLETTER":
			eventIDname = "Newsletter - ";
			break;
		}
	
	cmCreateConversionEventTag(eventIDname + productNameNoHTML,"2",eventCategory, "1");
	

}