// ############################################
// used on contact us page, faq details page level survey
// ##########################################

var versionText = "What version?";
var imNotSure = "I'm not sure";
var perviousVersion = "Previous versions";
var unknownDisplay = "Product unknown";

var productInfo = {
	'win_simplestart' : {
		productLevel1 : 'QuickBooks SimpleStart',
		productName : 'EasyStart',
		productPlatform : 'W',
		productType : 'QUICKBOOKS_QUICKBOOKS_SIMPLE_START.QUICKBOOKS_SIMPLE_START_QUICKBOOKS_SIMPLE_START',
		boxImageIdentifier : 'QBUK-box-simplestart',
		displayTopics : 'ps,is,dc,ts,er',
		years : '2012,2010,2008,PREVIOUS',
		yearCodePrefix: '',
		defaultYear: '2012'
	},
	'win_pro' : {
		productLevel1 : 'QuickBooks Pro',
		productName : 'Pro',
		productPlatform : 'W',
		productType : 'QUICKBOOKS_QUICKBOOKS_PRO.QUICKBOOKS_PRO_QUICKBOOKS_PRO',
		boxImageIdentifier : 'QBUK-box-pro',
		displayTopics : 'ps,is,dc,ts,ep,er',
		years : '2012,2010,2008,PREVIOUS',
		yearCodePrefix: '',
		defaultYear: '2012'
	},
	'win_premier' : {
		productLevel1 : 'QuickBooks Premier',
		productName : 'Premier',
		productPlatform : 'W',
		productType : 'QUICKBOOKS_QUICKBOOKS_PREMIER.QUICKBOOKS_PREMIER_QUICKBOOKS_PREMIER',
		boxImageIdentifier : 'QBUK-box-premier',
		displayTopics : 'ps,is,dc,ts,ep,er',
		years : '2012,2010,2008,PREVIOUS',
		yearCodePrefix: '',
		defaultYear: '2012'
	},
	'win_dontknow' : {
		productLevel1 : 'I\'m not sure / my edition isn\'t shown',
		productName : 'Premier',
		productPlatform : 'W',
		productType : 'QUICKBOOKS_QUICKBOOKS_PREMIER.QUICKBOOKS_PREMIER_QUICKBOOKS_PREMIER',
		boxImageIdentifier : 'QBUK-box-NONE',
		displayTopics : 'ps,is,dc,ts,ep,er',
		years : '',
		yearCodePrefix: '',
		defaultYear: '2012'
	}
}

var problemTypeMap = {
		'products_services': 'FMS_PRODUCTS_AND_SERVICES',
		'install_setup': 'FMS_INSTALL_AND_SETUP',
		'data_company_files': 'FMS_DATA_AND_COMPANY_FILES',
		'run_the_business': 'FMS_RUN_THE_BUSINESS',
		'employees_payroll': 'FMS_EMPLOYEES_AND_PAYROLL',
		'errors': 'FMS_FMS_ERRORS'
};

//############################################
//used to write topics per product select
//##########################################
var bucketTopicMap = Array(
	//Array('Topic Name','BUCKET','online/desktop/both/none', 'id');
	Array('Products &amp; Services','SB','deskop','ps','products_services'),
	Array('Install &amp; Setup','GS','desktop','is','install_setup'),
	Array('Data &amp; Company Files','GS','deskop','dc','data_company_files'),
	Array('Run the Business','GS','deskop','ts','run_the_business'),
	Array('Employees &amp; Payroll','WOMR','deskop','ep','employees_payroll'),
	Array('Errors','WOMR','deskop', 'er','errors')
);

var phone1 = new Phone('0808 168 9535','8:00 a.m. to 8:00 p.m.  (BST), weekdays (excluding bank holidays)<br /><br />If you use <strong>Barclays Business Manager:</strong><br /><strong>Call Barclays: 0845 601 5962</strong>','We\'ll respond in less than 3 min', '');
var phone2 = new Phone('0808 168 9536','8:00 a.m. to 8:00 p.m.  (BST), weekdays (excluding bank holidays)<br /><br />If you use <strong>Barclays Business Manager:</strong><br /><strong>Call Barclays: 0845 601 5962</strong>','We\'ll respond in less than 3 min', '');

var email1 = new Email('general','9:00 a.m. to 5:30 p.m. (BST), weekdays','No waiting on hold!<br />We\'ll respond within 1 business day', '');
var email2 = new Email('quickbooks','9:00 a.m. to 5:30 p.m. (GMT), weekdays','No waiting on hold!<br />We\'ll respond within 1 business day', '');

