function autoCompleteSelect(obj, dir){
	if (obj=='undefined')
	{
		alert('Select Auto Complete: [Object] not found!');
		return;
	}
	if (dir==undefined)
		this._dir = '';
	else
		this._dir = dir;
		
	this._self = obj;
	var _textFieldWidth = 120;
	
	this._iframe = document.createElement('iframe');
	this._iframe.style.display = "none";
	this._iframe.id = 'ac_text_iframe' + obj.name;
	this._iframe.style.position='absolute';
	this._iframe.frameBorder = "0";
	this._iframe.style.width = _textFieldWidth + 120 + "px";
	this._iframe.style.height = 30 + "px";
	this._iframe.marginHeight = 2;
	this._iframe.marginWidth = 0;
	//this._iframe.scrolling="no";
	this._iframe.style.top = eval(curTop(obj) + obj.offsetHeight) + "px";
	this._iframe.style.left = curRight(obj) - (_textFieldWidth + 120) + "px";
	this._oIframe = obj.insertAdjacentElement("afterEnd", this._iframe);
	this._iframe_doc = this._iframe.contentWindow.document;
	this._doc = document;
	//if (this._iframe_doc.designMode)	//if firefox
	//	this._iframe_doc.designMode = "on";
	
	this._iframe_doc.open();
	var html = "<html>\n";
	html += "<head>\n";
	html += "<style>\n";
	html += "body {font-size:10pt; padding:0; font-family:arial; background-color:'#e0e0e0'} .bold { font-weight:bold }\n";
	html += "</style>\n";
	html += "</head>\n";
	html += "<body dir=rtl>\n";
	html += "</body>\n";
	html += "</html>";
	this._iframe_doc.write(html);
	this._iframe_doc.close();

	this._div = this._iframe_doc.createElement('div');
	this._div.id = 'ac_text_div' + obj.name;
	this._div.style.height = '25px';
	this._div.style.fontFamily = 'arial';
	this._div.style.fontSize = '12px';
	this._div.style.backgroundColor = '#e0e0e0';
	this._div.innerHTML = '<span class=bold>חיפוש: </span>';
	//document.getElementById("aaaaaa").style='';
	
	this._text = this._iframe_doc.createElement('input');
	this._text.type = 'text';
	this._text.id = 'ac_text';
	
	this._div.appendChild(this._text);
	this._iframe_doc.body.appendChild(this._div);
	this._text = this._iframe_doc.getElementById("ac_text");
	//addEvent(this._text,"keypress",function () { alert("hello"); });
	/*this._text.style.position='absolute';
	
	this._text.style.width = _textFieldWidth + "px";
	this._text.style.top = eval(curTop(obj) + obj.offsetHeight) + "px";
	this._text.style.left = curRight(obj) - _textFieldWidth + "px";*/
	
	this._acObj = null;
	
	var self = this;
	var firstTime = true;
		
	this.img_dir = this._dir + 'js/auto_complete/imgs/';
	
	var dataArray = populateArray(obj);
	var img = document.createElement("img");
	img.src = this.img_dir + 'autoc.gif';
	img.onclick = keyPressProcess;
	img.hspace = 5;
	img.title = 'לחץ כאן על מנת לפתוח חיפוש ברשימה';
	obj.insertAdjacentElement("afterEnd", img);

	addEvent(obj,"keypress",keyPressProcess);
	
	function keyPressProcess(evt)
	{
		if (!evt) evt = event;
		a = evt.keyCode;
		if (document.getElementById('ac_text_iframe' + self._self.name)=='undefined')
		{
			self._oIframe=document.body.appendChild(self._iframe);
			self._oIframe.style.display = "";
			self._text.focus();
		}
		else
		{
			self._oIframe.style.display = "";
			self._text.focus();
		}

		if (firstTime)
		{
			self._acObj = new actb(self._text,self,dataArray);
			firstTime = false;
		}
		else
			self._acObj.setText('');
		
		self._acObj.setText(self._acObj.getText() + String.fromCharCode(a));
		self._acObj.actb_checkkey(evt);
		setCaret(self._text,self._acObj.getText().length);
		return false;
	}
	
	this.selectWord = function (word) {
		var options = self._self.options;
		self._self.focus();
		for (var i=0;i<options.length;i++)
		{
			if (options[i].text == word)
			{
				self._self.selectedIndex = i;
				return;
			}
		}
		return;
	}
	this._iframe.style.top = eval(curTop(obj) + obj.offsetHeight) + "px";
	this._iframe.style.left = curRight(obj) - (_textFieldWidth + 120) + "px";
	return this;
}

