/* ---- Variables ---- */
var actb_timeOut = -1; // Autocomplete Timeout in ms (-1: autocomplete never time out)
var actb_lim = 5; // Number of elements autocomplete can show (-1: no limit)
var actb_firstText = false; // should the auto complete be limited to the beginning of keyword?
/* ---- Variables ---- */
/* --- Styles --- */
var actb_bgColor = '#FFFFFF';
var actb_textColor = '#000000';
var actb_hBgColor = '#990000';
var actb_htextColor = '#FFFFFF';
var actb_fFamily = 'Courier';
var actb_fSize = '14px';
var actb_hStyle = 'text-decoration:underline;font-weight="bold"';
/* --- Styles --- */
/* ---- Constants ---- */
var actb_keywords = new Array();
var actb_display = true;
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 = true;
/* ---- Constants ---- */
function actb_parse(n){
var t = escape(actb_curr.value);
var tobuild = '';
var i;
var re = "";
if (actb_firstText){
re = new RegExp("^" + t, "i");
}else{
re = new RegExp(t, "i");
}
var p = n.search(re);
for (i=0;i
1){
r = a.insertRow(-1);
r.style.backgroundColor = actb_bgColor;
c = r.insertCell(-1);
c.style.color = actb_textColor;
c.style.fontFamily = 'arial narrow';
a.style.zIndex = 5;
c.style.fontSize = actb_fSize;
c.align='center';
c.innerHTML = '/\\';
}
for (i=0;i= actb_rangeu && j <= actb_ranged){
r = a.insertRow(-1);
r.style.backgroundColor = actb_bgColor;
r.id = 'tat_tr'+(j);
c = r.insertCell(-1);
c.style.color = actb_textColor;
c.style.fontFamily = actb_fFamily;
a.style.zIndex = 5;
c.style.fontSize = actb_fSize;
c.innerHTML = actb_parse(actb_keywords[i]);
c.id = 'tat_td'+(j);
j++;
}else{
j++;
}
}
if (j > actb_ranged) break;
}
if (j-1 < actb_total){
r = a.insertRow(-1);
r.style.backgroundColor = actb_bgColor;
c = r.insertCell(-1);
c.style.color = actb_textColor;
c.style.fontFamily = 'arial narrow';
c.style.fontSize = actb_fSize;
c.align='center';
c.innerHTML = '\\/';
height = height + c.height;
width = c.width;
}
if(navigator.appName == "Microsoft Internet Explorer") {
frame.width=width;
frame.height=height;
}
}
function actb_goup(){
if (!actb_display) return;
if (actb_pos == 1) return;
document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_bgColor;
document.getElementById('tat_td'+actb_pos).style.color = actb_textColor;
actb_pos--;
if (actb_pos < actb_rangeu) actb_moveup();
document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_hBgColor;
document.getElementById('tat_td'+actb_pos).style.color = actb_htextColor;
if (actb_toid) clearTimeout(actb_toid);
if (actb_timeOut > 0) actb_toid = setTimeout("actb_removedisp()",actb_timeOut);
}
function actb_godown(){
if (!actb_display) return;
if (actb_pos == actb_total) return;
document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_bgColor;
document.getElementById('tat_td'+actb_pos).style.color = actb_textColor;
actb_pos++;
if (actb_pos > actb_ranged) actb_movedown();
document.getElementById('tat_tr'+actb_pos).style.backgroundColor = actb_hBgColor;
document.getElementById('tat_td'+actb_pos).style.color= actb_htextColor;
if (actb_toid) clearTimeout(actb_toid);
if (actb_timeOut > 0) actb_toid = setTimeout("actb_removedisp()",actb_timeOut);
}
function actb_movedown(){
actb_rangeu++;
actb_ranged++;
actb_remake();
}
function actb_moveup(){
actb_rangeu--;
actb_ranged--;
actb_remake();
}
function actb_penter(){
if (!actb_display) return;
actb_display = 0;
var word = '';
var c = 0;
for (var i=0;i<=actb_keywords.length;i++){
if (actb_bool[i]) c++;
if (c == actb_pos){
word = actb_keywords[i];
break;
}
}
a = word;//actb_keywords[actb_pos-1];//document.getElementById('tat_td'+actb_pos).;
actb_curr.value = a;
actb_removedisp();
}
function actb_removedisp(){
actb_display = 0;
if(navigator.appName == "Microsoft Internet Explorer")
if (document.getElementById('tat_frame')) document.body.removeChild(document.getElementById('tat_frame'));
if (document.getElementById('tat_table')) document.body.removeChild(document.getElementById('tat_table'));
if (actb_toid) clearTimeout(actb_toid);
}
function actb_checkkey(evt, sndr){
a = evt.keyCode;
if (a == 38){ // up key
actb_goup();
}else if(a == 40){ // down key
actb_godown();
}else if(a == 13){
actb_penter();
}
}
function actb_tocomplete(sndr,evt,arr){
if (arr) actb_keywords = arr;
if (evt.keyCode == 38 || evt.keyCode == 40 || evt.keyCode == 13) return;
var i;
if (actb_display){
var word = 0;
var c = 0;
for (i=0;i<=actb_keywords.length;i++){
if (actb_bool[i]) c++;
if (c == actb_pos){
word = i;
break;
}
}
actb_pre = word;//actb_pos;
}else{ actb_pre = -1; }
if (!sndr) sndr = evt.srcElement;
actb_curr = sndr;
if (sndr.value == ''){
actb_removedisp();
return;
}
var t = sndr.value;
var re = "";
if (actb_firstText){
re = new RegExp("^" + t, "i");
}else{
re = new RegExp(t, "i");
}
actb_total = 0;
actb_tomake = false;
for (i=0;i 0) actb_toid = setTimeout("actb_removedisp()",actb_timeOut);
actb_generate(actb_bool);
}