var chat1 = new Chat('9:00 a.m. to 5:30 p.m. (GMT), weekdays (excluding bank holidays)','We\'ll respond in less then 3 min', '');

var asktina1 = new AskTina('No waiting on hold!');

var contactInfo = Array(
	//new ContactInformation('Product','topic id',phone,email,chat,asktina)
	new ContactInformation('win_simplestart','ps',phone1,email1,null,true,asktina1),
	new ContactInformation('win_simplestart','is',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_simplestart','dc',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_simplestart','ts',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_simplestart','er',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_pro','ps',phone1,email1,null,true,asktina1),
	new ContactInformation('win_pro','is',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_pro','dc',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_pro','ts',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_pro','ep',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_pro','er',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_premier','ps',phone1,email1,null,true,asktina1),
	new ContactInformation('win_premier','is',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_premier','dc',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_premier','ts',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_premier','ep',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_premier','er',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_dontknow','ps',phone1,email1,null,true,asktina1),
	new ContactInformation('win_dontknow','is',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_dontknow','dc',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_dontknow','ts',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_dontknow','ep',phone2,email2,chat1,true,asktina1),
	new ContactInformation('win_dontknow','er',phone2,email2,chat1,true,asktina1)
	/*new ContactInformation('win_simplestart','ps',phone1,null,null,true),
	new ContactInformation('win_simplestart','is',phone1,null,null,true),
	new ContactInformation('win_simplestart','dc',phone1,null,null,true),
	new ContactInformation('win_simplestart','ts',phone1,null,null,true),
	new ContactInformation('win_simplestart','er',phone1,null,null,true),
	new ContactInformation('win_pro','ps',phone1,null,null,true),
	new ContactInformation('win_pro','is',phone1,null,null,true),
	new ContactInformation('win_pro','dc',phone1,null,null,true),
	new ContactInformation('win_pro','ts',phone1,null,null,true),
	new ContactInformation('win_pro','ep',phone1,null,null,true),
	new ContactInformation('win_pro','er',phone1,null,null,true),
	new ContactInformation('win_premier','ps',phone1,null,null,true),
	new ContactInformation('win_premier','is',phone1,null,null,true),
	new ContactInformation('win_premier','dc',phone1,null,null,true),
	new ContactInformation('win_premier','ts',phone1,null,null,true),
	new ContactInformation('win_premier','ep',phone1,null,null,true),
	new ContactInformation('win_premier','er',phone1,null,null,true),
	new ContactInformation('win_dontknow','ps',phone1,null,null,true),
	new ContactInformation('win_dontknow','is',phone1,null,null,true),
	new ContactInformation('win_dontknow','dc',phone1,null,null,true),
	new ContactInformation('win_dontknow','ts',phone1,null,null,true),
	new ContactInformation('win_dontknow','ep',phone1,null,null,true),
	new ContactInformation('win_dontknow','er',phone1,null,null,true)*/
);

function Email(key, hours, wait, ignoreYears){
	this.key = key;
	this.hours = hours;
	this.wait = wait;
	this.ignoreYears = ignoreYears;
}

function Phone(number, hours, wait, ignoreYears){
	this.number = number;
	this.hours = hours;
	this.wait = wait;
	this.ignoreYears = ignoreYears;
}

function Chat(hours, wait, ignoreYears){
	this.hours = hours;
	this.wait = wait;
	this.ignoreYears = ignoreYears;
}

function AskTina(message){
	this.message = message;
}

function ContactInformation(product, topicId, phone, email, chat, advisor, asktina){
	this.product = product;
	this.topicId = topicId;
	this.phone = phone;
	this.email = email;
	this.chat = chat;
	this.advisor = advisor
	this.asktina = asktina
}

function getStep1ProductName (productToken) {
	if (productToken == 'nan_dontknow') {
		return 'I\'m Not Sure';
	}
	var productLevel1 = productInfo[productToken].productLevel1;
	// this should return something like: TurboTax Home & Business Online
	return productLevel1.replace('for',productInfo[productToken].productName,'gi');
}

function convertProdPlatform2ProductTokenNew (product) {
	var productToken = null;
	$.each(productInfo, function(i) {
		if (this.productType == product) {
			productToken = i;
		}
    });
	return productToken;
}

function convertProdPlatform2ProductToken (product, platform) {
	var productToken = null;
	$.each(productInfo, function(i) {
		if (this.productType == product && this.productPlatform.toUpperCase() == platform.toUpperCase() ) {
			productToken = i;
		}
    });
	return productToken;
}
