// Copyright 2004 and onwards by Google, Inc.
var w="",Ta=false,ka="",Z=false,k="",I="",j="",o=-1,n=null,C=-1,R=null,ja=5,v="",fb="div",Ra="span",D=null,d=null,g=null,m=null,Ma=null,Oa=null,F=null,J=null,oa=false,va={},Q=1,ca=1,aa=false,X=false,pa=-1,Ja=(new Date).getTime(),L=false,r=null,la=null,B=null,G=null,V=null,W=false,wa=false,u=60,Ia=null,ha=null,A=0,E=0,Ea=null,T=null,U=null,ea=false,S=false,da="",z=null,P=null,p=null,s=null,ia=null,Fa=-1,Ga=-1;InstallAC=function(a,b,c,e,f,i,h,l){D=a;d=b;Ma=c;if(!e)e="search";Ia=e;var t="zh|zh-CN|zh-TW|ja|ko|";
if(!f||f.length<1)f="en";J=xa(f);if(t.indexOf(J+"|")==-1){F=false;X=true;aa=false;W=false}else{F=false;X=true;if(J.indexOf("zh")==0)aa=false;W=true}if(!i)i=false;ha=i;if(!h)h="query";w=h;Oa=l;Xa()};function ya(){oa=true;d.blur();setTimeout("sfi();",10)}function gb(){if(document.createEventObject){var a=document.createEventObject();a.ctrlKey=true;a.keyCode=70;document.fireEvent("onkeydown",a)}}function cb(a){if(!a&&window.event)a=window.event;if(a)pa=a.keyCode;if(a&&a.keyCode==8){if(F&&d.createTextRange&&
a.srcElement==d&&M(d)==0&&N(d)==0){Pa(d);a.cancelBubble=true;a.returnValue=false;return false}}}function eb(){if(w=="url"){Ka()}Y()}function Y(){if(g){g.style.left=Ba(d,"offsetLeft")+"px";g.style.top=Ba(d,"offsetTop")+d.offsetHeight-1+"px";g.style.width=Aa()+"px";if(m){m.style.left=g.style.left;m.style.top=g.style.top;m.style.width=g.style.width;m.style.height=g.style.height}}}function Aa(){if(navigator&&navigator.userAgent.toLowerCase().indexOf("msie")==-1){return d.offsetWidth-Q*2}else{return d.offsetWidth}}
function Xa(){if(Ca()){L=true}else{L=false}if(Ta)B="complete";else B="/complete/"+Ia;la=B+"?hl="+J+"&client=suggest";if(!L){na("qu","",0,B,null,null)}D.onsubmit=fa;d.autocomplete="off";d.onblur=Za;d.onfocus=db;if(d.createTextRange)d.onkeyup=new Function("return okuh(event); ");else d.onkeyup=okuh;d.onsubmit=fa;k=d.value;ka=k;g=document.createElement("DIV");g.id="completeDiv";Q=1;ca=1;g.style.borderRight="black "+Q+"px solid";g.style.borderLeft="black "+Q+"px solid";g.style.borderTop="black "+ca+"px solid";
g.style.borderBottom="black "+ca+"px solid";g.style.zIndex="2";g.style.paddingRight="0";g.style.paddingLeft="0";g.style.paddingTop="0";g.style.paddingBottom="0";g.style.visibility="hidden";g.style.position="absolute";g.style.backgroundColor="white";m=document.createElement("IFRAME");m.id="completeIFrame";m.style.zIndex="1";m.style.position="absolute";if(window.opera&&(!window.opera.version||window.opera.version()<="8.54"))m.style.display="none";else m.style.display="block";m.style.visibility="hidden";
m.style.borderRightWidth="0";m.style.borderLeftWidth="0";m.style.borderTopWidth="0";m.style.borderBottomWidth="0";Y();document.body.appendChild(g);document.body.appendChild(m);ta("",[],[]);Wa(g);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=g;b.name="completionFrame";b.id="completionFrame";b.src=la;a.appendChild(b);document.body.appendChild(a);
if(frames&&frames["completionFrame"]&&frames["completionFrame"].frameElement)G=frames["completionFrame"].frameElement;else G=document.getElementById("completionFrame");if(w=="url"){Ka();Y()}window.onresize=eb;document.onkeydown=cb;gb();if(W){setTimeout("idkc()",10);if(d.attachEvent){d.attachEvent("onpropertychange",Ua)}}p=document.createElement("INPUT");p.type="hidden";p.name="aq";p.value=null;p.disabled=true;D.appendChild(p);s=document.createElement("INPUT");s.type="hidden";s.name="oq";s.value=null;
s.disabled=true;D.appendChild(s)}function db(a){S=true}function Za(a){S=false;if(!a&&window.event)a=window.event;if(!oa){y();if(pa==9){ib();pa=-1}}oa=false}okuh=function(a){if(!ea){ea=true}j=a.keyCode;V=d.value;Ha()};function ib(){Ma.focus()}sfi=function(){d.focus()};function kb(a){for(var b=0,c="",e="\n\r";b<a.length;b++)if(e.indexOf(a.charAt(b))==-1)c+=a.charAt(b);else c+=" ";return c}function za(a,b){var c=a.getElementsByTagName(Ra);if(c){for(var e=0;e<c.length;++e){if(c[e].className==b){var f=
c[e].innerHTML;if(f=="&nbsp;")return"";else{var i=kb(f);return i}}}}else{return""}}function H(a){if(!a)return null;return za(a,"cAutoComplete")}function ga(a){if(!a)return null;return za(a,"dAutoComplete")}function y(){document.getElementById("completeDiv").style.visibility="hidden";document.getElementById("completeIFrame").style.visibility="hidden"}function La(){document.getElementById("completeDiv").style.visibility="visible";document.getElementById("completeIFrame").style.visibility="visible";
Y()}function ta(a,b,c){va[a]=new Array(b,c)}sendRPCDone=function(a,b,c,e,f){if(A>0)A--;var i=(new Date).getTime();if(!a)a=G;ta(b,c,e);if(b==k){if(z){clearTimeout(z);z=null}da=b}var h=a.completeDiv;h.completeStrings=c;h.displayStrings=e;h.prefixStrings=f;Sa(h,h.completeStrings,h.displayStrings);Da(h,H);if(ja>0){h.height=16*ja+4;m.height=h.height-4}else{y()}};hcd=function(){y();z=null};function Ha(){if(j==40||j==38)ya();var a=N(d),b=M(d),c=d.value;if(F&&j!=0){if(a>0&&b!=-1)c=c.substring(0,b);if(j==
13||j==3){var e=d;if(e.createTextRange){var f=e.createTextRange();f.moveStart("character",e.value.length);f.select()}else if(e.setSelectionRange){e.setSelectionRange(e.value.length,e.value.length)}}else{if(d.value!=c)K(c)}}if(j!=9&&j!=13&&!(j>=16&&j<=20)&&j!=27&&!(j>=33&&j<=38)&&j!=40&&j!=44&&!(j>=112&&j<=123)){k=c;if(j!=39)ia=c}if(Qa(j)&&j!=0&&da==k)Da(g,H);if(da!=k&&!z)z=setTimeout("hcd()",500)}function fa(){return Ya(w)}function Ya(a){Z=true;if(!L){na("qu","",0,B,null,null)}y();if(a=="url"){var b=
"";if(o!=-1&&n)b=H(n);if(b=="")b=d.value;if(v=="")document.title=b;else document.title=v;var c="window.frames['"+Oa+"'].location = \""+b+'";';setTimeout(c,10);return false}else if(a=="query"){p.disabled=(s.disabled=true);if(ia!=d.value){p.value="t";p.disabled=false;s.value=ia;s.disabled=false}else if(P){p.value=P;p.disabled=false}else if(E>=3||A>=10){p.value="o";p.disabled=false}P=null;D.submit();return true}}newwin=function(){window.open(d.value);y();return false};idkc=function(a){if(W){if(S){Na()}var b=
d.value;if(b!=V){j=0;Ha()}V=b;setTimeout("idkc()",10)}};function xa(a){if(encodeURIComponent)return encodeURIComponent(a);if(escape)return escape(a)}function Va(a){var b=100;for(var c=1;c<=(a-2)/2;c++){b=b*2}b=b+50;return b}idfn=function(){if(E>=3)return false;if(ka!=k){if(!Z){var a=xa(k),b=va[k];if(b){Ja=-1;sendRPCDone(G,k,b[0],b[1],G.completeDiv.prefixStrings)}else{A++;Ja=(new Date).getTime();if(L){hb(a)}else{na("qu",a,null,B,null,null);frames["completionFrame"].document.location.reload(true)}}d.focus()}Z=
false}ka=k;setTimeout("idfn()",Va(A));return true};setTimeout("idfn()",10);var $a=function(){K(H(this));v=ga(this);Z=true;fa()},ab=function(){if(window.event){var a=window.event.x,b=window.event.y;if(a==Fa&&b==Ga){return}Fa=a;Ga=b}if(n)q(n,"aAutoComplete");q(this,"bAutoComplete");n=this;for(var c=0;c<C;c++){if(R[c]==n){o=c;break}}},bb=function(){q(this,"aAutoComplete")};function ma(a){P="t";k=I;K(I);v=I;if(!R||C<=0)return;La();if(a>=C){a=C-1}if(o!=-1&&a!=o){q(n,"aAutoComplete");o=-1}if(a<0){o=-1;
d.focus();return}o=a;n=R.item(a);q(n,"bAutoComplete");k=I;v=ga(n);K(H(n))}function Qa(a){if(a==40){ma(o+1);return false}else if(a==38){ma(o-1);return false}else if(a==13||a==3){return false}return true}function Da(a,b){var c=d,e=false;o=-1;var f=a.getElementsByTagName(fb),i=f.length;C=i;R=f;ja=i;I=k;if(k==""||i==0){y()}else{La()}var h="";if(k.length>0){var l,t;for(var l=0;l<i;l++){for(t=0;t<a.prefixStrings.length;t++){var sa=a.prefixStrings[t]+k;if(aa||!X&&b(f.item(l)).toUpperCase().indexOf(sa.toUpperCase())==
0||X&&l==0&&b(f.item(l)).toUpperCase()==sa.toUpperCase()){h=a.prefixStrings[t];e=true;break}}if(e){break}}}if(e)o=l;for(var l=0;l<i;l++)q(f.item(l),"aAutoComplete");if(e){n=f.item(o);v=ga(n)}else{v=k;o=-1;n=null}var qa=false;switch(j){case 8:case 33:case 34:case 35:case 35:case 36:case 37:case 39:case 45:case 46:qa=true;break;default:break}if(!qa&&n){var $=k;q(n,"bAutoComplete");var O;if(e)O=b(n).substr(a.prefixStrings[t].length);else O=$;if(O!=c.value){if(c.value!=k)return;if(F){if(c.createTextRange||
c.setSelectionRange)K(O);if(c.createTextRange){var ra=c.createTextRange();ra.moveStart("character",$.length);ra.select()}else if(c.setSelectionRange){c.setSelectionRange($.length,c.value.length)}}}}else{o=-1;v=k}}function Ba(a,b){var c=0;while(a){c+=a[b];a=a.offsetParent}return c}function na(a,b,c,e,f,i){var h=a+"="+b+(c?"; expires="+c.toGMTString():"")+(e?"; path="+e:"")+(f?"; domain="+f:"")+(i?"; secure":"");document.cookie=h}function Ka(){var a=document.body.scrollWidth-220;a=0.73*a;d.size=Math.floor(a/
6.18)}function N(a){var b=-1;if(a.createTextRange){var c=document.selection.createRange().duplicate();b=c.text.length}else if(a.setSelectionRange){b=a.selectionEnd-a.selectionStart}return b}function M(a){var b=0;if(a.createTextRange){var c=document.selection.createRange().duplicate();c.moveEnd("textedit",1);b=a.value.length-c.text.length}else if(a.setSelectionRange){b=a.selectionStart}else{b=-1}return b}function Pa(a){if(a.createTextRange){var b=a.createTextRange();b.moveStart("character",a.value.length);
b.select()}else if(a.setSelectionRange){a.setSelectionRange(a.value.length,a.value.length)}}function q(a,b){ua();a.className=b;if(wa){return}switch(b.charAt(0)){case "m":a.style.fontSize="13px";a.style.fontFamily="arial,sans-serif";a.style.wordWrap="break-word";break;case "l":a.style.display="block";a.style.paddingLeft="3";a.style.paddingRight="3";a.style.height="16px";a.style.overflow="hidden";break;case "a":a.style.backgroundColor="white";a.style.color="black";if(a.displaySpan){a.displaySpan.style.color=
"green"}break;case "b":a.style.backgroundColor="#3366cc";a.style.color="white";if(a.displaySpan){a.displaySpan.style.color="white"}break;case "c":a.style.width=u+"%";a.style.cssFloat="left";a.style.whiteSpace="nowrap";a.style.overflow="hidden";a.style.textOverflow="ellipsis";break;case "d":a.style.cssFloat="right";a.style.width=100-u+"%";if(w=="query"){a.style.fontSize="10px";a.style.textAlign="right";a.style.color="green";a.style.paddingTop="3px"}else{a.style.color="#696969"}break}}function ua(){u=
65;if(w=="query"){var a=110,b=Aa(),c=(b-a)/b*100;u=c}else{u=65}if(ha){u=99.99}}function Wa(a){ua();var b="font-size: 13px; font-family: arial,sans-serif; word-wrap:break-word;",c="display: block; padding-left: 3; padding-right: 3; height: 16px; overflow: hidden;",e="background-color: white;",f="background-color: #3366cc; color: white ! important;",i="display: block; margin-left: 0%; width: "+u+"%; float: left;",h="display: block; margin-left: "+u+"%;";if(w=="query"){h+="font-size: 10px; text-align: right; color: green; padding-top: 3px;"}else{h+=
"color: #696969;"}x(".mAutoComplete",b);x(".lAutoComplete",c);x(".aAutoComplete *",e);x(".bAutoComplete *",f);x(".cAutoComplete",i);x(".dAutoComplete",h);q(a,"mAutoComplete")}function Sa(a,b,c){while(a.childNodes.length>0)a.removeChild(a.childNodes[0]);for(var e=0;e<b.length;++e){var f=document.createElement("DIV");q(f,"aAutoComplete");f.onmousedown=$a;f.onmousemove=ab;f.onmouseout=bb;var i=document.createElement("SPAN");q(i,"lAutoComplete");if(J.substring(0,2)=="zh")i.style.height=d.offsetHeight-
4;else i.style.height=d.offsetHeight-6;var h=document.createElement("SPAN");h.innerHTML=b[e];var l=document.createElement("SPAN");q(l,"dAutoComplete");q(h,"cAutoComplete");f.displaySpan=l;if(!ha)l.innerHTML=c[e];i.appendChild(h);i.appendChild(l);f.appendChild(i);a.appendChild(f)}}function x(a,b){if(wa){var c=document.styleSheets[0];if(c.addRule){c.addRule(a,b)}else if(c.insertRule){c.insertRule(a+" { "+b+" }",c.cssRules.length)}}}function Ca(){var a=null;try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(b){try{a=
new ActiveXObject("Microsoft.XMLHTTP")}catch(c){a=null}}if(!a&&typeof XMLHttpRequest!="undefined"){a=new XMLHttpRequest}return a}function hb(a){if(r&&r.readyState!=0){r.abort()}r=Ca();if(r){r.open("GET",la+"&js=true&qu="+a,true);r.onreadystatechange=function(){if(r.readyState==4&&r.responseText){switch(r.status){case 403:E=1000;break;case 500:case 502:case 503:E++;break;case 200:var b=r.responseText;if(b.charAt(0)!="<"&&b.indexOf("sendRPCDone")!=-1)eval(b);else A--;default:E=0;break}}};r.send(null)}}
function K(a){d.value=a;V=a}function Ua(a){if(!a&&window.event)a=window.event;if(!ea&&S&&a.propertyName=="value"){if(lb()){Na();setTimeout("ba("+T+", "+U+");",30)}}}function lb(){var a=d.value,b=M(d),c=N(d);return b==T&&c==U&&a==Ea}function Na(){Ea=d.value;T=M(d);U=N(d)}ba=function(a,b){if(a==T&&b==U){jb()}};function jb(){ya();ma(o+1)};
