// #####################################################
// data object used to populate the contact page instant anwers
// requirements:  
//      - all nodes need to be keyed on UNIQUE identifier - totally arbitraty (could be database id)
//      - top level nodes must match tab buttons: products, efile, etc.
//      - top level nodes must contain forced_links and filters even if empty
// #####################################################

/**
 * This will get all the links to force to the top, for each topic, of the instant answers
 * 
 * @param {Object} topic
 */
function getInstantAnswersForcedLinks(topic)
{
	var forcedLinks = [];
	var count = 0;
	var obj;
	
	for (var o in instantAnswers[topic]["forced_links"]) {
		obj = instantAnswers[topic]["forced_links"][o];
		forcedLinks[count] = new Array(obj["url"], obj["faq"], obj["title"]);
		count ++;
	}
	
	return forcedLinks;
}

/**
 * This will get all the filters to apply for each topic.
 * Each topic will at least filter by platform.
 * 
 * @param {Object} topic
 * @param {Object} platform
 */
function getInstantAnswersFilters(topic, platform)
{
	var filter = "";
	var platformFilter = "";
	var obj;
	
	switch(platform) {
		case "w":
			platformFilter = "windows";
			break;
		case "m":
			platformFilter = "macintosh";
			break;
		case "o":
			platformFilter = "online";
	}
	platformFilter = platformFilter == "" ? platformFilter : "bn-platforms:" + platformFilter;
	
	for (var o in instantAnswers[topic]["filters"]) {
		obj = instantAnswers[topic]["filters"][o];
		if (filter == "") filter = "DC.subject:" + obj;
		else filter += "|" + "DC.subject:" + obj;
	}
	
	filter = filter == "" ? platformFilter : filter + "," + platformFilter
	return filter;
}

/**
 * This object contains filters to aply and links to force to the top of the instant answers for each topic.
 */
