function AutoComplete_Top_Callback(a,b){a.items=b;a.AutoComplete_callback(a.items)}function AutoType(e,d,b,c,a){this.autoCompleteSelectedIndex=0;this.autoCompleteVisible=false;this.autoCompleteCount=0;this.autoCompleteControl=null;this.originalInnerHtml="";this.setOriginalHtml=false;this.items=null;this.hiddenControlId=d;this.divDropDownClientId=b;this.autoCompleteFunction=a;this.requiredClientId=c;this.controlName=e}AutoType.prototype.ValidateAutoType=function(){var c=document.getElementById(this.hiddenControlId),b=true,a=document.getElementById(this.requiredClientId);if(a){b=c.value!="";if(!b)a.style.display="inline";else a.style.display="none"}return b};AutoType.prototype.inputBox_keypress=function(b,a){a=a?a:window.event;if(a.keyCode==13)return stopEvent(a)};AutoType.prototype.inputBox_keydown=function(b,a){a=a?a:window.event;if(this.autoCompleteVisible)switch(a.keyCode){case 40:if(this.autoCompleteSelectedIndex<this.autoCompleteCount-1)this.setAutoCompleteIndex(this.autoCompleteSelectedIndex+1);else this.setAutoCompleteIndex(0);break;case 38:if(this.autoCompleteSelectedIndex>0)this.setAutoCompleteIndex(this.autoCompleteSelectedIndex-1);else this.setAutoCompleteIndex(this.autoCompleteCount-1);break;case 13:if(this.autoCompleteSelectedIndex>-1){this.fillInputBox(this.autoCompleteSelectedIndex,this.items[this.autoCompleteSelectedIndex][1],this.items[this.autoCompleteSelectedIndex][0],this.items[this.autoCompleteSelectedIndex][2]);return stopEvent(a)}break;case 9:this.autoCompleteSelectedIndex>-1&&this.fillInputBox(this.autoCompleteSelectedIndex,this.items[this.autoCompleteSelectedIndex][1],this.items[this.autoCompleteSelectedIndex][0],this.items[this.autoCompleteSelectedIndex][2]);break;case 27:this.hideAutoComplete(false);return stopEvent(a)}};AutoType.prototype.inputBox_keyup=function(b,a,c,e,d){a=a?a:window.event;stopEvent(a);if(a.keyCode==38||a.keyCode==40||a.keyCode==13||a.keyCode==9||a.keyCode==27)return false;if(b.value.length>d){this.autoCompleteControl=b;if(c){var g=c.replace(e,b.value);webServiceRequest(g,"AutoTypeScriptSocket","&hiddenControlID="+this.hiddenControlId);window.status="Searching..."}else{var f=this.findItemInArray(b.value);this.AutoComplete_callback(f)}}};AutoType.prototype.AutoComplete_callback=function(a){this.showAutoComplete();this.drawFoundItems(a)};AutoType.prototype.inputBox_blur=function(b){setTimeout("obj"+this.controlName+".hideAutoComplete(true)",100);var a=document.getElementById(this.hiddenControlId),c=trim(b.value);if(c=="")a.value=""};AutoType.prototype.findItemInArray=function(d){var c=0,b=[];if(this.items!=null)for(var a=0;a<this.items.length;a++){var e=this.items[a][1];if(e.substring(0,d.length).toLowerCase()==d.toLowerCase()){b[c]=this.items[a];c++}}return b};AutoType.prototype.drawFoundItems=function(c){this.autoCompleteCount=c.length;this.autoCompleteSelectedIndex=-1;for(var d=document.getElementById(this.divDropDownClientId),f='<a href="javascript:void(null)" onmousedown="obj'+this.controlName+".fillInputBox(INDEX, 'VALUE', 'IDVAL', 'URL')\" onmouseover=\"obj"+this.controlName+".setAutoCompleteIndex(INDEX)\" class='noline'><div id='autoLink_"+this.divDropDownClientId+"_INDEX' style='width:298px;border-bottom:1px solid #cccccc;border-top:1px solid #cccccc;padding-top:5px;padding-bottom:5px;'>OUT</div></a>",e="",b=0;b<c.length;b++){var a=f.replace(/INDEX/g,b),g=this.escapeCharacters(c[b][1]),h=c[b][0],i=c[b][2];a=a.replace(/VALUE/g,g);a=a.replace(/OUT/g,c[b][1].replace("\\'","'"));a=a.replace(/HIDDEN/g,this.hiddenControlID);a=a.replace(/IDVAL/g,h);a=a.replace(/URL/g,i);e+=a}if(!this.setOriginalHtml){this.originalInnerHtml=d.innerHTML;this.setOriginalHtml=true}d.innerHTML=this.originalInnerHtml+e;if(this.autoCompleteCount==0){setTimeout("obj"+this.controlName+".hideAutoComplete(false)",100);return}};AutoType.prototype.escapeCharacters=function(a){var b=new RegExp('"',"gi");a=a.replace(b,"|");b=new RegExp("'","gi");a=a.replace(b,"\\'");return a};AutoType.prototype.unescapeCharacters=function(a){var b=new RegExp("\\'","gi");a=a.replace(b,"'");b=new RegExp("[|]","gi");a=a.replace(b,'"');return a};AutoType.prototype.setAutoCompleteBox=function(c){var a=document.getElementById(this.divDropDownClientId);c.parentNode.appendChild(a);a.style.position="absolute";a.style.display="inline";var b=Sys.UI.DomElement.getBounds(c);Sys.UI.DomElement.setLocation(a,b.x,b.y+b.height)};AutoType.prototype.showAutoComplete=function(){var a=document.getElementById(this.divDropDownClientId);a.style.visibility="visible";this.autoCompleteVisible=true;this.SetHiddenControlValue("")};AutoType.prototype.setAutoCompleteIndex=function(a){this.paintAutoCompleteCell(this.autoCompleteSelectedIndex,"");this.paintAutoCompleteCell(a,"#dddddd");this.autoCompleteSelectedIndex=a};AutoType.prototype.paintAutoCompleteCell=function(c,b){var a=document.getElementById("autoLink_"+this.divDropDownClientId+"_"+c);if(a)a.style.backgroundColor=b};AutoType.prototype.hideAutoComplete=function(b){var a=document.getElementById(this.divDropDownClientId);a.style.visibility="hidden";this.autoCompleteVisible=false;!b&&this.SetHiddenControlValue("")};AutoType.prototype.SetHiddenControlValue=function(b){var a=document.getElementById(this.hiddenControlId);a.value=b};AutoType.prototype.fillInputBox=function(d,a,b,c){a=this.unescapeCharacters(a);this.autoCompleteControl.value=a;this.SetHiddenControlValue(b);this.hideAutoComplete(true);this.autoCompleteFunction!=null&&typeof this.autoCompleteFunction=="function"&&this.autoCompleteFunction(b,c)};function CreateNewAutoTypeObject(index,objectName){var variableDesc="top.obj"+objectName+"_"+index;variableDesc+=" = new AutoType('"+objectName+"_"+index+"', 'ctl00_contentBody_"+objectName+"_"+index+"_hiddenValueBox', 'divAutoCompleteList_"+objectName+"_"+index+"', null, '');";eval(variableDesc)}