function actb(obj,ca,use_button,column_list,bindtype,show_keycode){
	/* ---- Public Variables ---- */
	this.actb_timeOut = -1; // Autocomplete Timeout in ms (-1: autocomplete never time out)
	this.actb_lim = 8;    // Number of elements autocomplete can show (-1: no limit)
	this.actb_firstText = true; // should the auto complete be limited to the beginning of keyword?
	this.actb_mouse = true; // Enable Mouse Support
	this.actb_delimiter = new Array(';',',');  // Delimiter for multiple autocomplete. Set it to empty array for single autocomplete
	this.actb_startcheck = 1; // Show widget only after this number of characters is typed in.
	this.actb_bindtype = (bindtype?bindtype:0); // Show widget only after this number of characters is typed in.
	this.actb_show_keycode = (show_keycode?show_keycode:113); //arrow down key => show list
	/* ---- Public Variables ---- */

	/* --- Styles --- */
	/*this.actb_bgColor = '#888888';
	this.actb_textColor = '#FFFFFF';
	this.actb_hColor = '#000000';
	this.actb_fFamily = 'Verdana';
	this.actb_fSize = '11px'; */
	//this.actb_hStyle = 'text-decoration:underline;font-weight="bold"';
	this.actb_style_button = 'actb_button';
	this.actb_style_table = 'actb_table';
	this.actb_style_header = 'actb_header';
	this.actb_style_header_td = 'actb_header_td';
	this.actb_style_row = 'actb_row';
	this.actb_style_activerow = 'actb_activerow';
	this.actb_style_highlight = 'actb_highlight';
	this.actb_style_btnScrColor = 'actb_btnScrColor';
	this.actb_style_btnScrColor_inactive = 'actb_btnScrColor_inactive';
	this.actb_style_checkcol = 'actb_checkcol';

	this.custom_function = null;
	this.data_loaded = false;

	/*
	if(!getCSSRule('.' + this.actb_style_table)){
		addCSSRule('.' + this.actb_style_table, 'font:12px arial; color:#ffffff; background-Color:#4A566E;');
		addCSSRule('.' + this.actb_style_highlight, 'Color:#8AA0AB; font-weight:bold;');
		addCSSRule('.' + this.actb_style_header, 'padding:2px; font:9px arial; color:#cccccc; font-weight:bold; background-Color:#454545;');
		addCSSRule('.' + this.actb_style_header_td, 'border-top:1px solid #bbbbbb; border-bottom:1px solid #333333;');
		addCSSRule('.' + this.actb_style_row, 'padding:2px');
		addCSSRule('.' + this.actb_style_activerow, 'padding:2px; background-Color:#636F89;');
		addCSSRule('.' + this.actb_style_button, 'border-top:1px solid #cccccc; border-left:1px solid #cccccc; border-bottom:1px solid #111111; font:11px arial; border-right:1px solid #111111; color:#555555; height:18px; padding-top:1px; width:12px; text-decoration:none; background-Color:#aaaaaa;');
		addCSSRule('.' + this.actb_style_button + ':hover', 'color:#ff0000; background-Color:#999999;');
		addCSSRule('.' + this.actb_style_btnScrColor, 'font:10px arial; color:#ffffff; '); //#434F68
		addCSSRule('.' + this.actb_style_btnScrColor_inactive, 'font:10px arial; color:#333333; ');
	} */

	/* --- Styles --- */

	/* --- public functions --- */
	// column_list : column0-caption;width;alignment;linkobj    width=0 => invisible
	this.setcolumns = function(column_list, rel_obj){
		actb_columnlist = new Array();

		var col_index=0;
		var item = column_list.split('|');
		actb_checkcolumn = (item.length) ? -1: 0;
		actb_visiblecols = 0;
		for(var i=0; i<item.length; i++) {
			if (item[i].length){
				var tag = item[i].split(';');
				var tag_caption = (tag.length>=1) ? tag[0]: '';
				var tag_width = (tag.length>=2) ? parseInt(tag[1].length ? tag[1]: -1): -1;
				var tag_align = (tag.length>=3) ? tag[2]: '';
				var tag_link = (tag.length>=4) ? (tag[3].length>0 ? tag[3]: null ): null;
				if(tag_width && actb_checkcolumn==-1) actb_checkcolumn = col_index;
				actb_columnlist[col_index] = { 'caption':tag_caption, 'w':tag_width, 'align':tag_align, 'link':tag_link};
				if(tag_width) actb_visiblecols ++;
				col_index ++;
			}
		}

		rel_obj.actb_columnlist = actb_columnlist;
	}

	this.add_and_select = function(data_array){
		var new_index =	this.setdata(data_array, null, true);
		if(new_index) set_index(new_index);
	}

	this.setdata = function(data_array,column_list,addon){
		var i=0;
		var column_list = column_list || '';
		var start_index = 0;

		if(column_list.length) setcolumns(column_list);

		if(addon && isArray(actb_keywords)){
			start_index = actb_keywords.length;
		} else {
			actb_keywords = new Array();
		}
		if (data_array!=null) actb_self.data_loaded = true;
		if (!data_array) return;

		if(!isArray(data_array)){
			var data_array = data_array.split('\u007f');
		}

		if(isArray(data_array)){
			var data_type=0;
			if(data_array.length) {
				if(isArray(data_array[i])){
					data_type=1;
				} else if (data_array[i].indexOf('|')!=-1) {
					data_type=2;
				} else if (data_array[i].indexOf('\u0008')!=-1) {
					data_type=3;
				} else {
					data_type=4;
				}
			}
			for(i=0; i<data_array.length; i++){
				switch(data_type){
					case 1: actb_keywords[start_index+i] = data_array[i]; break;
					case 2: actb_keywords[start_index+i] = data_array[i].split('|'); break;
					case 3: actb_keywords[start_index+i] = data_array[i].split('\u0008'); break;
					default: actb_keywords[start_index+i] = new Array(data_array[i]);
				}
			}
		}

		if (actb_autoload_req.length>0 && actb_autoload_time>0){
			if(actb_curr.focused) actb_self.showlist();
		}

		return isArray(data_array)? (start_index+data_array.length-1): 0;
	}

	this.showlist = function(obj_id){
		if(obj_id && obj_id!=actb_curr.id) {
			var active_obj = document.getElementById(obj_id);
			actb_curr = active_obj;
			actb_columnlist = actb_curr.actb_columnlist;
		}
		if(!(actb_curr.locked || actb_curr.disabled)){
			//actb_curr.focused = true;
			//actb_curr.focus();
			actb_tocomplete(0, true);
		}
	}

	this.attach_object = function(attach_obj, use_button, column_list) {
		var attach_obj = isString(attach_obj) ? document.getElementById(attach_obj): attach_obj;

		attach_obj.controller = actb_self;
		if(use_button==undefined) 
			actb_use_button = 1;  
		else 
			actb_use_button = use_button;

		actb_self.setcolumns(column_list, attach_obj);
		if(actb_use_button) actb_create_button(attach_obj);

		addEvent(attach_obj,"focus",actb_setup);

		return attach_obj;
	}

	this.setup_autoload = function(request_str, time){
		actb_autoload_req = request_str;
		actb_autoload_time = time;
	}

	/* ---- Private Variables ---- */
	var actb_delimwords = new Array();
	var actb_cdelimword = 0;
	var actb_delimchar = new Array();
	var actb_display = false;
	var actb_pos = 0;
	var actb_total = 0;
	var actb_curr = null;
	var actb_rangeu = 0;
	var actb_ranged = 0;
	var actb_bool = new Array();
	var actb_pre = 0;
	var actb_toid;
	var actb_tomake = false;
	var actb_getpre = "";
	var actb_mouse_on_list = 1;
	var actb_kwcount = 0;
	var actb_caretmove = false;
	var actb_keywords = new Array();
	var actb_columnlist = new Array();
	var actb_checkcolumn = 0;
	var actb_visiblecols = 0;
	var actb_autoload_timeout_id =0;
	var actb_autoload_req = '';
	var actb_autoload_time = 0;
	var actb_use_button = 0; // 0 none,  1 show on focus  2 always show
	var actb_button_timeout_id =0;
	var actb_button_width =14;

	/* ---- Private Variables---- */

	var actb_self = this;
	actb_curr = this.attach_object(obj, use_button, column_list);
	/*if (actb_self.actb_bindtype)
	{
	}*/
	this.setdata(ca);

	/* --- private functions --- */

	function actb_create_button(rel_obj){
		var a = document.createElement('a');
		//a.style.position='absolute';
		//a.style.top = eval(curTop(rel_obj)) + "px";
		//a.style.left = curLeft(rel_obj) + rel_obj.offsetWidth + "px";
		a.id = 'tat_button_' + rel_obj.id;
		a.href = "javascript:void(0);"
		a.tabIndex = -1;
		a.onclick = function() { 
			var obj_id = rel_obj.id;
			var obj = document.getElementById(obj_id);

			obj.focused = true;
			obj.focus();
			//a.blur();
			if (actb_autoload_req.length>0 && actb_autoload_time>0){
				show_button(true);
				actb_req_reload();
			} else {
				actb_self.showlist(obj_id); 
			}
		}
		a.innerHTML = '&#X25BC;';
		a.style.height = rel_obj.offsetHeight +'px';
		a.style.width = actb_button_width + 'px';
		a.className = actb_self.actb_style_button;
		a.style.display = "inline";
		a.style.position = "absolute";
		if(actb_use_button==2) {
			a.style.left = (curLeft(rel_obj) + getObjWidth(rel_obj) - actb_button_width) + 'px'
			a.style.visibility = "hidden";
		} else {
			//rel_obj.style.marginRight = actb_button_width;
			var obj_width = getObjWidth(rel_obj);
			if(obj_width){
				rel_obj.style.width = (obj_width - actb_button_width) + 'px';
			}
		}
		var op = rel_obj.parentNode;
		//document.body.appendChild(a);
		if(rel_obj.nextSibling)
			op.insertBefore(a,rel_obj.nextSibling);
		else
			op.appendChild(a);
		//rel_obj.style.width = (getObjWidth(rel_obj) - getObjWidth(a)) + 'px';
	}

	function actb_setup(evt){
		if (!evt) evt = event;
		
		//check previou focus relative object
		check_hide_button();
		
		actb_curr = evt.target || evt.srcElement;
		actb_columnlist = actb_curr.actb_columnlist;

		actb_curr.focused = true;

		show_button(true);

		addEvent(document,"keydown",actb_checkkey);
		addEvent(actb_curr,"blur",actb_clear);
		addEvent(document,"keypress",actb_keypress);
	}

	function show_button(bVisible, obj_id){
		var obj_id = (obj_id == undefined) ? actb_curr.id: obj_id;
		var obj_button = document.getElementById('tat_button_' + obj_id);
		var obj_control = document.getElementById(obj_id);
		if(obj_button && actb_use_button==2){
			if(bVisible) {
				obj_button.style.visibility = 'visible';
				obj_control.style.marginRight = getObjWidth(obj_button)+'px';
			} else {
				obj_button.style.visibility = 'hidden';
				obj_control.style.marginRight = 0;
			}
		}
	}

	function clear_timer_button(){
		if(actb_button_timeout_id) {
			clearTimeout(actb_button_timeout_id);
			actb_button_timeout_id = 0;
		}
	}

	function clear_timer_autoload(){
		if(actb_autoload_timeout_id) {
			clearTimeout(actb_autoload_timeout_id);
			actb_autoload_timeout_id = 0;
		}
	}


	function check_hide_button(obj_id){
		var obj = (obj_id) ? document.getElementById(obj_id): actb_curr;
		//debug_print(actb_curr.id + ': ' + obj_id);
		clear_timer_button();
		if(!obj.focused) {
			show_button(false);
			actb_removedisp(true, obj_id);
		}
	}
	function actb_clear(evt){
		actb_curr.focused =false;
		clear_timer_button();
		clear_timer_autoload();
		var actb_button_timeout_id = setTimeout(function(){ check_hide_button(actb_curr.id); }, 200);
		//actb_curr.timer_id =timer_id;

		//var obj_id =actb_curr.id;
		//var timer_id = setTimeout( function(){check_hide_button(obj_id );},200);
		//actb_curr.timer_id =timer_id;

		if (!evt) evt = event;
		removeEvent(document,"keydown",actb_checkkey);
		removeEvent(actb_curr,"blur",actb_clear);
		removeEvent(document,"keypress",actb_keypress);
		actb_removedisp();
	}
	function actb_parse(n){
		if (actb_self.actb_delimiter.length > 0){
			var t = actb_delimwords[actb_cdelimword].trim().addslashes();
			var plen = actb_delimwords[actb_cdelimword].trim().length;
		}else{
			var t = actb_curr.value.addslashes();
			var plen = actb_curr.value.length;
		}
		var tobuild = '';
		var i;

		if (actb_self.actb_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 class='"+(actb_self.actb_style_highlight)+"'>"
		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 actb_generate(){
		if (document.getElementById('tat_table')){ actb_display = false;document.body.removeChild(document.getElementById('tat_table')); } 
		if (actb_kwcount == 0){
			actb_display = false;
			return;
		}
		a = document.createElement('table');
		a.cellSpacing='0px';
		a.cellPadding='0px';
		a.style.position='absolute';
		//a.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		a.style.top = getPopupTop(actb_curr, a.offsetHeight);

		a.style.left = curLeft(actb_curr) + "px";
		a.id = 'tat_table';
		a.contents_id = actb_curr.id;
		a.className = actb_self.actb_style_table;
		document.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (actb_self.actb_mouse){
			a.onmouseout = actb_table_unfocus;
			a.onmouseover = actb_table_focus;
		}
		var counter = 0;

		if (actb_columnlist.length) {
			r = a.insertRow(-1);
			r.className = actb_self.actb_style_header;
			for (cn=0;cn<actb_columnlist.length;cn++) {
				if (actb_columnlist[cn]['w']!=0){
					c = r.insertCell(-1);
					if (actb_columnlist[cn]['w']>0){
						c.style.width = actb_columnlist[cn]['w'];
					}
					c.style.align = actb_columnlist[cn]['align'];
					c.innerHTML = HTMLEncode(actb_columnlist[cn]['caption'].trim());
					c.className = actb_self.actb_style_header_td;
					c.id = 'tat_tdh_'+(cn);
				}
			}
		}

		r = a.insertRow(-1);
		c = r.insertCell(-1);
		if(actb_visiblecols) c.colSpan=actb_visiblecols;
		c.align='center';
		replaceHTML(c,'\u25B2');
		r.className = actb_self.actb_style_btnScrColor_inactive;

		for (i=0;i<actb_keywords.length;i++){
			if (actb_bool[i]){
				counter++;
				r = a.insertRow(-1);
				if (first && !actb_tomake){
					first = false;
					actb_pos = counter;
					r.className = actb_self.actb_style_activerow;
				}else if(actb_pre == i){
					first = false;
					actb_pos = counter;
					r.className = actb_self.actb_style_activerow;
				}else{
					r.className = actb_self.actb_style_row;
				}
				r.id = 'tat_tr'+(j);
				r.setAttribute('pos',j);
				if (actb_self.actb_mouse){
					r.style.cursor = 'pointer';
					r.onclick=actb_mouseclick;
					r.onmouseover = actb_table_highlight;
				}

				for (cn=0; cn==0 || cn<actb_columnlist.length; cn++) {
					if (actb_columnlist[cn]['w']!=0){
						c = r.insertCell(-1);
						if (actb_checkcolumn==cn){
							c.innerHTML = actb_parse(actb_keywords[i][cn]);
							c.className = actb_self.actb_style_checkcol;
						} else {
							c.innerHTML = HTMLEncode(actb_keywords[i][cn].trim());
						}
						c.id = 'tat_td'+(j)+'_'+(cn);
					}
				}
				j++;
			}

			if (j - 1 == actb_self.actb_lim ) break;
		}

		r = a.insertRow(-1);
		r.className = actb_self.actb_style_row;
		c = r.insertCell(-1);
		if(actb_visiblecols) c.colSpan=actb_visiblecols;
		c.align='center';
		replaceHTML(c,'\u25BC');
		if (j -1 < actb_total){
			if (actb_self.actb_mouse){
				r.style.cursor = 'pointer';
				r.onclick = actb_mouse_down;
			}
			r.className = actb_self.actb_style_btnScrColor;
		} else {
			r.className = actb_self.actb_style_btnScrColor_inactive;
		}
		
		actb_rangeu = 1;
		actb_ranged = j-1;
		actb_display = true;
		if (actb_pos <= 0) actb_pos = 1;
		a.style.top = getPopupTop(actb_curr, a.offsetHeight);
	}
	function actb_remake(){
		document.body.removeChild(document.getElementById('tat_table'));
		a = document.createElement('table');
		a.cellSpacing='0px';
		a.cellPadding='0px';
		a.style.position='absolute';
		//a.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		a.style.top = getPopupTop(actb_curr, a.offsetHeight);
		a.style.left = curLeft(actb_curr) + "px";
		a.id = 'tat_table';
		a.contents_id = actb_curr.id;
		a.className = actb_self.actb_style_table;
		if (actb_self.actb_mouse){
			a.onmouseout= actb_table_unfocus;
			a.onmouseover=actb_table_focus;
		}
		document.body.appendChild(a);

		if (actb_columnlist.length) {
			r = a.insertRow(-1);
			r.className = actb_self.actb_style_header;
			for (cn=0;cn<actb_columnlist.length;cn++) {
				if (actb_columnlist[cn]['w']!=0){
					c = r.insertCell(-1);
					if (actb_columnlist[cn]['w']>0){
						c.style.width = actb_columnlist[cn]['w'];
					} else if (actb_columnlist[cn]['w']==0){
						c.style.display = 'none';
					}
					c.className = actb_self.actb_style_header_td;
					c.style.align = actb_columnlist[cn]['align'];
					c.innerHTML = HTMLEncode(actb_columnlist[cn]['caption'].trim());
					c.id = 'tat_tdh_'+(cn);
				}
			}
		}

		var i;
		var first = true;
		var j = 1;

		r = a.insertRow(-1);
		c = r.insertCell(-1);
		if(actb_visiblecols) c.colSpan=actb_visiblecols;
		c.align='center';
		replaceHTML(c,'\u25B2');
		if (actb_rangeu > 1){
			if (actb_self.actb_mouse){
				r.style.cursor = 'pointer';
				r.onclick = actb_mouse_up;
			}
			r.className = actb_self.actb_style_btnScrColor;
		} else {
			r.className = actb_self.actb_style_btnScrColor_inactive;
		}

		for (i=0;i<actb_keywords.length;i++){
			if (actb_bool[i]){
				if (j >= actb_rangeu && j <= actb_ranged){
					r = a.insertRow(-1);
					r.setAttribute('pos',j);
					r.id = 'tat_tr'+(j);
					r.className = actb_self.actb_style_row;
					if (actb_self.actb_mouse){
						r.style.cursor = 'pointer';
						r.onclick=actb_mouseclick;
						r.onmouseover = actb_table_highlight;
					}

					for (cn=0; cn==0 || cn<actb_columnlist.length; cn++) {
						if (actb_columnlist[cn]['w']!=0){
							c = r.insertCell(-1);
							if (actb_checkcolumn==cn){
								c.className = actb_self.actb_style_checkcol;
								c.innerHTML = actb_parse(actb_keywords[i][cn]);
							} else {
								/* check data : if(actb_keywords[i].length<=cn){
									alert(cn + '.' );
								} else { */
								c.innerHTML = HTMLEncode(actb_keywords[i][cn].trim());
							}
							c.id = 'tat_td'+(j)+'_'+(cn);
						}
					}
					j++;
				}else{
					j++;
				}
			}
			if (j > actb_ranged) break;
		}

		r = a.insertRow(-1);
		r.className = actb_self.actb_style_row;
		c = r.insertCell(-1);
		if(actb_visiblecols) c.colSpan=actb_visiblecols;
		c.align='center';
		replaceHTML(c,'\u25BC');
		if (j-1 < actb_total){
			if (actb_self.actb_mouse){
				r.style.cursor = 'pointer';
				r.onclick = actb_mouse_down;
			}
			r.className = actb_self.actb_style_btnScrColor;
		} else {
			r.className = actb_self.actb_style_btnScrColor_inactive;
		}
		a.style.top = getPopupTop(actb_curr, a.offsetHeight);
	}
	function actb_goup(pagemode){
		if (!actb_display) return;
		if (actb_pos == 1) return;
		document.getElementById('tat_tr'+actb_pos).className = actb_self.actb_style_row;
		if(pagemode) {
			actb_pos = (actb_pos-actb_self.actb_lim) > 0 ? (actb_pos-actb_self.actb_lim): 1;
		} else {
			actb_pos--;
		}
		if (actb_pos < actb_rangeu) actb_moveup(actb_rangeu - actb_pos);
		document.getElementById('tat_tr'+actb_pos).className = actb_self.actb_style_activerow;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_godown(pagemode){
		if (!actb_display) return;
		if (actb_pos == actb_total) return;
		document.getElementById('tat_tr'+actb_pos).className = actb_self.actb_style_row;
		if(pagemode) {
			actb_pos = (actb_pos+actb_self.actb_lim) <= actb_total ? (actb_pos+actb_self.actb_lim): actb_total;
		} else {
			actb_pos++;
		}
		if (actb_pos > actb_ranged) actb_movedown(actb_pos - actb_ranged);
		document.getElementById('tat_tr'+actb_pos).className = actb_self.actb_style_activerow;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_movedown(dSize){
		var dSize = dSize || 1
		actb_rangeu+=dSize;
		actb_ranged+=dSize;
		actb_remake();
	}
	function actb_moveup(dSize){
		var dSize = dSize || 1
		actb_rangeu-=dSize;
		actb_ranged-=dSize;
		actb_remake();
	}

	/* Mouse */
	function actb_wheel(event) {
		if (!event) event = window.event;
		var delta = 0;

		if (event.wheelDelta) {
			delta = event.wheelDelta/40; // defaul 3lines=120
			if (window.opera) delta = -delta;
		} else if (event.detail) { //firefox
			delta = -event.detail;
		}

		//alert(delta);
	}

	function actb_mouse_down(evt){
		if (!evt) evt = event;
		if (evt.stopPropagation){
			evt.stopPropagation();
		}else{
			evt.cancelBubble = true;
		}
		var old_selected = document.getElementById('tat_tr'+actb_pos);
		if(old_selected) old_selected.className = actb_self.actb_style_row;
		actb_pos = (actb_pos+actb_self.actb_lim) <= actb_total ? (actb_pos+actb_self.actb_lim): actb_total;
		actb_movedown(actb_self.actb_lim);
		var new_selected = document.getElementById('tat_tr'+actb_pos);
		if(new_selected) new_selected.className = actb_self.actb_style_activerow;

		actb_curr.focus();
		actb_curr.focused = true;

		//actb_mouse_on_list = 0;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_mouse_up(evt){
		if (!evt) evt = event;
		if (evt.stopPropagation){
			evt.stopPropagation();
		}else{
			evt.cancelBubble = true;
		}
		var old_selected = document.getElementById('tat_tr'+actb_pos);
		if(old_selected) old_selected.className = actb_self.actb_style_row;
		actb_pos = (actb_pos-actb_self.actb_lim) > 0 ? (actb_pos-actb_self.actb_lim): 1;
		actb_moveup(actb_self.actb_lim);
		var new_selected = document.getElementById('tat_tr'+actb_pos);
		if(new_selected) new_selected.className = actb_self.actb_style_activerow;

		actb_curr.focus();
		actb_curr.focused = true;

		//actb_mouse_on_list = 0;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list=0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_mouseclick(evt){
		if (!evt) evt = event;
		if (!actb_display) return;
		actb_mouse_on_list = 0;
		actb_pos = this.getAttribute('pos');
		actb_penter();
	}
	function actb_table_focus(){
		actb_mouse_on_list = 1;
	}
	function actb_table_unfocus(){
		actb_mouse_on_list = 0;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut);
	}
	function actb_table_highlight(){
		actb_mouse_on_list = 1;
		document.getElementById('tat_tr'+actb_pos).className = actb_self.actb_style_row;
		actb_pos = this.getAttribute('pos');
		while (actb_pos < actb_rangeu) actb_moveup();
		while (actb_pos > actb_ranged) actb_movedown();
		document.getElementById('tat_tr'+actb_pos).className = actb_self.actb_style_activerow;
		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut);
	}
	/* ---- */
	function actb_insertword(row_values){
		var a = row_values[actb_checkcolumn];
		if (actb_self.actb_delimiter.length > 0){
			str = '';
			l=0;
			for (i=0;i<actb_delimwords.length;i++){
				if (actb_cdelimword == i){
					prespace = postspace = '';
					gotbreak = false;
					for (j=0;j<actb_delimwords[i].length;++j){
						if (actb_delimwords[i].charAt(j) != ' '){
							gotbreak = true;
							break;
						}
						prespace += ' ';
					}
					for (j=actb_delimwords[i].length-1;j>=0;--j){
						if (actb_delimwords[i].charAt(j) != ' ') break;
						postspace += ' ';
					}
					str += prespace;
					str += a;
					l = str.length;
					if (gotbreak) str += postspace;
				}else{
					str += actb_delimwords[i];
				}
				if (i != actb_delimwords.length - 1){
					str += actb_delimchar[i];
				}
			}
			actb_curr.value = str;
			setCaret(actb_curr,l);
		}else{
			actb_curr.value = a;
		}
		actb_mouse_on_list = 0;
		actb_removedisp();
	}

	function set_index(new_index){
		if (new_index>=0 && new_index<actb_keywords.length){
			var row_values = actb_keywords[new_index];
			actb_curr.value = row_values[0];
			set_obj_values(row_values);
		}
	}

	function set_obj_values(row_values){
		for (var i=0; i<actb_columnlist.length; i++){
			if(actb_columnlist[i]['link']){
				SetObjValue(actb_columnlist[i]['link'], row_values[i]);
			}
		}
		if(actb_self.custom_function)
			actb_self.custom_function(row_values, actb_curr);
	}

	function actb_penter(){
		if (!actb_display) return;
		actb_display = false;
		var word = '';
		var c = 0;
		var selctedIndex = -1;
		for (var i=0;i<=actb_keywords.length;i++){
			if (actb_bool[i]) c++;
			if (c == actb_pos){
				row_values = actb_keywords[i];
				break;
			}
		}
		actb_insertword(row_values);
		l = getCaretStart(actb_curr);
		set_obj_values(row_values);
	}
	function actb_removedisp(bForce, check_id){
		var tbl = document.getElementById('tat_table');
		if(check_id && tbl){
			if(tbl.contents_id != check_id) {
				return false;
			}
		}
		if(bForce) actb_mouse_on_list =0;
		if (actb_mouse_on_list==0){
			actb_display = 0;
			if (tbl){ document.body.removeChild(tbl); }
			if (actb_toid) clearTimeout(actb_toid);
		}
	}
	function actb_keypress(e){
		if (actb_caretmove) stopEvent(e);
		if (actb_autoload_req.length>0 && actb_autoload_time>0){
			// clear timer for autoload
			clear_timer_autoload();
			actb_autoload_timeout_id = setTimeout(function(){actb_req_reload()},actb_autoload_time);
		}
		return !actb_caretmove;
	}

	function actb_req_reload(){
		//clear timer for autoload
		clear_timer_autoload();
		if(actb_curr.focused && actb_curr.value.length>0){
			HttpRequest("POST", actb_autoload_req+urlencode(actb_curr.value), "", 
				"document.getElementById('"+actb_curr.id+"').controller.setdata('%RETURN_STRING%')", false);
		} else {
			actb_self.setdata('');
		}
	}

	this.run_events = function(evt){
		return actb_checkkey(evt);
	}

	function actb_checkkey(evt){
		if (!evt) evt = event;
		a = evt.keyCode;
		caret_pos_start = getCaretStart(actb_curr);
		actb_caretmove = 0;
		switch (a){
			case actb_self.actb_show_keycode: // default = arrow down
				if (!actb_display){
					stopEvent(evt);
					actb_self.showlist();
					return false;
				}
				break;
			case 33:   //page up
				actb_goup(true);
				actb_caretmove = 1;
				return false;
				break;
			case 34:   //page down
				actb_godown(true);
				actb_caretmove = 1;
				return false;
				break;
			case 38: //arrow up
				if (actb_display){
					stopEvent(evt);
					actb_goup();
					actb_caretmove = 1;
					return false;
				}
				break;
			case 40: // arrow down
				if (actb_display){
					stopEvent(evt);
					actb_godown();
					actb_caretmove = 1;
					return false;
				}
				break;
			case 13: case 9: //select key
				if (actb_display){
					stopEvent(evt);
					actb_caretmove = 1;
					actb_penter();
					return false;
				}else{
					return true;
				}
				break;
			case 16: case 17: case 18: case 37: case 39:
				break;
			default:
				setTimeout(function(){actb_tocomplete(a)},50);
				break;
		}
	}

	function actb_tocomplete(kc, bForce){
		if (kc == 38 || kc == 40 || kc == 13) return;
		var i;
		if (actb_display){ 
			var word = 0;
			var c = 0;
			for (var i=0;i<=actb_keywords.length;i++){
				if (actb_bool[i]) c++;
				if (c == actb_pos){
					word = i;
					break;
				}
			}
			actb_pre = word;
		}else{ actb_pre = -1};

		if (actb_curr.value == '' && !bForce){
			actb_removedisp(true);
			return;
		}
		if (actb_self.actb_delimiter.length > 0){
			caret_pos_start = getCaretStart(actb_curr);
			caret_pos_end = getCaretEnd(actb_curr);
			
			delim_split = '';
			for (i=0;i<actb_self.actb_delimiter.length;i++){
				delim_split += actb_self.actb_delimiter[i];
			}
			delim_split = delim_split.addslashes();
			delim_split_rx = new RegExp("(["+delim_split+"])");
			c = 0;
			actb_delimwords = new Array();
			actb_delimwords[0] = '';
			for (i=0,j=actb_curr.value.length;i<actb_curr.value.length;i++,j--){
				if (actb_curr.value.substr(i,j).search(delim_split_rx) == 0){
					ma = actb_curr.value.substr(i,j).match(delim_split_rx);
					actb_delimchar[c] = ma[1];
					c++;
					actb_delimwords[c] = '';
				}else{
					actb_delimwords[c] += actb_curr.value.charAt(i);
				}
			}

			var l = 0;
			actb_cdelimword = -1;
			for (i=0;i<actb_delimwords.length;i++){
				if (caret_pos_end >= l && caret_pos_end <= l + actb_delimwords[i].length){
					actb_cdelimword = i;
				}
				l+=actb_delimwords[i].length + 1;
			}
			var ot = actb_delimwords[actb_cdelimword].trim(); 
			var t = actb_delimwords[actb_cdelimword].addslashes().trim();
		}else{
			var ot = actb_curr.value;
			var t = actb_curr.value.addslashes();
		}

		actb_total = 0;
		actb_tomake = false;
		actb_kwcount = 0;

		if (actb_curr.value.length){
			if (ot.length == 0){
				actb_removedisp(true);
			}
			if (ot.length < actb_self.actb_startcheck) return this;
			if (actb_self.actb_firstText){
				var re = new RegExp("^" + t, "i");
			}else{
				var re = new RegExp(t, "i");
			}

			for (i=0;i<actb_keywords.length;i++){
				actb_bool[i] = false;
				if (re.test(actb_keywords[i][actb_checkcolumn])){
					actb_total++;
					actb_bool[i] = true;
					actb_kwcount++;
					if (actb_pre == i) actb_tomake = true;
				}
			}
		} else {
			for (i=0;i<actb_keywords.length;i++){
				actb_total++;
				actb_bool[i] = true;
				actb_kwcount++;
				if (actb_pre == i) actb_tomake = true;
			}
		}

		if (actb_toid) clearTimeout(actb_toid);
		if (actb_self.actb_timeOut > 0) actb_toid = setTimeout(function(){actb_mouse_on_list = 0;actb_removedisp();},actb_self.actb_timeOut);
		actb_generate();
	}
	return this;
}