/*Sorting Logic (Which questions map to which products) */
function Questions2Products() {

	/* reset all flags to know false values */
	this.Aboriginal					= false;
	this.AddOpt							= false;
	this.Aerogold						= false;
	this.Agriculture				= false;
	this.Bizline						= false;
	this.CAIS								= false;
	this.CBIA								= false;
	this.CBOA								= false;
	this.Commercial					= false;
	this.CreditEdge					= false;
	this.DD									= false;
	this.EquipmentFinancing	= false;
	this.FML								= false;
	this.FOL								= false;
	this.FTL								= false;
	this.FxOnline						= false;
	this.GroupRRSPs					= false;
	this.Health							= false;
	this.Instalment					= false;
	this.LLC								= false;
	this.Merchant						= false;
	this.Nonprofit					= false;
	this.Overdraft					= false;
	this.PAP								= false;
	this.Payroll						= false;
	this.Rapid							= false;
	this.RLC								= false;
	this.SBExtra						= false;
	this.SERM								= false;
	this.Startup						= false;
	this.Trade							= false;
	this.USDollar						= false;
	
	this.setDisplayFlags = function(questionData) {
		/*************************
		if user has selected Agriculture as their industry then show 
		the Agricultural Bundle description and the CAIS deposit account
		*************************/
		if (questionData['businessIndustry'].value == '1A') {
			this.Agriculture = true;
			this.CAIS = true;
		}
		/*************************
		if user has selected Health Care as their industry then show 
		the Health Care Bundle description 
		*************************/
		else if (questionData['businessIndustry'].value == '1D') {
			this.Health = true;
		}
		/*************************
		if user has selected Aboriginal as their industry then 
		show the Aboriginal Bundle description 
		*************************/
		else if (questionData['businessIndustry'].value == '1I') {
			this.Aboriginal = true;
		}
		// end if
		
		
		/*************************
		if user has selected less then 2 years as their time in 
		business then show the Startup Baking Bundle description 
		*************************/
		if (questionData['timeOfOperation'].value == '2A') {
				this.Startup = true;
		}
		// end if
		
		
		/*************************
		if user has selected that do their banking through a banking 
		machine or debit card and they have also stated that they do not
		require $US currency or other foreign currency to run their business
		then show the additional option for Business Account Banking. 
		*************************/

		/*if (questionData['preferredBanking3C'].value == '3C' && questionData['foreignCurrency'].value != '7A') {*/
		if (questionData['preferredBanking3C'].value == '3C') {
				this.AddOpt = true;
		}
		// end if
		
		
		/*************************
		if user has indicated that are a Non-Profit Company and also 
		indicated that they conduct less then 10 transactions a month 
		then show the Non-Profit Flat Fee package 
		*************************/
		if (questionData['transactions'].value == '4A' && questionData['businessIndustry'].value == '1G') {
			this.Nonprofit = true;
		}
		//end if
		
		
		/*************************
		if user has indicated that they have more then 
		only one employee then show payroll
		*************************/
		if (questionData['numberOfEmployees'].value != '5A') {
			//this.Payroll = true;	
			this.GroupRRSPs = true;	
		}
		//end if
		
		
		/*************************
		if user has selected that they pay their employees 
		electronically and have more then 10 employees then show Direct Deposit.
		*************************/
		
		if (questionData['howToPay6B'].value == '6B' 
				&&
				(questionData['numberOfEmployees'].value == '5B' || questionData['numberOfEmployees'].value == '5D' || questionData['numberOfEmployees'].value == '5C')) {
			this.DD = true;
			this.Payroll = true;
		}
		//end if
		
		
		/*************************
		if user has selected that they pay their employees 
		by cheque and have more then 10 employees then show Direct Deposit.
		*************************/
		if (questionData['howToPay6A'].value == '6A'
				&&
				(questionData['numberOfEmployees'].value == '5B' || questionData['numberOfEmployees'].value == '5D' || questionData['numberOfEmployees'].value == '5C')) {
			this.DD = true;
		}
		//end if
		
		
		/*************************
		if user has selected that they pay their employees by 
		cash, electronically or by outsourced payroll then show 
		Direct Deposit and payroll.
		*************************/
		if (questionData['howToPay6C'].value == '6C' 
				&&
				(questionData['numberOfEmployees'].value == '5B' || questionData['numberOfEmployees'].value == '5D' || questionData['numberOfEmployees'].value == '5C')) {
			this.Payroll = true;
		}
		//end if
		
		
		/*************************
		if user has indicated that they require $US or foreign 
		currency to conduct their business then show US Dollar 
		account, FxOnline and Trade Finance.
		*************************/
		if (questionData['foreignCurrency'].value == '7A') {
			this.USDollar = true;
			this.FxOnline = true;
			this.Trade = true;	
		}
		/*************************
		if user has indicated that they do not require $US or 
		foreign currency to conduct their business then show 
		Business Operating Account.
		*************************/
		else {
			this.CBOA = true;
		}
		//end if
		
		
		/*************************
		if user has selected that their suppliers by cheque or 
		electronically then show Direct Deposit
		*************************/
		if (questionData['paySuppliers8A'].value == '8A' || questionData['paySuppliers8B'].value == '8B') {
			this.DD = true;
		}
		// end if
		
		
		/*************************
		if user has selected that they receive payments from their 
		customers in cheque or credit card or debit card then show 
		Merchant Services
		*************************/
		if (questionData['payments9A'].value == '9A' || questionData['payments9C'].value == '9C' || questionData['payments9D'].value == '9D') {
			this.Merchant = true;
		}
		//end if
		
		
		/*************************
		if user has selected that they receive payments from their 
		customers electronically then show Merchant Services and 
		Pre-Authorized Payments
		*************************/
		if (questionData['payments9B'].value == '9B') {
			this.PAP = true;
			this.Merchant = true;
		}
		// end if
		
		
		/*************************
		if user has selected that they receive payments from their customers 
		by Pre-Authorized payment then show Pre-Authorized Payments
		*************************/
		if (questionData['payments9G'].value == '9G') {
			this.PAP = true;
		}
		//end if
		
		
		/*************************
		if user has selected that they receive payments by letters 
		of credit then show Trade Finance
		*************************/
		if (questionData['payments9I'].value == '9I')	{
			this.Trade = true;
		}
		//end if
		
		/*************************
		if user has indicated that they have multiple locations then show Rapidtrans
		*************************/
		if (questionData['multipleLocations'].value == '10A') {
			this.Rapid = true;
		}
		//end if
		
		
		/*************************
		if user has selected that they conduct business outside of 
		Canada then then show US Dollar account, FxOnline and Trade Finance.
		*************************/
		if (questionData['businessOutsideCanada'].value == '11A') {
			this.USDollar = true;
			this.FxOnline = true;
			this.Trade = true;
		}
		//end if
		
		
		/*************************
		if user has indicated that they own more then 20% of their company 
		and that they want short-term financing under 250,000 then show overdraft
		*************************/
		if (questionData['financingRequired'].value == '12A') {
			if (questionData['timeOfOperation'].value != '2A') {
				this.Overdraft = true;
			}
			/*************************
			if user has indicated that they own more then 20% of their company and 
			that they want short-term financing under 250,000 and are in Agriculture 
			then show Farm Operating Loan
			*************************/
			if (questionData['businessIndustry'].value == '1A') {
				this.FOL = true;
			}
		}
		
		/*************************
		if user has indicated that they own more then 20% of their 
		company and that they want short-term financing over 250,000 
		and are not a Non-Profit then show Revolving Line of Credit
		*************************/
		else if (questionData['financingRequired'].value == '12B' && questionData['businessIndustry'].value != '1G') {
			this.RLC = true;
			/*************************
			if user has indicated that they own more then 20% of their company 
			and that they want short-term financing over 250,000 and are in 
			Agriculture then show Farm Operating Loan
			*************************/
			if (questionData['businessIndustry'].value == '1A') {
				this.FOL = true;
			}
		}
		
		/*************************
		if user has indicated that they own more then 20% of their company and 
		that they want long-term financing under 250,000 and are in Agriculture 
		then show Farm Operating Loan
		*************************/
		else if (questionData['businessIndustry'].value == '1A' && questionData['financingRequired'].value == '12C')	{
			this.FOL = true;
		}
				
		/*************************
		if user has indicated no then show Business Interest Account
		*************************/
		else if (questionData['financingRequired'].value == '12E') {
				this.CBIA = true;
		}
		//end if

		/*************************
		if user has indicated that they own more then 20% of their 
		company and that they want long-term financing and are not a 
		non-profit and make over 35,000 a year then show SERM
		*************************/
		if (	(questionData['businessIndustry'].value != '1G' && questionData['businessIndustry'].value != '1A')
							&& 
							questionData['revenue'].value != '14A' 
							&& 
							(questionData['financingRequired'].value == '12C' || questionData['financingRequired'].value == '12D') ){
			this.SERM = true;
		}	
		
		
		
		/*************************
		if user has indicated that they own more then 20% of their company and 
		that they want long-term financing over 250,000 and are not a non-profit 
		then show Revolving Line of Credit and Instalment Loans
		*************************/
		if (questionData['financingRequired'].value == '12D' && questionData['businessIndustry'].value != '1G') {
			this.RLC = true;
			this.Instalment = true;
			/*************************
			if user has indicated that they own more then 20% of their company and 
			that they want long-term financing under 250,000 and are in Agriculture 
			then show Farm Operating Loan
			*************************/
			if (questionData['businessIndustry'].value == '1A') {
				this.FOL = true;
			}
		}
		/*************************
		if user has selected that they will hire more staff then show 
		Payroll and Direct Deposit
		*************************/
		if (questionData['willYou13A'].value == '13A') {
			this.Payroll = true;
			this.DD = true;
		}//end if
		
		
		/*************************
		if user has selected that they will purchase additional business 
		*************************/
		if (questionData['willYou13B'].value == '13B') {
			/*************************
			if user has selected that they will purchase additional business and 
			have business for over 2 years and are not a non-profit and have indicated 
			they would like to borrow a short-term loan over or under 250,000 then 
			show Loans and Lines of Credit 100K-250K
			*************************/
			if (questionData['timeOfOperation'].value != '2A' 
					&&
					questionData['businessIndustry'].value != '1G' 
					&&
					(questionData['financingRequired'].value == '12A' || questionData['financingRequired'].value == '12C')) {
				this.LLC = true;
			}
		
			/*************************
			if user has selected that they will purchase additional business and 
			are in agriculture and have indicated that they would like to borrow a 
			short or long term loan over  250,000 then show Farm Mortgage Loan
			*************************/
			if (questionData['businessIndustry'].value == '1A' 
					&&
					(questionData['financingRequired'].value == '12C' || questionData['financingRequired'].value == '12D') ) {
				this.FML = true;
			}
		} //end if
		
		
		/*************************
		if user has selected that they will expand locations then show Rapidtrans
		*************************/
		if (questionData['willYou13C'].value == '13C') {
			this.Rapid = true;
			
			/*************************
			If user has selected that they are not a non-profit, that they will start doing
			 business outside of Canada and have indicated that they would like to borrow 
			 short term under 250,000
			*************************/
			if (questionData['businessIndustry'].value != '1G'
					&& 
					(questionData['financingRequired'].value == '12A' || questionData['financingRequired'].value == '12C')) {
		
						/*************************
						If user has selected that they are not a non-profit, they will start 
						doing business outside of Canada and have been in business for over 2 
						years and have indicated that they would like to borrow short term over 
						or under 250,000 than show Loans and Lines of Credit 100K-250K and Credit Edge
						*************************/
						if (questionData['timeOfOperation'].value != '2A'){
							this.LLC = true;
							this.CreditEdge = true;
						}
				} 
				
				/*************************
				if user has selected that they will expand locations and 
				are a professional, in retail and wholesale or are in 
				manufacturing and construction and have indicated they would 
				like a long or short term loan over 250,000 then show 
				Commercial Choice. 
				*************************/
				if ( (questionData['businessIndustry'].value == '1B' || questionData['businessIndustry'].value == '1C' || questionData['businessIndustry'].value == '1F') 
							&& 
							(questionData['financingRequired'].value == '12B' || questionData['financingRequired'].value == '12D') )	{
					this.Commercial = true;
				}
				if (	questionData['businessIndustry'].value == '1A' 
									&& 
									(questionData['financingRequired'].value == '12C' || questionData['financingRequired'].value == '12D') )	{
					this.FML = true;
				}
		}
		//end if
		
		
		/*************************
		if user has selected that they will start doing business 
		outside of Canada then show US Dollar Account, FxOnline 
		and Trade Finance
		*************************/
		if (questionData['willYou13D'].value == '13D') {
			this.USDollar = true;
			this.FxOnline = true;
			this.Trade = true;
			/*************************
			if user has selected that they will start doing business 
			outside of Canada and have indicated that they would like 
			to borrow short term under 250,000
			*************************/
			if  ( questionData['businessIndustry'].value != '1G' 
						&&
						(questionData['financingRequired'].value == '12A' || questionData['financingRequired'].value == '12C') ) {
				/*************************
				if user has selected that they will start doing business outside 
				of Canada and have been in business for over 2 years and have 
				indicated that they would like to borrow short term over or under 
				250,000 then show Loans and Lines of Credit 100K-250K and Credit Edge
				*************************/
				if (questionData['timeOfOperation'].value != '2A') {
					this.LLC = true;
					this.CreditEdge = true;
				}
			}
		}
		//end if
		
		
		/*************************
		if user has selected that they will expand products and services 
		and are not a non-profit 
		*************************/
		if (questionData['willYou13E'].value == '13E' && questionData['businessIndustry'].value != '1G') {
			/*************************
			if user has selected that they will expand products and services 
			and are not a non-profit and have indicated they would like to 
			borrow short-term under 250,000
			*************************/
			if ( questionData['financingRequired'].value == '12A' || questionData['financingRequired'].value == '12C'){
				/*************************
				if user has selected that they will expand products and 
				services and are not a non-profit and have indicated they 
				would like to borrow short-term over or under 250,000 and 
				have been in business for more then 2 years then show Loans 
				and Lines of Credit 100K-250K and Credit Edge
				*************************/
				if (questionData['timeOfOperation'].value != '2A') {
					this.LLC = true;
					this.CreditEdge = true;
				}
			}
			
			/*************************
			if user has selected that they will expand products 
			and services and are not a non-profit and have indicated 
			they would like to borrow short- or long- term over 250,000 
			and are in agriculture then show Farm Term Loan
			*************************/
			if (questionData['businessIndustry'].value == '1A' && (questionData['financingRequired'].value == '12C' || questionData['financingRequired'].value == '12D') ) {
				this.FTL = true;
			}
		}
		//end if
		
		
		/*************************
		if user has selected that they will buy or replace equipment 
		*************************/
		if (questionData['willYou13F'].value == '13F') {
			/*************************
			if user has selected that they will buy or replace equipment 
			and have indicated that they would like to borrow over 250,000 
			then show Equipment Financing
			*************************/
			if (questionData['financingRequired'].value == '12D' && questionData['businessIndustry'].value != '1G' ){
				this.EquipmentFinancing = true;		
			}
		
			/*************************
			if user has selected that they will buy or replace equipment 
			and have indicated they are in agriculture and have indicated 
			that they want to borrow long term then show Farm Term Loan
			*************************/
			if (questionData['businessIndustry'].value ==  '1A' && (questionData['financingRequired'].value == '12D' || questionData['financingRequired'].value == '12C') ) {
				this.FTL = true;
			}
			/*************************
			if user has selected that they will buy or replace equipment 
			and have indicated they would like to borrow under 250,000 
			*************************/
			if (questionData['businessIndustry'].value != '1G'
					&&
					(questionData['financingRequired'].value == '12A' || questionData['financingRequired'].value == '12C') ) {
				/*************************
				if user has selected that they will buy or replace equipment 
				and have indicated borrow under 250,000 and have indicated they 
				have been in business for more then 2 years then show Loans and 
				Lines of Credit 100K-250K and Credit Edge
				*************************/
				if (questionData['timeOfOperation'].value != '2A' ){
					this.LLC = true;
					this.CreditEdge = true;
				}
			}
		}
		//end if
		
		
		/*************************
		if user has selected that they will be renovating 
		*************************/
		if (questionData['willYou13G'].value == '13G') {
			/*************************
			if user has selected that they will be renovating and have 
			indicated they would like to borrow long-term then show Farm 
			Mortgage Loan
			*************************/
			if (questionData['businessIndustry'].value == '1A' && (questionData['financingRequired'].value == '12C' || questionData['financingRequired'].value == '12D') ) {
				this.FML = true;
			}
			/*************************
			if user has selected that they will be renovating and are 
			not a non-profit and have indicated they would like to borrow 
			under 250,000
			*************************/
			if (questionData['businessIndustry'].value != '1G' 
					&& 
					(questionData['financingRequired'].value == '12A' || questionData['financingRequired'].value == '12C') ) {
				/*************************
				if user has selected that they will be renovating and 
				are not a non-profit and have indicated they would like to 
				borrow under 250,000 then show Loans and Lines of Credit 100K-250K and Credit Edge
				*************************/
				if (questionData['timeOfOperation'].value != '2A') {
					this.LLC = true;
					this.CreditEdge = true;
				}
			}
		}
		//end if
		
		
		/*************************
		if user has selected that they will purchase commercial 
		property and are a professional, in retail and wholesale or 
		are in manufacturing and construction and have indicated they 
		would like a long or short term loan over 250,000 then show Commercial Choice.
		*************************/
		if (questionData['willYou13H'].value == '13H' 
					&& 
					(questionData['businessIndustry'].value == '1B' || questionData['businessIndustry'].value == '1C' || questionData['businessIndustry'].value == '1F') 
					&& 
					(questionData['financingRequired'].value == '12B' || questionData['financingRequired'].value == '12D') ) {
			this.Commercial = true;
		}
		
		/*************************
		if user has indicated that they make over 35,000 a year 
		then show Aerogold for Business and bizline
		*************************/
		if (questionData['revenue'].value != '14A')	{
			this.Aerogold = true;
			this.Bizline = true;
		}
		
		/*************************
		if user has indicated that they make over 500,000 a year and 
		have been in business for more then 2 years then show Aerogold 
		for Business, bizline and Small Business Extra
		*************************/
		/*if  ( (questionData['revenue'].value == '14E' || questionData['revenue'].value == '14F') && questionData['timeOfOperation'].value != '2A') {
			this.SBExtra = true;
		}*/
		//end if
		
		
		/*************************
		if user has indicated that have enough working capital 
		then show the Business Interest Account
		*************************/
		if (questionData['workingCapital'].value == '15A') {
			this.CBIA = true;
		}
		/*************************
		if user has indicated that do not have enough working 
		capital then show the Overdraft
		*************************/
		else	{
			if (questionData['timeOfOperation'].value != '2A') {
				this.Overdraft = true;
			}
		}
		//end if
	}
	//end setDisplayFlags
}