function actb(obj,selectObj,ca){
	/* ---- Public Variables ---- */
	this.actb_timeOut = -1; // Autocomplete Timeout in ms (-1: autocomplete never time out)
	this.actb_lim = 4;    // Number of elements autocomplete can show (-1: no limit)
	this.actb_firstText = false; // 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.img_dir = selectObj._dir + 'js/auto_complete/imgs/';
	/* ---- 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"';
	/* --- Styles --- */

	/* ---- 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 = 0;
	var clearing = 0;
	var dont_close = 0;
	var actb_kwcount = 0;
	var actb_caretmove = false;
	this.oSelect = selectObj;
	this.actb_keywords = new Array();
	this._iframe = null;
	this._iframe_doc = null;
	this._doc = null;
	/* ---- Private Variables---- */
	
	this.actb_keywords = ca;
	var actb_self = this;

	actb_curr = obj;
	
	this.getText = function() {
		return actb_curr.value;
	}
	
	this.setText = function(s) {
		actb_curr.value = s;
	}
	
	addEvent(actb_curr,"focus",actb_setup);
	function actb_setup(){
		createIFrame();
		addEvent(actb_curr,"keydown",actb_self.actb_checkkey);
		addEvent(actb_curr,"blur",actb_clear);
		addEvent(actb_curr,"keypress",actb_keypress);
	}
	
	function updateIFramePos(obj)
	{
		//actb_self._iframe.style.display = 'block';
		actb_self._iframe.style.left = "-300px";
		actb_self._iframe.style.width = "200px";
		actb_self._iframe.style.height = "400px";
		actb_self._iframe.style.display = "";
		actb_self._iframe.style.width = obj.offsetWidth;
		actb_self._iframe.style.height = obj.offsetHeight;
		actb_self._iframe.style.left = curRight(actb_self.oSelect._iframe) - actb_self._iframe.offsetWidth;
	}
	
	function createIFrame()
	{
		actb_self._iframe = document.createElement('iframe');
		actb_self._iframe.style.display = "none";
		actb_self._iframe.id = 'ac_options_iframe' + actb_self.oSelect._self.name;
		actb_self._iframe.style.position='absolute';
		actb_self._iframe.frameBorder = "0";
		actb_self._iframe.style.width = 220 + "px";
		actb_self._iframe.style.height = 130 + "px";
		actb_self._iframe.marginHeight = 2;
		actb_self._iframe.marginWidth = 0;
		actb_self._iframe.scrolling="no";
		actb_self._iframe.style.top = curTop(actb_self.oSelect._iframe) + actb_self.oSelect._iframe.offsetHeight + "px";
		actb_self._iframe.style.left = "200px";
		var ifrm = document.body.appendChild(actb_self._iframe);
		actb_self._iframe_doc = actb_self._iframe.contentWindow.document;
		actb_self._doc = document;
		//if (actb_self._iframe_doc.designMode)	//if firefox
		//	actb_self._iframe_doc.designMode = "on";
		
		actb_self._iframe_doc.open();
		var html = "<html>\n";
		html += "<head>\n";
		html += "<style>\n";
		html += "body {font-size:10pt; padding:0; font-family:arial; background-color:'#e0e0e0'} .bold { font-weight:bold }\n";
		html += "</style>\n";
		html += "</head>\n";
		html += "<body dir=rtl>\n";
		html += "</body>\n";
		html += "</html>";
		actb_self._iframe_doc.write(html);
		actb_self._iframe_doc.close();
	}
	function select_focus()
	{
		actb_self.oSelect._self.focus();
	}

	function actb_clear(evt){
		if (!evt) evt = event;
		clearing = 1;
		//window.status = actb_mouse_on_list;
		//if (actb_mouse_on_list==0){
		removeEvent(actb_curr,"keydown",actb_self.actb_checkkey);
		removeEvent(actb_curr,"blur",actb_clear);
		removeEvent(actb_curr,"keypress",actb_keypress);
		if (evt==null || evt.type=='blur')
		{
			if (!actb_display)
			{
				clearing = 0;
				actb_removedisp();
				select_focus();
			}
		}
		if (actb_display)
			actb_removedisp();
		//	oSelect._self.focus();
		//}
		clearing = 0;
	}
	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 style='"+(actb_self.actb_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 actb_generate(){
		actb_self._iframe.style.display = "none";
		if (actb_self._iframe_doc.getElementById('tat_table')){ actb_display = false;actb_self._iframe_doc.body.removeChild(actb_self._iframe_doc.getElementById('tat_table')); } 
		if (actb_kwcount == 0){
			actb_display = false;
			return;
		}
		a = actb_self._iframe_doc.createElement('table');
		a.cellSpacing='1px';
		a.cellPadding='2px';
		//a.style.position='absolute';
		//a.style.top = 0;//eval(curTop(actb_curr) + curTop(actb_self.oSelect._iframe) + actb_curr.offsetHeight) + "px";
		//a.style.left = 0;//10;
		a.style.backgroundColor=actb_self.actb_bgColor;
		a.id = 'tat_table';
		actb_self._iframe_doc.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;
		for (i=0;i<actb_self.actb_keywords.length;i++){
			if (actb_bool[i]){
				counter++;
				r = a.insertRow(-1);
				if (first && !actb_tomake){
					r.style.backgroundColor = actb_self.actb_hColor;
					first = false;
					actb_pos = counter;
				}else if(actb_pre == i){
					r.style.backgroundColor = actb_self.actb_hColor;
					first = false;
					actb_pos = counter;
				}else{
					r.style.backgroundColor = actb_self.actb_bgColor;
				}
				r.id = 'tat_tr'+(j);
				c = r.insertCell(-1);
				c.style.color = actb_self.actb_textColor;
				c.style.fontFamily = actb_self.actb_fFamily;
				c.style.fontSize = actb_self.actb_fSize;
				c.innerHTML = actb_parse(actb_self.actb_keywords[i]);
				c.id = 'tat_td'+(j);
				c.setAttribute('pos',j);
				if (actb_self.actb_mouse){
					c.style.cursor = 'pointer';
					c.onclick=actb_mouseclick;
					c.onmouseover = actb_table_highlight;
				}
				j++;
			}
			if (j - 1 == actb_self.actb_lim && j < actb_total){
				r = a.insertRow(-1);
				r.style.backgroundColor = actb_self.actb_bgColor;
				c = r.insertCell(-1);
				c.style.color = actb_self.actb_textColor;
				c.style.fontFamily = 'arial narrow';
				c.style.fontSize = actb_self.actb_fSize;
				c.align='center';
				var img = actb_self._iframe_doc.createElement('img');
				img.src = actb_self.img_dir+'down.gif';
				replaceHTMLbyObject(c,img);
				
				
				if (actb_self.actb_mouse){
					c.style.cursor = 'pointer';
					c.onclick = function () { dont_close=1; actb_mouse_down(); };
				}
				break;
			}
		}
		//a.style.left = (curRight(actb_self.oSelect._iframe) - a.offsetWidth) + "px";	//update the position of the AC table
		actb_rangeu = 1;
		actb_ranged = j-1;
		actb_display = true;
		if (actb_pos <= 0) actb_pos = 1;
		updateIFramePos(a);
	}
	function actb_remake(){
		actb_self._iframe.style.display = "none";
		actb_self._iframe_doc.body.removeChild(actb_self._iframe_doc.getElementById('tat_table'));
		a = actb_self._iframe_doc.createElement('table');
		a.cellSpacing='1px';
		a.cellPadding='2px';
		//a.style.position='absolute';
		//a.style.top = eval(curTop(actb_curr) + actb_curr.offsetHeight) + "px";
		//a.style.left = curLeft(actb_curr) + "px";
		a.style.backgroundColor=actb_self.actb_bgColor;
		a.id = 'tat_table';
		if (actb_self.actb_mouse){
			a.onmouseout= actb_table_unfocus;
			a.onmouseover=actb_table_focus;
		}
		actb_self._iframe_doc.body.appendChild(a);
		var i;
		var first = true;
		var j = 1;
		if (actb_rangeu > 1){
			r = a.insertRow(-1);
			r.style.backgroundColor = actb_self.actb_bgColor;
			c = r.insertCell(-1);
			c.style.color = actb_self.actb_textColor;
			c.style.fontFamily = 'arial narrow';
			c.style.fontSize = actb_self.actb_fSize;
			c.align='center';
			var img = actb_self._iframe_doc.createElement('img');
			img.src = actb_self.img_dir+'up.gif';
			replaceHTMLbyObject(c,img);
			if (actb_self.actb_mouse){
				c.style.cursor = 'pointer';
				c.onclick = actb_mouse_up;
			}
		}
		for (i=0;i<actb_self.actb_keywords.length;i++){
			if (actb_bool[i]){
				if (j >= actb_rangeu && j <= actb_ranged){
					r = a.insertRow(-1);
					r.style.backgroundColor = actb_self.actb_bgColor;
					r.id = 'tat_tr'+(j);
					c = r.insertCell(-1);
					c.style.color = actb_self.actb_textColor;
					c.style.fontFamily = actb_self.actb_fFamily;
					c.style.fontSize = actb_self.actb_fSize;
					c.innerHTML = actb_parse(actb_self.actb_keywords[i]);
					c.id = 'tat_td'+(j);
					c.setAttribute('pos',j);
					if (actb_self.actb_mouse){
						c.style.cursor = 'pointer';
						c.onclick=actb_mouseclick;
						c.onmouseover = actb_table_highlight;
					}
					j++;
				}else{
					j++;
				}
			}
			if (j > actb_ranged) break;
		}
		if (j-1 < actb_total){
			r = a.insertRow(-1);
			r.style.backgroundColor = actb_self.actb_bgColor;
			c = r.insertCell(-1);
			c.style.color = actb_self.actb_textColor;
			c.style.fontFamily = 'arial narrow';
			c.style.fontSize = actb_self.actb_fSize;
			c.align='center';
			var img = actb_self._iframe_doc.createElement('img');
			img.src = actb_self.img_dir+'down.gif';
			replaceHTMLbyObject(c,img);
			if (actb_self.actb_mouse){
				c.style.cursor = 'pointer';
				c.onclick = actb_mouse_down;
			}
		}
		updateIFramePos(a);
	}
	function actb_goup(){
		if (!actb_display) return;
		if (actb_pos == 1) return;
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos--;
		if (actb_pos < actb_rangeu) actb_moveup();
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		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(){
		if (!actb_display) return;
		if (actb_pos == actb_total) return;
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos++;
		if (actb_pos > actb_ranged) actb_movedown();
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		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(){
		actb_rangeu++;
		actb_ranged++;
		actb_remake();
	}
	function actb_moveup(){
		actb_rangeu--;
		actb_ranged--;
		actb_remake();
	}

	/* Mouse */
	function actb_mouse_down(){
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos++;
		actb_movedown();
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		actb_curr.focus();
		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;
		}
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos--;
		actb_moveup();
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		actb_curr.focus();
		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;
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_bgColor;
		actb_pos = this.getAttribute('pos');
		while (actb_pos < actb_rangeu) actb_moveup();
		while (actb_pos > actb_ranged) actb_movedown();
		actb_self._iframe_doc.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_self.actb_hColor;
		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(a){
		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 actb_penter(){
		if (!actb_display) return;
		actb_display = false;
		var word = '';
		var c = 0;
		for (var i=0;i<=actb_self.actb_keywords.length;i++){
			if (actb_bool[i]) c++;
			if (c == actb_pos){
				word = actb_self.actb_keywords[i];
				break;
			}
		}
		actb_insertword(word);
		actb_clear(null);
		actb_self.oSelect.selectWord(word);
		//l = getCaretStart(actb_curr);
	}
	function actb_removedisp(){
		if (actb_mouse_on_list==0 && !clearing){
			actb_display = 0;
			if (actb_self._iframe_doc.getElementById('tat_table')){ actb_self._iframe_doc.body.removeChild(actb_self._iframe_doc.getElementById('tat_table')); }
			if (document.getElementById('ac_options_iframe'+actb_self.oSelect._self.name)){ document.body.removeChild(document.getElementById('ac_options_iframe'+actb_self.oSelect._self.name)); }			
			//if (actb_self.oSelect._iframe_doc.getElementById('ac_text_div' + actb_self.oSelect._self.name)) { actb_self.oSelect._iframe_doc.body.removeChild(actb_self.oSelect._iframe_doc.getElementById('ac_text_div' + actb_self.oSelect._self.name)); }
			var o = document.getElementById('ac_text_iframe' + actb_self.oSelect._self.name);
			
			if (o!=null) {
				o.style.display = "none";
				//document.body.removeChild(o); 
				}
			if (actb_toid) clearTimeout(actb_toid);
		}
	}
	function actb_keypress(e){
		if (actb_caretmove) stopEvent(e);
		return !actb_caretmove;
	}
	
	this.actb_checkkey = function (evt){
		if (!evt) evt = event;
		a = evt.keyCode;
		caret_pos_start = getCaretStart(actb_curr);
		actb_caretmove = 0;
		switch (a){
			case 38:
				actb_goup();
				actb_caretmove = 1;
				return false;
				break;
			case 40:
				actb_godown();
				actb_caretmove = 1;
				return false;
				break;
			case 13: case 9:
				if (actb_display){
					actb_caretmove = 1;
					actb_penter();
					return false;
				}else{
					return true;
				}
				break;
			default:
				setTimeout(function(){actb_tocomplete(a)},50);
				break;
		}
	};
	
	function actb_tocomplete(kc){
		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_self.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 == ''){
			//actb_mouse_on_list = 0;
			//actb_removedisp();
			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();
		}
		if (ot.length == 0){
			actb_mouse_on_list = 0;
			actb_removedisp();
		}
		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");
		}

		actb_total = 0;
		actb_tomake = false;
		actb_kwcount = 0;
		for (i=0;i<actb_self.actb_keywords.length;i++){
			actb_bool[i] = false;
			if (re.test(actb_self.actb_keywords[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;
};