function actbCategory(obj,ca){
	/* ---- Public Variables ---- */
	this.actbCategory_timeOut = -1; // Autocomplete Timeout in ms (-1: autocomplete never time out)
	this.actbCategory_lim = 4;    // Number of elements autocomplete can show (-1: no limit)
	this.actbCategory_firstText = false; // should the auto complete be limited to the beginning of keyword?
	this.actbCategory_mouse = true; // Enable Mouse Support
	this.actbCategory_delimiter = new Array(';',',');  // Delimiter for multiple autocomplete. Set it to empty array for single autocomplete
	this.actbCategory_startcheck = 1; // Show widget only after this number of characters is typed in.
	/* ---- Public Variables ---- */

	/* --- Styles --- */
	this.actbCategory_bgColor = '#74954E';
	this.actbCategory_textColor = '#FFFFFF';
	this.actbCategory_hColor = '#666666';
	this.actbCategory_fFamily = 'tahoma';
	this.actbCategory_fSize = '9pt';
	this.actbCategory_hStyle = 'font-size:9pt;font-family:tahoma;';
	/* --- Styles --- */

	/* ---- Private Variables ---- */
	var actbCategory_delimwords = new Array();
	var actbCategory_cdelimword = 0;
	var actbCategory_delimchar = new Array();
	var actbCategory_display = false;
	var actbCategory_pos = 0;
	var actbCategory_total = 0;
	var actbCategory_curr = null;
	var actbCategory_rangeu = 0;
	var actbCategory_ranged = 0;
	var actbCategory_bool = new Array();
	var actbCategory_pre = 0;
	var actbCategory_toid;
	var actbCategory_tomake = false;
	var actbCategory_getpre = "";
	var actbCategory_mouse_on_list = 1;
	var actbCategory_kwcount = 0;
	var actbCategory_caretmove = false;
	this.actbCategory_keywords = new Array();
	/* ---- Private Variables---- */
	
	this.actbCategory_keywords = ca;
	var actbCategory_self = this;

	actbCategory_curr = obj;
	
	addEvent(actbCategory_curr,"focus",actbCategory_setup);
	function actbCategory_setup(){
		addEvent(document,"keydown",actbCategory_checkkey);
		addEvent(actbCategory_curr,"blur",actbCategory_clear);
		addEvent(document,"keypress",actbCategory_keypress);
	}

	function actbCategory_clear(evt){
		if (!evt) evt = event;
		removeEvent(document,"keydown",actbCategory_checkkey);
		removeEvent(actbCategory_curr,"blur",actbCategory_clear);
		removeEvent(document,"keypress",actbCategory_keypress);
		actbCategory_removedisp();
	}
	function actbCategory_parse(n){
		if (actbCategory_self.actbCategory_delimiter.length > 0){
			var t = actbCategory_delimwords[actbCategory_cdelimword].trim().addslashes();
			var plen = actbCategory_delimwords[actbCategory_cdelimword].trim().length;
		}else{
			var t = actbCategory_curr.value.addslashes();
			var plen = actbCategory_curr.value.length;
		}
		var tobuild = '';
		var i;

		if (actbCategory_self.actbCategory_firstText){
			var re = new RegExp("^" + t, "i");
		}else{
			var re = new RegExp(t, "i");
		}
		var p = n.search(re);
				
		for (i=0;i<p;i++){
			tobuild += n.substr(i,1);
		}
		tobuild += "<font style='"+(actbCategory_self.actbCategory_hStyle)+"'>"
		for (i=p;i<plen+p;i++){
			tobuild += n.substr(i,1);
		}
		tobuild += "</font>";
			for (i=plen+p;i<n.length;i++){
			tobuild += n.substr(i,1);
		}
		return tobuild;
	}
	function actbCategory_generate(){
		if (document.getElementById('tat_table')){ actbCategory_display = false;document.body.removeChild(document.getElementById('tat_table')); } 
		if (actbCategory_kwcount == 0){
			actbCategory_display = false;
			return;
		}
		a = document.createElement('table');
		a.cellSpacing='2px';
		a.cellPadding='2px';
		a.style.position='absolute';
		a.style.top = eval(curTop(actbCategory_curr) + actbCategory_curr.offsetHeight) + "px";
		a.style.left = curLeft(actbCategory_curr) + "px";
		a.style.width = "168px";
		a.style.backgroundColor=actbCategory_self.actbCategory_bgColor;
		a.id = 'tat_table';
		document.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (actbCategory_self.actbCategory_mouse){
			a.onmouseout = actbCategory_table_unfocus;
			a.onmouseover = actbCategory_table_focus;
		}
		var counter = 0;
		for (i=0;i<actbCategory_self.actbCategory_keywords.length;i++){
			if (actbCategory_bool[i]){
				counter++;
				r = a.insertRow(-1);
				if (first && !actbCategory_tomake){
					r.style.backgroundColor = actbCategory_self.actbCategory_hColor;
					first = false;
					actbCategory_pos = counter;
				}else if(actbCategory_pre == i){
					r.style.backgroundColor = actbCategory_self.actbCategory_hColor;
					first = false;
					actbCategory_pos = counter;
				}else{
					r.style.backgroundColor = actbCategory_self.actbCategory_bgColor;
				}
				r.id = 'tat_tr'+(j);
				c = r.insertCell(-1);
				c.style.color = actbCategory_self.actbCategory_textColor;
				c.style.fontFamily = actbCategory_self.actbCategory_fFamily;
				c.style.fontSize = actbCategory_self.actbCategory_fSize;
				c.style.width = "168px";
				c.innerHTML = actbCategory_parse(actbCategory_self.actbCategory_keywords[i]);
				c.id = 'tat_td'+(j);
				c.setAttribute('pos',j);
				if (actbCategory_self.actbCategory_mouse){
					c.style.cursor = 'pointer';
					c.onclick=actbCategory_mouseclick;
					c.onmouseover = actbCategory_table_highlight;
				}
				j++;
			}
			if (j - 1 == actbCategory_self.actbCategory_lim && j < actbCategory_total){
				r = a.insertRow(-1);
				r.style.backgroundColor = actbCategory_self.actbCategory_bgColor;
				c = r.insertCell(-1);
				c.style.color = actbCategory_self.actbCategory_textColor;
				c.style.fontFamily = 'tahoma';
				c.style.fontSize = actbCategory_self.actbCategory_fSize;
				c.align='center';
				c.style.width = "168px";
				c.style.backgroundImage='url(http://www.tarbon.com/images/downarrow.gif)';
				replaceHTML(c,'-');
				if (actbCategory_self.actbCategory_mouse){
					c.style.cursor = 'pointer';
					c.onclick = actbCategory_mouse_down;
				}
				break;
			}
		}
		actbCategory_rangeu = 1;
		actbCategory_ranged = j-1;
		actbCategory_display = true;
		if (actbCategory_pos <= 0) actbCategory_pos = 1;
	}
	function actbCategory_remake(){
		document.body.removeChild(document.getElementById('tat_table'));
		a = document.createElement('table');
		a.cellSpacing='2px';
		a.cellPadding='2px';
		a.style.position='absolute';
		a.style.top = eval(curTop(actbCategory_curr) + actbCategory_curr.offsetHeight) + "px";
		a.style.left = curLeft(actbCategory_curr) + "px";
		a.style.width = "168px";
		a.style.backgroundColor=actbCategory_self.actbCategory_bgColor;
		a.id = 'tat_table';
		if (actbCategory_self.actbCategory_mouse){
			a.onmouseout= actbCategory_table_unfocus;
			a.onmouseover=actbCategory_table_focus;
		}
		document.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (actbCategory_rangeu > 1){
			r = a.insertRow(-1);
			r.style.backgroundColor = actbCategory_self.actbCategory_bgColor;
			c = r.insertCell(-1);
			c.style.color = actbCategory_self.actbCategory_textColor;
			c.style.fontFamily = 'tahoma';
			c.style.fontSize = actbCategory_self.actbCategory_fSize;
			c.style.width = "168px";
			c.align='center';
			c.style.backgroundImage='url(http://www.tarbon.com/images/uparrow.gif)';
			replaceHTML(c,'\.');
			if (actbCategory_self.actbCategory_mouse){
				c.style.cursor = 'pointer';
				c.onclick = actbCategory_mouse_up;
			}
		}
		for (i=0;i<actbCategory_self.actbCategory_keywords.length;i++){
			if (actbCategory_bool[i]){
				if (j >= actbCategory_rangeu && j <= actbCategory_ranged){
					r = a.insertRow(-1);
					r.style.backgroundColor = actbCategory_self.actbCategory_bgColor;
					r.id = 'tat_tr'+(j);
					c = r.insertCell(-1);
					c.style.color = actbCategory_self.actbCategory_textColor;
					c.style.fontFamily = actbCategory_self.actbCategory_fFamily;
					c.style.fontSize = actbCategory_self.actbCategory_fSize;
					c.style.width = "168px";
					c.innerHTML = actbCategory_parse(actbCategory_self.actbCategory_keywords[i]);
					c.id = 'tat_td'+(j);
					c.setAttribute('pos',j);
					if (actbCategory_self.actbCategory_mouse){
						c.style.cursor = 'pointer';
						c.onclick=actbCategory_mouseclick;
						c.onmouseover = actbCategory_table_highlight;
					}
					j++;
				}else{
					j++;
				}
			}
			if (j > actbCategory_ranged) break;
		}
		if (j-1 < actbCategory_total){
			r = a.insertRow(-1);
			r.style.backgroundColor = actbCategory_self.actbCategory_bgColor;
			c = r.insertCell(-1);
			c.style.color = actbCategory_self.actbCategory_textColor;
			c.style.fontFamily = 'tahoma';
			c.style.width = "168px";
			c.style.fontSize = actbCategory_self.actbCategory_fSize;
			c.align='center';
			c.style.backgroundImage='url(http://www.tarbon.com/images/downarrow.gif)';
			replaceHTML(c,'-');
			if (actbCategory_self.actbCategory_mouse){
				c.style.cursor = 'pointer';
				c.onclick = actbCategory_mouse_down;
			}
		}
	}
	function actbCategory_goup(){
		if (!actbCategory_display) return;
		if (actbCategory_pos == 1) return;
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_bgColor;
		actbCategory_pos--;
		if (actbCategory_pos < actbCategory_rangeu) actbCategory_moveup();
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_hColor;
		if (actbCategory_toid) clearTimeout(actbCategory_toid);
		if (actbCategory_self.actbCategory_timeOut > 0) actbCategory_toid = setTimeout(function(){actbCategory_mouse_on_list=0;actbCategory_removedisp();},actbCategory_self.actbCategory_timeOut);
	}
	function actbCategory_godown(){
		if (!actbCategory_display) return;
		if (actbCategory_pos == actbCategory_total) return;
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_bgColor;
		actbCategory_pos++;
		if (actbCategory_pos > actbCategory_ranged) actbCategory_movedown();
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_hColor;
		if (actbCategory_toid) clearTimeout(actbCategory_toid);
		if (actbCategory_self.actbCategory_timeOut > 0) actbCategory_toid = setTimeout(function(){actbCategory_mouse_on_list=0;actbCategory_removedisp();},actbCategory_self.actbCategory_timeOut);
	}
	function actbCategory_movedown(){
		actbCategory_rangeu++;
		actbCategory_ranged++;
		actbCategory_remake();
	}
	function actbCategory_moveup(){
		actbCategory_rangeu--;
		actbCategory_ranged--;
		actbCategory_remake();
	}

	/* Mouse */
	function actbCategory_mouse_down(){
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_bgColor;
		actbCategory_pos++;
		actbCategory_movedown();
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_hColor;
		actbCategory_curr.focus();
		actbCategory_mouse_on_list = 0;
		if (actbCategory_toid) clearTimeout(actbCategory_toid);
		if (actbCategory_self.actbCategory_timeOut > 0) actbCategory_toid = setTimeout(function(){actbCategory_mouse_on_list=0;actbCategory_removedisp();},actbCategory_self.actbCategory_timeOut);
	}
	function actbCategory_mouse_up(evt){
		if (!evt) evt = event;
		if (evt.stopPropagation){
			evt.stopPropagation();
		}else{
			evt.cancelBubble = true;
		}
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_bgColor;
		actbCategory_pos--;
		actbCategory_moveup();
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_hColor;
		actbCategory_curr.focus();
		actbCategory_mouse_on_list = 0;
		if (actbCategory_toid) clearTimeout(actbCategory_toid);
		if (actbCategory_self.actbCategory_timeOut > 0) actbCategory_toid = setTimeout(function(){actbCategory_mouse_on_list=0;actbCategory_removedisp();},actbCategory_self.actbCategory_timeOut);
	}
	function actbCategory_mouseclick(evt){
		if (!evt) evt = event;
		if (!actbCategory_display) return;
		actbCategory_mouse_on_list = 0;
		actbCategory_pos = this.getAttribute('pos');
		actbCategory_penter();
	}
	function actbCategory_table_focus(){
		actbCategory_mouse_on_list = 1;
	}
	function actbCategory_table_unfocus(){
		actbCategory_mouse_on_list = 0;
		if (actbCategory_toid) clearTimeout(actbCategory_toid);
		if (actbCategory_self.actbCategory_timeOut > 0) actbCategory_toid = setTimeout(function(){actbCategory_mouse_on_list = 0;actbCategory_removedisp();},actbCategory_self.actbCategory_timeOut);
	}
	function actbCategory_table_highlight(){
		actbCategory_mouse_on_list = 1;
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_bgColor;
		actbCategory_pos = this.getAttribute('pos');
		while (actbCategory_pos < actbCategory_rangeu) actbCategory_moveup();
		while (actbCategory_pos > actbCategory_ranged) actbCategory_movedown();
		document.getElementById('tat_tr'+actbCategory_pos).style.backgroundColor = actbCategory_self.actbCategory_hColor;
		if (actbCategory_toid) clearTimeout(actbCategory_toid);
		if (actbCategory_self.actbCategory_timeOut > 0) actbCategory_toid = setTimeout(function(){actbCategory_mouse_on_list = 0;actbCategory_removedisp();},actbCategory_self.actbCategory_timeOut);
	}
	/* ---- */

	function actbCategory_insertword(a){
		if (actbCategory_self.actbCategory_delimiter.length > 0){
			str = '';
			l=0;
			for (i=0;i<actbCategory_delimwords.length;i++){
				if (actbCategory_cdelimword == i){
					prespace = postspace = '';
					gotbreak = false;
					for (j=0;j<actbCategory_delimwords[i].length;++j){
						if (actbCategory_delimwords[i].charAt(j) != ' '){
							gotbreak = true;
							break;
						}
						prespace += ' ';
					}
					for (j=actbCategory_delimwords[i].length-1;j>=0;--j){
						if (actbCategory_delimwords[i].charAt(j) != ' ') break;
						postspace += ' ';
					}
					str += prespace;
					str += a;
					l = str.length;
					if (gotbreak) str += postspace;
				}else{
					str += actbCategory_delimwords[i];
				}
				if (i != actbCategory_delimwords.length - 1){
					str += actbCategory_delimchar[i];
				}
			}
			actbCategory_curr.value = str;
			setCaret(actbCategory_curr,l);
		}else{
			actbCategory_curr.value = a;
		}
		actbCategory_mouse_on_list = 0;
		actbCategory_removedisp();
	}
	function actbCategory_penter(){
		if (!actbCategory_display) return;
		actbCategory_display = false;
		var word = '';
		var c = 0;
		for (var i=0;i<=actbCategory_self.actbCategory_keywords.length;i++){
			if (actbCategory_bool[i]) c++;
			if (c == actbCategory_pos){
				word = actbCategory_self.actbCategory_keywords[i];
				break;
			}
		}
		actbCategory_insertword(word);
		l = getCaretStart(actbCategory_curr);
	}
	function actbCategory_removedisp(){
		if (actbCategory_mouse_on_list==0){
			actbCategory_display = 0;
			if (document.getElementById('tat_table')){ document.body.removeChild(document.getElementById('tat_table')); }
			if (actbCategory_toid) clearTimeout(actbCategory_toid);
		}
	}
	function actbCategory_keypress(e){
		if (actbCategory_caretmove) stopEvent(e);
		return !actbCategory_caretmove;
	}
	function actbCategory_checkkey(evt){
		if (!evt) evt = event;
		a = evt.keyCode;
		caret_pos_start = getCaretStart(actbCategory_curr);
		actbCategory_caretmove = 0;
		switch (a){
			case 38:
				actbCategory_goup();
				actbCategory_caretmove = 1;
				return false;
				break;
			case 40:
				actbCategory_godown();
				actbCategory_caretmove = 1;
				return false;
				break;
			case 13: case 9:
				if (actbCategory_display){
					actbCategory_caretmove = 1;
					actbCategory_penter();
					return false;
				}else{
					return true;
				}
				break;
			default:
				setTimeout(function(){actbCategory_tocomplete(a)},50);
				break;
		}
	}

	function actbCategory_tocomplete(kc){
		if (kc == 38 || kc == 40 || kc == 13) return;
		var i;
		if (actbCategory_display){ 
			var word = 0;
			var c = 0;
			for (var i=0;i<=actbCategory_self.actbCategory_keywords.length;i++){
				if (actbCategory_bool[i]) c++;
				if (c == actbCategory_pos){
					word = i;
					break;
				}
			}
			actbCategory_pre = word;
		}else{ actbCategory_pre = -1};
		
		if (actbCategory_curr.value == ''){
			actbCategory_mouse_on_list = 0;
			actbCategory_removedisp();
			return;
		}
		if (actbCategory_self.actbCategory_delimiter.length > 0){
			caret_pos_start = getCaretStart(actbCategory_curr);
			caret_pos_end = getCaretEnd(actbCategory_curr);
			
			delim_split = '';
			for (i=0;i<actbCategory_self.actbCategory_delimiter.length;i++){
				delim_split += actbCategory_self.actbCategory_delimiter[i];
			}
			delim_split = delim_split.addslashes();
			delim_split_rx = new RegExp("(["+delim_split+"])");
			c = 0;
			actbCategory_delimwords = new Array();
			actbCategory_delimwords[0] = '';
			for (i=0,j=actbCategory_curr.value.length;i<actbCategory_curr.value.length;i++,j--){
				if (actbCategory_curr.value.substr(i,j).search(delim_split_rx) == 0){
					ma = actbCategory_curr.value.substr(i,j).match(delim_split_rx);
					actbCategory_delimchar[c] = ma[1];
					c++;
					actbCategory_delimwords[c] = '';
				}else{
					actbCategory_delimwords[c] += actbCategory_curr.value.charAt(i);
				}
			}

			var l = 0;
			actbCategory_cdelimword = -1;
			for (i=0;i<actbCategory_delimwords.length;i++){
				if (caret_pos_end >= l && caret_pos_end <= l + actbCategory_delimwords[i].length){
					actbCategory_cdelimword = i;
				}
				l+=actbCategory_delimwords[i].length + 1;
			}
			var ot = actbCategory_delimwords[actbCategory_cdelimword].trim(); 
			var t = actbCategory_delimwords[actbCategory_cdelimword].addslashes().trim();
		}else{
			var ot = actbCategory_curr.value;
			var t = actbCategory_curr.value.addslashes();
		}
		if (ot.length == 0){
			actbCategory_mouse_on_list = 0;
			actbCategory_removedisp();
		}
		if (ot.length < actbCategory_self.actbCategory_startcheck) return this;
		if (actbCategory_self.actbCategory_firstText){
			var re = new RegExp("^" + t, "i");
		}else{
			var re = new RegExp(t, "i");
		}

		actbCategory_total = 0;
		actbCategory_tomake = false;
		actbCategory_kwcount = 0;
		for (i=0;i<actbCategory_self.actbCategory_keywords.length;i++){
			actbCategory_bool[i] = false;
			if (re.test(actbCategory_self.actbCategory_keywords[i])){
				actbCategory_total++;
				actbCategory_bool[i] = true;
				actbCategory_kwcount++;
				if (actbCategory_pre == i) actbCategory_tomake = true;
			}
		}

		if (actbCategory_toid) clearTimeout(actbCategory_toid);
		if (actbCategory_self.actbCategory_timeOut > 0) actbCategory_toid = setTimeout(function(){actbCategory_mouse_on_list = 0;actbCategory_removedisp();},actbCategory_self.actbCategory_timeOut);
		actbCategory_generate();
	}
	return this;
}