diff -upN habla-5.x-1.0/habla.info habla/habla.info
--- habla-5.x-1.0/habla.info	2008-06-11 00:10:11.000000000 -0700
+++ habla/habla.info	2008-07-23 12:34:34.000000000 -0700
@@ -1,9 +1,5 @@
 name = "Hab.la Live Chat"
 description = Add hab.la live chat to your Drupal website.
-version = "5.x-1.0"
+version = "6.x"
 project = "habla"
-; Information added by drupal.org packaging script on 2008-06-11
-version = "5.x-1.0"
-project = "habla"
-datestamp = "1213168211"
-
+core = 6.x
diff -upN habla-5.x-1.0/habla.install habla/habla.install
--- habla-5.x-1.0/habla.install	2008-06-10 06:33:25.000000000 -0700
+++ habla/habla.install	2008-07-23 13:04:07.000000000 -0700
@@ -1,44 +1,44 @@
 <?php
 function habla_install() {
 /*
-	variable_set('habla_siteid', '');
-	variable_set('habla_cache', 0);
-	variable_set('habla_lastcache', 0);
-*/	
+  variable_set('habla_siteid', '');
+  variable_set('habla_cache', 0);
+  variable_set('habla_lastcache', 0);
+*/  
 }
 
 function habla_uninstall() {
-	variable_del('habla_siteid');
-	variable_del('habla_cache');
-	variable_del('habla_lastcache');
-	variable_del('habla_cpanel');
-	variable_del('habla_position');
-	variable_del('habla_mainwidth');
-	variable_del('habla_mainheight');
-	variable_del('habla_saytext');
-	variable_del('habla_beforechattext');
-	variable_del('habla_inchattext');
-	variable_del('habla_notavailabletext');
-	variable_del('habla_busytext');
-	variable_del('habla_awaytext');
-	variable_del('habla_welcomemsg');
-	variable_del('habla_offlinemsg');
-	variable_del('habla_busymsg');
-	variable_del('habla_expandonmsgreceived');
-	variable_del('habla_starthidden');
-	variable_del('habla_hide_not_available');
-	variable_del('habla_hide_when_away');
-	variable_del('habla_mainbg');
-	variable_del('habla_mainfg');
-	variable_del('habla_titlebg');
-	variable_del('habla_titlefg');
-	variable_del('habla_buttonbg');
-	variable_del('habla_buttonfg');
-	variable_del('habla_buttonhi');
-	variable_del('habla_local');
-	variable_del('habla_remote');
-	variable_del('habla_titlebg_highlight');
-	variable_del('habla_titlefg_highlight');
-	variable_del('habla_link');
-	variable_del('habla_linkhi');
+  variable_del('habla_siteid');
+  variable_del('habla_cache');
+  variable_del('habla_lastcache');
+  variable_del('habla_cpanel');
+  variable_del('habla_position');
+  variable_del('habla_mainwidth');
+  variable_del('habla_mainheight');
+  variable_del('habla_saytext');
+  variable_del('habla_beforechattext');
+  variable_del('habla_inchattext');
+  variable_del('habla_notavailabletext');
+  variable_del('habla_busytext');
+  variable_del('habla_awaytext');
+  variable_del('habla_welcomemsg');
+  variable_del('habla_offlinemsg');
+  variable_del('habla_busymsg');
+  variable_del('habla_expandonmsgreceived');
+  variable_del('habla_starthidden');
+  variable_del('habla_hide_not_available');
+  variable_del('habla_hide_when_away');
+  variable_del('habla_mainbg');
+  variable_del('habla_mainfg');
+  variable_del('habla_titlebg');
+  variable_del('habla_titlefg');
+  variable_del('habla_buttonbg');
+  variable_del('habla_buttonfg');
+  variable_del('habla_buttonhi');
+  variable_del('habla_local');
+  variable_del('habla_remote');
+  variable_del('habla_titlebg_highlight');
+  variable_del('habla_titlefg_highlight');
+  variable_del('habla_link');
+  variable_del('habla_linkhi');
 }
\ No newline at end of file
diff -upN habla-5.x-1.0/habla.module habla/habla.module
--- habla-5.x-1.0/habla.module	2008-06-10 06:33:25.000000000 -0700
+++ habla/habla.module	2008-07-23 14:05:21.000000000 -0700
@@ -7,396 +7,434 @@
  */
 
 
