function ACComponent(i,b,c,g,e,h,f,d,a){this.termStartPos=-1;this.termPrefix="";this.queryType="";this.fixedQueryType="";this.rangeObj=null;this.selectedRowIndex=-1;this.mouseIn=false;this.inputControl=dojo.byId(i);this.popupControl=dojo.byId(b);this.beginChar=c;this.enablemove=g;this.termEndPos=-1;dojo.connect(this.inputControl,"onkeyup",this,"onInputControlKeyUp");dojo.connect(this.inputControl,"onblur",this,"onInputControlBlur");if(h!=null){this.renderFunction=h}else{this.renderFunction=this.doRender}if(f!=null){this.enterRowFunction=f}else{this.enterRowFunction=this.doEnterRow}if(d!=null){this.selectRowFunction=d}else{this.selectRowFunction=this.doSelectRow}if(a!=null){this.showPopupFunction=a}else{this.showPopupFunction=this.showPopup}if(e!=null){this.doSearch=e}}ACComponent.prototype.onInputControlBlur=function(a){a=a?a:(window.event?window.event:null);if(!mouseInDiv){this.hidePopup()}};ACComponent.prototype.onInputControlKeyUp=function(m){m=m?m:(window.event?window.event:null);var k=this.inputControl.value;var c=32;var a=13;var n=27;var b=40;var d=38;var e=39;var q=37;switch(m.keyCode){case q:break;case a:var o=(this.popupControl.style.visibility=="visible");this.hidePopup();if(o&&this.selectedRowIndex!=-1){var s=this.popupControl.getElementsByTagName("table")[0];if(this.selectedRowIndex!=-1&&s!=null){this.selectRowFunction(s.rows[this.selectedRowIndex])}}else{this.doSearch()}break;case n:this.hidePopup();break;case b:var s=this.popupControl.getElementsByTagName("table")[0];if(s==0||s.rows.length==0){return}if(this.selectedRowIndex==s.rows.length-1){this.enterRowFunction(s.rows[0],this.selectedRowIndex);this.selectedRowIndex=0}else{this.enterRowFunction(s.rows[this.selectedRowIndex+1],this.selectedRowIndex);this.selectedRowIndex++}break;case d:var s=this.popupControl.getElementsByTagName("table")[0];if(s==0||s.rows.length==0){return}if(this.selectedRowIndex<=0){this.enterRowFunction(s.rows[s.rows.length-1],this.selectedRowIndex);this.selectedRowIndex=s.rows.length-1}else{this.enterRowFunction(s.rows[this.selectedRowIndex-1],this.selectedRowIndex);this.selectedRowIndex--}break;case e:if(this.termStartPos!=-1&&this.selectedRowIndex>=0&&this.popupControl.style.visibility=="visible"){var g=dojox.data.dom.textContent(this.popupControl.getElementsByTagName("table")[0].rows[this.selectedRowIndex].getElementsByTagName("span")[0]);k=this.inputControl.value.substring(0,this.termStartPos)+g;this.inputControl.value=k}else{break}default:if(m.keyCode==16||m.keyCode==17||m.keyCode==20){break}if(navigator.appName=="Microsoft Internet Explorer"){if(this.beginChar==""||this.beginChar==null){this.termStartPos=0;this.termEndPos=k.length;this.renderFunction(this.queryType,k,this);return}var f=0;var l=document.selection.createRange();var t=this.inputControl.createTextRange();for(f=0;t.compareEndPoints("StartToStart",l)<0;f++){t.moveStart("character",1)}this.termEndPos=f;var h=-1;for(var r=f-1;r>=0;r--){if(k.charAt(r)==this.beginChar){h=r+1;for(var p=r;p>=0;p--){if(k.charAt(p)==" "||p==0){this.queryType=k.substring(p==0?0:p+1,r).toLowerCase();break}}break}}if(h!=-1&&checkQueryType(this.queryType)){this.termStartPos=h;if(this.enablemove&&document.selection&&document.selection.createRange){this.rangeobj=l}}if(this.termStartPos!=-1){if(k.length<=this.termStartPos){this.hidePopup()}else{this.termPrefix=k.substring(this.termStartPos,f);if(this.termPrefix.charAt(0)=='"'){this.termPrefix=this.termPrefix.substring(1,this.termPrefix.length)}this.renderFunction(this.queryType,this.termPrefix,this)}}}else{if(this.beginChar==""||this.beginChar==null){this.termStartPos=0;this.termEndPos=k.length;this.renderFunction(this.queryType,k,this);return}var f=0;var u=this.inputControl.value;f=u.length;var h=-1;for(var r=u.length-1;r>=0;r--){if(k.charAt(r)==this.beginChar){h=r+1;for(var p=r;p>=0;p--){if(k.charAt(p)==" "||p==0){this.queryType=k.substring(p==0?0:p+1,r).toLowerCase();break}}break}}if(h!=-1&&checkQueryType(this.queryType)){this.termStartPos=h}if(this.termStartPos!=-1){if(k.length<=this.termStartPos){this.hidePopup()}else{this.termPrefix=k.substring(this.termStartPos,f);if(this.termPrefix.charAt(0)=='"'){this.termPrefix=this.termPrefix.substring(1,this.termPrefix.length)}this.renderFunction(this.queryType,this.termPrefix,this)}}}break}};ACComponent.prototype.hidePopup=function(){this.popupControl.style.visibility="hidden";if(dojo.byId("search-master-searchtype-select")!=null&&basic_search==false){dojo.byId("search-master-searchtype-select").style.display=""}};ACComponent.prototype.doEnterRow=function(a,b){if(b!=-1){var c=this.popupControl.getElementsByTagName("table")[0].rows[b];c.className=c.getAttribute("initialClassName");if(this.queryType!="ccl"&&this.queryType!="cas"){c.cells[1].className="count"}}a.className="searchhelp-mouseover";if(this.queryType!="ccl"&&this.queryType!="cas"){a.cells[1].className="countmouseover"}};ACComponent.prototype.doSelectRow=function(b){b=b.getElementsByTagName("span")[0];var c=dojox.data.dom.textContent(b);if(this.queryType=="ccl"){var d=c.indexOf(" ");if(d!=-1){c=c.substring(0,d)}}if(c.indexOf(" ")!=-1){c='"'+c+'"'}var a=this.termEndPos;if(this.inputControl.value.charAt(a)=='"'){a++}if(a!=-1){this.inputControl.value=this.inputControl.value.substring(0,this.termStartPos)+c+this.inputControl.value.substring(a)}else{this.inputControl.value=this.inputControl.value.substring(0,this.termStartPos)+c}this.inputControl.focus();this.hidePopup()};ACComponent.prototype.showPopup=function(){var e=(this.enablemove&&this.rangeobj!=null?this.rangeobj.offsetLeft:0)+calculateOffset(this.inputControl,"offsetLeft");var d=(this.enablemove&&this.rangeobj!=null?this.rangeobj.offsetTop:0)+calculateOffset(this.inputControl,"offsetTop")+22;if(d+this.popupControl.offsetHeight>document.documentElement.offsetHeight){d=d-this.popupControl.offsetHeight-22}this.popupControl.style.left=e+"px";this.popupControl.style.top=d+"px";var a=dojo.byId("search-master-searchtype-select");if(a!=null){var c=calculateOffset(a,"offsetLeft");var b=c+75;if(b>=e&&c<=(e+300)){a.style.display="none"}}this.popupControl.style.visibility="visible"};ACComponent.prototype.doRender=function(e,h,c){var d=getSearchTypeValue();var a="";dojo.byId("popupdiv-searchhelp").style.width="250px";if(this.fixedQueryType!=""){e=this.fixedQueryType}switch(e){case"an":case"ann":a=c_sCheckANxml;break;case"abst":case"kw":case"c":case"b":case"calm":case"ttl":case"r":a=c_sCheckKWxml;break;case"ccl":a=c_sCheckCCLxml;break;case"cas":a=c_sCheckCas;break;default:a=c_sCheckKWxml;break}var g=document.createElement("form");var b=document.createElement("textarea");b.name="sp";b.value=h;g.appendChild(b);var f={url:a+"&idi="+d,handleAs:"text",form:g,load:function(j,i){c.popupControl.innerHTML=XSLTtrans(j,"searchhelp.xsl");c.popupControl.comObject=c;c.selectedRowIndex=-1;if(c.popupControl.getElementsByTagName("table")[0].rows.length>0){c.showPopupFunction()}else{c.hidePopup()}},error:function(j,i){this.popupControl.innerHTML=j.message}};dojo.xhrPost(f)};function checkQueryStringType(a){switch(a){case"an":case"ann":case"abst":case"kw":case"c":case"b":case"calm":case"ttl":case"r":case"ccl":return true;default:return false}}function checkQueryType(a){switch(a){case"an":case"ann":case"abst":case"kw":case"c":case"b":case"calm":case"ttl":case"r":case"ccl":case"cas":return true;default:return false}};