var sortingLogicLoaded = true;

function Displayer(ProductFlag, questionData) {

	ProductFlag.setDisplayFlags(questionData);
	
	this.servicesHolder = new Array();
	this.operatingHolder = new Array();
	this.outsideCanadaHolder = new Array();
	this.financingHolder = new Array();
	this.investingHolder = new Array();

	this.detect = navigator.userAgent.toLowerCase();
	this.checkIt = function(string)
	{
		var place = this.detect.indexOf(string) + 1;
		var thestring = string;
		this.version = this.detect.charAt(place + thestring.length);
		return place;
	}	

	//this.productDisplayed = new Array();
	
	this.services 																= new Array();
	this.services['bundleAgriculture']						= false;
	this.services['bundleAboriginal']							= false,
	this.services['bundleHealthCareServices']			= false;
	this.services['bundleStartup']								= false;
	this.services['bundleSmallBusinessExtra']			= false;

	this.operating	 															= new Array();
	this.operating['busAcctsAll']									= false;
	this.operating['busAcctsBusOpAcct']						= false;
	this.operating['busAcctsNonProfit']						= false;
	this.operating['busAcctsAddOpt']							= false;
	this.operating['busAcctsInterest']						= false;
	this.operating['busAcctsDepAcct']							= false;
	this.operating['cshMgtAll']										= false;
	this.operating['cshMgtGovtFiling']						= false;
	this.operating['cshMgtDirectDeposit']					= false;
	this.operating['cshMgtPreAuth']								= false;
	this.operating['cshMgtRapidtrans']						= false;
	this.operating['thrdPrtyCeridian']						= false;
	this.operating['thrdPrtyMerchant']						= false;

	this.outsideCanada														= new Array();
	this.outsideCanada['thrdPrtyTrade']						= false;
	this.outsideCanada['busAcctsUSDollar']				= false;
	this.outsideCanada['thrdPrtyFXOnline']				= false;

	this.financing 																= new Array();
	this.financing['borrowAll']										= false;
	this.financing['borrowSmBusOver']							= false;
	this.financing['borrowEqpFin']								= false;
	this.financing['borrowSmBusCreditEdge']				= false;
	this.financing['borrowSmBus100To250']					= false;
	this.financing['borrowingRevolvingLnOfCred']	= false;
	this.financing['borrowInstalLoans']						= false;
	this.financing['borrowCredIns']								= false;
	this.financing['borrowFarmOpLoan']						= false;
	this.financing['borrowFarmTermLoan']					= false;
	this.financing['borrowFarmMrtgLoan']					= false;
	this.financing['borrowFarmLoadIns']						= false;
	this.financing['borrowCommercialChoiceMrtg']	= false;
	this.financing['borrowSelfEmployed']					= false;
	this.financing['creditCardsBiz']							= false;
	this.financing['creditCardsAerogold']					= false;

	this.investing 																= new Array();
	this.investing['investPlanning']							= false;
	this.investing['investFlexible']							= false;
	this.investing['investShrtTrm']								= false;
	this.investing['investLngTrm']								= false;
	this.investing['investGroup']									= false;

																
	this.getDisplayDiv = function(divName) {
		if (this.checkIt('msie') && this.version == 6) {
			for (cntr in document.getElementById(divName).childNodes) {
				if (document.getElementById(divName).childNodes[cntr].className == 'bdyReco') {
					//alert(cntr + '\n\n' + document.getElementById(divName).childNodes[cntr].innerHTML);
					return document.getElementById(divName).childNodes[cntr];
				}
			}
			
		}
		else {
			return document.getElementById(divName).childNodes[3];
		}	
		return null;
	}

	this.addHTMLToDiv = function(content, divName) {
		if (!divName) return;
		
		var divObj = this.getDisplayDiv(divName);
		
		if (divObj) {		
			var oldContent = '';
			oldContent = divObj.innerHTML;
			divObj.innerHTML = content;
		}
	}

	this.addHTMLToHolder = function(content, divName) {
		if (!divName) return;
		eval('this.' + divName + 'Holder += content');
	}
	
	this.setProductIsDisplayed = function(productDivName, displayFlag) {
		if (!productDivName || !displayFlag) return null;
		var divIn = this.divToDisplayIn(productDivName);
		var divDisplay = eval ('this.' + divIn);
		if (divDisplay[productDivName] == false || divDisplay[productDivName] == true) {
			divDisplay[productDivName] = displayFlag;
		}
	}
	
	this.productIsDisplayed = function(productDivName) {
		if (!productDivName) return;
		var divIn = this.divToDisplayIn(productDivName);
		if (!divIn) document.write(productDivName);
		return eval ('this.' + divIn + '[productDivName]');
	}

	this.divToDisplayIn = function(productDivName) {
		if (!productDivName) {
			return null;
		}
		
		if ( this.services[productDivName] == false || this.services[productDivName] == true) {
			return 'services';
		}

		if (this.operating[productDivName] == false || this.operating[productDivName] == true) {
			return 'operating';
		}

		if ( this.outsideCanada[productDivName] == false || this.outsideCanada[productDivName] == true) {
			return 'outsideCanada';
		}

		if (this.financing[productDivName] == false || this.financing[productDivName] == true) {
			return 'financing';
		}
		
		if ( this.investing[productDivName] == false || this.investing[productDivName] == true) {
			return 'investing';
		}
		
		return null;
	}
	
	
	this.showProduct = function(productDivName) {
		if (!productDivName) return;
		var divIn = this.divToDisplayIn(productDivName);
		if (! this.productIsDisplayed(productDivName) && divIn) {
			if (document.getElementById(productDivName)) {
				this.setProductIsDisplayed(productDivName, true);
			}
		}
	}

	this.getProductHTML = function(productDivName) {
		if (!productDivName) return;
		if (document.getElementById(productDivName)) {
				return document.getElementById(productDivName).innerHTML;
		}
	}
	
	this.showSection = function(divName) {
		var section = eval('this.'+divName);
		for (prodName in section) {
			if (section[prodName] == true) {
				this.addHTMLToHolder( this.getProductHTML(prodName), divName);
			}
		}
		var holder = eval('this.'+divName+'Holder');
		if (holder.length > 0) {
				// this is a hack to get the borrowAll in the correct place.
				if (divName == "financing") { 
					this.financingHolder = '';
					this.showProduct('borrowAll');	
					for (prodName in section) {
						if (section[prodName] == true) {
							this.addHTMLToHolder( this.getProductHTML(prodName), divName);
						}
					}
				}
				this.addTopLink(divName);
				holder = eval('this.'+divName+'Holder');
		}
		this.addHTMLToDiv(holder, divName);
	}
	
	this.addTopLink = function(divName) {
		this.addHTMLToHolder(this.getProductHTML('goTopLnk'),divName);
	}	
	
	this.hideAllEmpty = function() {	
		this.hideIfEmpty('services');
		this.hideIfEmpty('operating');
		this.hideIfEmpty('outsideCanada');
		this.hideIfEmpty('financing');
		this.hideIfEmpty('investing');		
	}
	this.hideIfEmpty = function(divName) {
		if (this.divIsEmpty(divName)) {
			document.getElementById(divName).style.display = 'none';
			var divLink = eval('document.getElementById(\'' + divName +'Link\')');
			divLink.style.display = 'none';
		}
	}
	
	this.divIsEmpty = function(divName) {
		var divObj = this.getDisplayDiv(divName);
		return (divObj && divObj.innerHTML.length == 0);
	}
	
	this.show = function() {

		/*
		Show All GICs and RRSPs to everyone
		Display:
			Government Payment & Filing Service
			CIBC Flexible GIC®
			CIBC Short-Term GIC
			CIBC Long-Term GIC
		*/
		this.showProduct('cshMgtAll'); // includes Gov't Payment & filing service.
		this.showProduct('busAcctsAll');
		this.showProduct('busAcctsBusOpAcct');
		
		if (ProductFlag.Nonprofit == true) {
			/*Since you are a non-profit organization, we suggest the Non-profit organizations Fee Package*/
			this.showProduct('busAcctsNonProfit');
		}

		this.showProduct('cshMgtGovtFiling'); // includes Gov't Payment & filing service.
		
		this.showProduct('investPlanning');
		//this.showProduct('borrowAll');	

		this.showProduct('investFlexible');
		this.showProduct('investShrtTrm');
		this.showProduct('investLngTrm');	
		
		if (ProductFlag.Agriculture == true) {
			/*
			Display:
				Agriculture
				Put planning guide link in right nav
			*/
			document.getElementById('farmBusPlngGdLnk').style.display = '';
			this.showProduct('bundleAgriculture');
		}
		if (ProductFlag.CAIS == true) {
			this.showProduct('busAcctsDepAcct');
		}
		if (ProductFlag.Health == true) {
			/*
			Display:
				Health Care Services
			*/
			this.showProduct('bundleHealthCareServices');
		}
		if (ProductFlag.Aboriginal == true) {
			/*
			Display:
				Aboriginal
			*/
			this.showProduct('bundleAboriginal');
		}
		if (ProductFlag.Startup == true) {
			/*
			Display:
				Startup
			*/
			this.showProduct('bundleStartup'); 
		}
		if (ProductFlag.AddOpt == true) {
			/*You may want to consider adding an Additional Option feature to your Business Operating Account.*/			
			this.showProduct('busAcctsAddOpt');
		}
		else {
			this.showProduct('busAcctsAll');
		}
		if (ProductFlag.Bizline == true) {
			/*
			Display: 
				CIBC bizline™ VISA* Card
			*/
			this.showProduct('creditCardsBiz');
		}
		if (ProductFlag.Aerogold == true) {
			/*
			Display:
				CIBC Aerogold® VISA Card for Business
			*/	
			this.showProduct('creditCardsAerogold');
		}
		if (ProductFlag.DD == true) {
			/*
			Display:
				Direct Deposit
			*/
			this.showProduct('cshMgtDirectDeposit');
		}
		if (ProductFlag.Payroll == true) {
			/*
			Display:	
				Ceridian Payroll Services
			*/
			this.showProduct('thrdPrtyCeridian');
		}
		if (ProductFlag.USDollar == true) {
			/*
			Display:
				CIBC U.S. Dollar Current Account
			*/
			this.showProduct('busAcctsUSDollar');
		}
		if (ProductFlag.FxOnline == true) {
			/*
			Display:
				CIBC Foreign Exchange Online 
			*/
			this.showProduct('thrdPrtyFXOnline');
		}
		
		if (ProductFlag.Trade == true) {
			/*
			Display:
				Trade Finance 
			*/
			this.showProduct('thrdPrtyTrade');
		}
		if (ProductFlag.CBOA == true) {
			/*
			Display:
				CIBC Business Operating Account
			*/
			this.showProduct('busAcctsBusOpAcct');
		}
		if (ProductFlag.Merchant == true) {
			/*
			Display:
				Merchant Services
			*/
			this.showProduct('thrdPrtyMerchant');
		}
		if (ProductFlag.PAP == true) {
			/*
			Display:
				Pre-Authorized Payments
			*/
			this.showProduct('cshMgtPreAuth');
		}
		if (ProductFlag.Rapid == true) {
			/*
			Display:
				Rapidtrans®
			*/
			this.showProduct('cshMgtRapidtrans');
		}
		if (ProductFlag.Overdraft == true) {
			/*
			Display:
				CIBC Small Business Overdraft
			*/
			this.showProduct('borrowSmBusOver');
		}
		if (ProductFlag.FOL == true) {
			/*
			Display:
				CIBC Farm Operating Loan
			*/
			this.showProduct('borrowFarmOpLoan');
		}
		if (ProductFlag.RLC == true) {
			/*
			Display:
				CIBC Revolving Line of Credit
			*/
			this.showProduct('borrowingRevolvingLnOfCred');
		}
		if (ProductFlag.SERM == true) {
			/*
			Display:
				CIBC Self-Employed Recognition Mortgage®
			*/
			this.showProduct('borrowSelfEmployed');
		}
		if (ProductFlag.Instalment == true) {
			/*
			Display:
				Instalment Loans (Fixed or Variable)
			*/
			this.showProduct('borrowInstalLoans');
		}
		if (ProductFlag.CBIA == true) {
			/*
			Display:
				CIBC Business Interest Account®
			*/
			this.showProduct('busAcctsInterest');
		}
		if (ProductFlag.LLC == true) {
			/*
			Display:
				CIBC Small Business Loans/Lines of Credit over $100,000 up to $250,000
			*/
			this.showProduct('borrowSmBus100To250');
		}
		if (ProductFlag.FML == true) {
			/*
			Display:
				CIBC Farm Mortgage Loan
			*/
			this.showProduct('borrowFarmMrtgLoan');
		}
		if (ProductFlag.CreditEdge == true) {
			/*
			Display:
				CIBC Small Business Credit Edge™
			*/
			this.showProduct('borrowSmBusCreditEdge');
		}
		if (ProductFlag.Commercial == true) {
			/*
			Display:
				CIBC Commercial Choice Mortgage
			*/
			this.showProduct('borrowCommercialChoiceMrtg');
		}
		if (ProductFlag.FTL == true) {
			/*
			Display:
				CIBC Farm Term Loan
			*/
			this.showProduct('borrowFarmTermLoan');
		}
		if (ProductFlag.EquipmentFinancing == true) {
			/*
			Display:
				Equipment Financing
			*/
			//this.showProduct('borrowEqpFin');			*********Temporary Turned Off Aug 12, 2005*********
		}
		/*if (ProductFlag.SBExtra == true) {
			
			//Display:
			//	Small Business Extra
			
			this.showProduct('bundleSmallBusinessExtra');
		}*/
		if (ProductFlag.GroupRRSPs == true) {
			/*
			Display:
				Group RRSPs
			*/
			this.showProduct('investGroup');
		}
		if (ProductFlag.FML == true || ProductFlag.FTL == true || ProductFlag.FOL == true) {
			/*
			Display in loan results section:
				CIBC offers both creditor insurance and farm loan insurance. To find out more, visit our creditor insurance or farm loan insurance pages
			*/
			this.showProduct('borrowFarmLoadIns');
		}
		else {
			//this.showProduct('borrowCredIns');
		}
		if (ProductFlag.Trade == true || ProductFlag.USDollar == true || ProductFlag.FxOnline == true) {
			/*
				Display Business Banking outside Canada
			*/
			this.showProduct('');
		}
		
		
		this.showSection('services');
		this.showSection('operating');
		this.showSection('outsideCanada');
		this.showSection('financing');
		this.showSection('investing');		
		
		this.hideAllEmpty();
		
	} // end display
	
}

var displayLogicLoaded = true;
