/*
 * @package AJAX_Chat
 * @author Sebastian Tschan
 * @copyright (c) Sebastian Tschan
 * @license GNU Affero General Public License
 * @link https://blueimp.net/ajax/
 */

// Ajax Chat config parameters:
var ajaxChatConfig = {

	// The channelID of the channel to enter on login (the loginChannelName is used if set to null):
	loginChannelID: null,
	// The channelName of the channel to enter on login (the default channel is used if set to null):
	loginChannelName: null,	
	
	// The time in ms between update calls to retrieve new chat messages:
	timerRate: 2000,
	
	// The URL to retrieve the XML chat messages (must at least contain one parameter):
	ajaxURL: './?ajax=true',
	// The base URL of the chat directory, used to retrieve media files (images, sound files, etc.):
	baseURL: './',

	// A regular expression for allowed source URL's for media content (e.g. images displayed inline);
	regExpMediaUrl: '^((http)|(https)):\\/\\/',
	
	// If set to false the chat update is delayed until the event defined in ajaxChat.setStartChatHandler():
	startChatOnLoad: true,
	
	// Defines the IDs of DOM nodes accessed by the chat:
	domIDs: {
		// The ID of the chat messages list:
		chatList: 'chatList',
		// The ID of the online users list:
		onlineList: 'onlineList',
		// The ID of the message text input field:
		inputField: 'inputField',
		// The ID of the message text length counter:
		messageLengthCounter: 'messageLengthCounter',
		// The ID of the channel selection:
		channelSelection: 'channelSelection',
		// The ID of the style selection:
		styleSelection: 'styleSelection',
		// The ID of the emoticons container:
		emoticonsContainer: 'emoticonsContainer',
		// The ID of the color codes container:
		colorCodesContainer: 'colorCodesContainer',
		// The ID of the flash interface container:
		flashInterfaceContainer: 'flashInterfaceContainer'
	},

	// Defines the settings which can be modified by users:
	settings: {
		// Defines if BBCode tags are replaced with the associated HTML code tags:
		bbCode: true,
		// Defines if image BBCode is replaced with the associated image HTML code:
		bbCodeImages: true,
		// Defines if color BBCode is replaced with the associated color HTML code:
		bbCodeColors: true,
		// Defines if hyperlinks are made clickable:
		hyperLinks: true,
		// Defines if line breaks are enabled:
		lineBreaks: true,
		// Defines if emoticon codes are replaced with their associated images:
		emoticons: true,
	
		// Defines if the focus is automatically set to the input field on chat load or channel switch:
		autoFocus: true,
		// Defines if the chat list scrolls automatically to display the latest messages:
		autoScroll: true,	
		// The maximum count of messages displayed in the chat list (will be ignored if set to 0):
		maxMessages: 0,
		
		// Defines if long words are wrapped to avoid vertical scrolling:
		wordWrap: true,
		// Defines the maximum length before a word gets wrapped: 
		maxWordLength: 32,
		
		// Defines the format of the date and time displayed for each chat message:
		dateFormat: '(%H:%i:%s)',
		
		// Defines if font colors persist without the need to assign them to each message:
		persistFontColor: false,	
		// The default font color, uses the page default font color if set to null:
		fontColor: null,
		
		// Defines if sounds are played:
		audio: true,
		// Defines the sound volume (0.0 = mute, 1.0 = max):
		audioVolume: 1.0,

		// Defines the sound that is played when normal messages are reveived:
		soundReceive: 'sound_1',
		// Defines the sound that is played on sending normal messages:
		soundSend: 'sound_2',
		// Defines the sound that is played on channel enter or login:
		soundEnter: 'sound_3',
		// Defines the sound that is played on channel leave or logout:
		soundLeave: 'sound_4',
		// Defines the sound that is played on chatBot messages:
		soundChatBot: 'sound_5',
		// Defines the sound that is played on error messages:
		soundError: 'sound_6',
		
		// Defines if the document title blinks on new messages:
		blink: true,
		// Defines the blink interval in ms:
		blinkInterval: 500,
		// Defines the number of blink intervals:
		blinkIntervalNumber: 10
	},
	
	// Defines a list of settings which are not to be stored in a session cookie:
	nonPersistentSettings: new Array(
	),

	// Defines the list of allowed BBCodes:
	bbCodeTags: new Array(
		'b',
		'i',
		'u',
		'quote',
		'code',
		'color',
		'url',
		'img'
	),
	
	// Defines the list of allowed color codes:
	colorCodes: new Array(
		'#000000', 	'#000033', 	'#000066', 	'#000099', 	'#0000CC', 	'#0000FF',
'#330000', 	'#330033', 	'#330066', 	'#330099', 	'#3300CC', 	'#3300FF',
'#660000',	'#660033', 	'#660066', 	'#660099', 	'#6600CC', 	'#6600FF',
'#990000', 	'#990033', 	'#990066', 	'#990099', 	'#9900CC', 	'#9900FF',
'#CC0000', 	'#CC0033', 	'#CC0066', 	'#CC0099', 	'#CC00CC', 	'#CC00FF',
'#FF0000', 	'#FF0033', 	'#FF0066', 	'#FF0099', 	'#FF00CC', 	'#FF00FF',
'#003300', 	'#003333', 	'#003366', 	'#003399', 	'#0033CC', 	'#0033FF',
'#333300', 	'#333333', 	'#333366', 	'#333399', 	'#3333CC', 	'#3333FF',
'#663300', 	'#663333', 	'#663366', 	'#663399', 	'#6633CC', 	'#6633FF',
'#993300', 	'#993333', 	'#993366', 	'#993399', 	'#9933CC', 	'#9933FF',
'#CC3300', 	'#CC3333', 	'#CC3366', 	'#CC3399', 	'#CC33CC', 	'#CC33FF',
'#FF3300', 	'#FF3333', 	'#FF3366', 	'#FF3399', 	'#FF33CC', 	'#FF33FF',
'#006600', 	'#006633', 	'#006666', 	'#006699', 	'#0066CC', 	'#0066FF',
'#336600', 	'#336633', 	'#336666', 	'#336699', 	'#3366CC', 	'#3366FF',
'#666600', 	'#666633', 	'#666666', 	'#666699', 	'#6666CC', 	'#6666FF',
'#996600', 	'#996633', 	'#996666', 	'#996699', 	'#9966CC', 	'#9966FF',
'#CC6600', 	'#CC6633', 	'#CC6666', 	'#CC6699', 	'#CC66CC', 	'#CC66FF',
'#FF6600', 	'#FF6633', 	'#FF6666', 	'#FF6699', 	'#FF66CC', 	'#FF66FF',
'#009900', 	'#009933', 	'#009966', 	'#009999', 	'#0099CC', 	'#0099FF',
'#339900', 	'#339933', 	'#339966', 	'#339999', 	'#3399CC', 	'#3399FF',
'#669900', 	'#669933', 	'#669966', 	'#669999', 	'#6699CC', 	'#6699FF',
'#999900', 	'#999933', 	'#999966', 	'#999999', 	'#9999CC', 	'#9999FF',
'#CC9900', 	'#CC9933', 	'#CC9966', 	'#CC9999', 	'#CC99CC', 	'#CC99FF',
'#FF9900', 	'#FF9933', 	'#FF9966', 	'#FF9999', 	'#FF99CC', 	'#FF99FF',
'#00CC00', 	'#00CC33', 	'#00CC66',	'#00CC99', 	'#00CCCC', 	'#00CCFF',
'#33CC00', 	'#33CC33', 	'#33CC66', 	'#33CC99', 	'#33CCCC', 	'#33CCFF',
'#66CC00', 	'#66CC33', 	'#66CC66', 	'#66CC99',	'#66CCCC', 	'#66CCFF',
'#99CC00', 	'#99CC33', 	'#99CC66', 	'#99CC99', 	'#99CCCC', 	'#99CCFF',
'#CCCC00', 	'#CCCC33', 	'#CCCC66', 	'#CCCC99', 	'#CCCCCC', 	'#CCCCFF',
'#FFCC00', 	'#FFCC33', 	'#FFCC66', 	'#FFCC99', 	'#FFCCCC', 	'#FFCCFF',
'#00FF00', 	'#00FF33', 	'#00FF66', 	'#00FF99', 	'#00FFCC', 	'#00FFFF',
'#33FF00', 	'#33FF33', 	'#33FF66', 	'#33FF99', 	'#33FFCC', 	'#33FFFF',
'#66FF00', 	'#66FF33', 	'#66FF66', 	'#66FF99', 	'#66FFCC', 	'#66FFFF',
'#99FF00', 	'#99FF33', 	'#99FF66', 	'#99FF99', 	'#99FFCC', 	'#99FFFF',
'#CCFF00', 	'#CCFF33', 	'#CCFF66', 	'#CCFF99', 	'#CCFFCC', 	'#CCFFFF',
'#FFFF00', 	'#FFFF33', 	'#FFFF66', 	'#FFFF99', 	'#FFFFCC', 	'#FFFFFF'
	),
	
	// Defines the list of allowed emoticon codes:
	emoticonCodes: new Array(
		':P',
		':D',
		'>:-D',
		':o)',
		':idea:',
		':important:',
		':help:',
		':error:',
		':warning:',
		':smile:',
		':biggrins:',
		':zwinker',
		':rofl:',
		':rotwerd',
		':tuscheln:',
		':yippie:',
		':bigcool:',
		':streichel:',
		':denk',
		':fing',
		':icon_cool',
		':zuck:',
		':dance',
		':motz:',
		':icon_mauer',
		':irre',
		':zunge',
		':umpf',
		':neinnein',
		':icon_bussi',
		':favorite:'		
 	),
	
 	// Defines the list of emoticon files associated with the emoticon codes:
	emoticonFiles: new Array(
		'razz.png',
		'grin.png',
		'devilish.png',
		'monkey.png',
		'idea.png',
		'important.png',
		'help.png',
		'error.png',
		'warning.png',
		'smile.gif',
		'icon_biggrins.gif',
		'zwinkern_2.gif',
		'icon_rotfl.gif',
		'rotwerd.gif',
		'tuschel.gif',
		'icon_yiippi.gif',
		'icon_stark.gif',
		'streichl.gif',
		'icon_denk.gif',
		'fing.gif',
		'icon_cool.gif',
		'icon_zuck.gif',
		'icon_dance.gif',
		'icon_motz.gif',
		'icon_mauer.gif',
		'irre.gif',
		'icon_zunge.gif',
		'umpf.gif',
		'neinnein.gif',
		'icon_bussi.gif',
		'favorite.png'
	),

	// Defines the available sounds loaded on chat start:
	soundFiles: {
		sound_1: 'sound_1.mp3',
		sound_2: 'sound_2.mp3',
		sound_3: 'sound_3.mp3',
		sound_4: 'sound_4.mp3',
		sound_5: 'sound_5.mp3',
		sound_6: 'sound_6.mp3'
	},
	
	
	// The following configuration options are usually overwritten by server-side values:
	
	// Session identification, used for style and setting cookies:
	sessionName: 'ajax_chat',

	// The time in days until the style and setting cookies expire:
	cookieExpiration: 365,
	// The path of the cookies, '/' allows to read the cookies from all directories:
	cookiePath: '/',
	// The domain of the cookies, defaults to the hostname of the server if set to null:
	cookieDomain: null,
	// If enabled, cookies must be sent over secure (SSL/TLS encrypted) connections:
	cookieSecure: null,
	
	// The name of the chat bot:
	chatBotName: 'ChatBot',
	// The userID of the chat bot:
	chatBotID: 2147483647,

	// Allow/Disallow registered users to delete their own messages:
	allowUserMessageDelete: true,
	
	// Minutes until a user is declared inactive (last status update) - the minimum is 2 minutes:
	inactiveTimeout: 2,

	// UserID plus this value are private channels (this is also the max userID and max channelID):
	privateChannelDiff: 500000000,
	// UserID plus this value are used for private messages:
	privateMessageDiff: 1000000000,

	// Defines if login/logout and channel enter/leave are displayed:
	showChannelMessages: true,

	// Max messageText length:
	messageTextMaxLength: 1040,
	
	// Defines if the socket server is enabled:
	socketServerEnabled: false,
	// Defines the hostname of the socket server used to connect from client side:
	socketServerHost: 'localhost',
	// Defines the port of the socket server:
	socketServerPort: 1935,
	// This ID can be used to distinguish between different chat installations using the same socket server:
	socketServerChatID: 0

}
