// ############################################
// 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 = {
	'onl_free' : {
		productLevel1 : 'Free Online',
		productName : 'Free Online',
		productPlatform : 'O',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_ONLINE.ONLINE_TURBOTAX_FREE',
		boxImageIdentifier : 'QT-online-free',
		displayTopics : 'ps,li,ic,tq,dt,pn',
		years : '2011,2010,2009',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011'
	},
	'win_basic' : {
		productLevel1 : 'Basic',
		productName : 'Basic',
		productPlatform : 'W',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_DESKTOP.DESKTOP_TURBOTAX_BASIC',
		boxImageIdentifier : 'QT-box-basic',
		displayTopics : 'ps,is,ic,tq,dt,po',
		years : '2011,2010,2009',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011'
	},
	'onl_standard' : {
		productLevel1 : 'Standard Online',
		productName : 'Standard Online',
		productPlatform : 'O',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_ONLINE.ONLINE_TURBOTAX_STANDARD',
		boxImageIdentifier : 'QT-online-standard',
		displayTopics : 'ps,li,ic,tq,dt,pn',
		years : '2011,2010,2009',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011'
	},
	'win_standard' : {
		productLevel1 : 'Standard',
		productName : 'Standard',
		productPlatform : 'W',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_DESKTOP.DESKTOP_TURBOTAX_STANDARD',
		boxImageIdentifier : 'QT-box-standard',
		displayTopics : 'ps,is,ic,tq,dt,po',
		years : '2011,2010,2009',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011'
	},
	'onl_student' : {
		productLevel1 : 'Student Online',
		productName : 'Student Online',
		productPlatform : 'O',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_ONLINE.ONLINE_TURBOTAX_STUDENT',
		boxImageIdentifier : 'QT-online-student',
		displayTopics : 'ps,li,ic,tq,dt,pn',
		years : '2011,2010,2009',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011'
	},
	'onl_platinum' : {
		productLevel1 : 'Platinum Online',
		productName : 'Platinum Online',
		productPlatform : 'O',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_ONLINE.ONLINE_TURBOTAX_PLATINUM',
		boxImageIdentifier : 'QT-online-platinum',
		displayTopics : 'ps,li,ic,tq,dt,pn',
		years : '2009,2008,2007',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2009'
	},
	'win_platinum' : {
		productLevel1 : 'Platinum',
		productName : 'Platinum',
		productPlatform : 'W',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_DESKTOP.DESKTOP_TURBOTAX_PLATINUM',
		boxImageIdentifier : 'QT-box-platinum',
		displayTopics : 'ps,is,ic,tq,dt,po',
		years : '2009,2008,2007',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2009'
	},
	'onl_premier' :{
		productLevel1 : 'Premier Online',
		productName : 'Premier Online',
		productPlatform : 'O',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_ONLINE.ONLINE_TURBOTAX_PREMIER',
		boxImageIdentifier : 'TT-online-premier',
		displayTopics : 'ps,li,ic,tq,dt,po',
		years : '2011,2010',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011,2010'
	},
	'win_premier' : {
		productLevel1 : 'Premier',
		productName : 'Premier',
		productPlatform : 'W',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_DESKTOP.DESKTOP_TURBOTAX_PREMIER',
		boxImageIdentifier : 'TT-box-premier',
		displayTopics : 'ps,is,ic,tq,dt,po',
		years : '2011,2010',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011,2010'
	},
	'onl_uninc' : {
		productLevel1 : 'Business Unincorporated Online',
		productName : 'Business Unincorporated Online',
		productPlatform : 'O',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_ONLINE.ONLINE_TURBOTAX_BUSINESS_UNINCORPORATED',
		boxImageIdentifier : 'QT-online-uninc',
		displayTopics : 'ps,li,ic,tq,dt,pn',
		years : '2009,2008,2007',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2009'
	},
	'win_uninc' : {
		productLevel1 : 'Business Unincorporated',
		productName : 'Business Unincorporated',
		productPlatform : 'W',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_DESKTOP.DESKTOP_TURBOTAX_BUSINESS_UNINCORPORATED',
		boxImageIdentifier : 'QT-box-uninc',
		displayTopics : 'ps,is,ic,tq,dt,po',
		years : '2009,2008,2007',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2009'
	},
	'onl_hbiz' : {
		productLevel1 : 'Home & Business Online',
		productName : 'Home & Business Online',
		productPlatform : 'O',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_ONLINE.ONLINE_TURBOTAX_HOME_AND_BUSINESS',
		boxImageIdentifier : 'TT-online-homebiz',
		displayTopics : 'ps,li,ic,tq,dt,pn',
		years : '2011,2010',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011,2010'
	},
	'win_hbiz' : {
		productLevel1 : 'Home & Business',
		productName : 'Home & Business',
		productPlatform : 'W',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_DESKTOP.DESKTOP_TURBOTAX_HOME_AND_BUSINESS',
		boxImageIdentifier : 'TT-box-homebiz',
		displayTopics : 'ps,is,ic,tq,dt,pn',
		years : '2011,2010',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011,2010'
	},
	'win_inc' : {
		productLevel1 : 'Business Incorporated',
		productName : 'Business Incorporated',
		productPlatform : 'W',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_DESKTOP.DESKTOP_TURBOTAX_BUSINESS_INCORPORATED',
		boxImageIdentifier : 'QT-box-inc',
		displayTopics : 'ps,is,ic,tq,dt,po',
		years : '2011,2010,2009',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011,2010'
	},
	'win_dontknow' : {
		productLevel1 : 'I\'m not sure / my edition isn\'t shown',
		productName : 'Standard',
		productPlatform : 'W',
		productType : 'TURBOTAX_GLOBAL_PRODUCTS_DESKTOP.DESKTOP_TURBOTAX_BASIC',
		boxImageIdentifier : 'QT-box-NONE',
		displayTopics : 'ps,is,ic,tq,dt,po',
		years : '',
		yearCodePrefix: 'TAX_YEAR_',
		defaultYear: '2011'
	}
};

