// ############################################
// 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_hbiz' : {
		productLevel1 : 'Quicken Home & Business',
		productName : 'Home & Business',
		productPlatform : 'W',
		productType : 'QUICKEN_GLOBAL_PRODUCTS_QUICKEN_HOME_AND_BUSINESS',
		boxImageIdentifier : 'QK-box-hb',
		displayTopics : 'ps,is,df,os,cf,er',
		years : '2012,2011,2010,2009,2008',
		yearCodePrefix: 'YEAR_',
		defaultYear: '2012'
	},
	'win_xg' : {
		productLevel1 : 'Quicken XG',
		productName : 'XG',
		productPlatform : 'W',
		productType : 'QUICKEN_GLOBAL_PRODUCTS_QUICKEN_XG',
		boxImageIdentifier : 'QK-box-xg',
		displayTopics : 'ps,is,df,os,cf,er',
		years : '2007,PREVIOUS',
		yearCodePrefix: 'YEAR_',
		defaultYear: '2007'
	},
	'win_cmgr' : {
		productLevel1 : 'Quicken Cash Manager',
		productName : 'Cash Manager',
		productPlatform : 'W',
		productType : 'QUICKEN_GLOBAL_PRODUCTS_QUICKEN_CASH_MANAGER',
		boxImageIdentifier : 'QK-box-cm',
		displayTopics : 'ps,is,df,os,cf,er',
		years : '2012,2011,2010,2009,PREVIOUS',
		yearCodePrefix: 'YEAR_',
		defaultYear: '2012'
	},
	'win_dontknow' : {
		productLevel1 : 'I\'m not sure / my edition isn\'t shown',
		productName : 'XG',
		productPlatform : 'W',
		productType : 'QUICKEN_GLOBAL_PRODUCTS_QUICKEN_HOME_AND_BUSINESS',
		boxImageIdentifier : 'QK-box-NONE',
		displayTopics : 'ps,is,df,os,cf,er',
		years : '',
		yearCodePrefix: 'YEAR_',
		defaultYear: '2012'
	}
}

var problemTypeMap = {
		'products_services': 'GLOBAL_QUICKEN_PRODUCTS_AND_SERVICES',
		'install_setup': 'GLOBAL_QUICKEN_INSTALL_AND_SETUP',
		'data_files': 'GLOBAL_QUICKEN_DATA_FILES',
		'online_services_banking': 'GLOBAL_QUICKEN_ONLINE_SERVICES_AND_BANKING',
		'cash_flow': 'GLOBAL_QUICKEN_CASH_FLOW',
		'errors': 'GLOBAL_QUICKEN_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','both','ps','products_services'),
	Array('Install &amp; setup','GS','online','is','install_setup'),
	Array('Data files','GS','desktop','df','data_files'),
	Array('Online services &amp; banking','GS','both','os','online_services_banking'),
	Array('Cash flow','GS','both','cf','cash_flow'),
	Array('Errors','GS','both','er','errors')
);

var phone1 = new Phone('1-888-829-8684','10:00 a.m. to 8:00 p.m. (EST), weekdays','We\'ll respond in less than 5 min', '');
var phone2 = new Phone('1-877-844-1515 (charges may apply)','10:00 a.m. to 8:00 p.m. (EST), weekdays','We\'ll respond in less than 5 min', '');

var email1 = new Email('icu_quicken','Available 24 hours a day, 7 days a week','No waiting on hold!<br />We\'ll respond within 3 business days', '');
var email2 = new Email('quickencanada','Available 24 hours a day, 7 days a week','<span style="color: red;">We are currently experiencing high email volumes.<br />It may take us more than 3 business days to respond. Sorry for the inconvenience.</span>', '');

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

var contactInfo = Array(
	//new ContactInformation('Product','topic id',phone,email,chat, asktina)
	new ContactInformation('win_hbiz','ps',phone1,email1,null,false,null),
	new ContactInformation('win_hbiz','is',phone2,email2,null,false,null),
	new ContactInformation('win_hbiz','df',phone2,email2,null,false,null),
	new ContactInformation('win_hbiz','os',phone2,email2,null,false,null),
	new ContactInformation('win_hbiz','cf',phone2,email2,null,false,null),
	new ContactInformation('win_hbiz','er',phone2,email2,null,false,null),
	new ContactInformation('win_xg','ps',phone1,email1,null,false,null),
	new ContactInformation('win_xg','is',phone2,email2,null,false,null),
	new ContactInformation('win_xg','df',phone2,email2,null,false,null),
	new ContactInformation('win_xg','os',phone2,email2,null,false,null),
	new ContactInformation('win_xg','cf',phone2,email2,null,false,null),
	new ContactInformation('win_xg','er',phone2,email2,null,false,null),
	new ContactInformation('win_cmgr','ps',phone1,email1,null,false,null),
	new ContactInformation('win_cmgr','is',phone2,email2,null,false,null),
	new ContactInformation('win_cmgr','df',phone2,email2,null,false,null),
	new ContactInformation('win_cmgr','os',phone2,email2,null,false,null),
	new ContactInformation('win_cmgr','cf',phone2,email2,null,false,null),
	new ContactInformation('win_cmgr','er',phone2,email2,null,false,null),
	new ContactInformation('win_dontknow','ps',phone1,email1,null,false,null),
	new ContactInformation('win_dontknow','is',phone2,email2,null,false,null),
	new ContactInformation('win_dontknow','df',phone2,email2,null,false,null),
	new ContactInformation('win_dontknow','os',phone2,email2,null,false,null),
	new ContactInformation('win_dontknow','cf',phone2,email2,null,false,null),
	new ContactInformation('win_dontknow','er',phone2,email2,null,false,null)
);

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 == platform.toUpperCase() ) {
			productToken = i;
		}
    });
	return productToken;
}
