smart_text = function (textid, plink, qcallback)
{
	this.ds = new YAHOO.util.LocalDataSource([]);
	this.cont = YAHOO.util.Dom.get('smart_text_container');
	if(this.cont){
		document.body.removeChild(this.cont)
	}
	this.cont = document.createElement('div');
	this.cont.id = 'smart_text_container';
	document.body.appendChild(this.cont);
	this.autocomp=new YAHOO.widget.AutoComplete(document.getElementById(textid),this.cont,this.ds);
	this.autocomp.minQueryLength = 3;	
	
	this.plink=null;
	if(plink!==null)
	{
		this.plink=getCustomTag(plink);
	}
	this.qcallback = qcallback;
	this.autocomp._sendQuery = smart_text_sendQuery;
	this.autocomp._smart = this;
};

smart_text_sendQuery = function (sQuery)
{
	result=true;
	if(this._smart.qcallback!==null)
	{
		result=this._smart.qcallback();
	}else{
		result = (sQuery.length >= this._smart.autocomp.minQueryLength || sQuery.length==0)
	}
	if(result && this._smart.plink!==null)
	{
		this._smart.plink.doPost();
	}
};