var pa=false;var _oldInputFieldValue="";var da=false;var _currentInputFieldValue="";var _inputChanged=(new Date()).getTime();var G="";var _eventKeycode="";var _highlightedSuggestionIndex=-1;var _highlightedSuggestionDiv=null;var _completeDivRows=-1;var _completeDivDivList=null;var _completeDivRows2=5;var q="";var _divTag="div";var _spanTag="span";var _documentForm=null;var _inputField=null;var _completeDiv=null;var _submitButton=null;var mb=null;var X=null;var _enString=null;var _cursorUpDownPressed=false;var kc=null;var hc=null;var _resultCache=new Object();var ca=1;var Aa=1;var Y=false;var _lastKeyCode=-1;var Va=(new Date()).getTime();var _hasXMLHTTP=false;var _xmlHttp=null;var _completeSearchString=null;var B=null;var aa=null;var Ba=false;var Ka=false;var p=60;var _timeoutAdjustment=0;var spinner=new Image();spinner.src="/dyn/6914/images/searchBar/spinner3.gif";cfgAutoComplete=function(c,b,h,a,e,d,g,f){_documentForm=c;_inputField=b;_submitButton=h;X=true;Y=false;Ba=false;cfgAutoComplete2()};function blurThenGetFocus(){_cursorUpDownPressed=true;_inputField.blur();setTimeout("setInputFieldFocus();",10);return}function fireKeydown(){if(document.createEventObject){var a=document.createEventObject();a.ctrlKey=true;a.keyCode=70;document.fireEvent("onkeydown",a)}}function gc(a){}function ic(a){}function keyDownHandler(a){if(!a&&window.event){a=window.event}if(a){_lastKeyCode=a.keyCode}if(a&&a.keyCode==8){if(X&&(_inputField.createTextRange&&(bb(_inputField)==0&&lb(_inputField)==0))){cc(_inputField);a.cancelBubble=true;a.returnValue=false;return false}}}function mc(){}function resizeHandler(){setCompleteDivSize()}function setCompleteDivSize(){if(_completeDiv){_completeDiv.style.left=calculateOffsetLeft(_inputField)+"px";_completeDiv.style.top=calculateOffsetTop(_inputField)+_inputField.offsetHeight-1+"px";_completeDiv.style.width=calculateWidth()+searchAsyncPaddingRight+"px"}}function calculateWidth(){if(navigator&&navigator.userAgent.toLowerCase().indexOf("msie")==-1){return _inputField.offsetWidth-ca*2}else{return _inputField.offsetWidth}}function cfgAutoComplete2(){if(getXMLHTTP()){_hasXMLHTTP=true}else{_hasXMLHTTP=false}_completeSearchString=searchAsyncUrl+"?searchType="+searchAsyncType;if(searchAsyncOtherParams){_completeSearchString+=searchAsyncOtherParams}if(!_hasXMLHTTP){setCookie("search","",0,_completeSearchString,null,null)}_documentForm.onsubmit=Fa;_inputField.autocomplete="off";_inputField.onblur=onBlurHandler;_inputField.onkeydown=keyDownHandler;if(_inputField.createTextRange){_inputField.onkeyup=new Function("return okuh(event);")}else{_inputField.onkeyup=okuh}_inputField.onsubmit=Fa;_currentInputFieldValue=_inputField.value;_inputChanged=(new Date()).getTime();_oldInputFieldValue=_currentInputFieldValue;_completeDiv=document.createElement("DIV");_completeDiv.id="completeDiv";ca=1;Aa=1;_completeDiv.style.borderRight="black "+ca+"px solid";_completeDiv.style.borderLeft="black "+ca+"px solid";_completeDiv.style.borderTop="black "+Aa+"px solid";_completeDiv.style.borderBottom="black "+Aa+"px solid";_completeDiv.style.zIndex="2";_completeDiv.style.paddingRight="0";_completeDiv.style.paddingLeft="0";_completeDiv.style.paddingTop="0";_completeDiv.style.paddingBottom="0";setCompleteDivSize();_completeDiv.style.visibility="hidden";_completeDiv.style.position="absolute";_completeDiv.style.backgroundColor="white";document.body.appendChild(_completeDiv);cacheResults("",new Array(),new Array());Gb(_completeDiv);var a=document.createElement("DIV");a.style.visibility="hidden";a.style.position="absolute";a.style.left="-10000";a.style.top="-10000";a.style.width="0";a.style.height="0";var b=document.createElement("IFRAME");b.completeDiv=_completeDiv;b.name="completionFrame";b.id="completionFrame";if(_hasXMLHTTP){b.src="/dyn/6914/images/dot.gif"}else{b.src=_completeSearchString}a.appendChild(b);document.body.appendChild(a);if(frames&&(frames.completionFrame&&frames.completionFrame.frameElement)){B=frames.completionFrame.frameElement}else{B=document.getElementById("completionFrame")}window.onresize=resizeHandler;fireKeydown()}function onBlurHandler(a){if(!a&&window.event){a=window.event}if(!_cursorUpDownPressed){hideCompleteDiv();if(_lastKeyCode==9){setSubmitButtonFocus();_lastKeyCode=-1}}_cursorUpDownPressed=false}okuh=function(a){_eventKeycode=a.keyCode;aa=_inputField.value;Oa()};function setSubmitButtonFocus(){_submitButton.focus()}setInputFieldFocus=function(){_inputField.focus()};function stripCRFromString(c){for(var d=0,b="",a="\n\r";d<c.length;d++){if(a.indexOf(c.charAt(d))==-1){b+=c.charAt(d)}else{b+=" "}}return b}function findSpanValueForClass(b,a){var g=b.getElementsByTagName(_spanTag);if(g){for(var d=0;d<g.length;++d){if(g[d].className==a){var c=g[d].innerHTML;if(c=="&nbsp;"){return""}else{var e=stripCRFromString(c);return e}}}}else{return""}}function valueOfCAutoComplete(a){if(!a){return null}return findSpanValueForClass(a,"cAutoComplete")}function valueOfDAutoComplete(a){if(!a){return null}return findSpanValueForClass(a,"dAutoComplete")}function hideCompleteDiv(){document.getElementById("completeDiv").style.visibility="hidden"}function showCompleteDiv(){document.getElementById("completeDiv").style.visibility="visible";setCompleteDivSize()}function cacheResults(b,a,c){_resultCache[b]=new Array(a,c)}handleResponse=function(c,f,d,g,h){if(_timeoutAdjustment>0){_timeoutAdjustment--}var e=(new Date()).getTime();if(!c){c=B}cacheResults(f,d,g);var a=c.completeDiv;a.completeStrings=d;a.displayStrings=g;a.prefixStrings=h;displaySuggestedList(a,a.completeStrings,a.displayStrings);Pa(a,valueOfCAutoComplete);if(_completeDivRows2>0){a.height=16*_completeDivRows2+4}else{hideCompleteDiv()}};function Oa(){if(_eventKeycode==40||_eventKeycode==38){blurThenGetFocus()}var f=lb(_inputField);var b=bb(_inputField);var a=_inputField.value;if(X&&_eventKeycode!=0){if(f>0&&b!=-1){a=a.substring(0,b)}if(_eventKeycode==13||_eventKeycode==3){var e=_inputField;if(e.createTextRange){var c=e.createTextRange();c.moveStart("character",e.value.length);c.select()}else{if(e.setSelectionRange){e.setSelectionRange(e.value.length,e.value.length)}}}else{if(_inputField.value!=a){selectEntry(a)}}}_currentInputFieldValue=a;_inputChanged=(new Date()).getTime();if(handleCursorUpDownEnter(_eventKeycode)&&_eventKeycode!=0){Pa(_completeDiv,valueOfCAutoComplete)}}function Fa(){return xb()}var origSearchIconSrc;function search(){xb()}function xb(){if(_inputField.value.trim()==""){return false}da=true;if(!_hasXMLHTTP){setCookie("search","",0,_completeSearchString,null,null)}hideCompleteDiv();var a=$("searchBtn");origSearchIconSrc=a.src;a.src=spinner.src;setTimeout("noSpinner();",20*1000);_documentForm.submit();return true}function noSpinner(){var a=$("searchBtn");a.src=origSearchIconSrc}newwin=function(){window.open(_inputField.value);hideCompleteDiv();return false};idkc=function(b){if(Ba){var a=_inputField.value;if(a!=aa){_eventKeycode=0;Oa()}aa=a;setTimeout("idkc()",10)}};setTimeout("idkc()",10);function escapeURI(a){if(encodeURIComponent){return encodeURIComponent(a)}if(escape){return escape(a)}}function recalculateTimeout(a){var b=100;for(var c=1;c<=(a-2)/2;c++){b=b*2}b=b+50;return b}var delays=[3000,500,300,150,100];function delay_for(a){var b=delays[a.length-1];if(b){return b}return delays[delays.length-1]}mainLoop=function(){var a=(new Date()).getTime();var c=a-_inputChanged;if(c>delay_for(_currentInputFieldValue)){if(_oldInputFieldValue!=_currentInputFieldValue){if(!da){var b=escapeURI(_currentInputFieldValue);var d=_resultCache[_currentInputFieldValue];if(d){Va=-1;handleResponse(B,_currentInputFieldValue,d[0],d[1],B.completeDiv.prefixStrings)}else{_timeoutAdjustment++;Va=(new Date()).getTime();if(_hasXMLHTTP){callServer(b)}else{setCookie("search",b,null,_completeSearchString,null,null);frames.completionFrame.document.location.reload(true)}}_inputField.focus()}da=false}_oldInputFieldValue=_currentInputFieldValue}setTimeout("mainLoop()",recalculateTimeout(_timeoutAdjustment));return true};setTimeout("mainLoop()",10);function Cb(b,a){selectEntry(valueOfCAutoComplete(b));q=valueOfDAutoComplete(b);da=true;Fa()}function pb(c,a){var b;if(_highlightedSuggestionDiv){setStyleForElement(_highlightedSuggestionDiv,"aAutoComplete");b=document.getElementById("dac_"+_highlightedSuggestionIndex);if(b){b.style.color="green"}}setStyleForElement(c,"bAutoComplete");b=document.getElementById("dac_"+a);if(b){b.style.color="white"}_highlightedSuggestionDiv=c;_highlightedSuggestionIndex=a}function ec(c,a){setStyleForElement(c,"aAutoComplete");var b=document.getElementById("dac_"+a);if(b){b.style.color="green"}}function highlightNewValue(b){_currentInputFieldValue=G;_inputChanged=(new Date()).getTime();selectEntry(G);q=G;if(!_completeDivDivList||_completeDivRows<=0){return}showCompleteDiv();if(b>=_completeDivRows){b=_completeDivRows-1}if(_highlightedSuggestionIndex!=-1&&b!=_highlightedSuggestionIndex){setStyleForElement(_highlightedSuggestionDiv,"aAutoComplete");var a=document.getElementById("dac_"+_highlightedSuggestionIndex);if(a){a.style.color="green"}_highlightedSuggestionIndex=-1}if(b<0){_highlightedSuggestionIndex=-1;_inputField.focus();return}_highlightedSuggestionIndex=b;_highlightedSuggestionDiv=_completeDivDivList.item(b);setStyleForElement(_highlightedSuggestionDiv,"bAutoComplete");var a=document.getElementById("dac_"+_highlightedSuggestionIndex);if(a){a.style.color="white"}_currentInputFieldValue=G;_inputChanged=(new Date()).getTime();q=valueOfDAutoComplete(_highlightedSuggestionDiv);selectEntry(valueOfCAutoComplete(_highlightedSuggestionDiv))}function handleCursorUpDownEnter(a){if(a==40){highlightNewValue(_highlightedSuggestionIndex+1);return false}else{if(a==38){highlightNewValue(_highlightedSuggestionIndex-1);return false}else{if(a==13||a==3){return false}}}return true}function Pa(j,g){var e=_inputField;var i=false;_highlightedSuggestionIndex=-1;var n=j.getElementsByTagName(_divTag);var k=n.length;_completeDivRows=k;_completeDivDivList=n;_completeDivRows2=k;G=_currentInputFieldValue;if(_currentInputFieldValue==""||k==0){hideCompleteDiv()}else{showCompleteDiv()}var c="";if(_currentInputFieldValue.length>0){var l;var d;for(var l=0;l<k;l++){for(d=0;d<j.prefixStrings.length;d++){var h=j.prefixStrings[d]+_currentInputFieldValue;if(Y||g(n.item(l)).toUpperCase().indexOf(h.toUpperCase())==0){c=j.prefixStrings[d];i=true;break}}if(i){break}}}if(i){_highlightedSuggestionIndex=l}for(var l=0;l<k;l++){setStyleForElement(n.item(l),"aAutoComplete");var a=document.getElementById("dac_"+l);if(a){a.style.color="green"}}if(i){_highlightedSuggestionDiv=n.item(_highlightedSuggestionIndex);q=valueOfDAutoComplete(_highlightedSuggestionDiv)}else{q=_currentInputFieldValue;_highlightedSuggestionIndex=-1;_highlightedSuggestionDiv=null}var s=false;switch(_eventKeycode){case 8:case 33:case 34:case 35:case 35:case 36:case 37:case 39:case 45:case 46:s=true;break;default:break}if(!s&&_highlightedSuggestionDiv){var b=_currentInputFieldValue;setStyleForElement(_highlightedSuggestionDiv,"bAutoComplete");var a=document.getElementById("dac_"+_highlightedSuggestionIndex);if(a){a.style.color="white"}var m;if(i){m=g(_highlightedSuggestionDiv).substr(j.prefixStrings[d].length)}else{m=b}if(m!=e.value){if(e.value!=_currentInputFieldValue){return}if(X){if(e.createTextRange||e.setSelectionRange){selectEntry(m)}if(e.createTextRange){var r=e.createTextRange();r.moveStart("character",b.length);r.select()}else{if(e.setSelectionRange){e.setSelectionRange(b.length,e.value.length)}}}}}else{_highlightedSuggestionIndex=-1;q=_currentInputFieldValue}}function calculateOffsetLeft(a){return Ya(a,"offsetLeft")}function calculateOffsetTop(a){return Ya(a,"offsetTop")}function Ya(c,a){var b=0;while(c){b+=c[a];c=c.offsetParent}return b}function setCookie(d,f,a,g,e,b){var c=d+"="+f+(a?";expires="+a.toGMTString():"")+(g?";path="+g:"")+(e?";domain="+e:"")+(b?";secure":"");document.cookie=c}function setInputFieldSize(){var a=document.body.scrollWidth-220;a=0.73*a;_inputField.size=Math.floor(a/6.18)}function lb(c){var b=-1;if(c.createTextRange){var a=document.selection.createRange().duplicate();b=a.text.length}else{if(c.setSelectionRange){b=c.selectionEnd-c.selectionStart}}return b}function bb(c){var a=0;if(c.createTextRange){var b=document.selection.createRange().duplicate();b.moveEnd("textedit",1);a=c.value.length-b.text.length}else{if(c.setSelectionRange){a=c.selectionStart}else{a=-1}}return a}function cc(b){if(b.createTextRange){var a=b.createTextRange();a.moveStart("character",b.value.length);a.select()}else{if(b.setSelectionRange){b.setSelectionRange(b.value.length,b.value.length)}}}function jc(b,c){if(!c){c=1}if(pa&&pa<=c){var a=document.createElement("DIV");a.innerHTML=b;document.getElementById("console").appendChild(a)}}function setStyleForElement(b,a){db();b.className=a;if(Ka){return}switch(a.charAt(0)){case"m":b.style.fontSize=searchAsyncSuggestFontSize;b.style.fontFamily="arial,sans-serif";b.style.wordWrap="break-word";break;case"l":b.style.display="block";b.style.paddingLeft="3";b.style.paddingRight="2";b.style.height="16px";b.style.overflow="hidden";break;case"a":b.style.backgroundColor="white";b.style.color="black";break;case"b":b.style.backgroundColor="#3366cc";b.style.color="white";break;case"c":b.style.width=p+"%";b.style.cssFloat="left";break;case"d":b.style.cssFloat="right";b.style.width=100-p+"%";b.style.fontSize="10px";b.style.textAlign="right";b.style.color="green";b.style.paddingTop="3px";break}}function db(){p=65;var b=calculateWidth();var a=(b-110)/b*100;p=a}function Gb(a){db();setStyleForElement(a,"mAutoComplete")}function displaySuggestedList(c,d,a){while(c.childNodes.length>0){c.removeChild(c.childNodes[0])}var b="";for(var e=0;e<d.length;++e){b+="<div class='aAutoComplete' style='background-color: white; color: black;'";b+="        onmouseover='javascript: pb(this, "+e+")'";b+="        onmousedown='javascript: Cb(this, "+e+")'";b+="        onmouseout='javascript: ec(this, "+e+")'>";b+="  <span class='lAutoComplete'";b+="        style='display: block; height: 16px; overflow: hidden;";b+="               padding-left: 3px;'>";b+="    <span class='cAutoComplete' style='float: left'; width: 100%>"+d[e]+"</span>";b+="    <span id='dac_"+e+"' class='dAutoComplete' style='float: right;";b+="          text-align: right; color: green; font-size: 10px'>"+a[e]+"</span>";b+="  </span>";b+="</div>"}c.innerHTML=b}function D(b,c){if(Ka){var a=document.styleSheets[0];if(a.addRule){a.addRule(b,c)}else{if(a.insertRule){a.insertRule(b+" { "+c+" }",a.cssRules.length)}}}}function getXMLHTTP(){var a=null;try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(c){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){a=null}}if(!a&&typeof XMLHttpRequest!="undefined"){a=new XMLHttpRequest()}return a}function callServer(query){if(_xmlHttp&&_xmlHttp.readyState!=0){_xmlHttp.abort()}_xmlHttp=getXMLHTTP();if(_xmlHttp){_xmlHttp.open("GET",_completeSearchString+"&search="+query,true);_xmlHttp.onreadystatechange=function(){if(_xmlHttp.readyState==4&&_xmlHttp.responseText){var frameElement=B;if(_xmlHttp.responseText.charAt(0)=="<"){_timeoutAdjustment--}else{eval(_xmlHttp.responseText)}}};_xmlHttp.send(null)}}function selectEntry(a){_inputField.value=a;aa=a};
