var useBSNns,dirty;
if(useBSNns){
if(typeof (bsn)=="undefined"){
bsn={};
}
_bsn=bsn;
}else{
_bsn=this;
}
_bsn.Ajax=function(){
this.req={};
this.isIE=false;
};
_bsn.Ajax.prototype.makeRequest=function(_1,_2,_3,_4){
if(_2!="POST"){
_2="GET";
}
this.onComplete=_3;
this.onError=_4;
var _5=this;
if(window.XMLHttpRequest){
this.req=new XMLHttpRequest();
this.req.onreadystatechange=function(){
_5.processReqChange();
};
this.req.open("GET",_1,true);
this.req.send(null);
}else{
if(window.ActiveXObject){
this.req=new ActiveXObject("Microsoft.XMLHTTP");
if(this.req){
this.req.onreadystatechange=function(){
_5.processReqChange();
};
this.req.open(_2,_1,true);
this.req.send();
}}}};
_bsn.Ajax.prototype.processReqChange=function(){
if(this.req.readyState==4){
if(this.req.status==200){
if(dirty){dirty=null;return;}
this.onComplete(this.req);
}else{
this.onError(this.req.status);
}}};
var useBSNns;
if(useBSNns){
if(typeof (bsn)=="undefined"){
bsn={};
}
_bsn=bsn;
}else{
_bsn=this;
}
if(typeof (_bsn.DOM)=="undefined"){
_bsn.DOM={};
}
_bsn.DOM.createElement=function(_6,_7,_8,_9){
var ne=document.createElement(_6);
if(!ne){
return false;
}
for(var a in _7){
ne[a]=_7[a];
}
if(typeof (_8)=="string"&&!_9){
ne.appendChild(document.createTextNode(_8));
}else{
if(typeof (_8)=="string"&&_9){
ne.innerHTML=_8;
}else{
if(typeof (_8)=="object"){
ne.appendChild(_8);
}}}
return ne;
};
_bsn.DOM.clearElement=function(id){
var _d=this.getElement(id);
if(!_d){
return false;
}
while(_d.childNodes.length){
_d.removeChild(_d.childNodes[0]);
}
return true;
};
_bsn.DOM.removeElement=function(_e){
var e=this.getElement(_e);
if(!e){
return false;
}else{
if(e.parentNode.removeChild(e)){
return true;
}else{
return false;
}}};
_bsn.DOM.replaceContent=function(id,_11,_12){
var ele=this.getElement(id);
if(!ele){
return false;
}
this.clearElement(ele);
if(typeof (_11)=="string"&&!_12){
ele.appendChild(document.createTextNode(_11));
}else{
if(typeof (_11)=="string"&&_12){
ele.innerHTML=_11;
}else{
if(typeof (_11)=="object"){
ele.appendChild(_11);
}}}};
_bsn.DOM.getElement=function(ele){
if(typeof (ele)=="undefined"){
return false;
}else{
if(typeof (ele)=="string"){
var re=document.getElementById(ele);
if(!re){
return false;
}else{
if(typeof (re.appendChild)!="undefined"){
return re;
}else{
return false;
}}}else{
if(typeof (ele.appendChild)!="undefined"){
return ele;
}else{
return false;
}}}};
_bsn.DOM.appendChildren=function(id,arr){
var ele=this.getElement(id);
if(!ele){
return false;
}
if(typeof (arr)!="object"){
return false;
}
for(var i=0;i<arr.length;i++){
var _1a=arr[i];
if(typeof (_1a)=="string"){
ele.appendChild(document.createTextNode(_1a));
}else{
if(typeof (_1a)=="object"){
ele.appendChild(_1a);
}}}};
_bsn.DOM.createSelect=function(_1b,opt,sel){
var _1e=this.createElement("select",_1b);
for(var a in opt){
var o={id:a};
if(a==sel){
o.selected="selected";
}
_1e.appendChild(this.createElement("option",o,opt[a]));
}
return _1e;
};
_bsn.DOM.getPos=function(ele){
var ele=this.getElement(ele);
var obj=ele;
var _23=0;
if(obj.offsetParent){
while(obj.offsetParent){
_23+=obj.offsetLeft;
obj=obj.offsetParent;
}}else{
if(obj.x){
_23+=obj.x;
}}
var obj=ele;
var _24=0;
if(obj.offsetParent){
while(obj.offsetParent){
_24+=obj.offsetTop;
obj=obj.offsetParent;
}}else{
if(obj.y){
_24+=obj.y;
}}
return {x:_23,y:_24};
};
var useBSNns;
if(useBSNns){
if(typeof (bsn)=="undefined"){
bsn={};
}
_bsn=bsn;
}else{
_bsn=this;
}
if(typeof (_bsn.DOM)=="undefined"){
_bsn.DOM={};
}
_bsn.AutoSuggest=function(_25,_26){
if(!document.getElementById){
return false;
}
this.fld=_bsn.DOM.getElement(_25);
if(!this.fld){
return false;
}
this.nInputChars=0;
this.aSuggestions=[];
this.iHighlighted=0;
this.oP=(_26)?_26:{};
if(!this.oP.minchars){
this.oP.minchars=1;
}
if(!this.oP.method){
this.oP.meth="get";
}
if(!this.oP.varname){
this.oP.varname="input";
}
if(!this.oP.className){
this.oP.className="autosuggest";
}
if(!this.oP.timeout){
this.oP.timeout=5000;
}
if(!this.oP.delay){
this.oP.delay=250;
}
if(!this.oP.maxheight&&this.oP.maxheight!==0){
this.oP.maxheight=250;
}
if(!this.oP.cache){
this.oP.cache=false;
}
var _27=this;
this.fld.onkeyup=function(){
_27.getSuggestions(this.value);
};
this.fld.setAttribute("autocomplete","off");
};
_bsn.AutoSuggest.prototype.getSuggestions=function(val){
if(val.length==this.nInputChars){
return false;
}
if(val.length<this.oP.minchars){
this.nInputChars=val.length;
this.aSuggestions=[];
this.clearSuggestions();
return;
}
if(val.length>this.nInputChars&&this.aSuggestions.length&&this.oP.cache){
var arr=[];
for(var i=0;i<this.aSuggestions.length;i++){
if(this.aSuggestions[i].substr(0,val.length).toLowerCase()==val.toLowerCase()){
arr.push(this.aSuggestions[i]);
}}
this.nInputChars=val.length;
this.aSuggestions=arr;
this.createList(this.aSuggestions);
return false;
}
this.nInputChars=val.length;
var _2b=this;
clearTimeout(this.ajID);
this.ajID=setTimeout(function(){
_2b.doAjaxRequest();
},this.oP.delay);
return false;
};
_bsn.AutoSuggest.prototype.doAjaxRequest=function(){
var _2c=this;
var url=this.oP.script+this.oP.varname+"="+escape(this.fld.value);
var _2e=this.oP.meth;
var _2f=function(req){
_2c.setSuggestions(req);
};
var _31=function(_32){
return;
};
var _33=new _bsn.Ajax;
_33.makeRequest(url,_2e,_2f,_31);
};
_bsn.AutoSuggest.prototype.setSuggestions=function(req){
var xml=req.responseXML;
this.aSuggestions=[];
var _36=xml.getElementsByTagName("results")[0].childNodes;
for(var i=0;i<_36.length;i++){
if(_36[i].hasChildNodes()){
this.aSuggestions.push(_36[i].childNodes[0].nodeValue);
}}
this.idAs="as_"+this.fld.id;
if (this.aSuggestions.length>0){
this.createList(this.aSuggestions);
} else {
this.aSuggestions=[];
this.clearSuggestions();
}};
_bsn.AutoSuggest.prototype.createList=function(arr){
this.clearSuggestions();
if (navigator.userAgent.match(/MSIE [0-6]\.[0-9]+;/) && this.oP.hide){document.getElementById(this.oP.hide).style.visibility = "hidden";}
var ul=_bsn.DOM.createElement("ul",{id:this.idAs,className:this.oP.className});
var _3a=this;
for(var i=0;i<arr.length;i++){
var a=_bsn.DOM.createElement("a",{href:"#"},arr[i]);
a.className = "nofade";
a.onclick=function(){
_3a.setValue(this.childNodes[0].nodeValue);
return false;
};
var li=_bsn.DOM.createElement("li",{},a);
ul.appendChild(li);
}
var pos=_bsn.DOM.getPos(this.fld);
ul.style.left=pos.x+"px";
ul.style.top=(pos.y+this.fld.offsetHeight)+"px";
ul.style.width=this.fld.offsetWidth+"px";
ul.onmouseover=function(){
_3a.killTimeout();
};
ul.onmouseout=function(){
_3a.resetTimeout();
};
document.getElementsByTagName("body")[0].appendChild(ul);
if(ul.offsetHeight>this.oP.maxheight&&this.oP.maxheight!=0){
ul.style["height"]=this.oP.maxheight+"px";
}
var TAB=9;
var ESC=27;
var ENT=13;
var _42=38;
var _43=40;
var _44=13;
this.fld.onblur=function(){
setTimeout(function(){_3a.clearSuggestions();},500);
}
this.fld.onkeydown=function(ev){
var key=(window.event)?window.event.keyCode:ev.keyCode;
switch(key){
case TAB:
_3a.clearSuggestions();
break;
case ESC:
_3a.clearSuggestions();
break;
case ENT:
return _3a.setHighlightedValue();
break;
case _42:
_3a.changeHighlight(key);
return false;
break;
case _43:
_3a.changeHighlight(key);
return false;
break;
}};
this.iHighlighted=0;
clearTimeout(this.toID);
var _3a=this;
this.toID=setTimeout(function(){
_3a.clearSuggestions();
},this.oP.timeout);
};
_bsn.AutoSuggest.prototype.changeHighlight=function(key){
var _48=_bsn.DOM.getElement(this.idAs);
if(!_48){
return false;
}
if(this.iHighlighted>0){
_48.childNodes[this.iHighlighted-1].className="";
}
if(key==40){
this.iHighlighted++;
}else{
if(key=38){
this.iHighlighted--;
}}
if(this.iHighlighted>_48.childNodes.length){
this.iHighlighted=_48.childNodes.length;
}
if(this.iHighlighted<1){
this.iHighlighted=1;
}
_48.childNodes[this.iHighlighted-1].className="highlight";
this.killTimeout();
};
_bsn.AutoSuggest.prototype.killTimeout=function(){
clearTimeout(this.toID);
};
_bsn.AutoSuggest.prototype.resetTimeout=function(){
clearTimeout(this.toID);
var _49=this;
this.toID=setTimeout(function(){
_49.clearSuggestions();
},1000);
};
_bsn.AutoSuggest.prototype.clearSuggestions=function(){
if(document.getElementById(this.idAs)){
_bsn.DOM.removeElement(this.idAs);
if (navigator.userAgent.match(/MSIE [0-6]\.[0-9]+;/) && this.oP.hide){document.getElementById(this.oP.hide).style.visibility = "visible";}}
this.fld.onkeydown=null;
};
_bsn.AutoSuggest.prototype.setHighlightedValue=function(){
if(this.iHighlighted){
this.fld.value=document.getElementById(this.idAs).childNodes[this.iHighlighted-1].firstChild.firstChild.nodeValue;
this.nInputChars=this.fld.value.length;
this.killTimeout();
this.clearSuggestions();
return false;
} else {
return true;
}};
_bsn.AutoSuggest.prototype.setValue=function(val){
this.fld.value=val;
this.resetTimeout();
this.clearSuggestions();
};