var problemTypeMap = {
		'products_services': 'GLOBAL_TURBOTAX_PRODUCTS_AND_SERVICES',
		'install_setup': 'GLOBAL_TURBOTAX_INSTALL_AND_SETUP',
		'login': 'GLOBAL_TURBOTAX_LOGIN',
		'import_carryforward': 'GLOBAL_TURBOTAX_IMPORT_AND_CARRY-FORWARD',
		'tax_questions': 'GLOBAL_TURBOTAX_TAX_QUESTIONS',
		'doing_your_taxes': 'GLOBAL_TURBOTAX_DOING_YOUR_TAXES',
		'printing_filing_online': 'GLOBAL_TURBOTAX_PRINTING_AND_FILING_ONLINE'
};

//############################################
//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('Login','GS','online','li','login'),
	Array('Install &amp; Setup','GS','desktop','is','install_setup'),
	Array('Import &amp; Carry-forward','GS','both','ic','import_carryforward'),
	Array('Tax Questions','GS','both','tq','tax_questions'),
	Array('Doing Your Taxes','GS','both','dt','doing_your_taxes'),
	Array('Printing and NETFILE','WOMR','online','pn','printing_filing_online'),
	Array('Printing &amp; filing online','WOMR','deskop', 'po','printing_filing_online')
);

//var phone1 = new Phone('1-888-829-8608','9:00 a.m. to 6 p.m. (EST) weekdays','We\'ll respond in less than 5 min', '');
//var phone2 = new Phone('1-514-227-3063','8:00 a.m. to 12:00 a.m. (EST), 7 days a week','We\'ll respond in less than 5 min', '');
//var phone3 = new Phone('1-877-440-4288','8:00 a.m. to 12:00 a.m. (EST), 7 days a week','We\'ll respond in less than 5 min', '');

var phone1 = new Phone('1-780-665-4555','9:00 a.m. to 6:00 p.m. (EST) weekdays',false, '');
var phone2 = new Phone('1-514-227-3063','9:00 a.m. to 6:00 p.m. (EST) weekdays',false, '');
var phone3 = new Phone('1-877-440-4288','9:00 a.m. to 6:00 p.m. (EST) weekdays',false, '');

var phone4 = new Phone('1-866-438-8020 (Press 1 for sales; Press 2 for support)','<strong>For Sales:</strong> 9:00 a.m. to 5:30 p.m. (EST), weekdays<br /><strong>For Support:</strong> 9:00 a.m. to 8:00 p.m. (EST), weekdays','less than 5 min', '');
var phone5 = new Phone('1-888-829-8608','9:00 a.m. to 6:00 p.m. (EST) weekdays','less than 5 minutes', '');
var phone6 = new Phone('1-780-665-4555','8:00 a.m. to 12:00 a.m. (EST), 7 days a week.','less than 5 minutes', '');
var phone7 = new Phone('1-877-440-4288','8:00 a.m. to 12:00 a.m. (EST), 7 days a week.','less than 5 minutes', '');

