YAHOO.widget.DS_JSArray=YAHOO.util.LocalDataSource;
YAHOO.widget.DS_JSFunction=YAHOO.util.FunctionDataSource;
YAHOO.widget.DS_XHR=function(d,a,b){var c=new YAHOO.util.XHRDataSource(d,b);
c._aDeprecatedSchema=a;
return c
};
YAHOO.widget.DS_ScriptNode=function(d,a,b){var c=new YAHOO.util.ScriptNodeDataSource(d,b);
c._aDeprecatedSchema=a;
return c
};
YAHOO.widget.DS_XHR.TYPE_JSON=YAHOO.util.DataSourceBase.TYPE_JSON;
YAHOO.widget.DS_XHR.TYPE_XML=YAHOO.util.DataSourceBase.TYPE_XML;
YAHOO.widget.DS_XHR.TYPE_FLAT=YAHOO.util.DataSourceBase.TYPE_TEXT;
YAHOO.widget.AutoComplete=function(i,c,f,b){if(i&&c&&f){if(f instanceof YAHOO.util.DataSourceBase){this.dataSource=f
}else{return
}this.key=0;
var a=f.responseSchema;
if(f._aDeprecatedSchema){var e=f._aDeprecatedSchema;
if(YAHOO.lang.isArray(e)){if((f.responseType===YAHOO.util.DataSourceBase.TYPE_JSON)||(f.responseType===YAHOO.util.DataSourceBase.TYPE_UNKNOWN)){a.resultsList=e[0];
this.key=e[1];
a.fields=(e.length<3)?null:e.slice(1)
}else{if(f.responseType===YAHOO.util.DataSourceBase.TYPE_XML){a.resultNode=e[0];
this.key=e[1];
a.fields=e.slice(1)
}else{if(f.responseType===YAHOO.util.DataSourceBase.TYPE_TEXT){a.recordDelim=e[0];
a.fieldDelim=e[1]
}}}f.responseSchema=a
}}if(YAHOO.util.Dom.inDocument(i)){if(YAHOO.lang.isString(i)){this._sName="instance"+YAHOO.widget.AutoComplete._nIndex+" "+i;
this._elTextbox=document.getElementById(i)
}else{this._sName=(i.id)?"instance"+YAHOO.widget.AutoComplete._nIndex+" "+i.id:"instance"+YAHOO.widget.AutoComplete._nIndex;
this._elTextbox=i
}YAHOO.util.Dom.addClass(this._elTextbox,"yui-ac-input")
}else{return
}if(YAHOO.util.Dom.inDocument(c)){if(YAHOO.lang.isString(c)){this._elContainer=document.getElementById(c)
}else{this._elContainer=c
}if(this._elContainer.style.display=="none"){}var k=this._elContainer.parentNode;
var d=k.tagName.toLowerCase();
if(d=="div"){YAHOO.util.Dom.addClass(k,"yui-ac")
}else{}}else{return
}if(this.dataSource.dataType===YAHOO.util.DataSourceBase.TYPE_LOCAL){this.applyLocalFilter=true
}if(b&&(b.constructor==Object)){for(var g in b){if(g){this[g]=b[g]
}}}this._initContainerEl();
this._initProps();
this._initListEl();
this._initContainerHelperEls();
var h=this;
var j=this._elTextbox;
YAHOO.util.Event.addListener(j,"keyup",h._onTextboxKeyUp,h);
YAHOO.util.Event.addListener(j,"keydown",h._onTextboxKeyDown,h);
YAHOO.util.Event.addListener(j,"focus",h._onTextboxFocus,h);
YAHOO.util.Event.addListener(j,"blur",h._onTextboxBlur,h);
YAHOO.util.Event.addListener(c,"mouseover",h._onContainerMouseover,h);
YAHOO.util.Event.addListener(c,"mouseout",h._onContainerMouseout,h);
YAHOO.util.Event.addListener(c,"click",h._onContainerClick,h);
YAHOO.util.Event.addListener(c,"scroll",h._onContainerScroll,h);
YAHOO.util.Event.addListener(c,"resize",h._onContainerResize,h);
YAHOO.util.Event.addListener(j,"keypress",h._onTextboxKeyPress,h);
YAHOO.util.Event.addListener(window,"unload",h._onWindowUnload,h);
this.textboxFocusEvent=new YAHOO.util.CustomEvent("textboxFocus",this);
this.textboxKeyEvent=new YAHOO.util.CustomEvent("textboxKey",this);
this.dataRequestEvent=new YAHOO.util.CustomEvent("dataRequest",this);
this.dataReturnEvent=new YAHOO.util.CustomEvent("dataReturn",this);
this.dataErrorEvent=new YAHOO.util.CustomEvent("dataError",this);
this.containerPopulateEvent=new YAHOO.util.CustomEvent("containerPopulate",this);
this.containerExpandEvent=new YAHOO.util.CustomEvent("containerExpand",this);
this.typeAheadEvent=new YAHOO.util.CustomEvent("typeAhead",this);
this.itemMouseOverEvent=new YAHOO.util.CustomEvent("itemMouseOver",this);
this.itemMouseOutEvent=new YAHOO.util.CustomEvent("itemMouseOut",this);
this.itemArrowToEvent=new YAHOO.util.CustomEvent("itemArrowTo",this);
this.itemArrowFromEvent=new YAHOO.util.CustomEvent("itemArrowFrom",this);
this.itemSelectEvent=new YAHOO.util.CustomEvent("itemSelect",this);
this.unmatchedItemSelectEvent=new YAHOO.util.CustomEvent("unmatchedItemSelect",this);
this.selectionEnforceEvent=new YAHOO.util.CustomEvent("selectionEnforce",this);
this.containerCollapseEvent=new YAHOO.util.CustomEvent("containerCollapse",this);
this.textboxBlurEvent=new YAHOO.util.CustomEvent("textboxBlur",this);
this.textboxChangeEvent=new YAHOO.util.CustomEvent("textboxChange",this);
j.setAttribute("autocomplete","off");
YAHOO.widget.AutoComplete._nIndex++
}else{}};
YAHOO.widget.AutoComplete.prototype.dataSource=null;
YAHOO.widget.AutoComplete.prototype.applyLocalFilter=null;
YAHOO.widget.AutoComplete.prototype.queryMatchCase=false;
YAHOO.widget.AutoComplete.prototype.queryMatchContains=false;
YAHOO.widget.AutoComplete.prototype.queryMatchSubset=false;
YAHOO.widget.AutoComplete.prototype.minQueryLength=1;
YAHOO.widget.AutoComplete.prototype.maxResultsDisplayed=10;
YAHOO.widget.AutoComplete.prototype.queryDelay=0.2;
YAHOO.widget.AutoComplete.prototype.typeAheadDelay=0.5;
YAHOO.widget.AutoComplete.prototype.queryInterval=500;
YAHOO.widget.AutoComplete.prototype.highlightClassName="yui-ac-highlight";
YAHOO.widget.AutoComplete.prototype.prehighlightClassName=null;
YAHOO.widget.AutoComplete.prototype.delimChar=null;
YAHOO.widget.AutoComplete.prototype.autoHighlight=true;
YAHOO.widget.AutoComplete.prototype.typeAhead=false;
YAHOO.widget.AutoComplete.prototype.animHoriz=false;
YAHOO.widget.AutoComplete.prototype.animVert=true;
YAHOO.widget.AutoComplete.prototype.animSpeed=0.3;
YAHOO.widget.AutoComplete.prototype.forceSelection=false;
YAHOO.widget.AutoComplete.prototype.allowBrowserAutocomplete=true;
YAHOO.widget.AutoComplete.prototype.alwaysShowContainer=false;
YAHOO.widget.AutoComplete.prototype.useIFrame=false;
YAHOO.widget.AutoComplete.prototype.useShadow=false;
YAHOO.widget.AutoComplete.prototype.suppressInputUpdate=false;
YAHOO.widget.AutoComplete.prototype.resultTypeList=true;
YAHOO.widget.AutoComplete.prototype.queryQuestionMark=true;
YAHOO.widget.AutoComplete.prototype.toString=function(){return"AutoComplete "+this._sName
};
YAHOO.widget.AutoComplete.prototype.getInputEl=function(){return this._elTextbox
};
YAHOO.widget.AutoComplete.prototype.getContainerEl=function(){return this._elContainer
};
YAHOO.widget.AutoComplete.prototype.isFocused=function(){return(this._bFocused===null)?false:this._bFocused
};
YAHOO.widget.AutoComplete.prototype.isContainerOpen=function(){return this._bContainerOpen
};
YAHOO.widget.AutoComplete.prototype.getListEl=function(){return this._elList
};
YAHOO.widget.AutoComplete.prototype.getListItemMatch=function(a){if(a._sResultMatch){return a._sResultMatch
}else{return null
}};
YAHOO.widget.AutoComplete.prototype.getListItemData=function(a){if(a._oResultData){return a._oResultData
}else{return null
}};
YAHOO.widget.AutoComplete.prototype.getListItemIndex=function(a){if(YAHOO.lang.isNumber(a._nItemIndex)){return a._nItemIndex
}else{return null
}};
YAHOO.widget.AutoComplete.prototype.setHeader=function(b){if(this._elHeader){var a=this._elHeader;
if(b){a.innerHTML=b;
a.style.display="block"
}else{a.innerHTML="";
a.style.display="none"
}}};
YAHOO.widget.AutoComplete.prototype.setFooter=function(b){if(this._elFooter){var a=this._elFooter;
if(b){a.innerHTML=b;
a.style.display="block"
}else{a.innerHTML="";
a.style.display="none"
}}};
YAHOO.widget.AutoComplete.prototype.setBody=function(a){if(this._elBody){var b=this._elBody;
YAHOO.util.Event.purgeElement(b,true);
if(a){b.innerHTML=a;
b.style.display="block"
}else{b.innerHTML="";
b.style.display="none"
}this._elList=null
}};
YAHOO.widget.AutoComplete.prototype.generateRequest=function(b){var a=this.dataSource.dataType;
if(a===YAHOO.util.DataSourceBase.TYPE_XHR){if(!this.dataSource.connMethodPost){b=(this.queryQuestionMark?"?":"")+(this.dataSource.scriptQueryParam||"query")+"="+b+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"")
}else{b=(this.dataSource.scriptQueryParam||"query")+"="+b+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"")
}}else{if(a===YAHOO.util.DataSourceBase.TYPE_SCRIPTNODE){b="&"+(this.dataSource.scriptQueryParam||"query")+"="+b+(this.dataSource.scriptQueryAppend?("&"+this.dataSource.scriptQueryAppend):"")
}}return b
};
YAHOO.widget.AutoComplete.prototype.sendQuery=function(b){var a=(this.delimChar)?this._elTextbox.value+b:b;
this._sendQuery(a)
};
YAHOO.widget.AutoComplete.prototype.collapseContainer=function(){this._toggleContainer(false)
};
YAHOO.widget.AutoComplete.prototype.getSubsetMatches=function(b){var c,d,a;
for(var e=b.length;
e>=this.minQueryLength;
e--){a=this.generateRequest(b.substr(0,e));
this.dataRequestEvent.fire(this,c,a);
d=this.dataSource.getCachedResponse(a);
if(d){return this.filterResults.apply(this.dataSource,[b,d,d,{scope:this}])
}}return null
};
YAHOO.widget.AutoComplete.prototype.preparseRawResponse=function(c,d,a){var b=((this.responseStripAfter!=="")&&(d.indexOf))?d.indexOf(this.responseStripAfter):-1;
if(b!=-1){d=d.substring(0,b)
}return d
};
YAHOO.widget.AutoComplete.prototype.filterResults=function(k,i,e,j){if(k&&k!==""){e=YAHOO.widget.AutoComplete._cloneObject(e);
var m=j.scope,f=this,c=e.results,h=[],a=false,l=(f.queryMatchCase||m.queryMatchCase),d=(f.queryMatchContains||m.queryMatchContains);
for(var b=c.length-1;
b>=0;
b--){var o=c[b];
var p=null;
if(YAHOO.lang.isString(o)){p=o
}else{if(YAHOO.lang.isArray(o)){p=o[0]
}else{if(this.responseSchema.fields){var g=this.responseSchema.fields[0].key||this.responseSchema.fields[0];
p=o[g]
}else{if(this.key){p=o[this.key]
}}}}if(YAHOO.lang.isString(p)){var n=(l)?p.indexOf(decodeURIComponent(k)):p.toLowerCase().indexOf(decodeURIComponent(k).toLowerCase());
if((!d&&(n===0))||(d&&(n>-1))){h.unshift(o)
}}}e.results=h
}else{}return e
};
YAHOO.widget.AutoComplete.prototype.handleResponse=function(b,a,c){if((this instanceof YAHOO.widget.AutoComplete)&&this._sName){this._populateList(b,a,c)
}};
YAHOO.widget.AutoComplete.prototype.doBeforeLoadData=function(b,a,c){return true
};
YAHOO.widget.AutoComplete.prototype.formatResult=function(d,b,a){var c=(a)?a:"";
return c
};
YAHOO.widget.AutoComplete.prototype.doBeforeExpandContainer=function(b,a,c,d){return true
};
YAHOO.widget.AutoComplete.prototype.destroy=function(){var d=this.toString();
var a=this._elTextbox;
var b=this._elContainer;
this.textboxFocusEvent.unsubscribeAll();
this.textboxKeyEvent.unsubscribeAll();
this.dataRequestEvent.unsubscribeAll();
this.dataReturnEvent.unsubscribeAll();
this.dataErrorEvent.unsubscribeAll();
this.containerPopulateEvent.unsubscribeAll();
this.containerExpandEvent.unsubscribeAll();
this.typeAheadEvent.unsubscribeAll();
this.itemMouseOverEvent.unsubscribeAll();
this.itemMouseOutEvent.unsubscribeAll();
this.itemArrowToEvent.unsubscribeAll();
this.itemArrowFromEvent.unsubscribeAll();
this.itemSelectEvent.unsubscribeAll();
this.unmatchedItemSelectEvent.unsubscribeAll();
this.selectionEnforceEvent.unsubscribeAll();
this.containerCollapseEvent.unsubscribeAll();
this.textboxBlurEvent.unsubscribeAll();
this.textboxChangeEvent.unsubscribeAll();
YAHOO.util.Event.purgeElement(a,true);
YAHOO.util.Event.purgeElement(b,true);
b.innerHTML="";
for(var c in this){if(YAHOO.lang.hasOwnProperty(this,c)){this[c]=null
}}};
YAHOO.widget.AutoComplete.prototype.textboxFocusEvent=null;
YAHOO.widget.AutoComplete.prototype.textboxKeyEvent=null;
YAHOO.widget.AutoComplete.prototype.dataRequestEvent=null;
YAHOO.widget.AutoComplete.prototype.dataReturnEvent=null;
YAHOO.widget.AutoComplete.prototype.dataErrorEvent=null;
YAHOO.widget.AutoComplete.prototype.containerPopulateEvent=null;
YAHOO.widget.AutoComplete.prototype.containerExpandEvent=null;
YAHOO.widget.AutoComplete.prototype.typeAheadEvent=null;
YAHOO.widget.AutoComplete.prototype.itemMouseOverEvent=null;
YAHOO.widget.AutoComplete.prototype.itemMouseOutEvent=null;
YAHOO.widget.AutoComplete.prototype.itemArrowToEvent=null;
YAHOO.widget.AutoComplete.prototype.itemArrowFromEvent=null;
YAHOO.widget.AutoComplete.prototype.itemSelectEvent=null;
YAHOO.widget.AutoComplete.prototype.unmatchedItemSelectEvent=null;
YAHOO.widget.AutoComplete.prototype.selectionEnforceEvent=null;
YAHOO.widget.AutoComplete.prototype.containerCollapseEvent=null;
YAHOO.widget.AutoComplete.prototype.textboxBlurEvent=null;
YAHOO.widget.AutoComplete.prototype.textboxChangeEvent=null;
YAHOO.widget.AutoComplete._nIndex=0;
YAHOO.widget.AutoComplete.prototype._sName=null;
YAHOO.widget.AutoComplete.prototype._elTextbox=null;
YAHOO.widget.AutoComplete.prototype._elContainer=null;
YAHOO.widget.AutoComplete.prototype._elContent=null;
YAHOO.widget.AutoComplete.prototype._elHeader=null;
YAHOO.widget.AutoComplete.prototype._elBody=null;
YAHOO.widget.AutoComplete.prototype._elFooter=null;
YAHOO.widget.AutoComplete.prototype._elShadow=null;
YAHOO.widget.AutoComplete.prototype._elIFrame=null;
YAHOO.widget.AutoComplete.prototype._bFocused=null;
YAHOO.widget.AutoComplete.prototype._oAnim=null;
YAHOO.widget.AutoComplete.prototype._bContainerOpen=false;
YAHOO.widget.AutoComplete.prototype._bOverContainer=false;
YAHOO.widget.AutoComplete.prototype._elList=null;
YAHOO.widget.AutoComplete.prototype._nDisplayedItems=0;
YAHOO.widget.AutoComplete.prototype._sCurQuery=null;
YAHOO.widget.AutoComplete.prototype._sPastSelections="";
YAHOO.widget.AutoComplete.prototype._sInitInputValue=null;
YAHOO.widget.AutoComplete.prototype._elCurListItem=null;
YAHOO.widget.AutoComplete.prototype._bItemSelected=false;
YAHOO.widget.AutoComplete.prototype._nKeyCode=null;
YAHOO.widget.AutoComplete.prototype._nDelayID=-1;
YAHOO.widget.AutoComplete.prototype._nTypeAheadDelayID=-1;
YAHOO.widget.AutoComplete.prototype._iFrameSrc="javascript:false;";
YAHOO.widget.AutoComplete.prototype._queryInterval=null;
YAHOO.widget.AutoComplete.prototype._sLastTextboxValue=null;
YAHOO.widget.AutoComplete.prototype._initProps=function(){var f=this.minQueryLength;
if(!YAHOO.lang.isNumber(f)){this.minQueryLength=1
}var c=this.maxResultsDisplayed;
if(!YAHOO.lang.isNumber(c)||(c<1)){this.maxResultsDisplayed=10
}var b=this.queryDelay;
if(!YAHOO.lang.isNumber(b)||(b<0)){this.queryDelay=0.2
}var e=this.typeAheadDelay;
if(!YAHOO.lang.isNumber(e)||(e<0)){this.typeAheadDelay=0.2
}var a=this.delimChar;
if(YAHOO.lang.isString(a)&&(a.length>0)){this.delimChar=[a]
}else{if(!YAHOO.lang.isArray(a)){this.delimChar=null
}}var d=this.animSpeed;
if((this.animHoriz||this.animVert)&&YAHOO.util.Anim){if(!YAHOO.lang.isNumber(d)||(d<0)){this.animSpeed=0.3
}if(!this._oAnim){this._oAnim=new YAHOO.util.Anim(this._elContent,{},this.animSpeed)
}else{this._oAnim.duration=this.animSpeed
}}if(this.forceSelection&&a){}};
YAHOO.widget.AutoComplete.prototype._initContainerHelperEls=function(){if(this.useShadow&&!this._elShadow){var a=document.createElement("div");
a.className="yui-ac-shadow";
a.style.width=0;
a.style.height=0;
this._elShadow=this._elContainer.appendChild(a)
}if(this.useIFrame&&!this._elIFrame){var b=document.createElement("iframe");
b.src=this._iFrameSrc;
b.frameBorder=0;
b.scrolling="no";
b.style.position="absolute";
b.style.width=0;
b.style.height=0;
b.tabIndex=-1;
b.style.padding=0;
this._elIFrame=this._elContainer.appendChild(b)
}};
YAHOO.widget.AutoComplete.prototype._initContainerEl=function(){YAHOO.util.Dom.addClass(this._elContainer,"yui-ac-container");
if(!this._elContent){var c=document.createElement("div");
c.className="yui-ac-content";
c.style.display="none";
this._elContent=this._elContainer.appendChild(c);
var d=document.createElement("div");
d.className="yui-ac-hd";
d.style.display="none";
this._elHeader=this._elContent.appendChild(d);
var b=document.createElement("div");
b.className="yui-ac-bd";
this._elBody=this._elContent.appendChild(b);
var a=document.createElement("div");
a.className="yui-ac-ft";
a.style.display="none";
this._elFooter=this._elContent.appendChild(a)
}else{}};
YAHOO.widget.AutoComplete.prototype._initListEl=function(){var c=this.maxResultsDisplayed;
var a=this._elList||document.createElement("ul");
var d;
while(a.childNodes.length<c){d=document.createElement("li");
d.style.display="none";
d._nItemIndex=a.childNodes.length;
a.appendChild(d)
}if(!this._elList){var b=this._elBody;
YAHOO.util.Event.purgeElement(b,true);
b.innerHTML="";
this._elList=b.appendChild(a)
}};
YAHOO.widget.AutoComplete.prototype._enableIntervalDetection=function(){var a=this;
if(!a._queryInterval&&a.queryInterval){a._queryInterval=setInterval(function(){a._onInterval()
},a.queryInterval)
}};
YAHOO.widget.AutoComplete.prototype._onInterval=function(){var a=this._elTextbox.value;
var b=this._sLastTextboxValue;
if(a!=b){this._sLastTextboxValue=a;
this._sendQuery(a)
}};
YAHOO.widget.AutoComplete.prototype._clearInterval=function(){if(this._queryInterval){clearInterval(this._queryInterval);
this._queryInterval=null
}};
YAHOO.widget.AutoComplete.prototype._isIgnoreKey=function(a){if((a==9)||(a==13)||(a==16)||(a==17)||(a>=18&&a<=20)||(a==27)||(a>=33&&a<=35)||(a>=36&&a<=40)||(a>=44&&a<=45)||(a==229)){return true
}return false
};
YAHOO.widget.AutoComplete.prototype._sendQuery=function(g){if(this.minQueryLength<0){this._toggleContainer(false);
return
}var e=(this.delimChar)?this.delimChar:null;
if(e){var c=-1;
for(var h=e.length-1;
h>=0;
h--){var a=g.lastIndexOf(e[h]);
if(a>c){c=a
}}if(e[h]==" "){for(var i=e.length-1;
i>=0;
i--){if(g[c-1]==e[i]){c--;
break
}}}if(c>-1){var f=c+1;
while(g.charAt(f)==" "){f+=1
}this._sPastSelections=g.substring(0,f);
g=g.substr(f)
}else{this._sPastSelections=""
}}if((g&&(g.length<this.minQueryLength))||(!g&&this.minQueryLength>0)){if(this._nDelayID!=-1){clearTimeout(this._nDelayID)
}this._toggleContainer(false);
return
}g=encodeURIComponent(g);
this._nDelayID=-1;
if(this.dataSource.queryMatchSubset||this.queryMatchSubset){var d=this.getSubsetMatches(g);
if(d){this.handleResponse(g,d,{query:g});
return
}}if(this.responseStripAfter){this.dataSource.doBeforeParseData=this.preparseRawResponse
}if(this.applyLocalFilter){this.dataSource.doBeforeCallback=this.filterResults
}var b=this.generateRequest(g);
this.dataRequestEvent.fire(this,g,b);
this.dataSource.sendRequest(b,{success:this.handleResponse,failure:this.handleResponse,scope:this,argument:{query:g}})
};
YAHOO.widget.AutoComplete.prototype._populateList=function(i,n,q){if(this._nTypeAheadDelayID!=-1){clearTimeout(this._nTypeAheadDelayID)
}i=(q&&q.query)?q.query:i;
var l=this.doBeforeLoadData(i,n,q);
if(l&&!n.error){this.dataReturnEvent.fire(this,i,n.results);
if(this._bFocused||(this._bFocused===null)){var g=decodeURIComponent(i);
this._sCurQuery=g;
this._bItemSelected=false;
var b=n.results,s=Math.min(b.length,this.maxResultsDisplayed),j=(this.dataSource.responseSchema.fields)?(this.dataSource.responseSchema.fields[0].key||this.dataSource.responseSchema.fields[0]):0;
if(s>0){if(!this._elList||(this._elList.childNodes.length<s)){this._initListEl()
}this._initContainerHelperEls();
var k=this._elList.childNodes;
for(var c=s-1;
c>=0;
c--){var d=k[c],o=b[c];
if(this.resultTypeList){var r=[];
r[0]=(YAHOO.lang.isString(o))?o:o[j]||o[this.key];
var h=this.dataSource.responseSchema.fields;
if(YAHOO.lang.isArray(h)&&(h.length>1)){for(var f=1,a=h.length;
f<a;
f++){r[r.length]=o[h[f].key||h[f]]
}}else{if(YAHOO.lang.isArray(o)){r=o
}else{if(YAHOO.lang.isString(o)){r=[o]
}else{r[1]=o
}}}o=r
}d._sResultMatch=(YAHOO.lang.isString(o))?o:(YAHOO.lang.isArray(o))?o[0]:(o[j]||"");
d._oResultData=o;
d.innerHTML=this.formatResult(o,g,d._sResultMatch);
d.style.display=""
}if(s<k.length){var m;
for(var e=k.length-1;
e>=s;
e--){m=k[e];
m.style.display="none"
}}this._nDisplayedItems=s;
this.containerPopulateEvent.fire(this,i,b);
if(this.autoHighlight){var p=this._elList.firstChild;
this._toggleHighlight(p,"to");
this.itemArrowToEvent.fire(this,p);
this._typeAhead(p,i)
}else{this._toggleHighlight(this._elCurListItem,"from")
}l=this.doBeforeExpandContainer(this._elTextbox,this._elContainer,i,b);
this._toggleContainer(l)
}else{this._toggleContainer(false)
}return
}}else{this.dataErrorEvent.fire(this,i)
}};
YAHOO.widget.AutoComplete.prototype._clearSelection=function(){var b=this._elTextbox.value;
var c=(this.delimChar)?this.delimChar[0]:null;
var a=(c)?b.lastIndexOf(c,b.length-2):-1;
if(a>-1){this._elTextbox.value=b.substring(0,a)
}else{this._elTextbox.value=""
}this._sPastSelections=this._elTextbox.value;
this.selectionEnforceEvent.fire(this)
};
YAHOO.widget.AutoComplete.prototype._textMatchesOption=function(){var a=null;
for(var d=this._nDisplayedItems-1;
d>=0;
d--){var c=this._elList.childNodes[d];
var b=(""+c._sResultMatch).toLowerCase();
if(b==this._sCurQuery.toLowerCase()){a=c;
break
}}return(a)
};
YAHOO.widget.AutoComplete.prototype._typeAhead=function(d,b){if(!this.typeAhead||(this._nKeyCode==8)){return
}var a=this,c=this._elTextbox;
if(c.setSelectionRange||c.createTextRange){this._nTypeAheadDelayID=setTimeout(function(){var f=c.value.length;
a._updateValue(d);
var e=c.value.length;
a._selectText(c,f,e);
var g=c.value.substr(f,e);
a.typeAheadEvent.fire(a,b,g)
},(this.typeAheadDelay*1000))
}};
YAHOO.widget.AutoComplete.prototype._selectText=function(b,a,d){if(b.setSelectionRange){b.setSelectionRange(a,d)
}else{if(b.createTextRange){var c=b.createTextRange();
c.moveStart("character",a);
c.moveEnd("character",d-b.value.length);
c.select()
}else{b.select()
}}};
YAHOO.widget.AutoComplete.prototype._toggleContainerHelpers=function(c){var b=this._elContent.offsetWidth+"px";
var e=this._elContent.offsetHeight+"px";
if(this.useIFrame&&this._elIFrame){var d=this._elIFrame;
if(c){d.style.width=b;
d.style.height=e;
d.style.padding=""
}else{d.style.width=0;
d.style.height=0;
d.style.padding=0
}}if(this.useShadow&&this._elShadow){var a=this._elShadow;
if(c){a.style.width=b;
a.style.height=e
}else{a.style.width=0;
a.style.height=0
}}};
YAHOO.widget.AutoComplete.prototype._toggleContainer=function(f){var a=this._elContainer;
if(this.alwaysShowContainer&&this._bContainerOpen){return
}if(!f){this._toggleHighlight(this._elCurListItem,"from");
this._nDisplayedItems=0;
this._sCurQuery=null;
if(!this._bContainerOpen){this._elContent.style.display="none";
return
}}var d=this._oAnim;
if(d&&d.getEl()&&(this.animHoriz||this.animVert)){if(d.isAnimated()){d.stop(true)
}var h=this._elContent.cloneNode(true);
a.appendChild(h);
h.style.top="-9000px";
h.style.width="";
h.style.height="";
h.style.display="";
var i=h.offsetWidth;
var b=h.offsetHeight;
var c=(this.animHoriz)?0:i;
var j=(this.animVert)?0:b;
d.attributes=(f)?{width:{to:i},height:{to:b}}:{width:{to:c},height:{to:j}};
if(f&&!this._bContainerOpen){this._elContent.style.width=c+"px";
this._elContent.style.height=j+"px"
}else{this._elContent.style.width=i+"px";
this._elContent.style.height=b+"px"
}a.removeChild(h);
h=null;
var g=this;
var e=function(){d.onComplete.unsubscribeAll();
if(f){g._toggleContainerHelpers(true);
g._bContainerOpen=f;
g.containerExpandEvent.fire(g)
}else{g._elContent.style.display="none";
g._bContainerOpen=f;
g.containerCollapseEvent.fire(g)
}};
this._toggleContainerHelpers(false);
this._elContent.style.display="";
d.onComplete.subscribe(e);
d.animate()
}else{if(f){this._elContent.style.display="";
this._toggleContainerHelpers(true);
this._bContainerOpen=f;
this.containerExpandEvent.fire(this)
}else{this._toggleContainerHelpers(false);
this._elContent.style.display="none";
this._bContainerOpen=f;
this.containerCollapseEvent.fire(this)
}}};
YAHOO.widget.AutoComplete.prototype._toggleHighlight=function(a,b){if(a){var c=this.highlightClassName;
if(this._elCurListItem){YAHOO.util.Dom.removeClass(this._elCurListItem,c);
this._elCurListItem=null
}if((b=="to")&&c){YAHOO.util.Dom.addClass(a,c);
this._elCurListItem=a
}}};
YAHOO.widget.AutoComplete.prototype._togglePrehighlight=function(c,b){if(c==this._elCurListItem){return
}var a=this.prehighlightClassName;
if((b=="mouseover")&&a){YAHOO.util.Dom.addClass(c,a)
}else{YAHOO.util.Dom.removeClass(c,a)
}};
YAHOO.widget.AutoComplete.prototype._updateValue=function(e){if(!this.suppressInputUpdate){var b=this._elTextbox;
var c=(this.delimChar)?(this.delimChar[0]||this.delimChar):null;
var f=e._sResultMatch;
var d="";
if(c){d=this._sPastSelections;
d+=f+c;
if(c!=" "){d+=" "
}}else{d=f
}b.value=d;
if(b.type=="textarea"){b.scrollTop=b.scrollHeight
}var a=b.value.length;
this._selectText(b,a,a);
this._elCurListItem=e
}};
YAHOO.widget.AutoComplete.prototype._selectItem=function(a){this._bItemSelected=true;
this._updateValue(a);
this._sPastSelections=this._elTextbox.value;
this._clearInterval();
this.itemSelectEvent.fire(this,a,a._oResultData);
this._toggleContainer(false)
};
YAHOO.widget.AutoComplete.prototype._jumpSelection=function(){if(this._elCurListItem){this._selectItem(this._elCurListItem)
}else{this._toggleContainer(false)
}};
YAHOO.widget.AutoComplete.prototype._moveSelection=function(b){if(this._bContainerOpen){var c=this._elCurListItem;
var d=-1;
if(c){d=c._nItemIndex
}var f=(b==40)?(d+1):(d-1);
if(f<-2||f>=this._nDisplayedItems){return
}if(c){this._toggleHighlight(c,"from");
this.itemArrowFromEvent.fire(this,c)
}if(f==-1){if(this.delimChar){this._elTextbox.value=this._sPastSelections+this._sCurQuery
}else{this._elTextbox.value=this._sCurQuery
}return
}if(f==-2){this._toggleContainer(false);
return
}var e=this._elList.childNodes[f];
var a=this._elContent;
var g=((YAHOO.util.Dom.getStyle(a,"overflow")=="auto")||(YAHOO.util.Dom.getStyle(a,"overflowY")=="auto"));
if(g&&(f>-1)&&(f<this._nDisplayedItems)){if(b==40){if((e.offsetTop+e.offsetHeight)>(a.scrollTop+a.offsetHeight)){a.scrollTop=(e.offsetTop+e.offsetHeight)-a.offsetHeight
}else{if((e.offsetTop+e.offsetHeight)<a.scrollTop){a.scrollTop=e.offsetTop
}}}else{if(e.offsetTop<a.scrollTop){this._elContent.scrollTop=e.offsetTop
}else{if(e.offsetTop>(a.scrollTop+a.offsetHeight)){this._elContent.scrollTop=(e.offsetTop+e.offsetHeight)-a.offsetHeight
}}}}this._toggleHighlight(e,"to");
this.itemArrowToEvent.fire(this,e);
if(this.typeAhead){this._updateValue(e)
}}};
YAHOO.widget.AutoComplete.prototype._onContainerMouseover=function(a,c){var b=YAHOO.util.Event.getTarget(a);
var d=b.nodeName.toLowerCase();
while(b&&(d!="table")){switch(d){case"body":return;
case"li":if(c.prehighlightClassName){c._togglePrehighlight(b,"mouseover")
}else{c._toggleHighlight(b,"to")
}c.itemMouseOverEvent.fire(c,b);
break;
case"div":if(YAHOO.util.Dom.hasClass(b,"yui-ac-container")){c._bOverContainer=true;
return
}break;
default:break
}b=b.parentNode;
if(b){d=b.nodeName.toLowerCase()
}}};
YAHOO.widget.AutoComplete.prototype._onContainerMouseout=function(a,c){var b=YAHOO.util.Event.getTarget(a);
var d=b.nodeName.toLowerCase();
while(b&&(d!="table")){switch(d){case"body":return;
case"li":if(c.prehighlightClassName){c._togglePrehighlight(b,"mouseout")
}else{c._toggleHighlight(b,"from")
}c.itemMouseOutEvent.fire(c,b);
break;
case"ul":c._toggleHighlight(c._elCurListItem,"to");
break;
case"div":if(YAHOO.util.Dom.hasClass(b,"yui-ac-container")){c._bOverContainer=false;
return
}break;
default:break
}b=b.parentNode;
if(b){d=b.nodeName.toLowerCase()
}}};
YAHOO.widget.AutoComplete.prototype._onContainerClick=function(a,c){var b=YAHOO.util.Event.getTarget(a);
var d=b.nodeName.toLowerCase();
while(b&&(d!="table")){switch(d){case"body":return;
case"li":c._toggleHighlight(b,"to");
c._selectItem(b);
return;
default:break
}b=b.parentNode;
if(b){d=b.nodeName.toLowerCase()
}}};
YAHOO.widget.AutoComplete.prototype._onContainerScroll=function(a,b){b._elTextbox.focus()
};
YAHOO.widget.AutoComplete.prototype._onContainerResize=function(a,b){b._toggleContainerHelpers(b._bContainerOpen)
};
YAHOO.widget.AutoComplete.prototype._onTextboxKeyDown=function(a,c){var b=a.keyCode;
if(c._nTypeAheadDelayID!=-1){clearTimeout(c._nTypeAheadDelayID)
}switch(b){case 9:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(c._elCurListItem){if(c.delimChar&&(c._nKeyCode!=b)){if(c._bContainerOpen){YAHOO.util.Event.stopEvent(a)
}}c._selectItem(c._elCurListItem)
}else{c._toggleContainer(false)
}}break;
case 13:if(!YAHOO.env.ua.opera&&(navigator.userAgent.toLowerCase().indexOf("mac")==-1)||(YAHOO.env.ua.webkit>420)){if(c._elCurListItem){if(c._nKeyCode!=b){if(c._bContainerOpen){YAHOO.util.Event.stopEvent(a)
}}c._selectItem(c._elCurListItem)
}else{c._toggleContainer(false)
}}break;
case 27:c._toggleContainer(false);
return;
case 39:c._jumpSelection();
break;
case 38:if(c._bContainerOpen){YAHOO.util.Event.stopEvent(a);
c._moveSelection(b)
}break;
case 40:if(c._bContainerOpen){YAHOO.util.Event.stopEvent(a);
c._moveSelection(b)
}break;
default:c._bItemSelected=false;
c._toggleHighlight(c._elCurListItem,"from");
c.textboxKeyEvent.fire(c,b);
break
}if(b===18){c._enableIntervalDetection()
}c._nKeyCode=b
};
YAHOO.widget.AutoComplete.prototype._onTextboxKeyPress=function(a,c){var b=a.keyCode;
if(YAHOO.env.ua.opera||(navigator.userAgent.toLowerCase().indexOf("mac")!=-1)&&(YAHOO.env.ua.webkit<420)){switch(b){case 9:if(c._bContainerOpen){if(c.delimChar){YAHOO.util.Event.stopEvent(a)
}if(c._elCurListItem){c._selectItem(c._elCurListItem)
}else{c._toggleContainer(false)
}}break;
case 13:if(c._bContainerOpen){YAHOO.util.Event.stopEvent(a);
if(c._elCurListItem){c._selectItem(c._elCurListItem)
}else{c._toggleContainer(false)
}}break;
default:break
}}else{if(b==229){c._enableIntervalDetection()
}}};
YAHOO.widget.AutoComplete.prototype._onTextboxKeyUp=function(a,c){var d=this.value;
c._initProps();
var b=a.keyCode;
if(c._isIgnoreKey(b)){return
}if(c._nDelayID!=-1){clearTimeout(c._nDelayID)
}c._nDelayID=setTimeout(function(){c._sendQuery(d)
},(c.queryDelay*1000))
};
YAHOO.widget.AutoComplete.prototype._onTextboxFocus=function(a,b){if(!b._bFocused){b._elTextbox.setAttribute("autocomplete","off");
b._bFocused=true;
b._sInitInputValue=b._elTextbox.value;
b.textboxFocusEvent.fire(b)
}};
YAHOO.widget.AutoComplete.prototype._onTextboxBlur=function(a,b){if(!b._bOverContainer||(b._nKeyCode==9)){if(!b._bItemSelected){var c=b._textMatchesOption();
if(!b._bContainerOpen||(b._bContainerOpen&&(c===null))){if(b.forceSelection){b._clearSelection()
}else{b.unmatchedItemSelectEvent.fire(b,b._sCurQuery)
}}else{if(b.forceSelection){b._selectItem(c)
}}}if(b._bContainerOpen){b._toggleContainer(false)
}b._clearInterval();
b._bFocused=false;
if(b._sInitInputValue!==b._elTextbox.value){b.textboxChangeEvent.fire(b)
}b.textboxBlurEvent.fire(b)
}};
YAHOO.widget.AutoComplete.prototype._onWindowUnload=function(a,b){if(b&&b._elTextbox&&b.allowBrowserAutocomplete){b._elTextbox.setAttribute("autocomplete","on")
}};
YAHOO.widget.AutoComplete.prototype.doBeforeSendQuery=function(a){return this.generateRequest(a)
};
YAHOO.widget.AutoComplete.prototype.getListItems=function(){var b=[],c=this._elList.childNodes;
for(var a=c.length-1;
a>=0;
a--){b[a]=c[a]
}return b
};
YAHOO.widget.AutoComplete._cloneObject=function(d){if(!YAHOO.lang.isValue(d)){return d
}var b={};
if(YAHOO.lang.isFunction(d)){b=d
}else{if(YAHOO.lang.isArray(d)){var c=[];
for(var e=0,f=d.length;
e<f;
e++){c[e]=YAHOO.widget.AutoComplete._cloneObject(d[e])
}b=c
}else{if(YAHOO.lang.isObject(d)){for(var a in d){if(YAHOO.lang.hasOwnProperty(d,a)){if(YAHOO.lang.isValue(d[a])&&YAHOO.lang.isObject(d[a])||YAHOO.lang.isArray(d[a])){b[a]=YAHOO.widget.AutoComplete._cloneObject(d[a])
}else{b[a]=d[a]
}}}}else{b=d
}}}return b
};
YAHOO.register("autocomplete",YAHOO.widget.AutoComplete,{version:"2.6.0",build:"1321"});
