/*
 * Copyright (C) 1995-2011 by 4system Polska Sp. z o.o.
 * All Rights Reserved. v4
 */
 
componentLexiconGroups = function(name)
{
	this.__componentText = __componentText;
	this.__componentText(name);
	
	this.groups = "";	
};

componentLexiconGroups.prototype = new __componentText;
componentLexiconGroups.prototype.type = "componentLexiconGroups";

componentLexiconGroups.prototype.onBaseCreate = function(obj)
{
	this.captureMouseEvents();
};

componentLexiconGroups.prototype.componentLexiconGroupsBaseOnCreate = componentLexiconGroups.prototype.onCreate;
componentLexiconGroups.prototype.onCreate = function(obj)
{
	this.componentLexiconGroupsBaseOnCreate();
	
	if (this.scrollable) {
		this.scrollOffset = 14;
		this.stopPropagation = true;
	};

	this.groups = this.text;
};

componentLexiconGroups.prototype.onPaint = function(obj)
{
	var f_list = this.groups.split(" ");
	this.text = "";
	for (var i=0; i<f_list.length; i++) {
		var filter = f_list[i];

		if (filter.length > 1 && filter != "0-9") filter = "";
		
		if (filter != "" && !lexicon.existsKey(f_list[i], true)) {
			this.text += f_list[i] + " ";
		} else {
			this.text += '<a href="javascript:void(0);" title="' + f_list[i] + '" onclick="pc.' + this.id + '.doClick(\'' + filter + '\');">' + f_list[i] + '</a> ';
		}
	}
	this.setValue(this.text);
};

componentLexiconGroups.prototype.doClick = function(value)
{
	lexicon.setFilter(value);
};