var email1 = new Email('qt_cservice','Available 24 hours a day, 7 days a week','No waiting on hold!<br />A Response Within 1 Business Day', '2006');
var email4 = new Email('qt_cservice','Available 24 hours a day, 7 days a week','No waiting on hold!<br />A Response Within 1 Business Day', '2006');
var email2 = new Email('qt_prod_support','Available 24 hours a day, 7 days a week','No waiting on hold!<br />A Response Within 1 Business Day', '2006');
var email3 = new Email('qtbinc','Available 24 hours a day, 7 days a week','No waiting on hold!<br />A Response Within 1 Business Day', '2006');
var email5 = new Email('qtbinc','Available 24 hours a day, 7 days a week','No waiting on hold!<br />A Response Within 1 Business Day', '2006');

var chat1 = new Chat('8:00 a.m. to 12:00 a.m. (EST), 7 days a week.','Less than 2 Minutes', '2006');
//var chat1 = new Chat('8:00 a.m. to 12:00 a.m. (EST), 7 days a week','We\'ll respond in less then 2 min', '2006');

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

var contactInfo = Array(
	//new ContactInformation('Product','topic id',phone,email,chat,advisor,asktina)
	new ContactInformation('onl_free','ps',phone5,email4,null,false,asktina1),
	new ContactInformation('onl_free','li',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_free','ic',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_free','tq',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_free','dt',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_free','pn',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_basic','ps',phone5,email1,chat1,false,asktina1),
	new ContactInformation('win_basic','is',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_basic','ic',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_basic','tq',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_basic','dt',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_basic','po',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_standard','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('onl_standard','li',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_standard','ic',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_standard','tq',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_standard','dt',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_standard','pn',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_standard','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('win_standard','is',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_standard','ic',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_standard','tq',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_standard','dt',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_standard','po',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_student','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('onl_student','li',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_student','ic',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_student','tq',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_student','dt',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_student','pn',phone6,email2,chat1,false,asktina1),
	new ContactInformation('onl_platinum','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('onl_platinum','li',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_platinum','ic',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_platinum','tq',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_platinum','dt',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_platinum','pn',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_platinum','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('win_platinum','is',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_platinum','ic',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_platinum','tq',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_platinum','dt',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_platinum','po',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_premier','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('onl_premier','li',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_premier','ic',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_premier','tq',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_premier','dt',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_premier','po',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_premier','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('win_premier','is',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_premier','ic',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_premier','tq',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_premier','dt',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_premier','po',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_uninc','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('onl_uninc','li',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_uninc','ic',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_uninc','tq',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_uninc','dt',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_uninc','pn',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_uninc','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('win_uninc','is',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_uninc','ic',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_uninc','tq',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_uninc','dt',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_uninc','po',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_hbiz','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('onl_hbiz','li',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_hbiz','ic',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_hbiz','tq',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_hbiz','dt',phone7,email2,chat1,false,asktina1),
	new ContactInformation('onl_hbiz','pn',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_hbiz','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('win_hbiz','is',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_hbiz','ic',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_hbiz','tq',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_hbiz','dt',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_hbiz','pn',phone7,email2,chat1,false,asktina1),
	new ContactInformation('win_inc','ps',phone4,email5,null,false,asktina1),
	new ContactInformation('win_inc','is',phone4,email5,null,false,asktina1),
	new ContactInformation('win_inc','ic',phone4,email5,null,false,asktina1),
	new ContactInformation('win_inc','tq',phone4,email5,null,false,asktina1),
	new ContactInformation('win_inc','dt',phone4,email5,null,false,asktina1),
	new ContactInformation('win_inc','po',phone4,email5,null,false,asktina1),
	new ContactInformation('win_dontknow','ps',phone5,email1,null,false,asktina1),
	new ContactInformation('win_dontknow','is',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_dontknow','ic',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_dontknow','tq',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_dontknow','dt',phone6,email2,chat1,false,asktina1),
	new ContactInformation('win_dontknow','po',phone6,email2,chat1,false,asktina1)
);

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;
	this.closed = '<span style="color: red;">Currently closed</span>';
}

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;
}
