var ajaxBox_offsetX=0;
var ajaxBox_offsetY=0;
var ajax_list_externalFile="/home/codes.asp";
var minimumLettersBeforeLookup=1;
var ajax_list_objects=new Array();
var ajax_list_cachedLists=new Array();
var ajax_list_activeInput=false;
var ajax_list_activeItem;
var ajax_list_optionDivFirstItem=false;
var ajax_list_currentLetters=new Array();
var ajax_optionDiv=false;
var ajax_optionDiv_iframe=false;
var ajax_list_MSIE=false;
if(navigator.userAgent.indexOf("MSIE")>=0&&navigator.userAgent.indexOf("Opera")<0){
ajax_list_MSIE=true;
}
var currentListIndex=0;
function ajax_getTopPos(_1){
var _2=_1.offsetTop;
while((_1=_1.offsetParent)!=null){
_2+=_1.offsetTop;
}
return _2;
}
function ajax_list_cancelEvent(){
return false;
}
function ajax_getLeftPos(_3){
var _4=_3.offsetLeft;
while((_3=_3.offsetParent)!=null){
_4+=_3.offsetLeft;
}
return _4;
}
function ajax_option_setValue(e,_6){
if(!_6){
_6=this;
}
var _7=_6.innerHTML;
if(ajax_list_MSIE){
_7=_6.innerText;
}else{
_7=_6.textContent;
}
if(!_7){
_7=_6.innerHTML;
}
var _8=_7;
_7=ltrim(_8.replace(_8.split(/\s/g,1),""));
ajax_list_activeInput.value=_7;
if(document.getElementById(ajax_list_activeInput.name+"_hidden")){
document.getElementById(ajax_list_activeInput.name+"_hidden").value=_6.id+".AX";
}
ajax_options_hide();
}
function ajax_options_hide(){
if(ajax_optionDiv){
ajax_optionDiv.style.display="none";
}
if(ajax_optionDiv_iframe){
ajax_optionDiv_iframe.style.display="none";
}
}
function ajax_options_rollOverActiveItem(_9,_a){
if(ajax_list_activeItem){
ajax_list_activeItem.className="optionDiv";
}
_9.className="optionDivSelected";
ajax_list_activeItem=_9;
if(_a){
if(ajax_list_activeItem.offsetTop>ajax_optionDiv.offsetHeight){
ajax_optionDiv.scrollTop=ajax_list_activeItem.offsetTop-ajax_optionDiv.offsetHeight+ajax_list_activeItem.offsetHeight+2;
}
if(ajax_list_activeItem.offsetTop<ajax_optionDiv.scrollTop){
ajax_optionDiv.scrollTop=0;
}
}
}
function ajax_option_list_buildList(_b,_c){
ajax_optionDiv.innerHTML="";
ajax_list_activeItem=false;
if(ajax_list_cachedLists[_c][_b.toLowerCase()].length<1){
ajax_options_hide();
return;
}
ajax_list_optionDivFirstItem=false;
var _d=false;
for(var no=0;no<ajax_list_cachedLists[_c][_b.toLowerCase()].length;no++){
if(ajax_list_cachedLists[_c][_b.toLowerCase()][no].length==0){
continue;
}
_d=true;
var _f=document.createElement("DIV");
var _10=ajax_list_cachedLists[_c][_b.toLowerCase()][no].split(/###/gi);
if(ajax_list_cachedLists[_c][_b.toLowerCase()].length==1&&ajax_list_activeInput.value==_10[0]){
ajax_options_hide();
return;
}
_f.innerHTML=_10[_10.length-1];
_f.id=_10[0];
_f.className="optionDiv";
_f.onmouseover=function(){
ajax_options_rollOverActiveItem(this,false);
};
_f.onclick=ajax_option_setValue;
if(!ajax_list_optionDivFirstItem){
ajax_list_optionDivFirstItem=_f;
}
ajax_optionDiv.appendChild(_f);
}
if(_d){
ajax_optionDiv.style.display="block";
if(ajax_optionDiv_iframe){
ajax_optionDiv_iframe.style.display="";
}
ajax_options_rollOverActiveItem(ajax_list_optionDivFirstItem,true);
}
}
function ajax_option_list_showContent(_11,_12,_13,_14){
if(_14!=currentListIndex){
return;
}
var _15=_12.value;
var _16=ajax_list_objects[_11].response;
var _17=_16.split("|");
ajax_list_cachedLists[_13][_15.toLowerCase()]=_17;
ajax_option_list_buildList(_15,_13);
}
function ajax_option_resize(_18){
ajax_optionDiv.style.top=(ajax_getTopPos(_18)+_18.offsetHeight+ajaxBox_offsetY)+"px";
ajax_optionDiv.style.left=(ajax_getLeftPos(_18)+ajaxBox_offsetX)+"px";
if(ajax_optionDiv_iframe){
ajax_optionDiv_iframe.style.left=ajax_optionDiv.style.left;
ajax_optionDiv_iframe.style.top=ajax_optionDiv.style.top;
}
}
function ajax_showOptions(_19,_1a,e){
if(e.keyCode==13||e.keyCode==9){
return;
}
if(ajax_list_currentLetters[_19.name]==_19.value){
return;
}
if(!ajax_list_cachedLists[_1a]){
ajax_list_cachedLists[_1a]=new Array();
}
ajax_list_currentLetters[_19.name]=_19.value;
if(!ajax_optionDiv){
ajax_optionDiv=document.createElement("DIV");
ajax_optionDiv.id="ajax_listOfOptions";
document.body.appendChild(ajax_optionDiv);
if(ajax_list_MSIE){
ajax_optionDiv_iframe=document.createElement("IFRAME");
ajax_optionDiv_iframe.border="0";
ajax_optionDiv_iframe.style.width=ajax_optionDiv.clientWidth+"px";
ajax_optionDiv_iframe.style.height=ajax_optionDiv.clientHeight+"px";
ajax_optionDiv_iframe.id="ajax_listOfOptions_iframe";
document.body.appendChild(ajax_optionDiv_iframe);
}
var _1c=document.getElementsByTagName("INPUT");
for(var no=0;no<_1c.length;no++){
if(!_1c[no].onkeyup){
_1c[no].onfocus=ajax_options_hide;
}
}
var _1e=document.getElementsByTagName("SELECT");
for(var no=0;no<_1e.length;no++){
_1e[no].onfocus=ajax_options_hide;
}
var _1f=document.body.onkeydown;
if(typeof _1f!="function"){
document.body.onkeydown=ajax_option_keyNavigation;
}else{
document.body.onkeydown=function(){
_1f();
ajax_option_keyNavigation();
};
}
var _20=document.body.onresize;
if(typeof _20!="function"){
document.body.onresize=function(){
ajax_option_resize(_19);
};
}else{
document.body.onresize=function(){
_20();
ajax_option_resize(_19);
};
}
}
if(_19.value.length<minimumLettersBeforeLookup){
ajax_options_hide();
return;
}
ajax_optionDiv.style.top=(ajax_getTopPos(_19)+_19.offsetHeight+ajaxBox_offsetY)+"px";
ajax_optionDiv.style.left=(ajax_getLeftPos(_19)+ajaxBox_offsetX)+"px";
if(ajax_optionDiv_iframe){
ajax_optionDiv_iframe.style.left=ajax_optionDiv.style.left;
ajax_optionDiv_iframe.style.top=ajax_optionDiv.style.top;
}
ajax_list_activeInput=_19;
ajax_optionDiv.onselectstart=ajax_list_cancelEvent;
currentListIndex++;
if(ajax_list_cachedLists[_1a][_19.value.toLowerCase()]){
ajax_option_list_buildList(_19.value,_1a,currentListIndex);
}else{
var _21=currentListIndex/1;
ajax_optionDiv.innerHTML="";
var _22=ajax_list_objects.length;
ajax_list_objects[_22]=new sack();
var url=ajax_list_externalFile+"?"+_1a+"=1&letters="+_19.value.replace(" ","+");
ajax_list_objects[_22].requestFile=url;
ajax_list_objects[_22].onCompletion=function(){
ajax_option_list_showContent(_22,_19,_1a,_21);
};
ajax_list_objects[_22].runAJAX();
}
}
function ajax_option_keyNavigation(e){
if(document.all){
e=event;
}
if(!ajax_optionDiv){
return;
}
if(ajax_optionDiv.style.display=="none"){
return;
}
if(e.keyCode==38){
if(!ajax_list_activeItem){
return;
}
if(ajax_list_activeItem&&!ajax_list_activeItem.previousSibling){
return;
}
ajax_options_rollOverActiveItem(ajax_list_activeItem.previousSibling,true);
}
if(e.keyCode==40){
if(!ajax_list_activeItem){
ajax_options_rollOverActiveItem(ajax_list_optionDivFirstItem,true);
}else{
if(!ajax_list_activeItem.nextSibling){
return;
}
ajax_options_rollOverActiveItem(ajax_list_activeItem.nextSibling,true);
}
}
if(e.keyCode==13||e.keyCode==9){
if(ajax_list_activeItem&&ajax_list_activeItem.className=="optionDivSelected"){
ajax_option_setValue(false,ajax_list_activeItem);
}
if(e.keyCode==13){
return false;
}else{
return true;
}
}
if(e.keyCode==27){
ajax_options_hide();
}
}
document.documentElement.onclick=autoHideList;
function autoHideList(e){
if(document.all){
e=event;
}
if(e.target){
source=e.target;
}else{
if(e.srcElement){
source=e.srcElement;
}
}
if(source.nodeType==3){
source=source.parentNode;
}
if(source.tagName.toLowerCase()!="input"&&source.tagName.toLowerCase()!="textarea"){
ajax_options_hide();
}
}
function sack(_26){
this.xmlhttp=null;
this.resetData=function(){
this.method="POST";
this.queryStringSeparator="?";
this.argumentSeparator="&";
this.URLString="";
this.encodeURIString=true;
this.execute=false;
this.element=null;
this.elementObj=null;
this.requestFile=_26;
this.vars=new Object();
this.responseStatus=new Array(2);
};
this.resetFunctions=function(){
this.onLoading=function(){
};
this.onLoaded=function(){
};
this.onInteractive=function(){
};
this.onCompletion=function(){
};
this.onError=function(){
};
this.onFail=function(){
};
};
this.reset=function(){
this.resetFunctions();
this.resetData();
};
this.createAJAX=function(){
try{
this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1){
try{
this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch(e2){
this.xmlhttp=null;
}
}
if(!this.xmlhttp){
if(typeof XMLHttpRequest!="undefined"){
this.xmlhttp=new XMLHttpRequest();
}else{
this.failed=true;
}
}
};
this.setVar=function(_27,_28){
this.vars[_27]=Array(_28,false);
};
this.encVar=function(_29,_2a,_2b){
if(true==_2b){
return Array(encodeURIComponent(_29),encodeURIComponent(_2a));
}else{
this.vars[encodeURIComponent(_29)]=Array(encodeURIComponent(_2a),true);
}
};
this.processURLString=function(_2c,_2d){
encoded=encodeURIComponent(this.argumentSeparator);
regexp=new RegExp(this.argumentSeparator+"|"+encoded);
varArray=_2c.split(regexp);
for(i=0;i<varArray.length;i++){
urlVars=varArray[i].split("=");
if(true==_2d){
this.encVar(urlVars[0],urlVars[1]);
}else{
this.setVar(urlVars[0],urlVars[1]);
}
}
};
this.createURLString=function(_2e){
if(this.encodeURIString&&this.URLString.length){
this.processURLString(this.URLString,true);
}
if(_2e){
if(this.URLString.length){
this.URLString+=this.argumentSeparator+_2e;
}else{
this.URLString=_2e;
}
}
this.setVar("rndval",new Date().getTime());
urlstringtemp=new Array();
for(key in this.vars){
if(false==this.vars[key][1]&&true==this.encodeURIString){
encoded=this.encVar(key,this.vars[key][0],true);
delete this.vars[key];
this.vars[encoded[0]]=Array(encoded[1],true);
key=encoded[0];
}
urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0];
}
if(_2e){
this.URLString+=this.argumentSeparator+urlstringtemp.join(this.argumentSeparator);
}else{
this.URLString+=urlstringtemp.join(this.argumentSeparator);
}
};
this.runResponse=function(){
eval(this.response);
};
this.runAJAX=function(_2f){
if(this.failed){
this.onFail();
}else{
this.createURLString(_2f);
if(this.element){
this.elementObj=document.getElementById(this.element);
}
if(this.xmlhttp){
var _30=this;
if(this.method=="GET"){
totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString;
this.xmlhttp.open(this.method,totalurlstring,true);
}else{
this.xmlhttp.open(this.method,this.requestFile,true);
try{
this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
catch(e){
}
}
this.xmlhttp.onreadystatechange=function(){
switch(_30.xmlhttp.readyState){
case 1:
_30.onLoading();
break;
case 2:
_30.onLoaded();
break;
case 3:
_30.onInteractive();
break;
case 4:
_30.response=_30.xmlhttp.responseText;
_30.responseXML=_30.xmlhttp.responseXML;
_30.responseStatus[0]=_30.xmlhttp.status;
_30.responseStatus[1]=_30.xmlhttp.statusText;
if(_30.execute){
_30.runResponse();
}
if(_30.elementObj){
elemNodeName=_30.elementObj.nodeName;
elemNodeName.toLowerCase();
if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea"){
_30.elementObj.value=_30.response;
}else{
_30.elementObj.innerHTML=_30.response;
}
}
if(_30.responseStatus[0]=="200"){
_30.onCompletion();
}else{
_30.onError();
}
_30.URLString="";
break;
}
};
this.xmlhttp.send(this.URLString);
}
}
};
this.reset();
this.createAJAX();
}
function ltrim(_31){
return _31.replace(/^\s+/,"");
}

