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

var versionText = "Quelle version?";
var imNotSure = "Je ne suis pas certain";
var perviousVersion = "Versions ant&eacute;rieures";
var unknownDisplay = "Logiciel inconnu";

var productInfo = {
	'win_xg' : {
		productLevel1 : 'Quicken de luxe',
		productName : 'de luxe',
		productPlatform : 'W',
		productType : 'QUICKEN_GLOBAL_PRODUCTS_QUICKEN_XG',
		boxImageIdentifier : 'QK-box-dlx',
		displayTopics : 'ps,is,df,os,cf,er',
		years : '2006,PREVIOUS',
		yearCodePrefix: 'YEAR_',
		defaultYear: '2006'
	},
	'win_def' : {
		productLevel1 : 'Quicken',
		productName : '',
		productPlatform : 'W',
		productType : 'QUICKEN_GLOBAL_PRODUCTS_QUICKEN_CASH_MANAGER',
		boxImageIdentifier : 'QK-box-def',
		displayTopics : 'ps,is,df,os,cf,er',
		years : '2006,PREVIOUS',
		yearCodePrefix: 'YEAR_',
		defaultYear: '2006'
	},
	'win_dontknow' : {
		productLevel1 : 'Je ne suis pas certain ou l\'&eacute;dition n\'est pas indiqu&eacute;e',
		productName : 'XG',
		productPlatform : 'W',
		productType : 'QUICKEN_GLOBAL_PRODUCTS_QUICKEN_XG',
		boxImageIdentifier : 'QK-box-NONE',
		displayTopics : 'ps,is,df,os,cf,er',
		years : '',
		yearCodePrefix: 'YEAR_',
		defaultYear: '2006'
	}
}

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('Produits et services','SB','both','ps','products_services'),
	Array('Installation et configuration','GS','online','is','install_setup'),
	Array('Fichiers de données','GS','desktop','df','data_files'),
	Array('Services et services bancaires en ligne','GS','both','os','online_services_banking'),
	Array('Trésorerie','GS','both','cf','cash_flow'),
	Array('Erreurs','GS','both','er','errors')
);

var phone1 = new Phone('1-888-829-8684','Message automatisé seulement','moins de 5 minutes', '');

var email1 = new Email('quicken_francais','Disponible 24 heures par jour, 7 jours par semaine','Il n\'y a pas d\'attente en ligne!<br />Une réponse dans les trois jours ouvrables', '');

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

var contactInfo = Array(
	//new ContactInformation('Product','topic id',phone,email,chat, asktina)
	new ContactInformation('win_xg','ps',phone1,email1,null,false,null),
	new ContactInformation('win_xg','is',null,email1,null,false,null),
	new ContactInformation('win_xg','df',null,email1,null,false,null),
	new ContactInformation('win_xg','os',null,email1,null,false,null),
	new ContactInformation('win_xg','cf',null,email1,null,false,null),
	new ContactInformation('win_xg','er',null,email1,null,false,null),
	new ContactInformation('win_def','ps',phone1,email1,null,false,null),
	new ContactInformation('win_def','is',null,email1,null,false,null),
	new ContactInformation('win_def','df',null,email1,null,false,null),
	new ContactInformation('win_def','os',null,email1,null,false,null),
	new ContactInformation('win_def','cf',null,email1,null,false,null),
	new ContactInformation('win_def','er',null,email1,null,false,null),
	new ContactInformation('win_dontknow','ps',phone1,email1,null,false,null),
	new ContactInformation('win_dontknow','is',null,email1,null,false,null),
	new ContactInformation('win_dontknow','df',null,email1,null,false,null),
	new ContactInformation('win_dontknow','os',null,email1,null,false,null),
	new ContactInformation('win_dontknow','cf',null,email1,null,false,null),
	new ContactInformation('win_dontknow','er',null,email1,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;
}