-function habla_help($section) {
-	switch ($section) {
-		case 'admin/settings/habla':
-			return t('Hab.la is a free live chat that allow you to chat with your website visitors using Jabber IM client.');
-	}
+function habla_help($path, $arg) {
+  switch ($path) {
+    case 'admin/settings/habla':
+      return t('Hab.la is a free live chat that allow you to chat with your website visitors using Jabber IM client.');
+  }
 }
 
-function habla_menu($maycache) {
-	$items = array();
-	if ($maycache) {
-		$items[] = array(
-			'path' => 'admin/settings/habla',
-			'title' => t('Hab.la Live Chat'),
-			'description' => t('Configure the settings of Hab.la.'),
-			'callback' => 'drupal_get_form',
-			'callback arguments' => 'habla_admin_settings',
-			'access' => user_access('administer site configuration'),
-			'type' => MENU_NORMAL_ITEM,
-		);
-	}
-	return $items;
+function habla_menu() {
+  $items['admin/settings/habla'] = array(
+    'title' => 'Hab.la Live Chat',
+    'description' => 'Configure the settings of Hab.la.',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('habla_admin_settings'),
+    'access arguments' => array('administer site configuration'),
+    'type' => MENU_NORMAL_ITEM,
+    
+    );
+  return $items;
 }
 
 /**
  * Implementation of hook_admin_settings() for configuring the module
  */
 function habla_admin_settings() {
-	$form = array();
-	$form['habla_siteid'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Site ID'),
-		'#size' => 30,
-		'#maxlength' => 30,
-		'#default_value' => variable_get('habla_siteid',''),
-		'#description' => t('You can obtain the Site ID by creating an account at <a href="@url">hab.la</a> website.', array('@url' => 'http://hab.la'))
-	);
-	$form['habla_cache'] = array(
-		'#type' => 'checkbox',
-		'#title' => t('Cache the javascript file to your server'),
-		'#description' => t('If checked, the javascript file will be cached. This will speed up the loading but might break if the live script is updated. It will be downloaded daily from hab.la server via cron.'),
-		'#default_value' => variable_get('habla_cache', 0),
-	);
-	$form['habla_cpanel'] = array(
-		'#type' => 'checkbox',
-		'#title' => t('Use Customization Control Panel'),
-		'#description' => t('If checked, all setting below will be ignored, to configure any setting you need to use the Customization Control Panel at <a href="@url">hab.la</a> website.', array('@url' => 'http://hab.la')),
-		'#default_value' => variable_get('habla_cpanel', 1),
-	);
-	// Configuration
-	$window_position= array(
-		'TR' => 'Top Right',
-		'TL' => 'Top Left',
-		'BR' => 'Bottom Right',
-		'BL' => 'Bottom Left'
-	);
-
-	$form['habla_config'] = array(
-		'#type' => 'fieldset',
-		'#title' => t('Configuration'),
-		'#collapsible' => TRUE,
-		'#collapsed'=>TRUE
-	);
-	$form['habla_config']['habla_position'] = array(
-		'#type' => 'select',
-		'#title' => t('Window Position'),
-		'#options' => $window_position,
-		'#description' => t('Set the position of hab.la window position'),
-		'#default_value' => variable_get('habla_position', 'BL')
-	);
-	$form['habla_config']['habla_mainwidth'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Width'),
-		'#size' => 10,
-		'#maxlength' => 10,
-		'#default_value' => variable_get('habla_mainwidth',''),
-		'#description' => t('The width of chat box. Leave empty for default.')
-	);
-	$form['habla_config']['habla_mainheight'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Height'),
-		'#size' => 10,
-		'#maxlength' => 10,
-		'#default_value' => variable_get('habla_mainheight',''),
-		'#description' => t('The height of chat box. Leave empty for default.')
-	);
-	$form['habla_config']['habla_disableGoogleAnalytics'] = array(
-		'#type' => 'radios',
-		'#title' => t('Disable logging chat event to Google Analytics'),
-		'#default_value' => variable_get('habla_disableGoogleAnalytics', 0),
-		'#options' => array(1 => 'Yes', 0 => 'No'),
-		'#description' => t('By default, if you have google analytics on your page Hab.la will automatically report chat events to google analytics.'),
-	);
-	$form['habla_config']['habla_expandonmsgreceived'] = array(
-		'#type' => 'radios',
-		'#title' => t('Chat window will expand when you send the user a message'),
-		'#default_value' => variable_get('habla_expandonmsgreceived', 0),
-		'#options' => array(1 => 'Yes', 0 => 'No'),
-	);
-	$form['habla_config']['habla_starthidden'] = array(
-		'#type' => 'radios',
-		'#title' => t('Hide the chat bar even when you are available'),
-		'#default_value' => variable_get('habla_starthidden', 0),
-		'#options' => array(1 => 'Yes', 0 => 'No'),
-	);
-	$form['habla_config']['habla_hide_not_available'] = array(
-		'#type' => 'radios',
-		'#title' => t('Hide the chat bar from displaying when you are unavailable'),
-		'#default_value' => variable_get('habla_hide_not_available', 0),
-		'#options' => array(1 => 'Yes', 0 => 'No'),
-	);
-	$form['habla_config']['habla_hide_when_away'] = array(
-		'#type' => 'radios',
-		'#title' => t('Hide the chat bar when you are away'),
-		'#default_value' => variable_get('habla_hide_when_away', 0),
-		'#options' => array(1 => 'Yes', 0 => 'No'),
-	);
-	$form['habla_config']['habla_force_nickname'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Visitor Name'),
-		'#size' => 15,
-		'#maxlength' => 15,
-		'#default_value' => variable_get('habla_force_nickname','webuser'),
-		'#description' => t('Fill in <em>drupal</em> to use drupal username automatically.')
-	);
-	$form['habla_config']['habla_local_name_override'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Operator Name'),
-		'#size' => 15,
-		'#maxlength' => 15,
-		'#default_value' => variable_get('habla_local_name_override',''),
-	);
-	$form['habla_msgoption'] = array(
-		'#type' => 'fieldset',
-		'#title' => t('Message and Text'),
-		'#collapsible' => TRUE,
-		'#collapsed'=>TRUE
-	);
-	$form['habla_msgoption']['habla_saytext'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Input label'),
-		'#size' => 60,
-		'#maxlength' => 60,
-		'#default_value' => variable_get('habla_saytext','Say: '),
-		'#description' => t('Text that appears beside the user input.')
-	);
-	$form['habla_msgoption']['habla_beforechattext'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Before Chat Text'),
-		'#size' => 60,
-		'#maxlength' => 60,
-		'#default_value' => variable_get('habla_beforechattext','click here to chat'),
-		'#description' => t('Text that appear on top before a chat begins.')
-	);
-	$form['habla_msgoption']['habla_inchattext'] = array(
-		'#type' => 'textfield',
-		'#title' => t('In Chat Text'),
-		'#size' => 60,
-		'#maxlength' => 60,
-		'#default_value' => variable_get('habla_inchattext','now chatting'),
-		'#description' => t('Text displayed in the top bar during a chat.')
-	);
-	$form['habla_msgoption']['habla_notavailabletext'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Not Available Text'),
-		'#size' => 60,
-		'#maxlength' => 60,
-		'#default_value' => variable_get('habla_notavailabletext','not available'),
-		'#description' => t('Text displayed in the top bar when the operator is not available.')
-	);
-	$form['habla_msgoption']['habla_busytext'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Busy Text'),
-		'#size' => 60,
-		'#maxlength' => 60,
-		'#default_value' => variable_get('habla_busytext','busy'),
-		'#description' => t('Text displayed in the top bar when the operator is busy or they have reached their concurrent slot limit.')
-	);
-	$form['habla_msgoption']['habla_awaytext'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Away Text'),
-		'#size' => 60,
-		'#maxlength' => 60,
-		'#default_value' => variable_get('habla_awaytext','away'),
-		'#description' => t('Text displayed in the top bar when the operator is away.')
-	);
-	$form['habla_msgoption']['habla_welcomemsg'] = array(
-		'#type' => 'textarea',
-		'#title' => t('Welcome Message'),
-		'#rows' => 3,
-		'#default_value' => variable_get('habla_welcomemsg','<p>Welcome to my website, you can use this box to chat with me!</p>'),
-		'#description' => t('The welcome message is displayed when a visitor expands the hab.la window but there is no active conversation. HTML enabled.')
-	);
-	$form['habla_msgoption']['habla_offlinemsg'] = array(
-		'#type' => 'textarea',
-		'#title' => t('Offline Message'),
-		'#rows' => 3,
-		'#default_value' => variable_get('habla_offlinemsg','<p>No one is available right now. Please try again later.</p>'),
-		'#description' => t('This message is displayed in the body of the hab.la window when no operators are available. HTML enabled.')
-	);
-	$form['habla_msgoption']['habla_busymsg'] = array(
-		'#type' => 'textarea',
-		'#title' => t('Busy Message'),
-		'#rows' => 3,
-		'#default_value' => variable_get('habla_busymsg','<p>Our operator is busy. Please wait or try again later.</p>'),
-		'#description' => t('This message is displayed in the body of the hab.la window when an operator exceed their concurrent slot limit. HTML enabled.')
-	);
-	
-	$form['habla_coloroption'] = array(
-		'#type' => 'fieldset',
-		'#title' => t('Color Option'),
-		'#collapsible' => TRUE,
-		'#collapsed'=>TRUE
-	);
-	$form['habla_coloroption']['habla_mainbg'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Main Background'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_mainbg',''),
-	);
-	$form['habla_coloroption']['habla_mainfg'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Main Text'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_mainfg',''),
-	);
-	$form['habla_coloroption']['habla_titlebg'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Title background'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_titlebg',''),
-	);
-	$form['habla_coloroption']['habla_titlefg'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Title text'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_titlefg',''),
-	);
-	$form['habla_coloroption']['habla_buttonbg'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Background of the minimize and close buttons'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_buttonbg',''),
-	);
-	$form['habla_coloroption']['habla_buttonfg'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Text of the minimize and close buttons'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_buttonfg',''),
-	);
-	$form['habla_coloroption']['habla_buttonhi'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Highlight of the minimize and close buttons'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_buttonhi',''),
-	);
-	$form['habla_coloroption']['habla_control'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Text input box'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_control',''),
-	);
-	$form['habla_coloroption']['habla_local'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Web username'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_local',''),
-	);
-	$form['habla_coloroption']['habla_remote'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Operator name'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_remote',''),
-	);
-	$form['habla_coloroption']['habla_titlebg_highlight'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Title bar when highlighted'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_titlebg_highlight',''),
-	);
-	$form['habla_coloroption']['habla_titlefg_highlight'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Titlebar text when highlighted'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_titlefg_highlight',''),
-	);
-	$form['habla_coloroption']['habla_link'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Color of link'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_link',''),
-	);
-	$form['habla_coloroption']['habla_linkhi'] = array(
-		'#type' => 'textfield',
-		'#title' => t('Color of link when higlighted'),
-		'#size' => 10,
-		'#maxlength' => 11,
-		'#default_value' => variable_get('habla_linkhi',''),
-	);
-	
-	return system_settings_form($form);
+  $form = array();
+  $form['habla_siteid'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Site ID'),
+    '#size' => 30,
+    '#maxlength' => 30,
+    '#default_value' => variable_get('habla_siteid', ''),
+    '#description' => t('You can obtain the Site ID by creating an account at <a href="@url">hab.la</a> website.', array('@url' => 'http://hab.la'))
+  );
+  $form['habla_cache'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Cache the javascript file to your server'),
+    '#description' => t('If checked, the javascript file will be cached. This will speed up the loading but might break if the live script is updated. It will be downloaded daily from hab.la server via cron.'),
+    '#default_value' => variable_get('habla_cache', 0),
+  );
+  $form['habla_cpanel'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use Customization Control Panel'),
+    '#description' => t('If checked, all setting below will be ignored, to configure any setting you need to use the Customization Control Panel at <a href="@url">hab.la</a> website.', array('@url' => 'http://hab.la')),
+    '#default_value' => variable_get('habla_cpanel', 1),
+  );
+  // Configuration
+  $window_position= array(
+    'TR' => 'Top Right',
+    'TL' => 'Top Left',
+    'BR' => 'Bottom Right',
+    'BL' => 'Bottom Left'
+  );
+
+  $form['habla_config'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Configuration'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE
+  );
+  $form['habla_config']['habla_position'] = array(
+    '#type' => 'select',
+    '#title' => t('Window Position'),
+    '#options' => $window_position,
+    '#description' => t('Set the position of hab.la window position'),
+    '#default_value' => variable_get('habla_position', 'BL')
+  );
+  $form['habla_config']['habla_mainwidth'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Width'),
+    '#size' => 10,
+    '#maxlength' => 10,
+    '#default_value' => variable_get('habla_mainwidth', ''),
+    '#description' => t('The width of chat box. Leave empty for default.')
+  );
+  $form['habla_config']['habla_mainheight'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Height'),
+    '#size' => 10,
+    '#maxlength' => 10,
+    '#default_value' => variable_get('habla_mainheight', ''),
+    '#description' => t('The height of chat box. Leave empty for default.')
+  );
+  $form['habla_config']['habla_disableGoogleAnalytics'] = array(
+    '#type' => 'radios',
+    '#title' => t('Disable logging chat event to Google Analytics'),
+    '#default_value' => variable_get('habla_disableGoogleAnalytics', 0),
+    '#options' => array(1 => 'Yes', 0 => 'No'),
+    '#description' => t('By default, if you have google analytics on your page Hab.la will automatically report chat events to google analytics.'),
+  );
+  $form['habla_config']['habla_expandonmsgreceived'] = array(
+    '#type' => 'radios',
+    '#title' => t('Chat window will expand when you send the user a message'),
+    '#default_value' => variable_get('habla_expandonmsgreceived', 0),
+    '#options' => array(1 => 'Yes', 0 => 'No'),
+  );
+  $form['habla_config']['habla_starthidden'] = array(
+    '#type' => 'radios',
+    '#title' => t('Hide the chat bar even when you are available'),
+    '#default_value' => variable_get('habla_starthidden', 0),
+    '#options' => array(1 => 'Yes', 0 => 'No'),
+  );
+  $form['habla_config']['habla_hide_not_available'] = array(
+    '#type' => 'radios',
+    '#title' => t('Hide the chat bar from displaying when you are unavailable'),
+    '#default_value' => variable_get('habla_hide_not_available', 0),
+    '#options' => array(1 => 'Yes', 0 => 'No'),
+  );
+  $form['habla_config']['habla_hide_when_away'] = array(
+    '#type' => 'radios',
+    '#title' => t('Hide the chat bar when you are away'),
+    '#default_value' => variable_get('habla_hide_when_away', 0),
+    '#options' => array(1 => 'Yes', 0 => 'No'),
+  );
+  $form['habla_config']['habla_force_nickname'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Visitor Name'),
+    '#size' => 15,
+    '#maxlength' => 15,
+    '#default_value' => variable_get('habla_force_nickname', 'webuser'),
+    '#description' => t('Fill in <em>drupal</em> to use drupal username automatically.')
+  );
+  $form['habla_config']['habla_local_name_override'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Operator Name'),
+    '#size' => 15,
+    '#maxlength' => 15,
+    '#default_value' => variable_get('habla_local_name_override', ''),
+  );
+  $form['habla_msgoption'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Message and Text'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE
+  );
+  $form['habla_msgoption']['habla_saytext'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Input label'),
+    '#size' => 60,
+    '#maxlength' => 60,
+    '#default_value' => variable_get('habla_saytext', 'Say: '),
+    '#description' => t('Text that appears beside the user input.')
+  );
+  $form['habla_msgoption']['habla_beforechattext'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Before Chat Text'),
+    '#size' => 60,
+    '#maxlength' => 60,
+    '#default_value' => variable_get('habla_beforechattext', 'click here to chat'),
+    '#description' => t('Text that appear on top before a chat begins.')
+  );
+  $form['habla_msgoption']['habla_inchattext'] = array(
+    '#type' => 'textfield',
+    '#title' => t('In Chat Text'),
+    '#size' => 60,
+    '#maxlength' => 60,
+    '#default_value' => variable_get('habla_inchattext', 'now chatting'),
+    '#description' => t('Text displayed in the top bar during a chat.')
+  );
+  $form['habla_msgoption']['habla_notavailabletext'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Not Available Text'),
+    '#size' => 60,
+    '#maxlength' => 60,
+    '#default_value' => variable_get('habla_notavailabletext', 'not available'),
+    '#description' => t('Text displayed in the top bar when the operator is not available.')
+  );
+  $form['habla_msgoption']['habla_busytext'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Busy Text'),
+    '#size' => 60,
+    '#maxlength' => 60,
+    '#default_value' => variable_get('habla_busytext', 'busy'),
+    '#description' => t('Text displayed in the top bar when the operator is busy or they have reached their concurrent slot limit.')
+  );
+  $form['habla_msgoption']['habla_awaytext'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Away Text'),
+    '#size' => 60,
+    '#maxlength' => 60,
+    '#default_value' => variable_get('habla_awaytext', 'away'),
+    '#description' => t('Text displayed in the top bar when the operator is away.')
+  );
+  $form['habla_msgoption']['habla_welcomemsg'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Welcome Message'),
+    '#rows' => 3,
+    '#default_value' => variable_get('habla_welcomemsg', '<p>Welcome to my website, you can use this box to chat with me!</p>'),
+    '#description' => t('The welcome message is displayed when a visitor expands the hab.la window but there is no active conversation. HTML enabled.')
+  );
+  $form['habla_msgoption']['habla_offlinemsg'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Offline Message'),
+    '#rows' => 3,
+    '#default_value' => variable_get('habla_offlinemsg', '<p>No one is available right now. Please try again later.</p>'),
+    '#description' => t('This message is displayed in the body of the hab.la window when no operators are available. HTML enabled.')
+  );
+  $form['habla_msgoption']['habla_busymsg'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Busy Message'),
+    '#rows' => 3,
+    '#default_value' => variable_get('habla_busymsg', '<p>Our operator is busy. Please wait or try again later.</p>'),
+    '#description' => t('This message is displayed in the body of the hab.la window when an operator exceed their concurrent slot limit. HTML enabled.')
+  );
+  
+  $form['habla_coloroption'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Color Option'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE
+  );
+  $form['habla_coloroption']['habla_mainbg'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Main Background'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_mainbg', ''),
+  );
+  $form['habla_coloroption']['habla_mainfg'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Main Text'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_mainfg', ''),
+  );
+  $form['habla_coloroption']['habla_titlebg'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Title background'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_titlebg', ''),
+  );
+  $form['habla_coloroption']['habla_titlefg'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Title text'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_titlefg', ''),
+  );
+  $form['habla_coloroption']['habla_buttonbg'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Background of the minimize and close buttons'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_buttonbg', ''),
+  );
+  $form['habla_coloroption']['habla_buttonfg'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Text of the minimize and close buttons'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_buttonfg', ''),
+  );
+  $form['habla_coloroption']['habla_buttonhi'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Highlight of the minimize and close buttons'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_buttonhi', ''),
+  );
+  $form['habla_coloroption']['habla_control'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Text input box'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_control', ''),
+  );
+  $form['habla_coloroption']['habla_local'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Web username'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_local', ''),
+  );
+  $form['habla_coloroption']['habla_remote'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Operator name'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_remote', ''),
+  );
+  $form['habla_coloroption']['habla_titlebg_highlight'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Title bar when highlighted'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_titlebg_highlight', ''),
+  );
+  $form['habla_coloroption']['habla_titlefg_highlight'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Titlebar text when highlighted'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_titlefg_highlight', ''),
+  );
+  $form['habla_coloroption']['habla_link'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Color of link'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_link', ''),
+  );
+  $form['habla_coloroption']['habla_linkhi'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Color of link when higlighted'),
+    '#size' => 10,
+    '#maxlength' => 11,
+    '#default_value' => variable_get('habla_linkhi', ''),
+  );
+  
+  return system_settings_form($form);
 }
 
 /**
  * Implementation of hook_footer() to insert Javascript at the end of the page
  */
 function habla_footer() {
-	$id = variable_get('habla_siteid', '');
+  $id = variable_get('habla_siteid', '');
 
-	if ($id) {
-		// Use local cache?
-		
-		if (variable_get('habla_cache', 0) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC)) {
-			$source = _habla_cache('http://static.hab.la/js/wc.js');
-			if (!empty($source)) {
-				//$source = base_path() . $source;
-				drupal_add_js($source, 'module', 'header');
-			}
-		}
-		
-		if (!isset($source)) {
-			$source = 'http://static.hab.la/js/wc.js';
-			$script = '<script type="text/javascript" src="'. $source .'"></script>';
-		}
-		$script .= '<script type="text/javascript">';
-		if (variable_get('habla_cpanel', 1) == 0) {
-			$script .= 'c=wc_config();';
-			$script .= 'c.setPosition("'.variable_get('habla_position', 'BL').'");';
-			
-			if (variable_get('habla_mainwidth','')) { $script .= 'c.setWidth('.variable_get('habla_mainwidth','').');'; }
-			if (variable_get('habla_mainheight','')) { $script .= 'c.vars["convo_height"] = '.variable_get('habla_mainheight','').';'; }
-			$script .= 'c.vars["disableGoogleAnalytics"] ='.variable_get('habla_disableGoogleAnalytics', 0).';';
-			
-			$script .= 'c.vars["say_text"] = "'.variable_get('habla_saytext','Say: ').'";';
-			$script .= 'c.vars["before_chat_text"] = "'.variable_get('habla_beforechattext','click here to chat').'";';
-			$script .= 'c.vars["in_chat_text"] = "'.variable_get('habla_inchattext','now chatting').'";';
-			$script .= 'c.vars["not_available_text"] = "'.variable_get('habla_notavailabletext','not available').'";';
-			$script .= 'c.vars["busy_text"] = "'.variable_get('habla_busytext','busy').'";';
-			$script .= 'c.vars["away_text"] = "'.variable_get('habla_awaytext','away').'";';
-			$script .= 'c.vars["welcome_message"] = \''.variable_get('habla_welcomemsg', '<p>Welcome to my website, you can use this box to chat with me!</p>').'\';';
-			$script .= 'c.vars["offline_message"] = \''.variable_get('habla_offlinemsg', '<p>No one is available right now. Please try again later.</p>').'\';';
-			$script .= 'c.vars["busy_message"] = \''.variable_get('habla_busymsg', '<p>Our operator is busy. Please wait or try again later.</p>').'\';';
-	
-			$visitorname = variable_get('habla_force_nickname','webuser');
-			if ($visitorname == 'drupal') {
-				global $user;
-				$visitorname = $user->name;
-			}
-			//config.vars["local_name_override"] = "Your name";
-			$script .= 'c.vars["force_nickname"] = "'.$visitorname.'";';
-			if (variable_get('habla_local_name_override','')) { $script .= 'c.vars["local_name_override"]="'.variable_get('habla_local_name_override','').'";'; }
-			
-			if (variable_get('habla_expandonmsgreceived',0)) { $script .= 'c.vars["expandOnMessageReceived"]='.variable_get('habla_expandonmsgreceived',0).';'; }
-			if (variable_get('habla_starthidden',0)) { $script .= 'c.vars["start_hidden"] = '.variable_get('habla_starthidden',0).';'; }
-			if (variable_get('habla_hide_not_available',0)) { $script .= 'c.vars["hide_not_available"] = '.variable_get('habla_hide_not_available',0).';'; }
-			if (variable_get('habla_hide_when_away',0)) { $script .= 'c.vars["hide_when_away"] = '.variable_get('habla_hide_when_away',0).';'; }
-			
-			if (variable_get('habla_mainbg','')) { $script .= 'c.palette["mainbg"] = "'.variable_get('habla_mainbg','').'";'; }
-			if (variable_get('habla_mainfg','')) { $script .= 'c.palette["mainfg"] = "'.variable_get('habla_mainfg','').'";'; }
-			if (variable_get('habla_titlebg','')) { $script .= 'c.palette["titlebg"] = "'.variable_get('habla_titlebg','').'";'; }
-			if (variable_get('habla_titlefg','')) { $script .= 'c.palette["titlefg"] = "'.variable_get('habla_titlefg','').'";'; }
-			if (variable_get('habla_buttonbg','')) { $script .= 'c.palette["buttonbg"] = "'.variable_get('habla_buttonbg','').'";'; }
-			if (variable_get('habla_buttonfg','')) { $script .= 'c.palette["buttonfg"] = "'.variable_get('habla_buttonfg','').'";'; }
-			if (variable_get('habla_buttonhi','')) { $script .= 'c.palette["buttonhi"] = "'.variable_get('habla_buttonhi','').'";'; }
-		
-			if (variable_get('habla_local','')) { $script .= 'c.palette["local"] = "'.variable_get('habla_local','').'";'; }
-			if (variable_get('habla_remote','')) { $script .= 'c.palette["remote"] = "'.variable_get('habla_remote','').'";'; }
-			if (variable_get('habla_titlebg_highlight','')) { $script .= 'c.palette["titlebg_highlight"] = "'.variable_get('habla_titlebg_highlight','').'";'; }
-			if (variable_get('habla_titlefg_highlight','')) { $script .= 'c.palette["titlefg_highlight"] = "'.variable_get('habla_titlefg_highlight','').'";'; }
-			if (variable_get('habla_link','')) { $script .= 'c.palette["link"] = "'.variable_get('habla_link','').'";'; }
-			if (variable_get('habla_linkhi','')) { $script .= 'c.palette["linkhi"] = "'.variable_get('habla_linkhi','').'";'; }
-
-		}
-		$script .= 'wc_init('. drupal_to_js($id);
-		if (variable_get('habla_cpanel', 1) == 0) { $script .= ',c'; }
-		$script .= ');</script>';
-		return $script;
-	} //if $id
+  if ($id) {
+    // Use local cache?
+    
+    if (variable_get('habla_cache', 0) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC)) {
+      $source = _habla_cache('http://static.hab.la/js/wc.js');
+      if (!empty($source)) {
+        //$source = base_path() . $source;
+        drupal_add_js($source, 'module', 'header');
+      }
+    }
+    
+    if (!isset($source)) {
+      $source = 'http://static.hab.la/js/wc.js';
+      $script = '<script type="text/javascript" src="'. $source .'"></script>';
+    }
+    $script .= '<script type="text/javascript">';
+    if (variable_get('habla_cpanel', 1) == 0) {
+      $script .= 'c=wc_config();';
+      $script .= 'c.setPosition("'. variable_get('habla_position', 'BL') .'");';
+      
+      if (variable_get('habla_mainwidth', '')) { 
+        $script .= 'c.setWidth('. variable_get('habla_mainwidth', '') .');'; 
+        }
+      if (variable_get('habla_mainheight', '')) { 
+        $script .= 'c.vars["convo_height"] = '. variable_get('habla_mainheight', '') .';'; 
+        }
+      $script .= 'c.vars["disableGoogleAnalytics"] ='. variable_get('habla_disableGoogleAnalytics', 0) .';';
+      
+      $script .= 'c.vars["say_text"] = "'. variable_get('habla_saytext', 'Say: ') .'";';
+      $script .= 'c.vars["before_chat_text"] = "'. variable_get('habla_beforechattext', 'click here to chat') .'";';
+      $script .= 'c.vars["in_chat_text"] = "'. variable_get('habla_inchattext', 'now chatting') .'";';
+      $script .= 'c.vars["not_available_text"] = "'. variable_get('habla_notavailabletext', 'not available') .'";';
+      $script .= 'c.vars["busy_text"] = "'. variable_get('habla_busytext', 'busy') .'";';
+      $script .= 'c.vars["away_text"] = "'. variable_get('habla_awaytext', 'away') .'";';
+      $script .= 'c.vars["welcome_message"] = \''. variable_get('habla_welcomemsg', '<p>Welcome to my website, you can use this box to chat with me!</p>') .'\';';
+      $script .= 'c.vars["offline_message"] = \''. variable_get('habla_offlinemsg', '<p>No one is available right now. Please try again later.</p>') .'\';';
+      $script .= 'c.vars["busy_message"] = \''. variable_get('habla_busymsg', '<p>Our operator is busy. Please wait or try again later.</p>') .'\';';
+  
+      $visitorname = variable_get('habla_force_nickname', 'webuser');
+      if ($visitorname == 'drupal') {
+        global $user;
+        $visitorname = $user->name;
+      }
+      //config.vars["local_name_override"] = "Your name";
+      $script .= 'c.vars["force_nickname"] = "'. $visitorname .'";';
+      if (variable_get('habla_local_name_override', '')) {
+        $script .= 'c.vars["local_name_override"]="'. variable_get('habla_local_name_override', '') .'";'; 
+        }
+      
+      if (variable_get('habla_expandonmsgreceived', 0)) { 
+        $script .= 'c.vars["expandOnMessageReceived"]='. variable_get('habla_expandonmsgreceived', 0) .';'; 
+        }
+      if (variable_get('habla_starthidden', 0)) {
+        $script .= 'c.vars["start_hidden"] = '. variable_get('habla_starthidden', 0) .';'; 
+        }
+      if (variable_get('habla_hide_not_available', 0)) {
+        $script .= 'c.vars["hide_not_available"] = '. variable_get('habla_hide_not_available', 0) .';'; 
+        }
+      if (variable_get('habla_hide_when_away', 0)) {
+        $script .= 'c.vars["hide_when_away"] = '. variable_get('habla_hide_when_away', 0) .';'; }
+      
+      if (variable_get('habla_mainbg', '')) {
+        $script .= 'c.palette["mainbg"] = "'. variable_get('habla_mainbg', '') .'";';
+        }
+      if (variable_get('habla_mainfg', '')) {
+        $script .= 'c.palette["mainfg"] = "'. variable_get('habla_mainfg', '') .'";';
+        }
+      if (variable_get('habla_titlebg', '')) {
+        $script .= 'c.palette["titlebg"] = "'. variable_get('habla_titlebg', '') .'";';
+        }
+      if (variable_get('habla_titlefg', '')) {
+        $script .= 'c.palette["titlefg"] = "'. variable_get('habla_titlefg', '') .'";';
+        }
+      if (variable_get('habla_buttonbg', '')) {
+        $script .= 'c.palette["buttonbg"] = "'. variable_get('habla_buttonbg', '') .'";';
+        }
+      if (variable_get('habla_buttonfg', '')) {
+        $script .= 'c.palette["buttonfg"] = "'. variable_get('habla_buttonfg', '') .'";';
+        }
+      if (variable_get('habla_buttonhi', '')) {
+        $script .= 'c.palette["buttonhi"] = "'. variable_get('habla_buttonhi', '') .'";';
+        }
+    
+      if (variable_get('habla_local', '')) {
+        $script .= 'c.palette["local"] = "'. variable_get('habla_local', '') .'";';
+        }
+      if (variable_get('habla_remote', '')) {
+        $script .= 'c.palette["remote"] = "'. variable_get('habla_remote', '') .'";';
+        }
+      if (variable_get('habla_titlebg_highlight', '')) {
+        $script .= 'c.palette["titlebg_highlight"] = "'. variable_get('habla_titlebg_highlight', '') .'";';
+        }
+      if (variable_get('habla_titlefg_highlight', '')) {
+        $script .= 'c.palette["titlefg_highlight"] = "'. variable_get('habla_titlefg_highlight', '') .'";';
+        }
+      if (variable_get('habla_link', '')) {
+        $script .= 'c.palette["link"] = "'. variable_get('habla_link', '') .'";';
+        }
+      if (variable_get('habla_linkhi', '')) {
+        $script .= 'c.palette["linkhi"] = "'. variable_get('habla_linkhi', '') .'";';
+        }
+
+    }
+    $script .= 'wc_init('. drupal_to_js($id);
+    if (variable_get('habla_cpanel', 1) == 0) { 
+      $script .= ',c';
+      }
+    $script .= ');</script>';
+    return $script;
+  } //if $id
 } //habla_footer()
 
 /**
@@ -407,49 +445,49 @@ function habla_footer() {
  *   The path to the local javascript file on success, boolean FALSE on failure.
  */
 function _habla_cache($location = 'http://static.hab.la/js/wc.js') {
-	$directory = file_directory_path() .'/habla';
-	$file_destination = $directory .'/'. basename($location);
-	if (!file_exists($file_destination)) {
-		$result = drupal_http_request($location);
-			if ($result->code == 200) {
-				// Check that the files directory is writable
-				if (file_check_directory($directory, FILE_CREATE_DIRECTORY)) {
-					return file_save_data($result->data, $directory .'/'. basename($location), FILE_EXISTS_REPLACE);
-				}
-			}
-	} 
-	else {
-		return $file_destination;
-	}
+  $directory = file_directory_path() .'/habla';
+  $file_destination = $directory .'/'. basename($location);
+  if (!file_exists($file_destination)) {
+    $result = drupal_http_request($location);
+      if ($result->code == 200) {
+        // Check that the files directory is writable
+        if (file_check_directory($directory, FILE_CREATE_DIRECTORY)) {
+          return file_save_data($result->data, $directory .'/'. basename($location), FILE_EXISTS_REPLACE);
+        }
+      }
+  } 
+  else {
+    return $file_destination;
+  }
 }
 
 /**
  * Implementation of hook_requirements().
  */
 function habla_requirements($phase) {
-	$requirements = array();
-	if ($phase == 'runtime') {
-		// Raise warning if hab.la site id has not been set yet.
-		if (variable_get('habla_siteid', '') == '') {
-			$requirements['habla'] = array(
-				'title' => t('Hab.la Live Chat module'),
-				'description' => t('Hab.la module has not been configured yet.'),
-				'severity' => REQUIREMENT_ERROR,
-				'value' => t('Not configured'),
-			);
-		}
-	}
-	
-	return $requirements;
+  $requirements = array();
+  if ($phase == 'runtime') {
+    // Raise warning if hab.la site id has not been set yet.
+    if (variable_get('habla_siteid', '') == '') {
+      $requirements['habla'] = array(
+        'title' => t('Hab.la Live Chat module'),
+        'description' => t('Hab.la module has not been configured yet.'),
+        'severity' => REQUIREMENT_ERROR,
+        'value' => t('Not configured'),
+      );
+    }
+  }
+  
+  return $requirements;
 }
 
 /**
  * Implementation of hook_cron().
  */
 function habla_cron() {
-	// Regenerate the js every day.
-	if (time() - variable_get('habla_lastcache', 0) >= 86400) {
-		file_delete(file_directory_path() .'/habla/wc.js');
-		variable_set('habla_lastcache', time());
-	}
+  // Regenerate the js every day.
+  if (time() - variable_get('habla_lastcache', 0) >= 86400) {
+    file_delete(file_directory_path() .'/habla/wc.js');
+    variable_set('habla_lastcache', time());
+  }
 }
\ No newline at end of file
