QuickSearch.prototype = new CabiBase;
QuickSearch.prototype.constructor = QuickSearch;

function QuickSearch(stringId,stringSize,stringWidth,stringContainer){
	CabiBase.call(this);
	this.id = stringId;
	this.size = stringSize;
	this.width = stringWidth;
	this.container = stringContainer;
	this.selectedIndex = 0;
}

QuickSearch.prototype.Show = function Show(){
	var placeholder = document.getElementById(this.container);	
	//var tbody = document.createElement("TBODY");	
	var table1 =  this.createTable(this.id,"90%","0","0","0",2,1);		
	
	var input2 = document.createElement("DIV");
	input2.setAttribute("id","SelectBox"+this.id);
	input2.className = "QuickSearchSelectBox";
	input2.style.visibility = "hidden";
	input2.style.width = this.width;
		
	this.col(table1,0,0).appendChild(this.addInputBox("text","SearchTextBox"));		
	this.col(table1,1,0).appendChild(input2);				
	
	placeholder.appendChild(table1);
	placeholder.innerHTML = placeholder.innerHTML;	
}

QuickSearch.prototype.clear = function clear(){
	while (this.SelectBox().childNodes[0]){
		this.SelectBox().removeChild(this.SelectBox().childNodes[0]);
	}	
}

QuickSearch.prototype.addData = function addData(datatable){
		this.SelectBox().appendChild(datatable);
		this.SelectBox().innerHTML = this.SelectBox().innerHTML;
}

QuickSearch.prototype.TextBox = function TextBox(){
	var table = document.getElementById(this.id);
	var tb = table.getElementsByTagName("input");
	return tb[0];
}

QuickSearch.prototype.SelectBox = function SelectBox(){	
	var selectbox = document.getElementById("SelectBox"+this.id);
	return selectbox;	
}	

QuickSearch.prototype.closeSelectBox = function closeSelectBox(){
	this.SelectBox().style.visibility = "hidden";
	this.selectedIndex = 0;
}

QuickSearch.prototype.moveIndex = function moveIndex(i,color1,color2){
	var trs = this.SelectBox().getElementsByTagName("TR");
	if(trs.length > 0){		
		trs[this.selectedIndex].setAttribute("bgColor",color1);
		if(i == 1 ){
			
			if(this.selectedIndex < trs.length-1){
				this.selectedIndex = this.selectedIndex + 1;			
				trs[this.selectedIndex].setAttribute("bgColor",color2);		
			}else{ 
				this.selectedIndex = 0;
				trs[0].setAttribute("bgColor",color2);		
			}
			
		}else{
			if(i == 0 && this.selectedIndex > 0){
				this.selectedIndex = this.selectedIndex - 1;
				trs[this.selectedIndex].setAttribute("bgColor",color2);		
			}
		}				
		return trs[this.selectedIndex];		
	}
}

QuickSearch.prototype.selectedItemText = function selectedItemText(){
	var tr = this.SelectBox().getElementsByTagName("TR");
	var tds = tr[this.selectedIndex].getElementsByTagName("TD");
	return tds[0].innerHTML;
}




	
