/*ADOBE SYSTEMS INCORPORATED
Copyright 2007 Adobe Systems Incorporated
All Rights Reserved.

NOTICE:  Adobe permits you to use, modify, and distribute this file in accordance with the
terms of the Adobe license agreement accompanying it.  If you have received this file from a
source other than Adobe, then your use, modification, or distribution of it requires the prior
written permission of Adobe.*/
if(!ColdFusion.Autosuggest){
ColdFusion.Autosuggest={};
}
var staticgifpath=_cf_ajaxscriptsrc+"/resources/cf/images/static.gif";
var dynamicgifpath=_cf_ajaxscriptsrc+"/resources/cf/images/loading.gif";
ColdFusion.Autosuggest.loadAutoSuggest=function(_b5,_b6){
var _b7=ColdFusion.objectCache[_b6.autosuggestid];
if(typeof (_b5)=="string"){
_b5=_b5.split(",");
}else{
var _b8=false;
if(_b5&&ColdFusion.Util.isArray(_b5)){
_b8=true;
if(_b5.length>0&&typeof (_b5[0])!="string"){
_b8=false;
}
}
if(!_b8){
ColdFusion.handleError(_b7.onbinderror,"autosuggest.loadautosuggest.invalidvalue","widget",[_b6.autosuggestid]);
return;
}
}
var _b9=document.getElementById(_b6.autosuggestid).value;
if(_b9.length==1&&_b5.length==0){
var _ba=new Array();
_b7.dataSource.flushCache();
_b7.dataSource=new YAHOO.widget.DS_JSArray(_ba);
_b7.autosuggestitems=_ba;
}
if(_b5.length>0){
var i=0;
var _bc=false;
var _ba=new Array();
for(i=0;i<_b5.length;i++){
if(_b5[i]){
if(typeof (_b5[i])=="string"){
_ba[i]=_b5[i];
}else{
_ba[i]=new String(_b5[i]);
}
if(_ba[i].indexOf(_b9)==0){
_bc=true;
}
}
}
if(_bc==false&&_b7.showloadingicon==true){
document.getElementById(_b6.autosuggestid+"_cf_button").src=staticgifpath;
}
_b7.dataSource.flushCache();
_b7.dataSource=new YAHOO.widget.DS_JSArray(_ba);
_b7.autosuggestitems=_ba;
}else{
if(_b7.showloadingicon==true){
document.getElementById(_b6.autosuggestid+"_cf_button").src=staticgifpath;
}
}
};
ColdFusion.Autosuggest.checkToMakeBindCall=function(arg,_be,_bf,_c0){
var _c0=document.getElementById(_be).value;
if(!_bf.isContainerOpen()&&_c0.length>0&&(arg.keyCode>31||(arg.keyCode==8&&_bf.valuePresent==true))){
_bf.valuePresent=false;
if(_bf.showloadingicon==true){
document.getElementById(_be+"_cf_button").src=dynamicgifpath;
}
ColdFusion.Log.info("autosuggest.checktomakebindcall.fetching","widget",[_be,_c0]);
return true;
}
return false;
};
ColdFusion.Autosuggest.checkValueNotInAutosuggest=function(_c1,_c2){
if(_c1.autosuggestitems){
for(var i=0;i<_c1.autosuggestitems.length;i++){
if(_c2==_c1.autosuggestitems[i]){
return false;
}
}
}
return true;
};
ColdFusion.Autosuggest.triggerOnChange=function(_c4,_c5){
var _c6=_c5[0];
var _c7=document.getElementById(_c6.id);
ColdFusion.Event.callBindHandlers(_c6.id,null,"change");
};

