var tmp=0,tmpanz=0,tmp_mode="";function createRequestObject(){var a;a=navigator.appName;return a=a=="Microsoft Internet Explorer"?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest}var http_ajaxsearch=createRequestObject();function AJAX_search(a){tmp_mode=a;var b=document.getElementById(a).value;if(b){http_ajaxsearch.open("get","includes/ajax_livesearch.php?mode="+a+"&q="+b,true);http_ajaxsearch.onreadystatechange=handleResponseAJAXsearch;http_ajaxsearch.send(null)}}
function color_div(){for(var a=0;tmpanz>a;){a+=1;document.getElementById(a).style.background="#FFFFFF";document.getElementById(a).style.color="#000000"}document.getElementById(tmp).style.background="#0066FF";document.getElementById(tmp).style.color="#FFFFFF"}
function mousecolor(a){for(var b=0;tmpanz>b;){b+=1;document.getElementById(b).style.background="#FFFFFF";document.getElementById(b).style.color="#000000"}document.getElementById(a).style.background="#0066FF";document.getElementById(a).style.color="#FFFFFF"}
function keydown(a,b){if(!a)a=window.event;if(a.which)var c=a.which;else if(a.keyCode)c=a.keyCode;switch(c){case 40:if(tmp<tmpanz){tmp=a=tmp+1;document.getElementById(b).value=document.getElementById(a).innerHTML}break;case 38:if(tmp>1){tmp=a=tmp-1;document.getElementById(b).value=document.getElementById(a).innerHTML}break;default:AJAX_search(b);break}color_div()}
function mouseklick(a,b){document.getElementById(b).value=document.getElementById(a).innerHTML;document.getElementById("L"+b).style.display="none";document.getElementById("L"+b).innerHTML=""}function handleResponseAJAXsearch(){if(http_ajaxsearch.readyState==4){var a=String(http_ajaxsearch.responseText),b=[];if(a.indexOf("|#|"!=-1)){b=a.split("|#|");if(b[1]>0){document.getElementById("L"+tmp_mode).innerHTML=b[0];document.getElementById("L"+tmp_mode).style.display="block";tmpanz=b[1]}}}}
function ajax_search_hide(a){for(var b=tmpanz=tmp=0;a;b++)document.getElementById("L"+a[b]).style.display="none"};