var CandyShop = (function(self) { return self; }(CandyShop || {}));

CandyShop.Colors = (function(self, Candy, $) {

	var _numColors,
		_currentColor = 0;

	self.init = function(numColors) {
		_numColors = numColors ? numColors : 8;

		self.applyTranslations();

		Candy.View.Event.Message.beforeSend = function(message) {
			if(_currentColor > 0 && $.trim(message) !== '') {
				return '|c:'+ _currentColor +'|' + message;
			}
			return message;
		};

		Candy.View.Event.Message.beforeShow = function(args) {
			var message = ($.type(args) !== 'string') ? /* Candy >= 1.0.4 */ args.message : /* Candy < 1.0.4 */ args;
			return message.replace(/^\|c:([0-9]{1,2})\|(.*)/gm, '<span class="colored color-$1">$2</span>');
		};

		if(Candy.Util.cookieExists('candyshop-colors-current')) {
			var color = parseInt(Candy.Util.getCookie('candyshop-colors-current'), 10);
			if(color > 0 && color < _numColors) {
				_currentColor = color;
			}
		}
		var html = '<li id="colors-control" data-tooltip="' + $.i18n._('candyshopColorsMessagecolor') + '"><span class="color-' + _currentColor + '" id="colors-control-indicator"></span></li>';
		$('#emoticons-icon').after(html);
		$('#colors-control').click(function(event) {
			CandyShop.Colors.showPicker(this);
		});
	};

	self.showPicker = function(elem) {
		elem = $(elem);
		var pos = elem.offset(),
			menu = $('#context-menu'),
			content = $('ul', menu),
			colors = '',
			i;

		$('#tooltip').hide();

		for(i = _numColors-1; i >= 0; i--) {
			colors = '<span class="color-' + i + '" data-color="' + i + '"></span>' + colors;
		}
		content.html('<li class="colors">' + colors + '</li>');
		content.find('span').click(function() {
			_currentColor = $(this).attr('data-color');
			$('#colors-control-indicator').attr('class', 'color-' + _currentColor);
			Candy.Util.setCookie('candyshop-colors-current', _currentColor, 365);
			Candy.View.Pane.Room.setFocusToForm(Candy.View.getCurrent().roomJid);
			menu.hide();
		});

		var posLeft = Candy.Util.getPosLeftAccordingToWindowBounds(menu, pos.left),
			posTop  = Candy.Util.getPosTopAccordingToWindowBounds(menu, pos.top);

		menu.css({'left': posLeft.px, 'top': posTop.px, backgroundPosition: posLeft.backgroundPositionAlignment + ' ' + posTop.backgroundPositionAlignment});
		menu.fadeIn('fast');

		return true;
	};

	self.applyTranslations = function() {
		Candy.View.Translation.en.candyshopColorsMessagecolor = 'Message color';
		Candy.View.Translation.ru.candyshopColorsMessagecolor = 'Цвет сообщения';
		Candy.View.Translation.de.candyshopColorsMessagecolor = 'Farbe für Nachrichten';
		Candy.View.Translation.fr.candyshopColorsMessagecolor = 'Couleur des messages';
		Candy.View.Translation.nl.candyshopColorsMessagecolor = 'Berichtkleur';
		Candy.View.Translation.es.candyshopColorsMessagecolor = 'Color de los mensajes';
	};

	return self;
}(CandyShop.Colors || {}, Candy, jQuery));
@@ -2354,63 +2354,39 @@
 %7B%0A%09%09
-Candy.View.Translation.en.candyshopColorsMessagecolor =
+var translations = %7B%0A%09%09  'en' :
  'Me
@@ -2395,73 +2395,26 @@
 age 
-c
+C
 olor'
-;%0A%09%09Candy.View.Translation.ru.candyshopColorsMessagecolor =
+,%0A%09%09  'ru' :
  '%D0%A6%D0%B2
@@ -2430,67 +2430,20 @@
 %D0%BD%D0%B8%D1%8F'
-;%0A%09%09Candy.View.Translation.de.candyshopColorsMessagecolor =
+,%0A%09%09  'de' :
  'Fa
@@ -2466,166 +2466,189 @@
 ten'
-;%0A%09%09Candy.View.Translation.fr.candyshopColorsMessagecolor = 'Couleu
+,%0A%09%09  'fr' : 'Couleur des messages',%0A%09%09  'nl' : 'Berichtkleur',%0A%09%09  'es' : 'Colo
 r de
+ lo
 s me
-ssages';%0A%09%09Candy.View.Translation.nl.candyshopColorsMessagecolor = 'Berichtkleur';%0A
+nsajes'%0A%09%09%7D;%0A%09%09$.each(translations, function(k, v) %7B%0A%09%09%09if(Candy.View.Translation%5Bk%5D) %7B%0A%09%09
 %09%09Ca
@@ -2671,11 +2671,11 @@
 tion
-.es
+%5Bk%5D
 .can
@@ -2701,39 +2701,29 @@
 color = 
-'Color de los mensajes'
+v;%0A%09%09%09%7D%0A%0A%09%09%7D)
 ;%0A%09%7D;%0A%0A%09
@@ -2777,8 +2777,9 @@
 Query));
+%0A

Fix translations for colors.js.