Searchbox.deriveFrom(Obj)
function Searchbox(outdiv,inbox,ajaxpath,form,hrefbase,parms){
	this.outdiv=outdiv
	this.inbox=inbox
	this.ajaxpath=ajaxpath
	this.form=form
	this.hrefbase=hrefbase
	this.parms=parms
	this.name=parms.name
	var nm=parms.name
	this.getName=function(){return nm;}
	this._init()
}
Searchbox.prototype._init=
function _init(){
	this.outdiv.style.position="absolute"
	this.on_Color=this.parms.on_Color
	this.on_BGColor=this.parms.on_BGColor
	this.on_ColorLight=this.parms.on_ColorLight
	this.on_BGColorLight=this.parms.on_BGColorLight
	this.off_Color1=this.parms.off_Color1
	this.off_BGColor1=this.parms.off_BGColor1
	this.off_Color2=this.parms.off_Color2
	this.off_BGColor2=this.parms.off_BGColor2
	this.num=-1
	this.numlines=this.parms.numlines
	this.inbox.focus()
	this.inbox.onkeyup= this.associateObjWithEvent(this,"SBKeyup")
	this.inbox.onfocus= this.associateObjWithEvent(this,"_event_Onfocus")
//	this.inbox.onblur= this.associateObjWithEvent(this,"_event_Onblur")
}
Searchbox.prototype.doCurrVal=function(val){
	//dummy
}
Searchbox.prototype.__Searchbox_doSelected=
Searchbox.prototype.doSelected=function(element){
	myDoc.removeChildren(this.outdiv)
	var recNode=this.getRecNode(element)
	this.inbox.value=this.strXml.getFieldData(recNode,"s")
	return this.strXml.getFieldData(recNode,"TLC")
}
/*
Searchbox.prototype._event_Onblur=
function (event,element){
	myDoc.removeChildren(this.outdiv)
}
*/
Searchbox.prototype._event_Onfocus=function (event,element){
//	alert(this.parms.name)
}
Searchbox.prototype.getRecNode=function(element){
	var recNo=parseInt(element.id.split(":")[1])+1
	var recNode=this.strXml.selectNodes(
				"/root/rec["+recNo+"]")[0]
	return recNode
}
Searchbox.prototype.SBKeyup=function (event,element){
	if(event.keyCode==13){
		if(this.num==-1)return
		var el=document.getElementById("SB:"+this.num)
		if(el)this.doSelected(el)
		return 
	}else if(event.keyCode==38){
		if(this.num<1)return
		var el=document.getElementById("SB:"+this.num)
		if(el) this.SBOutRowHighlightOff(el,this.num--)
		var el=document.getElementById("SB:"+this.num)
		if(el)this.SBOutRowHighlightOn(el,this.num)
		return
	}else if(event.keyCode==40){
		var numOfSBsLess2=this.numOfSBs-2
		if(this.num<0||this.num>numOfSBsLess2)return
		var el=document.getElementById("SB:"+this.num)
		if(el) this.SBOutRowHighlightOff(el,this.num++)
		var el=document.getElementById("SB:"+this.num)
		if(el)this.SBOutRowHighlightOn(el,this.num)
		return
	}
	this.doCurrVal(element.value)
	if(!element.value){
		myDoc.removeChildren(this.outdiv)
		return
	}
	this._HTTP=new MyHttp(this.ajaxpath)
	this._HTTP.appendParm("str",element.value)
	this.HTTPSend(this._HTTP,"SBReq")
}
Searchbox.prototype.SBReq=function(){
	var varss=this.HTTPReq(this._HTTP)
	if(!varss)return
//alert(varss["xmlstring"])	
	this.strXml=new MyXml()
	this.strXml.loadStr(varss["xmlstring"])
	this.SBReqBuild()
}
Searchbox.prototype.SBReqBuild=function(){
	myDoc.removeChildren(this.outdiv)
	var tbl=new HtmlTable(this.outdiv)
	tbl.element.style.cursor="pointer"
	tbl.element.style.width="100%"	
	tbl.element.style.backgroundColor="#ffffff"
	tbl.element.style.border="1px #c0c0c0 solid"
	tbl.element.style.borderTop="0px"
	var thead=new HtmlThead(tbl.element)
	this.num=0
	this.numOfSBs=0
	for(var x=0;x<this.numlines;x++){
if( this.strXml.xmlDom.documentElement.childNodes.length>x){	
	var recNode=this.strXml.selectNodes(
		"/root/rec["+(x+1)+"]")[0]
	var tr=this.SBOutRow(thead,x,recNode)
	tr.element.TLC=this.strXml.getFieldData(recNode,"TLC")
	if(!x){
tr.element.style.backgroundColor=this.on_BGColorLight
tr.element.style.color=this.on_ColorLight
	}
	this.numOfSBs++
}else{
	continue
}
	}
}
Searchbox.prototype.SBOutRow=function (thead,x,recNode){
	var tr=new HtmlTr(thead.element)
	tr.element.id="SB:"+x
	this.SBOutRowBC(tr.element,x)
	tr.element.onclick= this.associateObjWithEvent(this,"SBOutRowClick")
	tr.element.onmouseover= this.associateObjWithEvent(this,"SBOutRowMouseover")
	tr.element.onmouseout= this.associateObjWithEvent(this,"SBOutRowMouseout")
	var nameNode=this.strXml.selectNodes("s",recNode)[0]
	var TLCNode=this.strXml.selectNodes("TLC",recNode)[0]
//	var td=new HtmlTd(tr.element,TLCNode.firstChild.data+": "+nameNode.firstChild.data)
	var td=new HtmlTd(tr.element,nameNode.firstChild.data)
	return tr
}
Searchbox.prototype.SBOutRowBC=function(el,rowNo){
	if(!el)return
	this.SBOutRowHighlightOff(el,rowNo)	
}
Searchbox.prototype.SBOutRowClick=
function SBOutRowClick(event,element){
	this.doSelected(element)
}
Searchbox.prototype.SBOutRowMouseover=
function SBOutRowMouseover(event,element){
	this.SBOutRowHighlightOn(element)
	this.num=element.id.split(":")[1]
}
Searchbox.prototype.SBOutRowMouseout=
function SBOutRowMouseout(event,element){
	this.SBOutRowHighlightOff(element,element.id.split(":")[1])
}
Searchbox.prototype.SBOutRowHighlightOff=
function (element,x){
	if(x%2){
		element.style.color= this.off_Color1
		element.style.backgroundColor= this.off_BGColor1
	}else{
		element.style.color= this.off_Color2
		element.style.backgroundColor= this.off_BGColor2
	}
}
Searchbox.prototype.SBOutRowHighlightOn=
function (element){
	element.style.color=this.on_Color
	element.style.backgroundColor=this.on_BGColor
}



SearchboxSubmit.deriveFrom(Searchbox)
function SearchboxSubmit(outdiv,inbox,ajaxpath,form,hrefbase,parms){
	this.Searchbox(outdiv,inbox,ajaxpath,form,hrefbase,parms)
}
SearchboxSubmit.prototype.doSelected=function(element){
	this.form.action=this.hrefbase+"pageId="+element.TLC
	this.form.submit()	
}