var instantAnswers = {
	"buying_billing" : {
		"title" : "Buying &amp; Billing",
		// What links to force to the top of the baynote guide results
		"forced_links" : {
			0 : {
				"url" : "/support/go/620",
				"faq" : "620",
				"title" : "TurboTax Advantage (auto renew)"
			},
			1 : {
				"url" : "/support/go/5961",
				"faq" : "5961",
				"title" : "When will I get my rebate?"
			}
		},
		// What filters to apply to the baynote guides (0|1|2,a) 1-2=array index, a=bn-platforms:windows
		"filters" : {
			0 : "Buying and Billing.Account Info",
			1 : "Buying and Billing.Automatic Renewal",
			2 : "Buying and Billing.Billings and Charges",
			3 : "Buying and Billing.Mailings and Offers",
			4 : "Buying and Billing.Orders and Refunds",
			5 : "Buying and Billing.Product Details"
		}
	},
	"printing_e-filing" : {
		"title" : "Printing &amp; E-Filing",
		"forced_links" : {
			0 : {
				"url" : "/support/go/5961",
				"faq" : "5961",
				"title" : "When will I get my rebate?"
			},
			1 : {
				"url" : "/support/go/6255",
				"faq" : "6255",
				"title" : "Getting Your Rebate -- If You Used Santa Barbara Bank & Trust To Get Your 2007 Tax Refund"
			},
			2 : {
				"url" : "/support/go/605",
				"faq" : "605",
				"title" : "How to File an Extension Using TurboTax"
			},
			3 : {
				"url" : "/support/go/5375",
				"faq" : "5375",
				"title" : "Error 601 When Attempting to E-File"
			}
		},
		"filters" : {
			0 : "Printing Mailing and Saving.Accessing Prior Returns",
			1 : "Printing Mailing and Saving.Adobe Issues",
			2 : "Printing Mailing and Saving.Filing by Mail",
			3 : "Printing Mailing and Saving.Printing",
			4 : "Printing Mailing and Saving.Saving and Backing Up",
			5 : "E-file.E-file Rejections",
			6 : "E-file.E-file Status",
			7 : "E-file.E-file",
			8 : "E-file.Errors"
		}
    },
	"login_install" : {
		"title" : "Login &amp; Install",
		"forced_links" : {			
			0 : {
				"url" : "/support/go/5961",
				"faq" : "5961",
				"title" : "When will I get my rebate?"
			},
			1 : {
				"url" : "/support/go/6255",
				"faq" : "6255",
				"title" : "Getting Your Rebate -- If You Used Santa Barbara Bank & Trust To Get Your 2007 Tax Refund"
			},
			2 : {
				"url" : "/support/go/605",
				"faq" : "605",
				"title" : "How to File an Extension Using TurboTax"
			},
			3 : {
				"url" : "/support/go/5068",
				"faq" : "5068",
				"title" : ".NET Issues – Workaround provided"
			}
		},
		"filters" : {
			0 : "Connectivity.Browsers",
			1 : "Connectivity.Errors",
			2 : "Connectivity.Firewalls and Antivirus",
			3 : "Connectivity.Internet",
			4 : "Installing.Downloads and CDs",
			5 : "Installing.Errors",
			6 : "Installing.Installation",
			7 : "Installing.System requirements",
			8 : "Installing.Unlock",
			9 : "Installing.Upgrade",
			10 : "State Taxes.Federal State Interaction",
			11 : "State Taxes.Multi State",
			12 : "State Taxes.State Issues",
			13 : "Logging In.eStore Login",
			14 : "Logging In.Errors",
			15 : "Logging In.TTO Login",
			16 : "Logging In.Usernames and passwords",
			17 : "Logging In.Vault",
			18 : "Update.Errors",
			19 : "Update.Form Availability",
			20 : "Update.State Availability",
			21 : "Update.Update"
		}
    },
	"login_issues" : {
		"title" : "Login Issues",
		"forced_links" : {			
			0 : {
				"url" : "/support/go/5961",
				"faq" : "5961",
				"title" : "When will I get my rebate?"
			},
			1 : {
				"url" : "/support/go/6255",
				"faq" : "6255",
				"title" : "Getting Your Rebate -- If You Used Santa Barbara Bank & Trust To Get Your 2007 Tax Refund"
			},
			2 : {
				"url" : "/support/go/605",
				"faq" : "605",
				"title" : "How to File an Extension Using TurboTax"
			},
			3 : {
				"url" : "/support/go/5068",
				"faq" : "5068",
				"title" : ".NET Issues – Workaround provided"
			}
		},
		"filters" : {
			0 : "Connectivity.Browsers",
			1 : "Connectivity.Errors",
			2 : "Connectivity.Firewalls and Antivirus",
			3 : "Connectivity.Internet",
			4 : "Logging In.eStore Login",
			5 : "Logging In.Errors",
			6 : "Logging In.TTO Login",
			7 : "Logging In.Usernames and passwords",
			8 : "Logging In.Vault",
			9 : "Update.Form Availability",
			10 : "Update.State Availability"
		}
    },
	"install_update" : {
		"title" : "Install &amp; Update",
		"forced_links" : {
			0 : {
				"url" : "/support/go/5961",
				"faq" : "5961",
				"title" : "When will I get my rebate?"
			},
			1 : {
				"url" : "/support/go/6255",
				"faq" : "6255",
				"title" : "Getting Your Rebate -- If You Used Santa Barbara Bank & Trust To Get Your 2007 Tax Refund"
			},
			2 : {
				"url" : "/support/go/605",
				"faq" : "605",
				"title" : "How to File an Extension Using TurboTax"
			},
			3 : {
				"url" : "/support/go/5068",
				"faq" : "5068",
				"title" : ".NET Issues – Workaround provided"
			}
		},
		"filters" : {
			0 : "Connectivity.Firewalls and Antivirus",
			1 : "Intalling.Downloads and CDs",
			2 : "Intalling.Errors",
			3 : "Intalling.Installation",
			4 : "Intalling.System requirements",
			5 : "Intalling.Unlock",
			6 : "Intalling.Upgrade",
			7 : "State Taxes.Federal State Interaction",
			8 : "State Taxes.Multi State",
			9 : "State Taxes.State Issues",
			10 : "Update.Errors",
			11 : "Update.Form Availability",
			12 : "Update.State Availability",
			13 : "Update.Update"
		}
    },
	"import_transfer" : {
		"title" : "Import &amp; Transfer",
		"forced_links" : {
			0 : {
				"url" : "/support/go/5961",
				"faq" : "5961",
				"title" : "When will I get my rebate?"
			},
			1 : {
				"url" : "/support/go/6255",
				"faq" : "6255",
				"title" : "Getting Your Rebate -- If You Used Santa Barbara Bank & Trust To Get Your 2007 Tax Refund"
			},
			2 : {
				"url" : "/support/go/605",
				"faq" : "605",
				"title" : "How to File an Extension Using TurboTax"
			}
		},
		"filters" : {
			0 : "Import and Transfer.Errors",
			1 : "Import and Transfer.Import",
			2 : "Import and Transfer.Transfer"
		}
    },
	"doing_your_taxes" : {
		"title" : "Doing Your Taxes",
		"forced_links" : {
			0 : {
				"url" : "/support/go/5961",
				"faq" : "5961",
				"title" : "When will I get my rebate?"
			},
			1 : {
				"url" : "/support/go/6255",
				"faq" : "6255",
				"title" : "Getting Your Rebate -- If You Used Santa Barbara Bank & Trust To Get Your 2007 Tax Refund"
			},
			2 : {
				"url" : "/support/go/605",
				"faq" : "605",
				"title" : "How to File an Extension Using TurboTax"
			},
			3 : {
				"url" : "/support/go/5068",
				"faq" : "5068",
				"title" : ".NET Issues – Workaround provided"
			}
		},
		"filters" : {
			0 : "General Program Issues.Calculations",
			1 : "General Program Issues.Display Issues",
			2 : "General Program Issues.Entering Your Data",
			3 : "General Program Issues.Tax Essentials",
			4 : "Federal Review.Amended Return",
			5 : "Federal Review.Audits",
			6 : "Federal Review.Review Errors",
			7 : "Federal Review.TurboTax Services",
			8 : "Deductions and Credits.Deductions and Credits",
			9 : "Deductions and Credits.ItsDeductible"
		}
    },
	"tax_questions" : {
		"title" : "Tax Questions",
		"forced_links" : {
			0 : {
				"url" : "/support/go/5961",
				"faq" : "5961",
				"title" : "When will I get my rebate?"
			},
			1 : {
				"url" : "/support/go/6255",
				"faq" : "6255",
				"title" : "Getting Your Rebate -- If You Used Santa Barbara Bank & Trust To Get Your 2007 Tax Refund"
			},
			2 : {
				"url" : "/support/go/605",
				"faq" : "605",
				"title" : "How to File an Extension Using TurboTax"
			}
		},
		"filters" : {
			0 : "Personal Income.Earned Income",
			1 : "Personal Income.Investment Income",
			2 : "Schedule C income.Depreciation",
			3 : "Schedule C income.Expenses",
			4 : "Schedule C income.Home Office",
			5 : "Schedule C income.Income",
			6 : "Tax Content.Tax Glossary",
			7 : "Tax Content.Tax Help",
			8 : "Tax Content.Tax Tips"
		}
    }
};