var UDS_ServiceBase = "http://www.google.com/uds";
var UDS_CurrentLocale = "zh_CN";
var UDS_ShortDatePattern = "YMD";
var UDS_ApiKey = "internal";
var UDS_Version = "1.0";
var UDS_JSHash = "1a41f108a78acc17f84699d3129071c8";
var UDS_KeyVerified = true;
var UDS_LoadFailure = false;

var _UDS_MSG_SEARCHER_IMAGE = ('Image');
var _UDS_MSG_SEARCHER_WEB = ('Web');
var _UDS_MSG_SEARCHER_BLOG = ('Blog');
var _UDS_MSG_SEARCHER_VIDEO = ('Video');
var _UDS_MSG_SEARCHER_LOCAL = ('Local');
var _UDS_MSG_SEARCHCONTROL_SAVE = ('save');
var _UDS_MSG_SEARCHCONTROL_KEEP = ('keep');
var _UDS_MSG_SEARCHCONTROL_INCLUDE = ('include');
var _UDS_MSG_SEARCHCONTROL_COPY = ('copy');
var _UDS_MSG_SEARCHCONTROL_CLOSE = ('close');
var _UDS_MSG_SEARCHCONTROL_SPONSORED_LINKS = ('Sponsored Links');
var _UDS_MSG_SEARCHCONTROL_SEE_MORE = ('see more...');
var _UDS_MSG_SEARCHCONTROL_WATERMARK = ('clipped from Google');
var _UDS_MSG_SEARCHER_CONFIG_SET_LOCATION = ('Search location');
var _UDS_MSG_SEARCHER_CONFIG_DISABLE_ADDRESS_LOOKUP = ('Disable address lookup');
var _UDS_MSG_SEARCHER_NEWS = ('News');
function _UDS_MSG_MINUTES_AGO(AGE_MINUTES_AGO) {
  return ('' + AGE_MINUTES_AGO + ' minutes ago');
}
var _UDS_MSG_ONE_HOUR_AGO = ('1 hour ago');
function _UDS_MSG_HOURS_AGO(AGE_HOURS_AGO) {
  return ('' + AGE_HOURS_AGO + ' hours ago');
}
function _UDS_MSG_NEWS_ALL_N_RELATED(NUMBER) {
  return ('all ' + NUMBER + ' related');
}
var _UDS_MSG_NEWS_RELATED = ('Related Articles');
var _UDS_MSG_BRANDING_STRING = ('powered by Google');
var _UDS_MSG_SORT_BY_DATE = ('Sort by date');
var _UDS_MSG_MONTH_ABBR_JAN = ('Jan');
var _UDS_MSG_MONTH_ABBR_FEB = ('Feb');
var _UDS_MSG_MONTH_ABBR_MAR = ('Mar');
var _UDS_MSG_MONTH_ABBR_APR = ('Apr');
var _UDS_MSG_MONTH_ABBR_MAY = ('May');
var _UDS_MSG_MONTH_ABBR_JUN = ('Jun');
var _UDS_MSG_MONTH_ABBR_JUL = ('Jul');
var _UDS_MSG_MONTH_ABBR_AUG = ('Aug');
var _UDS_MSG_MONTH_ABBR_SEP = ('Sep');
var _UDS_MSG_MONTH_ABBR_OCT = ('Oct');
var _UDS_MSG_MONTH_ABBR_NOV = ('Nov');
var _UDS_MSG_MONTH_ABBR_DEC = ('Dec');
var _UDS_MSG_DIRECTIONS = ('directions');
var _UDS_MSG_CLEAR_RESULTS = ('clear results');
var _UDS_MSG_SHOW_ONE_RESULT = ('show one result');
var _UDS_MSG_SHOW_MORE_RESULTS = ('show more results');
var _UDS_MSG_SHOW_ALL_RESULTS = ('show all results');
var _UDS_MSG_SETTINGS = ('settings');
var _UDS_MSG_SEARCH = ('search');
var _UDS_MSG_SEARCH_UC = ('Search');
var _UDS_MSG_POWERED_BY = ('powered by');
function _UDS_MSG_LOCAL_ATTRIBUTION(LOCAL_RESULTS_PROVIDER) {
  return ('Business listings provided by ' + LOCAL_RESULTS_PROVIDER + '');
}
var _UDS_MSG_SEARCHER_BOOK = ('Book');
function _UDS_MSG_FOUND_ON_PAGE(FOUND_ON_PAGE) {
  return ('Page ' + FOUND_ON_PAGE + '');
}
function _UDS_MSG_TOTAL_PAGE_COUNT(PAGE_COUNT) {
  return ('' + PAGE_COUNT + ' pages');
}
var _UDS_MSG_SEARCHER_BY = ('by');
var _UDS_MSG_SEARCHER_CODE = ('Code');
var _UDS_MSG_UNKNOWN_LICENSE = ('Unknown License');
var _UDS_MSG_SEARCHER_GSA = ('Search Appliance');
var _UDS_MSG_SEARCHCONTROL_MORERESULTS = ('More results');
var _UDS_MSG_SEARCHCONTROL_PREVIOUS = ('Previous');
var _UDS_MSG_SEARCHCONTROL_NEXT = ('Next');
var _UDS_MSG_GET_DIRECTIONS = ('Get directions');
var _UDS_MSG_GET_DIRECTIONS_TO_HERE = ('To here');
var _UDS_MSG_GET_DIRECTIONS_FROM_HERE = ('From here');
var _UDS_MSG_CLEAR_RESULTS_UC = ('Clear results');
var _UDS_MSG_SEARCH_THE_MAP = ('search the map');
var _UDS_MSG_SCROLL_THROUGH_RESULTS = ('scroll through results');
var _UDS_MSG_EDIT_TAGS = ('edit tags');
var _UDS_MSG_TAG_THIS_SEARCH = ('tag this search');
var _UDS_MSG_SEARCH_STRING = ('search string');
var _UDS_MSG_OPTIONAL_LABEL = ('optional label');
var _UDS_MSG_DELETE = ('delete');
var _UDS_MSG_DELETED = ('deleted');
var _UDS_MSG_CANCEL = ('cancel');
var _UDS_MSG_UPLOAD_YOUR_VIDEOS = ('upload your own video');
var _UDS_MSG_IM_DONE_WATCHING = ('i\047m done watching this');
var _UDS_MSG_CLOSE_VIDEO_PLAYER = ('close video player');


var udsi=new Object;udsi["blank"]="&nbsp;";udsi["image"]=_UDS_MSG_SEARCHER_IMAGE;udsi["web"]=_UDS_MSG_SEARCHER_WEB;udsi["blog"]=_UDS_MSG_SEARCHER_BLOG;udsi["video"]=_UDS_MSG_SEARCHER_VIDEO;udsi["local"]=_UDS_MSG_SEARCHER_LOCAL;udsi["news"]=_UDS_MSG_SEARCHER_NEWS;udsi["book"]=_UDS_MSG_SEARCHER_BOOK;udsi["save"]=_UDS_MSG_SEARCHCONTROL_SAVE;udsi["keep"]=_UDS_MSG_SEARCHCONTROL_KEEP;udsi["include"]=_UDS_MSG_SEARCHCONTROL_INCLUDE;udsi["copy"]=_UDS_MSG_SEARCHCONTROL_COPY;udsi["close"]=_UDS_MSG_SEARCHCONTROL_CLOSE;
udsi["sponsored-links"]=_UDS_MSG_SEARCHCONTROL_SPONSORED_LINKS;udsi["see-more"]=_UDS_MSG_SEARCHCONTROL_SEE_MORE;udsi["watermark"]=_UDS_MSG_SEARCHCONTROL_WATERMARK;udsi["search-location"]=_UDS_MSG_SEARCHER_CONFIG_SET_LOCATION;udsi["disable-address-lookup"]=_UDS_MSG_SEARCHER_CONFIG_DISABLE_ADDRESS_LOOKUP;udsi["sort-by-date"]=_UDS_MSG_SORT_BY_DATE;udsi["pbg"]=_UDS_MSG_BRANDING_STRING;udsi["n-minutes-ago"]=_UDS_MSG_MINUTES_AGO;udsi["n-hours-ago"]=_UDS_MSG_HOURS_AGO;udsi["one-hour-ago"]=_UDS_MSG_ONE_HOUR_AGO;
udsi["all-n-related"]=_UDS_MSG_NEWS_ALL_N_RELATED;udsi["related-articles"]=_UDS_MSG_NEWS_RELATED;udsi["page-count"]=_UDS_MSG_TOTAL_PAGE_COUNT;var udsy=new Array;udsy[0]=_UDS_MSG_MONTH_ABBR_JAN;udsy[1]=_UDS_MSG_MONTH_ABBR_FEB;udsy[2]=_UDS_MSG_MONTH_ABBR_MAR;udsy[3]=_UDS_MSG_MONTH_ABBR_APR;udsy[4]=_UDS_MSG_MONTH_ABBR_MAY;udsy[5]=_UDS_MSG_MONTH_ABBR_JUN;udsy[6]=_UDS_MSG_MONTH_ABBR_JUL;udsy[7]=_UDS_MSG_MONTH_ABBR_AUG;udsy[8]=_UDS_MSG_MONTH_ABBR_SEP;udsy[9]=_UDS_MSG_MONTH_ABBR_OCT;udsy[10]=_UDS_MSG_MONTH_ABBR_NOV;
udsy[11]=_UDS_MSG_MONTH_ABBR_DEC;udsi["month-abbr"]=udsy;udsi["directions"]=_UDS_MSG_DIRECTIONS;udsi["clear-results"]=_UDS_MSG_CLEAR_RESULTS;udsi["show-one-result"]=_UDS_MSG_SHOW_ONE_RESULT;udsi["show-more-results"]=_UDS_MSG_SHOW_MORE_RESULTS;udsi["show-all-results"]=_UDS_MSG_SHOW_ALL_RESULTS;udsi["settings"]=_UDS_MSG_SETTINGS;udsi["search"]=_UDS_MSG_SEARCH;udsi["search-uc"]=_UDS_MSG_SEARCH_UC;udsi["powered-by"]=_UDS_MSG_POWERED_BY;udsi["sa"]=_UDS_MSG_SEARCHER_GSA;udsi["by"]=_UDS_MSG_SEARCHER_BY;
udsi["code"]=_UDS_MSG_SEARCHER_CODE;udsi["unknown-license"]=_UDS_MSG_UNKNOWN_LICENSE;udsi["more-results"]=_UDS_MSG_SEARCHCONTROL_MORERESULTS;udsi["previous"]=_UDS_MSG_SEARCHCONTROL_PREVIOUS;udsi["next"]=_UDS_MSG_SEARCHCONTROL_NEXT;udsi["get-directions"]=_UDS_MSG_GET_DIRECTIONS;udsi["to-here"]=_UDS_MSG_GET_DIRECTIONS_TO_HERE;udsi["from-here"]=_UDS_MSG_GET_DIRECTIONS_FROM_HERE;udsi["clear-results-uc"]=_UDS_MSG_CLEAR_RESULTS_UC;if(UDS_CurrentLocale!="en"){udsi["clear-results-uc"]=_UDS_MSG_CLEAR_RESULTS}
udsi["search-the-map"]=_UDS_MSG_SEARCH_THE_MAP;udsi["scroll-results"]=_UDS_MSG_SCROLL_THROUGH_RESULTS;udsi["edit-tags"]=_UDS_MSG_EDIT_TAGS;udsi["tag-search"]=_UDS_MSG_TAG_THIS_SEARCH;udsi["search-string"]=_UDS_MSG_SEARCH_STRING;udsi["optional-label"]=_UDS_MSG_OPTIONAL_LABEL;udsi["delete"]=_UDS_MSG_DELETE;udsi["deleted"]=_UDS_MSG_DELETED;udsi["cancel"]=_UDS_MSG_CANCEL;udsi["upload-video"]=_UDS_MSG_UPLOAD_YOUR_VIDEOS;udsi["im-done"]=_UDS_MSG_IM_DONE_WATCHING;udsi["close-player"]=_UDS_MSG_CLOSE_VIDEO_PLAYER;
GSearch.strings=udsi;
Function.prototype.inherits=function(uds){var udsb=function(){}
;udsb.prototype=uds.prototype;this.prototype=new udsb;this.prototype.__super__=function(udsa,udsd,udsf,udse){var udsh=Array.prototype.splice.apply(arguments,[1,arguments.length]);return udsa.apply(this,udsh)}
}
;var _json_cache_defeater_=0;function udsX(uds){return uds+"&key="+UDS_ApiKey+"&v="+UDS_Version}
function udsO(uds){var udsb=document.getElementsByTagName("head")[0];var udsa=document.createElement("script");udsa.type="text/javascript";udsa.charset="utf-8";var udsd=udsX(uds);if(udsN()||udsZ()){udsd=udsd+"&nocache="+_json_cache_defeater_++}udsa.src=udsd;var udsf=function(){var udsh=udsa.parentNode;udsh.removeChild(udsa);delete udsa}
;var udse=function(udsh){var udsj=(udsh?udsh:window.event).target?(udsh?udsh:window.event).target:(udsh?udsh:window.event).srcElement;if(udsj.readyState=="loaded"||udsj.readyState=="complete"){udsf()}}
;if(navigator.product=="Gecko"){udsa.onload=udsf}else{udsa.onreadystatechange=udse}udsb.appendChild(udsa)}
function udsG(uds,udsb){return function(){return udsb.apply(uds,arguments)}
}
function udst(uds,udsb,udsa){return function(){return udsb.apply(uds,udsa)}
}
function udsF(uds){while(uds.firstChild){uds.removeChild(uds.firstChild)}}
function udsU(uds,udsb){if(uds){try{udsF(uds);uds.appendChild(udsb)}catch(udsa){}}return udsb}
function udsg(uds,udsb){try{uds.appendChild(udsb)}catch(udsa){}return udsb}
function udsV(uds,udsb){uds.innerHTML=udsb}
function udsT(uds){return document.createTextNode(uds?uds:"")}
function udsk(uds,udsb){var udsa=document.createElement("div");if(uds){udsa.innerHTML=uds}if(udsb){udsa.className=udsb}return udsa}
function udsn(uds){var udsb=document.createElement("div");if(uds){udsb.className=uds}return udsb}
function udsS(uds,udsb){var udsa=document.createElement("span");if(uds){udsg(udsa,udsT(uds))}if(udsb){udsa.className=udsb}return udsa}
function udsE(uds,udsb,udsa){var udsd=document.createElement("table");udsd.setAttribute("cellSpacing",uds?uds:0);udsd.setAttribute("cellPadding",udsb?udsb:0);if(udsa){udsd.className=udsa}return udsd}
function udsC(uds,udsb,udsa){var udsd=uds.insertRow(-1);if(!udsd){alert(udsd)}for(var udsf=0;udsf<udsb;udsf++){udss(udsd,udsa)}return udsd}
function udss(uds,udsb){var udsa=uds.insertCell(-1);if(udsb){udsa.className=udsb}return udsa}
function udsD(uds,udsb,udsa,udsd){var udsf=document.createElement("img");udsf.src=uds;if(udsb){udsf.width=udsb}if(udsa){udsf.height=udsa}if(udsd){udsf.className=udsd}return udsf}
function udsW(uds,udsb,udsa,udsd){var udsf;if(udsN()){udsf=udsn(udsd);udsf.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+uds+'")';udsf.style.width=udsb+"px";udsf.style.height=udsa+"px"}else{udsf=udsD(uds,null,null,udsd)}return udsf}
function udsL(uds,udsb,udsa,udsd){var udsf=document.createElement("a");udsf.href=uds;if(udsb){if(udsd){udsg(udsf,udsS(udsb,udsd))}else{udsg(udsf,udsT(udsb))}}if(udsa){udsf.target=udsa}return udsf}
function udsq(uds,udsb,udsa,udsd){var udsf=udsk(null,udsd);var udse=document.createElement("a");udse.href=uds;udse.innerHTML=udsb;if(udsd){udse.className=udsd}if(udsa){udse.target=udsa}udsf.appendChild(udse);return udsf}
function udsQ(uds){var udsb=document.createElement("form");if(uds){udsb.className=uds}return udsb}
function udsH(uds,udsb){var udsa=document.createElement("input");udsa.type="submit";udsa.value=uds;if(udsb){udsa.className=udsb}return udsa}
function udsR(uds,udsb,udsa){var udsd=document.createElement("input");udsd.setAttribute("autoComplete","off");udsd.type="text";if(uds==-1){udsm(udsd,"util-css-expand")}else{udsd.size=uds>0?uds:10}if(udsb){udsm(udsd,udsb)}if(udsa){udsd.value=udsa}return udsd}
function udsK(uds,udsb,udsa,udsd){var udsf=document.createElement("input");udsf.type="checkbox";udsf.name=uds;udsf.value=udsb;if(udsd){udsf.className=udsd}if(udsa){udsf.checked=udsa}return udsf}
function udsB(uds,udsb){uds.className=udsb}
function udsm(uds,udsb){uds_(uds,udsb)}
function udsz(uds,udsb){uds1(uds,udsb)}
function uds0(uds,udsb){if(uds==null||uds.className==null)return false;var udsa=uds.className.split(" ");for(var udsd=0;udsd<udsa.length;udsd++){if(udsa[udsd]==udsb){return true}}return false}
function uds_(uds,udsb){if(uds0(uds,udsb))return;uds.className+=" "+udsb}
function uds1(uds,udsb){if(uds.className==null)return;var udsa=uds.className.split(" ");var udsd=[];var udsf=false;for(var udse=0;udse<udsa.length;udse++){if(udsa[udse]!=udsb){if(udsa[udse]){udsd.push(udsa[udse])}}else{udsf=true}}if(udsf){uds.className=udsd.join(" ")}}
var udsI="";function uds2(uds){var udsb=uds.toLowerCase().split(".");if(udsb.length<2){udsI=".com"}var udsa=udsb.pop();var udsd=udsb.pop();if(udsa.length==2){if(udsJ[udsd]&&udsJ[udsd][udsa]==1){udsI="."+udsd+"."+udsa}else{udsI="."+udsa}}else{udsI=".com"}return udsI}
var udsJ={co:{ck:1,cr:1,hu:1,id:1,il:1,"in":1,je:1,jp:1,ke:1,kr:1,ls:1,nz:1,th:1,ug:1,uk:1,ve:1,vi:1,za:1},com:{ag:1,ar:1,au:1,bo:1,br:1,bz:1,co:1,cu:1,"do":1,ec:1,fj:1,gi:1,gr:1,gt:1,hk:1,jm:1,ly:1,mt:1,mx:1,my:1,na:1,nf:1,ni:1,np:1,pa:1,pe:1,ph:1,pk:1,pr:1,py:1,sa:1,sg:1,sv:1,tr:1,tw:1,ua:1,uy:1,vc:1,vn:1},off:{ai:1}};function uds3(uds){var udsb=uds.toLowerCase().split(".");if(udsb.length<2){return false}var udsa=udsb.pop();var udsd=udsb.pop();if((udsd=="igoogle"||udsd=="gmodules")&&udsa=="com"
){return true}if(udsa.length==2&&udsb.length>0){if(udsJ[udsd]&&udsJ[udsd][udsa]==1){udsd=udsb.pop()}}return udsd=="google"}
function udsM(uds){if(uds in udsP){return udsP[uds]}return udsP[uds]=navigator.userAgent.toLowerCase().indexOf(uds)!=-1}
var udsP={};function udsN(){return udsM("msie")}
function udsZ(){return udsM("safari")||udsM("konqueror")}
;
function udsc(){}
udsc.q="gs-result";udsc.Td="gs-id";udsc.Xb="gs-spacer";udsc.r="gs-title";udsc.Y="gs-snippet";udsc.v="gs-visibleUrl";udsc.eb="gs-visibleUrl-long";udsc.Zb="gs-visibleUrl-short";udsc.hd="gs-watermark";udsc.dd="gs-results-attribution";udsc.Qb="gs-address";udsc.Yb="gs-street";udsc.Rb="gs-city";udsc.Ub="gs-region";udsc.Uc="gs-country";udsc.Sb="gs-phone";udsc.Vc="gs-directions";udsc.Wc="gs-directions-to-from";udsc.Yc="gs-label";udsc.Wb="gs-secondary-link";udsc.Rc="gs-author";udsc.Tb="gs-publisher";udsc.$c=
"gs-location";udsc.Tc="gs-clusterUrl";udsc.db="gs-image-box";udsc.Sc="gs-image-box gs-book-image-box";udsc.Ea="gs-text-box";udsc.Ud="gs-metadata";udsc.ed="gs-row-1";udsc.fd="gs-row-2";udsc.Vd="gs-shadow";udsc.cd="gs-pages";udsc.bd="gs-page-edge";udsc.H="gs-image";udsc.gd="gs-size";udsc.ad="gs-pageCount";udsc.Da="gs-publishedDate";udsc.Vb="gs-relativePublishedDate";udsc.$b="gs-webAd";udsc.Zc="gs-localAd";udsc.cb="gs-ad-marker";udsc.X="gs-line";udsc.Xc="gs-divider";udsc.zc="gsc-control";udsc.Cc="gsc-narrow"
;udsc.Mb="gsc-search-box";udsc.Nb="gsc-search-button";udsc.Gb="gsc-clear-button";udsc.Ib="gsc-input";udsc.wa="gsc-branding";udsc.Fb="gsc-branding-vertical";udsc.sc="gsc-branding-img";udsc.tc="gsc-branding-user-defined";udsc.Wa="gsc-branding-img-noclear";udsc.rc="gsc-branding-clickable";udsc.xa="gsc-branding-text";udsc.Ya="gsc-resultsRoot";udsc.Hc="gsc-results";udsc.Xa="gsc-result";udsc.Gc="gsc-resultsHeader";udsc.V="gsc-resultsbox-invisible";udsc.W="gsc-resultsbox-visible";udsc.Ac="gsc-expansionArea"
;udsc.Nc="gsc-trailing-more-results";udsc.qc="gsc-ad-box";udsc.Oc="gsc-twiddleRegionCell";udsc.uc="gsc-configLabelCell";udsc.wc="gsc-configLabel";udsc.Pc="gsc-twiddle";udsc.ga="gsc-twiddle-closed";udsc.Ca="gsc-twiddle-opened";udsc.Mc="gsc-title";udsc.Jc="gsc-stats";udsc.Jb="gsc-keeper";udsc.Fc="gsc-result-selector gsc-one-result";udsc.Ec="gsc-result-selector gsc-more-results";udsc.Dc="gsc-result-selector gsc-all-results";udsc.Ic="gsc-results-selector";udsc.Lb="gsc-one-result-active";udsc.Kb="gsc-more-results-active"
;udsc.Eb="gsc-all-results-active";udsc.Pb="gsc-tabsArea";udsc.Ob="gsc-tabsAreaInvisible";udsc.Lc="gsc-tabHeader";udsc.ab="gsc-tabhActive";udsc.bb="gsc-tabhInactive";udsc.Za="gsc-tabdActive";udsc.$a="gsc-tabdInactive";udsc.Kc="gsc-tabData";udsc.Hb="gsc-config";udsc.Ba="gsc-configSetting";udsc.P="gsc-configSettingSubmit";udsc.Aa="gsc-configSettingCheckbox";udsc.ya="gsc-configSettingCheckboxLabel";udsc.yc="gsc-configSettingInput";udsc.xc="gsc-configSettingInputLabel";udsc.Bc="gsc-locationConfig";udsc.Qc=
"gsc-video-player";udsc.Sd="as-results";udsc.Va="as-result-vertical";udsc.Db="as-result-horizontal";udsc.Cb="as-result-cell";udsc.Rd="as-branding-cell";
GSearch.BASE=UDS_ServiceBase;GSearch.LARGE_RESULTSET="large";GSearch.SMALL_RESULTSET="small";GSearch.LARGE_RESULTS=8;GSearch.LARGE_ADS=4;GSearch.SMALL_RESULTS=4;GSearch.SMALL_ADS=2;GSearch.KEEP_SWEEPER_DELAY=5000;GSearch.LINK_TARGET_TOP="_top";GSearch.LINK_TARGET_SELF="_self";GSearch.LINK_TARGET_PARENT="_parent";GSearch.LINK_TARGET_BLANK="_blank";GSearch.ORDER_BY_RELEVANCE="order-by-relevance";GSearch.ORDER_BY_DATE="order-by-date";function GSearch(){this.Wd=null;this.Q=null;this.pc=0;this.Sa=0;this.pb=
true;this.N={width:100,height:75};this.R=GSearch.LINK_TARGET_BLANK;this.jc=1;this.setResultSetSize(GSearch.SMALL_RESULTSET);this.clearResults();this.kb=null;this.lb=null;this.Ab=null;this.tb=null;this.va=null;this.ta=null;this.Ja=null;this.l="null";this.g=null;this.K=null}
GSearch.prototype.Hd=function(){var uds=this.ca+"?hl="+UDS_CurrentLocale+"&source=uds";if(this.K){uds=uds+this.K}else{uds=uds+"&q="}if(this.ka&&this.ka!=""){return this.ka}else{return uds}}
;GSearch.prototype.setQueryAddition=function(uds){if(uds==null||uds==""){this.g=null}else{this.g=uds}}
;GSearch.prototype.G=function(uds,udsb){var udsa=GSearch.BASE+this.u+"?callback="+uds+"&context="+udsb+"&lstkp="+this.od()+"&rsz="+this.Na+"&hl="+UDS_CurrentLocale;if(this.rb){udsa+="&gss="+this.rb}if(UDS_JSHash){udsa+="&sig="+UDS_JSHash}return udsa}
;GSearch.prototype.setLinkTarget=function(uds){this.R=uds}
;GSearch.prototype.e=function(){if(this.R&&this.R!=""){return this.R}else{return null}}
;GSearch.prototype.gc=function(){this.pc++;this.Sa++;if(this.Ja){clearTimeout(this.Ja)}this.Ja=setTimeout(udst(this,this.execute,[null]),GSearch.KEEP_SWEEPER_DELAY)}
;GSearch.prototype.od=function(){clearTimeout(this.Ja);var uds=this.Sa;this.Sa=0;return uds}
;GSearch.prototype.qb=function(){if(this.kb==null){this.kb="gsc-"+this.l+"Result"}return this.kb}
;GSearch.prototype.I=function(){if(this.lb==null){this.lb="gs-"+this.l+"Result"}return this.lb}
;GSearch.prototype.yd=function(){if(this.Ab==null){this.Ab=udsi[this.l]}if(this.va){return this.va}else{return this.Ab}}
;GSearch.prototype.wd=function(){if(this.tb==null){this.tb=udsi[this.l]}if(this.va){return this.va}else{return this.tb}}
;GSearch.prototype.getResultSetSize=function(){return this.Na}
;GSearch.prototype.setResultSetSize=function(uds){switch(uds){case GSearch.LARGE_RESULTSET:this.Na=GSearch.LARGE_RESULTSET;break;default:case GSearch.SMALL_RESULTSET:this.Na=GSearch.SMALL_RESULTSET;break}}
;GSearch.prototype.execute=function(uds){var udsb=this.n(uds,null,null);udsO(udsb)}
;GSearch.prototype.getExecuteUrl=function(uds,udsb,udsa){var udsd=this.n(uds,udsb,udsa);return udsX(udsd)}
;GSearch.prototype.s=function(uds){var udsb="http://code.google.com/apis/ajaxsearch/faq.html";var udsa=udsi["watermark"]+" - "+this.pd();var udsd=udsq(udsb,udsa,"_blank",udsc.hd);udsg(uds,udsd)}
;GSearch.prototype.pd=function(){var uds=new Date;var udsb=uds.getMonth()+1+"/"+uds.getFullYear();return udsb}
;GSearch.prototype.formatToShortDate=function(uds){var udsb;var udsa=uds.getFullYear();var udsd=uds.getMonth();var udsf=udsi["month-abbr"][udsd];var udse=uds.getDate();if(udse<10){udse="0"+udse}switch(UDS_ShortDatePattern){case "MDY":udsb=udsf+" "+udse+", "+udsa;break;case "YMD":udsb=udsa+" "+udsf+" "+udse;break;default:case "DMY":udsb=udse+" "+udsf+" "+udsa;break}return udsb}
;GSearch.ac=3600000;GSearch.kd=60000;GSearch.jd=86400000;GSearch.prototype.formatToRelativeDate=function(uds){var udsb=new Date;var udsa=udsb.getTime();var udsd=uds.getTime();var udsf;if(udsa<udsd){return udsi["n-minutes-ago"](2)}var udse=udsa-udsd;if(udse<GSearch.ac){var udsh=parseInt(udse/GSearch.kd);if(udsh<=1){udsf=2}else{udsf=udsh}return udsi["n-minutes-ago"](udsf)}if(udse<GSearch.jd){var udsj=parseInt(udse/GSearch.ac);if(udsj<=1){return udsi["one-hour-ago"]}else{udsf=udsj;return udsi["n-hours-ago"
](udsf)}}return this.formatToShortDate(uds)}
;GSearch.prototype.clearResults=function(){this.gwsUrl=null;this.Xd=null;this.results=new Array;this.adResults=new Array}
;GSearch.prototype.fc=function(){if(this.dc){this.dc()}}
;GSearch.prototype.onSearchComplete=function(uds,udsb,udsa,udsd){if(uds==null&&udsb==204){return}this.gwsUrl=null;if(uds&&uds.results&&uds.results.length>0){this.results=uds.results;if(this.K&&this.ca){this.gwsUrl=this.Hd()}}else{this.results=new Array}if(uds&&uds.adResults&&uds.adResults.length>0){this.adResults=uds.adResults}else{this.adResults=new Array}this.completionStatus=udsb;this.hashStatus=udsd;this.completionFailureDetails=udsa;if(uds&&uds.resultAttribution&&uds.resultAttribution!=null&&
uds.resultAttribution!=""){this.Ma=uds.resultAttribution}else{this.Ma=null}if(this.pb){this.cc()}this.fc()}
;GSearch.prototype.getAttribution=function(){var uds=null;if(this.Ma){uds=udsk(this.Ma,udsc.dd)}return uds}
;GSearch.prototype.cc=function(){var uds;var udsb;for(uds=0;uds<this.results.length;uds++){udsb=this.results[uds];this.createResultHtml(udsb)}for(uds=0;uds<this.adResults.length;uds++){udsb=this.adResults[uds];this.ja(udsb)}}
;GSearch.prototype.ja=function(uds){if(uds.html){delete uds.html}}
;GSearch.prototype.setSearchCompleteCallback=function(uds,udsb,udsa){if(!udsa){udsa=[null]}this.dc=udst(uds,udsb,udsa)}
;GSearch.AllocateCompletionMapContext=function(uds,udsb){var udsa=false;var udsd=null;if(uds.length){for(var udsf=0;udsf<uds.length;udsf++){if(uds[udsf]==null){uds[udsf]=udsb;udsd=udsf;udsa=true;break}}}if(!udsa){udsd=uds.length;uds.push(udsb)}return udsd}
;GSearch.prototype.setUserDefinedLabel=function(uds){this.va=uds}
;GSearch.prototype.setUserDefinedClassSuffix=function(uds){this.ta=uds}
;GSearch.prototype.setNoHtmlGeneration=function(){this.pb=false}
;GSearch.scaleImage=function(uds,udsb,udsa,udsd){var udsf=udsa.width/uds;var udse=udsa.height/udsb;var udsh=Math.min(udsf,udse);var udsj=Math.min(udsh,1);var udsl=new Object;udsl.width=Math.round(uds*udsj);udsl.height=Math.round(udsb*udsj);if(udsd){udsd.width=udsl.width;udsd.height=udsl.height}return udsl}
;GSearch.VERTICAL_BRANDING=1;GSearch.HORIZONTAL_BRANDING=2;GSearch.getBranding=function(uds,udsb,udsa){var udsd=udsn(udsc.wa);var udsf=udsE(null,null,udsc.wa);udsg(udsd,udsf);var udse=true;if(udsb){if(udsb==GSearch.VERTICAL_BRANDING){udse=false;udsm(udsd,udsc.Fb);udsm(udsf,udsc.Fb)}else if(udsb==GSearch.HORIZONTAL_BRANDING){udse=true}else{udse=true}}var udsh=udsC(udsf,0);var udsj;var udsl;if(udse){udsj=udsh;udsl=udsh}else{udsj=udsh;udsl=udsC(udsf,0)}var udso=udss(udsj,udsc.xa);var udsp=udss(udsl,
udsc.Wa);var udsu=udsk(udsi["powered-by"],udsc.xa);var udsw=UDS_ServiceBase+"/css/small-logo.png";var udsv=udsW(udsw,51,15,udsc.Wa);udsg(udso,udsu);if(udsa){var udsx="http://www.google.com";if(typeof udsa=="string"&&udsa.match(/^http:\/\/[a-z]*\.google\.com/)){udsx=udsa}var udsA=udsL(udsx,null,"_BLANK");udsA.className=udsc.rc;udsg(udsA,udsv);udsg(udsp,udsA)}else{udsg(udsp,udsv)}if(uds){udsF(uds);udsg(uds,udsd)}return udsd}
;GSearch.setOnLoadCallback=function(uds){var udsb=window;if(udsb.addEventListener){udsb.addEventListener("load",uds,false)}else if(udsb.attachEvent){udsb.attachEvent("onload",uds)}else{udsb["onload"]=uds}}
;
function GwebSearch(){GSearch.call(this);this.l="web";this.u="/GwebSearch";this.ca="http://www.google.com/search";this.h=null;this.ba=false;this.Ga=null;this.mb=null;this.ka=null}
GwebSearch.inherits(GSearch);GwebSearch.RESULT_CLASS="GwebSearch";GwebSearch.AD_CLASS="GwebSearch.ad";GwebSearch.c=new Array;GwebSearch.RawCompletion=function(uds,udsb,udsa,udsd,udsf){var udse=0;if(uds){udse=parseInt(uds)}var udsh=GwebSearch.c[udse];GwebSearch.c[udse]=null;udsh.onSearchComplete(udsb,udsa,udsd,udsf)}
;GwebSearch.prototype.n=function(uds,udsb,udsa){var udsd;if(udsa==null){udsd=GSearch.AllocateCompletionMapContext(GwebSearch.c,this)}else{udsd=udsa}var udsf;if(udsb==null){udsf="GwebSearch.RawCompletion"}else{udsf=udsb}var udse=this.G(udsf,udsd);if(uds){var udsh;var udsj=uds;if(this.g){udsj=udsj+" "+this.g}if(this.h&&this.ba==true&&this.mb){var udsl=this.mb;udsl=udsl.replace(/__HL__/,UDS_CurrentLocale);udsl=udsl.replace(/__QUERY__/,encodeURIComponent(udsj));this.ka=udsl}if(this.h&&this.ba==false)
{udsj=udsj+" site:"+this.h}udsh="";if(this.h&&this.ba==true){udsh=udsh+"&cx="+this.h;if(this.Ga!=null){udsj=udsj+" more:"+this.Ga}}udsh=udsh+"&q="+encodeURIComponent(udsj);udse=udse+udsh;this.K=udsh}return udse}
;GwebSearch.prototype.createResultHtml=function(uds){if(uds.html){delete uds.html}var udsb=udsn(this.I());udsm(udsb,udsc.q);var udsa;udsa=udsq(uds.unescapedUrl,uds.title,this.e(),udsc.r);udsg(udsb,udsa);udsa=udsk(uds.content,udsc.Y);udsg(udsb,udsa);udsa=udsk(uds.visibleUrl,udsc.v);udsg(udsb,udsa);udsm(udsa,udsc.Zb);var udsd=uds.unescapedUrl.indexOf(uds.visibleUrl);var udsf=uds.visibleUrl;if(udsd!=-1&&udsd!=0){udsf=uds.unescapedUrl.substring(udsd)}udsa=udsk(udsf,udsc.v);udsm(udsa,udsc.eb);udsg(udsb,
udsa);uds.html=udsb;this.s(uds.html)}
;GwebSearch.prototype.ja=function(uds){if(uds.html){delete uds.html}var udsb=udsn(udsc.$b);udsm(udsb,udsc.q);var udsa;udsa=udsq(uds.unescapedUrl,uds.title,this.e(),udsc.r);udsg(udsb,udsa);if(uds.content1){udsa=udsk(uds.content1,udsc.X);udsg(udsb,udsa)}if(uds.content2){udsa=udsk(uds.content2,udsc.X);udsg(udsb,udsa)}udsa=udsk(uds.visibleUrl,udsc.v);var udsd=udsD(uds.impressionUrl,12,12,udsc.cb);udsg(udsa,udsd);udsg(udsb,udsa);uds.html=udsb;this.s(uds.html)}
;GwebSearch.prototype.setSiteRestriction=function(uds,udsb,udsa){this.ka=null;if(uds==null||uds==""){this.h=null;this.ba=false;this.Ga=null}else{var udsd=uds.match(/^\d{21}:.*/);if(udsd){this.h=uds;this.ba=true;if(udsb){this.Ga=udsb}if(udsa){if(udsa.match(/__HL__/)&&udsa.match(/__QUERY__/)){this.mb=udsa}}}else{this.h=uds;this.ba=false}}}
;
function GadSearch(uds,udsb,udsa){GSearch.call(this);this.l="ad";this.u="/GadSearch";this.lc();if(udsa&&uds==null&&udsb==null){this.bootOptions=udsa;this.boot()}else{this.setRoot(uds);if(udsb){this.mc(udsb)}}}
GadSearch.inherits(GSearch);GadSearch.RESULT_CLASS="GwebSearch";GadSearch.AD_CLASS="GwebSearch.ad";GadSearch.c=new Array;GadSearch.RawCompletion=function(uds,udsb,udsa,udsd,udsf){var udse=0;if(uds){udse=parseInt(uds)}var udsh=GadSearch.c[udse];GadSearch.c[udse]=null;udsh.onSearchComplete(udsb,udsa,udsd,udsf)}
;GadSearch.prototype.ud=function(uds){this.setResultSetSize(GadSearch.p[this.b.C].vb);var udsb=this.n(uds,null,null);udsO(udsb)}
;GadSearch.prototype.n=function(uds,udsb,udsa){var udsd;if(udsa==null){udsd=GSearch.AllocateCompletionMapContext(GadSearch.c,this)}else{udsd=udsa}var udsf;if(udsb==null){udsf="GadSearch.RawCompletion"}else{udsf=udsb}var udse=this.G(udsf,udsd);if(uds){var udsh=uds;udse=udse+"&q="+encodeURIComponent(udsh)}return udse}
;GadSearch.prototype.createResultHtml=function(uds){if(uds.html){delete uds.html}var udsb=udsn(this.I());udsm(udsb,udsc.q);var udsa;udsa=udsq(uds.unescapedUrl,uds.title,this.e(),udsc.r);udsg(udsb,udsa);udsa=udsk(uds.content,udsc.Y);udsg(udsb,udsa);udsa=udsk(uds.visibleUrl,udsc.v);udsg(udsb,udsa);udsm(udsa,udsc.Zb);var udsd=uds.unescapedUrl.indexOf(uds.visibleUrl);var udsf=uds.visibleUrl;if(udsd!=-1&&udsd!=0){udsf=uds.unescapedUrl.substring(udsd)}udsa=udsk(udsf,udsc.v);udsm(udsa,udsc.eb);udsg(udsb,
udsa);uds.html=udsb;this.s(uds.html)}
;GadSearch.prototype.ja=function(uds){if(uds.html){delete uds.html}var udsb=udsn(udsc.$b);udsm(udsb,udsc.q);var udsa;udsa=udsq(uds.unescapedUrl,uds.title,this.e(),udsc.r);udsg(udsb,udsa);if(uds.content1){udsa=udsk(uds.content1,udsc.X);udsg(udsb,udsa)}if(uds.content2){udsa=udsk(uds.content2,udsc.X);udsg(udsb,udsa)}udsa=udsk(uds.visibleUrl,udsc.v);var udsd=udsD(uds.impressionUrl,12,12,udsc.cb);udsg(udsa,udsd);udsg(udsb,udsa);uds.html=udsb;this.s(uds.html)}
;GadSearch.TYPE_H3="h3";GadSearch.TYPE_V3="v3";GadSearch.TYPE_V6="v6";GadSearch.p={h3:{gb:udsc.Db,Bb:"740px",sb:"85px",C:GadSearch.TYPE_H3,D:false,F:3,vb:GSearch.SMALL_RESULTSET},v3:{gb:udsc.Va,Bb:"230px",sb:"205px",C:GadSearch.TYPE_V3,D:true,F:3,vb:GSearch.SMALL_RESULTSET},v6:{gb:udsc.Va,Bb:"230px",sb:"410px",C:GadSearch.TYPE_V6,D:true,F:6,vb:GSearch.LARGE_RESULTSET}};GadSearch.prototype.setRoot=function(uds){this.fa=uds;udsF(this.fa)}
;GadSearch.prototype.lc=function(){this.b=new Object;var uds=GadSearch.TYPE_V3;this.b.C=GadSearch.p[uds].C;this.b.D=GadSearch.p[uds].D;this.b.F=GadSearch.p[uds].F;this.b.ib=null;this.nc()}
;GadSearch.prototype.mc=function(uds){this.lc();for(var udsb in uds){var udsa=uds[udsb];switch(udsb){case "type":switch(udsa){case GadSearch.TYPE_H3:case GadSearch.TYPE_V3:case GadSearch.TYPE_V6:this.b.C=GadSearch.p[udsa].C;this.b.D=GadSearch.p[udsa].D;this.b.F=GadSearch.p[udsa].F;break;default:udsa=GadSearch.TYPE_V3;this.b.C=GadSearch.p[udsa].C;this.b.D=GadSearch.p[udsa].D;this.b.F=GadSearch.p[udsa].F;break}break;case "colors":var udsd="";if(uds.colors.background){udsd+="&cb="+uds.colors.background}
if(uds.colors.link){udsd+="&cl="+uds.colors.link}if(uds.colors.text){udsd+="&ct="+uds.colors.text}if(uds.colors.text){udsd+="&cu="+uds.colors.url}this.b.ib=udsd;break}}this.nc()}
;GadSearch.prototype.nc=function(){var uds="";var udsb;udsb=this.b.C;uds+="&aqt="+udsb;if(this.b.ib){uds+=this.b.ib}this.Id=uds}
;GadSearch.prototype.execute=function(uds){var udsb=(new Date).getTime();this.u="/GadSearch/"+udsb;var udsa=this.n("nothing","x","y");this.u="/GadSearch";var udsd=uds;if(this.g){udsd=udsd+" "+this.g}udsa=udsa+"&boot="+encodeURIComponent(udsd)+this.Id;var udsf="&dt="+(new Date).getTime();udsa+=udsf;var udse=this.qd(udsa);udsU(this.fa,udse)}
;GadSearch.prototype.qd=function(uds){var udsb=this.b.C;var udsa;if(udsN()){udsa=document.createElement("<iframe frameborder=no scrolling=no>")}else{udsa=document.createElement("iframe");udsa.setAttribute("frameborder","no");udsa.setAttribute("scrolling","no")}udsa.className=GadSearch.p[udsb].gb;udsa.style.width=GadSearch.p[udsb].Bb;udsa.style.height=GadSearch.p[udsb].sb;udsa.style.border="none";udsa.id=(new Date).getTime();udsa.src=uds;return udsa}
;GadSearch.prototype.boot=function(){if(!this.bootOptions){alert("options not set");return}this.setRoot(document.getElementById(this.bootOptions.resultsRoot));this.mc(this.bootOptions);this.setLinkTarget(GSearch.LINK_TARGET_PARENT);this.setSearchCompleteCallback(this,GadSearch.prototype.nd,[null]);this.ud(this.bootOptions.bootQuery)}
;GadSearch.prototype.nd=function(){if(this.adResults&&this.adResults.length>0){var uds=this.adResults.length;if(uds>this.F){uds=this.F}var udsb;var udsa;var udsd=null;if(this.b.D){udsa=udsE(null,null,udsc.Va)}else{udsa=udsE(null,null,udsc.Db)}for(var udsf=0;udsf<uds;udsf++){var udse=this.adResults[udsf];var udsh=udse.html.cloneNode(true);if(this.b.D){udsd=udsC(udsa,0)}else{if(udsd==null){udsd=udsC(udsa,0)}}udsb=udss(udsd,udsc.Cb);udsb.appendChild(udsh)}udsd=udsC(udsa,0);udsb=udss(udsd,udsc.Cb);if(
!this.b.D){udsb.setAttribute("colspan",uds)}var udsj=udsk("Ads by Google",udsc.wa);udsg(udsb,udsj);this.fa.appendChild(udsa)}}
;
function GsaSearch(uds){GSearch.call(this);this.md=uds;this.l="sa";this.u="/ajax"}
GsaSearch.inherits(GSearch);GsaSearch.RESULT_CLASS="GsaSearch";GsaSearch.AD_CLASS="GsaSearch.ad";GsaSearch.c=new Array;GsaSearch.RawCompletion=function(uds,udsb,udsa){var udsd=0;if(uds){udsd=parseInt(uds)}var udsf=GsaSearch.c[udsd];GsaSearch.c[udsd]=null;udsf.onSearchComplete(udsb,udsa)}
;GsaSearch.NEXT_PAGE="next";GsaSearch.PREV_PAGE="prev";GsaSearch.prototype.execute=function(uds,udsb){var udsa=this.n(uds,null,null,udsb);udsO(udsa)}
;GsaSearch.prototype.n=function(uds,udsb,udsa,udsd){var udsf;if(udsa==null){udsf=GSearch.AllocateCompletionMapContext(GsaSearch.c,this)}else{udsf=udsa}var udse;if(udsb==null){udse="GsaSearch.RawCompletion"}else{udse=udsb}var udsh=this.G(udse,udsf,udsd);if(uds){var udsj=uds;if(this.g){udsj=udsj+" "+this.g}udsh=udsh+"&q="+encodeURIComponent(udsj)}return udsh}
;GsaSearch.prototype.createResultHtml=function(uds){if(uds.html){delete uds.html}var udsb=udsn(this.I());udsm(udsb,udsc.q);var udsa;udsa=udsq(uds.unescapedUrl,uds.title,this.e(),udsc.r);udsg(udsb,udsa);udsa=udsk(uds.content,udsc.Y);udsg(udsb,udsa);udsa=udsk(uds.visibleUrl,udsc.v);udsg(udsb,udsa);udsm(udsa,udsc.eb);uds.html=udsb;this.s(uds.html)}
;GsaSearch.sd="&ajax_version=1.0&client=default_frontend&site=default_collection&ie=UTF-8&oe=UTF-8";GsaSearch.prototype.G=function(uds,udsb,udsa){var udsd=this.md+this.u+"?ajax_callback="+uds+"&ajax_context="+udsb+"&hl="+UDS_CurrentLocale+GsaSearch.sd+"&num="+this.La+this.xd(udsa);return udsd}
;GsaSearch.prototype.gc=function(){this.pc++;this.Sa++}
;GsaSearch.prototype.onSearchComplete=function(uds,udsb){if(uds==null&&udsb==204){return}if(uds&&uds.results&&uds.results.length>0){this.results=new Array;for(var udsa=0;udsa<uds.results.length;udsa++){var udsd=uds.results[udsa];var udsf=new Object;udsf.GsearchResultClass=udsd.GsearchResultClass;udsf.unescapedUrl=udsd.unescapedUrl;udsf.url=udsd.url;udsf.visibleUrl=udsd.visibleUrl;udsf.title=udsd.title;udsf.titleNoFormatting=udsd.titleNoFormatting;udsf.content=udsd.snippet;this.results.push(udsf)}
this.Pa=uds.start_index;this.Ha=uds.end_index;this.nb=uds.est}else{this.results=new Array;this.Pa=0;this.Ha=0;this.nb=0}this.completionStatus=udsb;this.hashStatus=200;this.completionFailureDetails="";this.Ma=null;if(this.pb){this.cc()}this.fc()}
;GsaSearch.prototype.setResultSetSize=function(uds){this.__super__(GSearch.prototype.setResultSetSize,uds);switch(this.Na){case GSearch.LARGE_RESULTSET:this.La=8;break;case GSearch.SMALL_RESULTSET:this.La=4;break}}
;GsaSearch.prototype.xd=function(uds){var udsb="";if(uds&&this.completionStatus==200&&this.Pa&&this.Ha&&this.nb){if(uds==GsaSearch.NEXT_PAGE){if(this.Ha<this.nb){udsb="&start="+this.Ha}}else if(uds==GsaSearch.PREV_PAGE){var udsa;if(this.Pa>this.La+1){udsa=this.Pa-(this.La+1)}else{udsa=0}udsb="&start="+udsa}}return udsb}
;
function GnewsSearch(){GSearch.call(this);this.l="news";this.u="/GnewsSearch";this.ca="http://news.google.com/nwshp";this.Yd=null;this.f=false;this.ia=true;this.Q=udsG(this,GnewsSearch.prototype.S);this.ha="gsc-newsConfig";this.d=null}
GnewsSearch.inherits(GSearch);GnewsSearch.RESULT_CLASS="GnewsSearch";GnewsSearch.c=new Array;GnewsSearch.RawCompletion=function(uds,udsb,udsa,udsd,udsf){var udse=0;if(uds){udse=parseInt(uds)}var udsh=GnewsSearch.c[udse];GnewsSearch.c[udse]=null;udsh.onSearchComplete(udsb,udsa,udsd,udsf)}
;GnewsSearch.prototype.n=function(uds,udsb,udsa){var udsd;if(udsa==null){udsd=GSearch.AllocateCompletionMapContext(GnewsSearch.c,this)}else{udsd=udsa}var udsf;if(udsb==null){udsf="GnewsSearch.RawCompletion"}else{udsf=udsb}var udse=this.G(udsf,udsd);if(uds){var udsh;var udsj=uds;if(this.g){udsj=udsj+" "+this.g}if(this.h){udsj=udsj+" source:"+this.h}udsh="&q="+encodeURIComponent(udsj);if(this.f){udsh=udsh+"&scoring=d"}if(this.h){udse=udse.replace(/&hl=.*&/,"&hl=en&")}udse=udse+udsh;this.K=udsh}return udse}

;GnewsSearch.prototype.createResultHtml=function(uds){if(uds.html){delete uds.html}var udsb=udsn(this.I());udsm(udsb,udsc.q);var udsa;udsa=udsq(uds.unescapedUrl,uds.title,this.e(),udsc.r);udsg(udsb,udsa);udsa=udsk(uds.publisher,udsc.Tb);udsg(udsb,udsa);var udsd=uds.location.split(",");if(udsd.length>1){var udsf=", "+udsd[udsd.length-1];udsa=udsk(udsf,udsc.$c);udsg(udsb,udsa)}var udse=new Date(uds.publishedDate);udsa=udsk(" - "+this.formatToShortDate(udse),udsc.Da);udsg(udsb,udsa);var udse=new Date(
uds.publishedDate);udsa=udsk(" - "+this.formatToRelativeDate(udse),udsc.Vb);udsg(udsb,udsa);udsa=udsk(uds.content,udsc.Y);udsg(udsb,udsa);if(uds.clusterUrl&&uds.clusterUrl!=""){udsa=udsq(uds.clusterUrl,udsi["related-articles"]+"&nbsp;&raquo;",this.e(),udsc.Tc);udsg(udsb,udsa)}uds.html=udsb;this.s(uds.html)}
;GnewsSearch.prototype.setSiteRestriction=function(uds){if(uds==null||uds==""){this.h=null}else{this.h=uds.replace(/\s/g,"_")}}
;GnewsSearch.prototype.setResultOrder=function(uds){if(uds==GSearch.ORDER_BY_DATE){this.f=true}else if(uds==GSearch.ORDER_BY_RELEVANCE){this.f=false}else{this.f=false}}
;GnewsSearch.prototype.S=function(uds,udsb){if(udsb){if(this.d==null){var udsa=udsn(udsc.Ba);this.d=udsK(null,"0",this.f?true:false,udsc.Aa);udsg(udsa,this.d);udsg(udsa,udsk(udsi["sort-by-date"],udsc.ya));var udsd=udsn(udsc.P);udsg(udsd,udsH(udsi["close"],udsc.P));udsg(udsa,udsd);udsg(uds,udsa);this.d.focus()}else{this.d.checked=this.f?true:false;this.d.focus()}}else{if(this.d){if(this.d.checked){this.setResultOrder(GSearch.ORDER_BY_DATE)}else{this.setResultOrder(GSearch.ORDER_BY_RELEVANCE)}}}}
;
function GimageSearch(){GSearch.call(this);this.jc=4;this.l="image";this.u="/GimageSearch"}
GimageSearch.inherits(GSearch);GimageSearch.RESULT_CLASS="GimageSearch";GimageSearch.AD_CLASS="GwebSearch.ad";GimageSearch.c=new Array;GimageSearch.RawCompletion=function(uds,udsb,udsa,udsd,udsf){var udse=0;if(uds){udse=parseInt(uds)}var udsh=GimageSearch.c[udse];GimageSearch.c[udse]=null;udsh.onSearchComplete(udsb,udsa,udsd,udsf)}
;GimageSearch.prototype.n=function(uds,udsb,udsa){var udsd;if(udsa==null){udsd=GSearch.AllocateCompletionMapContext(GimageSearch.c,this)}else{udsd=udsa}var udsf;if(udsb==null){udsf="GimageSearch.RawCompletion"}else{udsf=udsb}var udse=this.G(udsf,udsd);if(uds){var udsh=uds;if(this.g){udsh=udsh+" "+this.g}udse=udse+"&q="+encodeURIComponent(udsh)}return udse}
;GimageSearch.prototype.createResultHtml=function(uds){if(uds.html){delete uds.html}var udsb=udsn(this.I());udsm(udsb,udsc.q);var udsa=GSearch.scaleImage(uds.tbWidth,uds.tbHeight,this.N);var udsd=udsD(uds.tbUrl,udsa.width,udsa.height,udsc.H);var udsf=udsL(uds.originalContextUrl,null,this.e(),udsc.H);udsB(udsf,udsc.H);udsg(udsf,udsd);udsg(udsb,udsf);var udse;udse=udsq(uds.originalContextUrl,uds.title,this.e(),udsc.r);udsg(udsb,udse);var udsh=uds.width+" x "+uds.height+" px";udse=udsk(udsh,udsc.gd)
;udsg(udsb,udse);udse=udsk(uds.visibleUrl,udsc.v);udsg(udsb,udse);uds.html=udsb;this.s(uds.html)}
;
function GlocalSearch(){GSearch.call(this);this.o=null;this.B="San Francisco, CA";this.z=null;this.ma=true;this.$=false;if(window.location&&window.location.host&&window.location.host!=""){this.rb=uds2(window.location.host)}else{this.rb=".com"}this.ia=true;this.Q=udsG(this,GlocalSearch.prototype.S);this.ha=udsc.Bc;this.l="local";this.u="/GlocalSearch";this.j=null;this.Z=null}
GlocalSearch.inherits(GSearch);GlocalSearch.RESULT_CLASS="GlocalSearch";GlocalSearch.AD_CLASS="GlocalSearch.ad";GlocalSearch.c=new Array;GlocalSearch.RawCompletion=function(uds,udsb,udsa,udsd,udsf){var udse=0;if(uds){udse=parseInt(uds)}var udsh=GlocalSearch.c[udse];GlocalSearch.c[udse]=null;udsh.onSearchComplete(udsb,udsa,udsd,udsf)}
;GlocalSearch.prototype.n=function(uds,udsb,udsa){var udsd;if(udsa==null){udsd=GSearch.AllocateCompletionMapContext(GlocalSearch.c,this)}else{udsd=udsa}var udsf;if(udsb==null){udsf="GlocalSearch.RawCompletion"}else{udsf=udsb}var udse=this.G(udsf,udsd);if(uds){udse=udse+"&q="+encodeURIComponent(uds)}var udsh;if(this.o){var udsj;var udsl;var udso;if(this.ma){udsj=this.o.getCenterLatLng();udsl=this.o.getSpanLatLng();udso=this.o.getZoomLevel();if(udso<0){udso=0}else if(udso>10){udso=10}udsh="&sll="+udsj.y+
","+udsj.x;udsh+="&sspn="+udsl.height+","+udsl.width;udsh+="&z="+udso;udsh+=GlocalSearch.centerToGll(udsj.y,udsj.x);udse+=udsh}else{udsj=this.o.getCenter();udsl=this.o.getBounds().toSpan().toUrlValue();udso=17-this.o.getZoom();if(udso<0){udso=0}else if(udso>10){udso=10}udsh="&sll="+udsj.y+","+udsj.x;udsh+="&sspn="+udsl;udsh+="&z="+udso;udsh+=GlocalSearch.centerToGll(udsj.y,udsj.x);udse+=udsh}}else if(this.z){udsh="&sll="+this.z.y+","+this.z.x;udsh+="&z=6";udsh+=GlocalSearch.centerToGll(this.z.y,this.z.x)
;udse+=udsh}else if(this.B){udsh="&near="+escape(this.B);udse+=udsh}if(this.$){udse+="&nogeocode=t"}return udse}
;GlocalSearch.Gd=3.141592653589;GlocalSearch.td=6367000;GlocalSearch.Qd=16093;GlocalSearch.centerToGll=function(uds,udsb){var udsa=GlocalSearch.Qd;var udsd=2*udsa/GlocalSearch.td*2*GlocalSearch.Gd;var udsf=uds-udsd;var udse=udsb-udsd;var udsh=uds+udsd;var udsj=udsb+udsd;var udsl="&gll="+parseInt(udsf*1000000)+","+parseInt(udse*1000000)+","+parseInt(udsh*1000000)+","+parseInt(udsj*1000000)+"&llsep=500,500";return udsl}
;GlocalSearch.prototype.createResultHtml=function(uds){if(uds.html){delete uds.html}var udsb=udsn(this.I());udsm(udsb,udsc.q);var udsa;udsa=udsq(uds.url,uds.title,this.e(),udsc.r);udsg(udsb,udsa);var udsd=udsn(udsc.Qb);udsa=udsk(uds.streetAddress,udsc.Yb);udsg(udsd,udsa);var udsf="";if(uds.city!=""){udsf=uds.city;if(uds.region!=""){udsf+=", "}}udsa=udsk(udsf,udsc.Rb);udsg(udsd,udsa);udsa=udsk(uds.region,udsc.Ub);udsg(udsd,udsa);udsa=udsk(uds.country,udsc.Uc);udsg(udsd,udsa);udsg(udsb,udsd);if(uds.phoneNumbers&&
uds.phoneNumbers.length){var udse=null;var udsh=null;var udsj=uds.phoneNumbers[0];var udsl;for(var udso=0;udso<uds.phoneNumbers.length;udso++){udsl=uds.phoneNumbers[udso];if(udsl.type=="main"){udse=udsl;break}if(udsl.type==""||udsl.type=="mobile"&&udsh==null){udsh=udsl}}if(udse){udsl=udse}else if(udsh){udsl=udsh}else{udsl=udsj}udsa=udsk(udsl.number,udsc.Sb);udsg(udsb,udsa)}if(uds.ddUrl&&uds.ddUrl!=""){udsa=udsq(uds.ddUrl,udsi["directions"],this.e(),udsc.Vc);udsg(udsb,udsa)}if(uds.ddUrlToHere&&uds.ddUrlToHere!=
""&&uds.ddUrlFromHere&&uds.ddUrlFromHere!=""){udsa=udsn(udsc.Wc);var udsp=udsk(udsi["get-directions"]+":",udsc.Yc);udsa.appendChild(udsp);udsp=udsq(uds.ddUrlToHere,udsi["to-here"],this.e(),udsc.Wb);udsa.appendChild(udsp);udsp=udsk("-",udsc.Xb);udsa.appendChild(udsp);udsp=udsq(uds.ddUrlFromHere,udsi["from-here"],this.e(),udsc.Wb);udsa.appendChild(udsp);udsg(udsb,udsa)}uds.html=udsb;this.s(uds.html)}
;GlocalSearch.prototype.ja=function(uds){if(uds.html){delete uds.html}var udsb=udsn(udsc.Zc);udsm(udsb,udsc.q);var udsa;udsa=udsq(uds.unescapedUrl,uds.title,this.e(),udsc.r);udsg(udsb,udsa);if(uds.content1){udsa=udsk(uds.content1,udsc.X);udsg(udsb,udsa)}if(uds.content2){udsa=udsk(uds.content2,udsc.X);udsg(udsb,udsa)}if(uds.phoneNumber){udsa=udsk(uds.phoneNumber,udsc.Sb);udsg(udsb,udsa)}udsa=udsk(uds.visibleUrl,udsc.v);var udsd=udsD(uds.impressionUrl,12,12,udsc.cb);udsg(udsa,udsd);udsg(udsb,udsa);
if(uds.streetAddress&&uds.city&&uds.region){var udsf=udsn(udsc.Qb);var udse=uds.streetAddress+", ";udsa=udsk(udse,udsc.Yb);udsg(udsf,udsa);udse=uds.city+", ";udsa=udsk(udse,udsc.Rb);udsg(udsf,udsa);udse=uds.region;udsa=udsk(udse,udsc.Ub);udsg(udsf,udsa);udsg(udsb,udsf)}uds.html=udsb;this.s(uds.html)}
;GlocalSearch.prototype.setCenterPoint=function(uds){if(uds.centerAndZoom){this.ma=true;this.o=uds;this.z=null;this.B="";if(this.j){this.j=null}}else if(uds.setCenter){this.ma=false;this.o=uds;this.z=null;this.B="";if(this.j){this.j=null}}else if(uds.x&&uds.y){this.ma=true;this.z=uds;this.o=null;this.B="";if(this.j){this.j=null}}else{if(uds!=null&&uds!=""){this.ma=true;this.o=null;this.B=uds;this.z=null;if(this.j){this.j=null}var udsb=new GlocalSearch;udsb.setSearchCompleteCallback(this,this.ld,[
udsb,uds]);udsb.execute(uds)}}}
;GlocalSearch.prototype.ld=function(uds,udsb){if(uds.results&&uds.results.length){if(window.GMap){var udsa=new GPoint(parseFloat(uds.results[0].lng),parseFloat(uds.results[0].lat));this.z=udsa}else{this.z=null}this.B=udsb;this.ia=true;this.o=null}}
;GlocalSearch.prototype.S=function(uds,udsb){if(udsb){if(this.j==null){var udsa=null;if(this.o==null){var udsd=udsn(udsc.Ba);this.j=udsR(null,udsc.yc,this.B==""?null:this.B);udsg(udsd,udsk(udsi["search-location"],udsc.xc));udsg(udsd,this.j);udsg(uds,udsd);udsa=this.j}udsd=udsn("gsc-configSetting");this.Z=udsK(null,"0",this.$?true:false,udsc.Aa);udsg(udsd,this.Z);udsg(udsd,udsk(udsi["disable-address-lookup"],udsc.ya));if(udsa==null){udsa=this.Z}var udsf=udsk(null,"gsc-configSettingSubmit");udsg(udsf,
udsH(udsi["close"],udsc.P));udsg(udsd,udsf);udsg(uds,udsd);udsa.focus()}}else{if(this.j){if(this.j.value){this.B=this.j.value;this.setCenterPoint(this.B)}this.j=null}if(this.Z){if(this.Z.checked){this.$=true}else{this.$=false}this.Z=null}udsF(uds)}}
;GlocalSearch.ADDRESS_LOOKUP_DISABLED="disabled";GlocalSearch.ADDRESS_LOOKUP_ENABLED="enabled";GlocalSearch.prototype.setAddressLookupMode=function(uds){if(uds==GlocalSearch.ADDRESS_LOOKUP_DISABLED){this.$=true}else if(uds==GlocalSearch.ADDRESS_LOOKUP_ENABLED){this.$=false}}
;
function GblogSearch(){GSearch.call(this);this.l="blog";this.u="/GblogSearch";this.ca="http://blogsearch.google.com/blogsearch";this.h=null;this.f=false;this.ia=true;this.Q=udsG(this,GblogSearch.prototype.S);this.ha="gsc-blogConfig";this.d=null}
GblogSearch.inherits(GSearch);GblogSearch.RESULT_CLASS="GblogSearch";GblogSearch.AD_CLASS="GwebSearch.ad";GblogSearch.c=new Array;GblogSearch.RawCompletion=function(uds,udsb,udsa,udsd,udsf){var udse=0;if(uds){udse=parseInt(uds)}var udsh=GblogSearch.c[udse];GblogSearch.c[udse]=null;udsh.onSearchComplete(udsb,udsa,udsd,udsf)}
;GblogSearch.prototype.n=function(uds,udsb,udsa){var udsd;if(udsa==null){udsd=GSearch.AllocateCompletionMapContext(GblogSearch.c,this)}else{udsd=udsa}var udsf;if(udsb==null){udsf="GblogSearch.RawCompletion"}else{udsf=udsb}var udse=this.G(udsf,udsd);if(uds){var udsh;var udsj=uds;if(this.g){udsj=udsj+" "+this.g}if(this.h){udsj=udsj+" blogurl:"+this.h}udsh="&q="+encodeURIComponent(udsj);if(this.f){udsh=udsh+"&scoring=d"}udse=udse+udsh;this.K=udsh}return udse}
;GblogSearch.prototype.createResultHtml=function(uds){if(uds.html){delete uds.html}var udsb=udsn(this.I());udsm(udsb,udsc.q);var udsa;udsa=udsq(uds.postUrl,uds.title,this.e(),udsc.r);udsg(udsb,udsa);var udsd=new Date(uds.publishedDate);udsa=udsk(this.formatToShortDate(udsd),udsc.Da);udsg(udsb,udsa);udsd=new Date(uds.publishedDate);udsa=udsk(this.formatToRelativeDate(udsd),udsc.Vb);udsg(udsb,udsa);udsa=udsk(uds.content,udsc.Y);udsg(udsb,udsa);udsa=udsq(uds.blogUrl,uds.blogUrl,this.e(),udsc.v);udsg(
udsb,udsa);uds.html=udsb;this.s(uds.html)}
;GblogSearch.prototype.setSiteRestriction=function(uds){if(uds==null||uds==""){this.h=null}else{this.h=uds}}
;GblogSearch.prototype.setResultOrder=function(uds){if(uds==GSearch.ORDER_BY_DATE){this.f=true}else if(uds==GSearch.ORDER_BY_RELEVANCE){this.f=false}else{this.f=false}}
;GblogSearch.prototype.S=function(uds,udsb){if(udsb){if(this.d==null){var udsa=udsn(udsc.Ba);this.d=udsK(null,"0",this.f?true:false,udsc.Aa);udsg(udsa,this.d);udsg(udsa,udsk(udsi["sort-by-date"],udsc.ya));var udsd=udsn(udsc.P);udsg(udsd,udsH(udsi["close"],udsc.P));udsg(udsa,udsd);udsg(uds,udsa);this.d.focus()}else{this.d.checked=this.f?true:false;this.d.focus()}}else{if(this.d){if(this.d.checked){this.setResultOrder(GSearch.ORDER_BY_DATE)}else{this.setResultOrder(GSearch.ORDER_BY_RELEVANCE)}}}}
;
function GvideoSearch(){GSearch.call(this);this.l="video";this.u="/GvideoSearch";this.ca="http://video.google.com/videosearch";this.f=false;this.ia=true;this.Q=udsG(this,GvideoSearch.prototype.S);this.ha="gsc-videoConfig";this.d=null}
GvideoSearch.inherits(GSearch);GvideoSearch.RESULT_CLASS="GvideoSearch";GvideoSearch.AD_CLASS="GwebSearch.ad";GvideoSearch.c=new Array;GvideoSearch.RawCompletion=function(uds,udsb,udsa,udsd,udsf){var udse=0;if(uds){udse=parseInt(uds)}var udsh=GvideoSearch.c[udse];GvideoSearch.c[udse]=null;udsh.onSearchComplete(udsb,udsa,udsd,udsf)}
;GvideoSearch.prototype.n=function(uds,udsb,udsa){var udsd;if(udsa==null){udsd=GSearch.AllocateCompletionMapContext(GvideoSearch.c,this)}else{udsd=udsa}var udsf;if(udsb==null){udsf="GvideoSearch.RawCompletion"}else{udsf=udsb}var udse=this.G(udsf,udsd);if(uds){var udsh;var udsj=uds;if(this.g){udsj=udsj+" "+this.g}udsh="&q="+encodeURIComponent(udsj);if(this.f){udsh=udsh+"&scoring=d"}udse=udse+udsh;this.K=udsh}return udse}
;GvideoSearch.prototype.createResultHtml=function(uds){if(uds.html){delete uds.html}var udsb=udsn(this.I());udsm(udsb,udsc.q);var udsa=udsn(udsc.db);var udsd=udsn(udsc.Ea);var udsf=udsE();var udse=udsC(udsf,0);var udsh=udss(udse,udsc.db);var udsj=udss(udse,udsc.Ea);udsg(udsh,udsa);udsg(udsj,udsd);udsg(udsb,udsf);var udsl=GSearch.scaleImage(uds.tbWidth,uds.tbHeight,this.N);var udso=udsD(uds.tbUrl,udsl.width,udsl.height,udsc.H);var udsp=udsL(uds.url,null,this.e(),udsc.H);udsB(udsp,udsc.H);udsg(udsp,
udso);udsg(udsa,udsp);var udsu;udsu=udsq(uds.url,uds.title,this.e(),udsc.r);udsg(udsd,udsu);var udsw=udsk(uds.content,udsc.Y);if(udsN()){udsw.style.height="2.6em"}udsg(udsd,udsw);var udsv=new Date(uds.published);udsu=udsk(this.formatToShortDate(udsv),udsc.Da);udsg(udsd,udsu);var udsx="http://"+uds.publisher;udsu=udsq(udsx,uds.publisher,this.e(),udsc.Tb);udsg(udsd,udsu);uds.html=udsb;this.s(uds.html)}
;GvideoSearch.createPlayer=function(uds,udsb){var udsa=null;if(uds.playUrl&&uds.playUrl!=""){var udsd=uds.playUrl;var udsf=udsc.Qc;if(udsb){udsf=udsb}if(udsM("opera")){udsa=document.createElement("object");udsa.className=udsf;udsa.setAttribute("type","application/x-shockwave-flash");udsa.setAttribute("data",udsd)}else{udsa=document.createElement("embed");udsa.className=udsf;udsa.setAttribute("type","application/x-shockwave-flash");udsa.setAttribute("src",udsd);if(uds.videoType){if(uds.videoType==
"Google"){udsa.setAttribute("bgcolor","#000000")}else{udsa.setAttribute("wmode","transparent")}}else{udsa.setAttribute("bgcolor","#000000")}}}return udsa}
;GvideoSearch.prototype.setResultOrder=function(uds){if(uds==GSearch.ORDER_BY_DATE){this.f=true}else if(uds==GSearch.ORDER_BY_RELEVANCE){this.f=false}else{this.f=false}}
;GvideoSearch.prototype.S=function(uds,udsb){if(udsb){if(this.d==null){var udsa=udsn(udsc.Ba);this.d=udsK(null,"0",this.f?true:false,udsc.Aa);udsg(udsa,this.d);udsg(udsa,udsk(udsi["sort-by-date"],udsc.ya));var udsd=udsn(udsc.P);udsg(udsd,udsH(udsi["close"],udsc.P));udsg(udsa,udsd);udsg(uds,udsa);this.d.focus()}else{this.d.checked=this.f?true:false;this.d.focus()}}else{if(this.d){if(this.d.checked){this.setResultOrder(GSearch.ORDER_BY_DATE)}else{this.setResultOrder(GSearch.ORDER_BY_RELEVANCE)}}}}
;
function GbookSearch(){GSearch.call(this);this.l="book";this.u="/GbookSearch";this.ca="http://books.google.com/books"}
GbookSearch.inherits(GSearch);GbookSearch.RESULT_CLASS="GbookSearch";GbookSearch.AD_CLASS="GwebSearch.ad";GbookSearch.c=new Array;GbookSearch.RawCompletion=function(uds,udsb,udsa,udsd,udsf){var udse=0;if(uds){udse=parseInt(uds)}var udsh=GbookSearch.c[udse];GbookSearch.c[udse]=null;udsh.onSearchComplete(udsb,udsa,udsd,udsf)}
;GbookSearch.prototype.n=function(uds,udsb,udsa){var udsd;if(udsa==null){udsd=GSearch.AllocateCompletionMapContext(GbookSearch.c,this)}else{udsd=udsa}var udsf;if(udsb==null){udsf="GbookSearch.RawCompletion"}else{udsf=udsb}var udse=this.G(udsf,udsd);if(uds){var udsh;var udsj=uds;if(this.g){udsj=udsj+" "+this.g}udsh="&q="+encodeURIComponent(udsj);udse=udse+udsh;this.K=udsh}return udse}
;GbookSearch.prototype.createResultHtml=function(uds){if(uds.html){delete uds.html}uds.thumbnailHtml=this.rd(uds);var udsb=udsn(this.I());udsm(udsb,udsc.q);var udsa=udsn(udsc.Ea);var udsd=udsE();var udsf=udsC(udsd,0);var udse=udss(udsf,udsc.db);var udsh=udss(udsf,udsc.Ea);udsg(udse,uds.thumbnailHtml.cloneNode(true));udsg(udsh,udsa);udsg(udsb,udsd);var udsj;udsj=udsq(uds.unescapedUrl,uds.title,this.e(),udsc.r);udsg(udsa,udsj);udsj=udsk(udsi["by"]+"&nbsp;"+uds.authors,udsc.Rc);udsg(udsa,udsj);udsj=
udsn(udsc.Xb);udsg(udsa,udsj);if(uds.publishedYear){udsj=udsk(uds.publishedYear,udsc.Da);udsg(udsa,udsj)}if(parseInt(uds.pageCount)>0){udsj=udsk("-&nbsp;"+udsi["page-count"](uds.pageCount),udsc.ad);udsg(udsa,udsj)}udsj=udsq("http://books.google.com","books.google.com",this.e(),udsc.v);udsg(udsa,udsj);uds.html=udsb;this.s(uds.html)}
;GbookSearch.prototype.rd=function(uds){var udsb="http://books.google.com/googlebooks/";var udsa=udsn(udsc.Sc);var udsd=udsn(udsc.ed);var udsf=udsD(udsb+"pages-trans.gif",null,null,udsc.cd);udsg(udsd,udsf);udsf=udsD(udsb+"p_edge-trans.gif",null,null,udsc.bd);udsg(udsd,udsf);udsg(udsa,udsd);udsd=udsn(udsc.fd);var udse=GSearch.scaleImage(uds.tbWidth,uds.tbHeight,this.N);udsf=udsD(uds.tbUrl,udse.width,udse.height,udsc.H);var udsh=udsL(uds.unescapedUrl,null,this.e(),udsc.H);udsB(udsh,udsc.H);udsg(udsh,
udsf);udsg(udsd,udsh);udsg(udsa,udsd);return udsa}
;
function GsearcherOptions(){this.E=GSearchControl.EXPAND_MODE_PARTIAL;this.kc=this.E;this.root=null;this.N={width:54,height:40};this.la=true;this.Ua={width:100,height:75}}
GsearcherOptions.prototype.setExpandMode=function(uds){switch(uds){case GSearchControl.EXPAND_MODE_CLOSED:case GSearchControl.EXPAND_MODE_OPEN:case GSearchControl.EXPAND_MODE_PARTIAL:this.E=uds;break;default:this.E=GSearchControl.EXPAND_MODE_PARTIAL;break}this.kc=this.E}
;GsearcherOptions.prototype.setRoot=function(uds){udsF(uds);this.root=uds}
;GsearcherOptions.prototype.setImageResultsTbHeight=function(uds){if(uds>100){uds=100}this.N.height=uds;this.N.width=Math.round(uds*1.33)}
;GsearcherOptions.prototype.setVideoResultsTbHeight=function(uds){if(uds>100){uds=100}this.Ua.height=uds;this.Ua.width=Math.round(uds*1.33)}
;GsearcherOptions.prototype.setImageResultsHorizontal=function(){this.la=true}
;GsearcherOptions.prototype.setImageResultsVertical=function(){this.la=false}
;function GdrawOptions(){this.input=null;this.oc=null;this.A=GSearchControl.DRAW_MODE_LINEAR}
GdrawOptions.prototype.setInput=function(uds){this.input=uds}
;GdrawOptions.prototype.setSearchFormRoot=function(uds){this.oc=uds}
;GdrawOptions.prototype.setDrawMode=function(uds){if(uds==GSearchControl.DRAW_MODE_LINEAR||uds==GSearchControl.DRAW_MODE_TABBED){this.A=uds}else{this.A=GSearchControl.DRAW_MODE_LINEAR}}
;function udsr(uds,udsb,udsa){this.b=udsa;this.ob=false;this.jb=false;this.gs=uds;this.i=null;this.Ld=udst(udsb,GSearchControl.prototype.Fd,[this]);this.Od=udst(udsb,GSearchControl.prototype.ub,[this,udsr.SRC_ONE]);this.Nd=udst(udsb,GSearchControl.prototype.ub,[this,udsr.SRC_MORE]);this.Md=udst(udsb,GSearchControl.prototype.ub,[this,udsr.SRC_ALL]);this.Kd=udst(udsb,GSearchControl.prototype.Ed,[this]);this.Jd=udst(udsb,GSearchControl.prototype.Bd,[this]);this.gs.setSearchCompleteCallback(udsb,GSearchControl.prototype.onSearchComplete,
[this]);this.gs.setResultSetSize(udsb.resultSetSize);this.gs.setLinkTarget(udsb.R);this.root=null;this.Ta=null;this.da=null;this.wb=null;this.L=null;this.aa=null;this.t=null;this.Ia=true}
GSearchControl.TIMEOUT_SHORT=350;GSearchControl.TIMEOUT_MEDIUM=500;GSearchControl.TIMEOUT_LONG=700;GSearchControl.EXPAND_MODE_CLOSED=1;GSearchControl.EXPAND_MODE_OPEN=2;GSearchControl.EXPAND_MODE_PARTIAL=3;GSearchControl.DRAW_MODE_LINEAR=1;GSearchControl.DRAW_MODE_TABBED=2;function GSearchControl(uds){if(!UDS_KeyVerified){if(GSearchControl.keyCheck()){UDS_KeyVerified=true}else{return}}this.resultSetSize=GSearch.SMALL_RESULTSET;this.A=GSearchControl.DRAW_MODE_LINEAR;this.root=null;this.Oa=null;this.input=
null;this.Ra=GSearchControl.TIMEOUT_MEDIUM;this.zd=udst(this,GSearchControl.prototype.Cd,[null]);this.Ad=udst(this,GSearchControl.prototype.Dd,[null]);this.oa=null;this.yb=null;this.xb=null;this.ea=null;this.hc=false;this.Fa=false;this.R=GSearch.LINK_TARGET_BLANK;this.Ka=udsi["copy"];this.a=new Array;this.fb=new Array;var udsb;if(uds){for(var udsa=0;udsa<uds.length;udsa++){udsb=new udsr(uds[udsa],this,false);this.a.push(udsb)}}}
try{GSearchControl.appPath=window.location.href}catch(uds4){GSearchControl.appPath=null}GSearchControl.keyCheck=function(){var uds=true;if(uds3(window.location.host)){return true}if(UDS_LoadFailure){if(UDS_OriginalAppPath&&GSearchControl.appPath){if(GSearchControl.appPath==UDS_OriginalAppPath){alert("AJAX Search API Load Failure: invalid api key supplied");uds=false}else{UDS_LoadFailure=false;uds=true}}}UDS_KeyVerified=true;UDS_LoadFailure=false;return uds}
;GSearchControl.prototype.addSearcher=function(uds,udsb){if(!udsb){udsb=new GsearcherOptions}if(uds.l=="ad"){this.fb.push(uds)}else{var udsa=new udsr(uds,this,udsb);this.a.push(udsa)}}
;GSearchControl.prototype.draw=function(uds,udsb){var udsa=null;var udsd=null;if(udsb){if(udsb.A){this.A=udsb.A;udsa=udsb.input;udsd=udsb.oc}else{this.A=GSearchControl.DRAW_MODE_LINEAR}}else{this.A=GSearchControl.DRAW_MODE_LINEAR}this.root=udsn(udsc.zc);if(udsa!=null){this.input=udsa;this.input.onkeyup=this.zd;this.input.onpaste=this.Ad}else{if(udsd==null){udsd=this.root}var udsf=new GSearchForm(true,udsd);udsf.setOnSubmitCallback(this,GSearchControl.prototype.submit);udsf.setOnClearCallback(this,
GSearchControl.prototype.clearAllResults);this.input=udsf.input}this.qa=udsn(udsc.V);if(this.A==GSearchControl.DRAW_MODE_TABBED){this.O=udsn(udsc.Ob);udsg(this.root,this.O);this.k=new Array;this.w=0;for(var udse=0;udse<this.a.length;udse++){var udsh=new Object;udsh.J=udsk(this.a[udse].gs.yd());udsh.M=null;udsh.J.onclick=udst(this,GSearchControl.prototype.Pd,[udse]);this.k[udse]=udsh;udsg(this.O,udsh.J);this.a[udse].b.setExpandMode(GSearchControl.EXPAND_MODE_OPEN)}}udsg(this.root,this.qa);for(var udse=
0;udse<this.a.length;udse++){if(this.a[udse].b.root){this.a[udse].Ia=false;this.a[udse].root=this.a[udse].b.root;udsm(this.a[udse].root,udsc.Ya);udsz(this.a[udse].root,udsc.W);udsm(this.a[udse].root,udsc.V)}else{this.a[udse].root=udsn(udsc.Ya)}if(this.a[udse].gs.ta){var udsj=udsc.Ya+"-"+this.a[udse].gs.ta;udsm(this.a[udse].root,udsj)}if(this.A==GSearchControl.DRAW_MODE_TABBED){this.k[udse].M=this.a[udse].root}var udsl=udsE(null,null,udsc.Gc);var udso=udsC(udsl,0);this.a[udse].U=udss(udso,udsc.Oc)
;var udsp=udss(udso,udsc.uc);this.a[udse].Ta=udsk("",udsc.Pc);udsg(this.a[udse].U,this.a[udse].Ta);var udsu=udsk(this.a[udse].gs.wd(),udsc.Mc);udsg(this.a[udse].Ta,udsu);this.a[udse].da=udsk("",udsc.Jc);udsg(this.a[udse].U,this.a[udse].da);var udsw=udsk();var udsv=udsk(udsi["blank"],udsc.Fc);var udsx=udsk(udsi["blank"],udsc.Ec);var udsA=udsk(udsi["blank"],udsc.Dc);udsv.title=udsi["show-one-result"];udsx.title=udsi["show-more-results"];udsA.title=udsi["show-all-results"];udsg(udsw,udsv);udsg(udsw,
udsx);udsg(udsw,udsA);udsv.onclick=this.a[udse].Od;udsx.onclick=this.a[udse].Nd;udsA.onclick=this.a[udse].Md;this.a[udse].wb=udsw;this.a[udse].zb(udsr.SRC_INIT);udsg(this.a[udse].U,this.a[udse].wb);this.a[udse].Ta.onclick=this.a[udse].Ld;if(this.a[udse].gs.Q){this.a[udse].m=udsS("",udsc.wc);udsV(this.a[udse].m,udsi["blank"]);udsm(this.a[udse].m,udsc.ga);udsg(udsp,this.a[udse].m);this.a[udse].m.onclick=this.a[udse].Kd;this.a[udse].m.title=udsi["settings"];this.a[udse].L=udsn(udsc.Hb);udsm(this.a[udse]
.L,this.a[udse].gs.ha);this.a[udse].aa=udsQ(udsc.Hb);udsm(this.a[udse].aa,this.a[udse].gs.ha);this.a[udse].aa.onsubmit=this.a[udse].Jd;udsg(this.a[udse].L,this.a[udse].aa);this.a[udse].L.style.display="none"}this.a[udse].t=udsn(udsc.Hc);udsm(this.a[udse].t,this.a[udse].gs.qb());if(this.a[udse].b.root==null){udsg(this.qa,this.a[udse].root)}udsg(this.a[udse].root,udsl);if(this.a[udse].L){udsg(this.a[udse].root,this.a[udse].L)}udsg(this.a[udse].root,this.a[udse].t)}if(this.A==GSearchControl.DRAW_MODE_TABBED)
{for(var udse=0;udse<this.a.length;udse++){udsm(this.k[udse].J,udsc.Lc);udsm(this.k[udse].M,udsc.Kc);if(udse==this.w){udsm(this.k[udse].J,udsc.ab);udsm(this.k[udse].M,udsc.Za)}else{udsm(this.k[udse].J,udsc.bb);udsm(this.k[udse].M,udsc.$a)}}}if(uds){udsU(uds,this.root);var udsY=this.vd();if(udsY&&udsY<300){this.hc=true;udsm(this.root,udsc.Cc)}}}
;GSearchControl.prototype.setTimeoutInterval=function(uds){switch(uds){case GSearchControl.TIMEOUT_SHORT:case GSearchControl.TIMEOUT_MEDIUM:case GSearchControl.TIMEOUT_LONG:this.Ra=uds;break;default:this.Ra=GSearchControl.TIMEOUT_MEDIUM;break}}
;GSearchControl.KEEP_LABEL_SAVE="save";GSearchControl.KEEP_LABEL_KEEP="keep";GSearchControl.KEEP_LABEL_INCLUDE="include";GSearchControl.KEEP_LABEL_COPY="copy";GSearchControl.KEEP_LABEL_BLANK="blank";GSearchControl.prototype.setOnKeepCallback=function(uds,udsb,udsa){if(udsa){switch(udsa){case GSearchControl.KEEP_LABEL_SAVE:case GSearchControl.KEEP_LABEL_KEEP:case GSearchControl.KEEP_LABEL_INCLUDE:case GSearchControl.KEEP_LABEL_COPY:case GSearchControl.KEEP_LABEL_BLANK:this.Ka=udsi[udsa];break;default:
this.Ka=udsa;break}}this.oa=udsG(uds,udsb)}
;GSearchControl.prototype.Pd=function(uds){if(this.w==uds){return}udsz(this.k[this.w].J,udsc.ab);udsz(this.k[this.w].M,udsc.Za);udsm(this.k[this.w].J,udsc.bb);udsm(this.k[this.w].M,udsc.$a);this.w=uds;udsm(this.k[this.w].J,udsc.ab);udsm(this.k[this.w].M,udsc.Za);udsz(this.k[this.w].J,udsc.bb);udsz(this.k[this.w].M,udsc.$a)}
;GSearchControl.prototype.submit=function(){if(this.input.value.length){this.execute()}else{this.clearAllResults()}return false}
;GSearchControl.prototype.execute=function(uds){var udsb;if(uds){udsb=uds;this.input.value=udsb}else{udsb=this.input.value}if(udsb.length){this.Fa=false;udsB(this.qa,udsc.W);if(this.O){udsB(this.O,udsc.Pb)}for(var udsa=0;udsa<this.a.length;udsa++){if(!this.a[udsa].Ia){udsz(this.a[udsa].root,udsc.V);udsm(this.a[udsa].root,udsc.W)}if(this.yb){this.yb(this,this.a[udsa].gs,udsb)}this.a[udsa].gs.execute(udsb)}for(var udsa=0;udsa<this.fb.length;udsa++){this.fb[udsa].execute(udsb)}}}
;GSearchControl.prototype.Cd=function(){var uds=this.input.value;if(uds&&uds!=""){if(this.ea){clearTimeout(this.ea)}this.ea=setTimeout(udst(this,GSearchControl.prototype.execute,[null]),this.Ra)}}
;GSearchControl.prototype.Dd=function(){if(this.ea){clearTimeout(this.ea)}this.ea=setTimeout(udst(this,GSearchControl.prototype.execute,[null]),this.Ra)}
;GSearchControl.prototype.setResultSetSize=function(uds){var udsb=true;switch(uds){case GSearch.LARGE_RESULTSET:this.resultSetSize=uds;udsb=true;break;default:case GSearch.SMALL_RESULTSET:this.resultSetSize=GSearch.SMALL_RESULTSET;udsb=false;break}for(var udsa=0;udsa<this.a.length;udsa++){this.a[udsa].gs.setResultSetSize(uds)}}
;GSearchControl.prototype.setLinkTarget=function(uds){this.R=uds;for(var udsb=0;udsb<this.a.length;udsb++){this.a[udsb].gs.setLinkTarget(uds)}}
;GSearchControl.prototype.Fd=function(uds){if(uds.ob){this.T(uds,false)}else{this.T(uds,true)}}
;GSearchControl.prototype.T=function(uds,udsb,udsa){if(!udsb){udsz(uds.U,udsc.Ca);udsm(uds.U,udsc.ga);uds.ob=false;uds.t.style.display="none";if(udsa){var udsd="(0)";uds.da.innerHTML=udsd}else{var udsd="("+(uds.gs.results.length+uds.gs.adResults.length)+")";uds.da.innerHTML=udsd}}else{udsz(uds.U,udsc.ga);udsm(uds.U,udsc.Ca);uds.ob=true;uds.t.style.display="block"}}
;GSearchControl.prototype.Bd=function(uds){this.ra(uds,false,true);return false}
;GSearchControl.prototype.Ed=function(uds){if(uds.gs.ia){if(uds.jb){this.ra(uds,false,true)}else{this.ra(uds,true,true)}}}
;GSearchControl.prototype.ra=function(uds,udsb,udsa){if(!udsb){if(uds.m){udsz(uds.m,udsc.Ca);udsm(uds.m,udsc.ga);uds.m.innerHTML=udsi["blank"];uds.jb=false;uds.gs.Q(uds.aa,false);uds.L.style.display="none";if(udsa){this.execute()}}}else{if(uds.m){udsm(uds.m,udsc.Ca);udsz(uds.m,udsc.ga);uds.m.innerHTML=udsi["close"];uds.jb=true;uds.L.style.display="block";uds.gs.Q(uds.aa,true)}}}
;GSearchControl.prototype.ic=function(uds,udsb){if(this.oa){udsb.gs.gc();this.oa(uds)}}
;GSearchControl.prototype.cancelSearch=function(){this.Fa=true}
;GSearchControl.prototype.clearAllResults=function(){this.input.value="";udsB(this.qa,udsc.V);if(this.O){udsB(this.O,udsc.Ob)}for(var uds=0;uds<this.a.length;uds++){if(!this.a[uds].Ia){udsz(this.a[uds].root,udsc.W);udsm(this.a[uds].root,udsc.V)}var udsb=this.a[uds];udsF(udsb.t);udsb.i=null;this.T(udsb,false,true);this.ra(udsb,false,false)}}
;GSearchControl.prototype.onSearchComplete=function(uds){var udsb;var udsa;var udsd=false;var udsf;if(this.Fa){return}udsF(uds.t);uds.i=null;this.T(uds,false,true);this.ra(uds,false,false);uds.zb(udsr.SRC_INIT);for(var udsa=0;udsa<uds.gs.results.length;udsa++){udsb=uds.gs.results[udsa];if(!udsb.html){uds.gs.createResultHtml(udsb)}if(udsb.html){udsd=true;udsf=udsn(uds.gs.qb());udsm(udsf,udsc.Xa);if(uds.gs.ta){var udse=udsc.Xa+"-"+uds.gs.ta;udsm(udsf,udse)}var udsh=udsb.html.cloneNode(true);if(udsb.GsearchResultClass==
GimageSearch.RESULT_CLASS){if(uds.b.la){udsm(udsf,"horizontal")}else{udsm(udsf,"vertical")}if(uds.b.N){var udsj=udsh.getElementsByTagName("img");for(var udsl=0;udsl<udsj.length;udsl++){GSearch.scaleImage(udsb.tbWidth,udsb.tbHeight,uds.b.N,udsj[udsl])}}}else if(udsb.GsearchResultClass==GvideoSearch.RESULT_CLASS){if(uds.b.Ua){var udsj=udsh.getElementsByTagName("img");for(var udsl=0;udsl<udsj.length;udsl++){GSearch.scaleImage(udsb.tbWidth,udsb.tbHeight,uds.b.Ua,udsj[udsl])}}}udsg(udsf,udsh);if(this.oa)
{var udso=this.Ka;if(udsb.GsearchResultClass==GimageSearch.RESULT_CLASS&&uds.b.la){udso=udsi["blank"]}var udsp=udsk("",udsc.Jb);udsV(udsp,udso);udsg(udsf,udsp);udsp.onclick=udst(this,GSearchControl.prototype.ic,[udsb,uds])}var udsu=uds.gs.jc;if(udsb.GsearchResultClass==GimageSearch.RESULT_CLASS){if(uds.b.la==false){udsu=1}else{if(this.hc){udsu=2}}}if(udsa>=udsu){if(!uds.i){uds.i=udsn(udsc.Ac);udsg(uds.t,uds.i);if(uds.b.E==GSearchControl.EXPAND_MODE_PARTIAL){uds.i.style.display="none"}}udsg(uds.i,
udsf)}else{udsg(uds.t,udsf)}}}if(uds.i&&uds.gs.K&&uds.gs.gwsUrl){udsf=udsq(uds.gs.gwsUrl,udsi["more-results"]+"&nbsp;&raquo;",uds.gs.e(),udsc.Nc);udsg(uds.i,udsf)}var udsw=uds.i?uds.i:uds.t;if(uds.gs.adResults.length){var udsv=udsn(udsc.qc);for(var udsa=0;udsa<uds.gs.adResults.length;udsa++){if(udsa==0){var udsf=udsk(udsi["sponsored-links"],udsc.Xc);udsg(udsv,udsf)}udsb=uds.gs.adResults[udsa];if(!udsb.html){uds.gs.ja(udsb)}if(udsb.html){udsd=true;udsf=udsn(uds.gs.qb());udsm(udsf,udsc.Xa);udsg(udsf,
udsb.html.cloneNode(true));if(this.oa){var udsp=udsk(this.Ka,udsc.Jb);udsg(udsf,udsp);udsp.onclick=udst(this,GSearchControl.prototype.ic,[udsb,uds])}udsg(udsv,udsf)}}udsg(udsw,udsv)}if(!udsd){uds.da.innerHTML="(0)";uds.t.innerHTML="";this.T(uds,false)}else{var udsx;var udsx="("+(uds.gs.results.length+uds.gs.adResults.length)+")";uds.da.innerHTML=udsx;if(uds.b.E==GSearchControl.EXPAND_MODE_PARTIAL||uds.b.E==GSearchControl.EXPAND_MODE_OPEN){this.T(uds,true)}else{this.T(uds,false)}var udsA=uds.gs.getAttribution(
true);if(udsA){udsg(uds.t,udsA)}}uds.b.E=uds.b.kc;if(this.xb){this.xb(this,uds.gs)}}
;GSearchControl.bc={border:"border",borderColor:"border-color",borderStyle:"border-style",borderWidth:"border-width",borderTop:"border-top",borderTopColor:"border-top-color",borderTopStyle:"border-top-style",borderTopWidth:"border-top-width",borderRight:"border-right",borderRightColor:"border-right-color",borderRightStyle:"border-right-style",borderRightWidth:"border-right-width",borderBottom:"border-bottom",borderBottomColor:"border-bottom-color",borderBottomStyle:"border-bottom-style",borderBottomWidth:
"border-bottom-width",borderLeft:"border-left",borderLeftColor:"border-left-color",borderLeftStyle:"border-left-style",borderLeftWidth:"border-left-width",color:"color",cssFloat:"float",styleFloat:"float",clear:"clear",cursor:"cursor",display:"display",font:"font",fontFamily:"font-family",fontSize:"font-size",fontStyle:"font-style",fontWeight:"font-weight",height:"height",margin:"margin",marginTop:"margin-top",marginRight:"margin-right",marginBottom:"margin-bottom",marginLeft:"margin-left",overflow:
"overflow",padding:"padding",paddingTop:"padding-top",paddingRight:"padding-right",paddingBottom:"padding-bottom",paddingLeft:"padding-left",textAlign:"text-align",textDecoration:"text-decoration",textTransform:"text-transform",verticalAlign:"vertical-align",visibility:"visibility",width:"width"};GSearchControl.inlineCurrentStyle=function(uds,udsb){if(udsZ()){alert("GSearchControl.inlineCurrentStyle is not supported on Safari");return}var udsa=true;if(udsb){udsa=udsb}if(udsa){for(var udsd=0;udsd<
uds.childNodes.length;udsd++){GSearchControl.inlineCurrentStyle(uds.childNodes[udsd],true)}}if(uds.nodeType==1){var udsf;var udse;var udsh=false;var udsj=false;if(window.getComputedStyle){udsf=window.getComputedStyle(uds,null);udse=true;udsh=true}else if(uds.currentStyle){udsf=uds.currentStyle;udse=false;udsh=true}if(udsh){for(var udsl in udsf){if(GSearchControl.bc[udsl]){var udso=GSearchControl.bc[udsl];var udsp=udsf[udsl];if(udsl=="display"&&udsp=="none"){uds.innerHTML="";udsj=true}if(udsf[udsl]
!=""){if(udse){uds.style.setProperty(udso,udsp,"")}else{uds.style.setAttribute(udso,udsp,"")}}}}if(udsj){if(udse==false){uds.outerHTML="<div style='display:none'/>"}}}}}
;GSearchControl.prototype.vd=function(uds){var udsb=uds?uds:this.root;var udsa=null;if(window.getComputedStyle){udsa=window.getComputedStyle(udsb,null)}else if(udsb.currentStyle){udsa=udsb.currentStyle}else if(document.defaultView.getComputedStyle){udsa=document.defaultView.getComputedStyle(udsb,null)}if(udsa){return parseInt(udsa["width"])}else{return 300}}
;GSearchControl.prototype.setSearchCompleteCallback=function(uds,udsb){this.xb=udsG(uds,udsb)}
;GSearchControl.prototype.setSearchStartingCallback=function(uds,udsb){this.yb=udsG(uds,udsb)}
;udsr.SRC_INIT=0;udsr.SRC_ONE=1;udsr.SRC_MORE=2;udsr.SRC_ALL=3;udsr.prototype.zb=function(uds){var udsb=udsc.Ic+" ";if(uds==udsr.SRC_INIT){if(this.b.E==GSearchControl.EXPAND_MODE_PARTIAL){udsb+=udsc.Lb}else if(this.gs.getResultSetSize()==GSearch.SMALL_RESULTSET){udsb+=udsc.Kb}else{udsb+=udsc.Eb}}else if(uds==udsr.SRC_ONE){udsb+=udsc.Lb}else if(uds==udsr.SRC_MORE){udsb+=udsc.Kb}else{udsb+=udsc.Eb}udsB(this.wb,udsb)}
;GSearchControl.prototype.ub=function(uds,udsb){uds.zb(udsb);var udsa=false;switch(udsb){default:case udsr.SRC_ONE:if(uds.i){uds.i.style.display="none"}break;case udsr.SRC_MORE:if(uds.i){uds.i.style.display="block"}if(uds.gs.getResultSetSize()!=GSearch.SMALL_RESULTSET){udsa=true}uds.gs.setResultSetSize(GSearch.SMALL_RESULTSET);break;case udsr.SRC_ALL:if(uds.i){uds.i.style.display="block"}if(uds.gs.getResultSetSize()!=GSearch.LARGE_RESULTSET){udsa=true}uds.gs.setResultSetSize(GSearch.LARGE_RESULTSET)
;break}if(udsa){var udsd;udsd=this.input.value;if(udsd.length){this.Fa=false;udsB(this.qa,udsc.W);if(this.O){udsB(this.O,udsc.Pb)}if(!uds.Ia){udsz(uds.root,udsc.V);udsm(uds.root,udsc.W)}uds.b.E=GSearchControl.EXPAND_MODE_OPEN;uds.gs.execute(udsd)}}}
;function GSearchForm(uds,udsb){var udsa=udsQ(udsc.Mb);udsa.acceptCharset="utf-8";var udsd=udsi["search-uc"];this.Oa=udsH(udsd,udsc.Nb);this.Oa.title=udsi["search"];var udsf;if(uds){udsf=udsc.sc;this.hb=udsk(udsi["blank"],udsc.Gb);this.hb.title=udsi["clear-results"]}else{udsf=udsc.Wa}this.input=udsR(null,udsc.Ib,null);var udse=udsE(null,null,udsc.Mb);udsg(udsa,udse);var udsh=udsC(udse,0);var udsj=udss(udsh,udsc.Ib);var udsl=udss(udsh,udsc.Nb);if(uds){var udso=udss(udsh,udsc.Gb);udsg(udso,this.hb)
}udsg(udsj,this.input);udsg(udsl,this.Oa);var udsp=udsE(null,null,udsc.wa);udsg(udsa,udsp);udsh=udsC(udsp,0);this.userDefinedCell=udss(udsh,udsc.tc);var udsu=udss(udsh,udsc.xa);var udsw=udss(udsh,udsf);var udsv=udsk(udsi["powered-by"],udsc.xa);var udsx=UDS_ServiceBase+"/css/small-logo.png";var udsA=udsW(udsx,51,15,udsf);udsg(udsu,udsv);udsg(udsw,udsA);this.fa=udsa;udsF(udsb);udsg(udsb,this.fa)}
GSearchForm.prototype.setOnSubmitCallback=function(uds,udsb){this.Qa=udst(uds,udsb,[this]);this.fa.onsubmit=this.Qa;this.Oa.onclick=this.Qa}
;GSearchForm.prototype.setOnClearCallback=function(uds,udsb){this.hb.onclick=udst(uds,udsb,[this])}
;GSearchForm.prototype.execute=function(uds){if(uds){this.input.value=uds}if(this.Qa){this.Qa()}}
;


function GSblogBar(barRoot, options) {

  // IE fadein/fadeout is disabled
  // On IE6, when clear type is enabled, you MUST set a background color on
  // the element being tweaked. This is totally impractical. If you dont do this
  // the fonts look terrible/unreadable
  //
  // On IE7, they "fixed" the bug, but they did it by disable font smoothing so
  // once again, the results are terrible. Fix is to just don't do this on IE
  this.br_AgentContains_cache_ = {};
  if (this.br_IsIE()) {
    this.startupDelay = 50;
    this.ieMode = true;
  } else {
    this.startupDelay = 0;
    this.ieMode = false;
  }

  this.CL_RESULTDIV = "resultDiv_gsblb";
  this.CL_RESULTDIV_BOLD = "resultDiv_gsblb resultDivBold_gsblb";
  // FF on win/mac has an interesting issue as well. As soon as opacity hits
  // 100%, the font size seems to change by a pixel or so for many fonts.
  // net result: visible jiggle. The "fix" is to never let ffwin/mac hit 100%...
  this.linkContainerClass = this.CL_RESULTDIV;
  if (this.br_IsNav() && (this.br_IsWin() || this.br_IsMac()) ) {
    if (this.br_IsMac()) {
      this.linkContainerClass = this.CL_RESULTDIV_BOLD;
    }
    this.shortOpacityMode = true;
  } else {
    this.shortOpacityMode = false;
  }

  this.setGlobals();
  this.processArguments(barRoot, options);
  this.adjustGlobals();

  this.buildSuperStructure();
  this.buildSearchControl();

  // build handlers for mousein/mouseout watchers
  // on this.resultsBox
  if ( !this.verticalMode ) {
    this.resultsBox.onmouseover = this.methodClosure(this,
                                            GSblogBar.prototype.setMouseIn,
                                            [null]);
    this.resultsBox.onmouseout = this.methodClosure(this,
                                            GSblogBar.prototype.setMouseOut,
                                            [null]);
    if (this.currentResultRoot) {
      this.currentResultRoot.onmouseover = this.methodClosure(this,
                                              GSblogBar.prototype.setMouseIn,
                                              [null]);
      this.currentResultRoot.onmouseout = this.methodClosure(this,
                                              GSblogBar.prototype.setMouseOut,
                                              [null]);
    }
  }

  // ie does not like this mode, so defer load on IE
  if (this.ieMode || this.startupDelay != 0) {
    var bootCompleteClosure = this.methodClosure(this,
                                                 GSblogBar.prototype.bootComplete,
                                                 [null]);
    setTimeout(bootCompleteClosure, this.startupDelay);
  } else {
    this.bootComplete();
  }
}

GSblogBar.prototype.bootComplete = function() {
  // if we have an auto execute list, then start it up
  if (this.autoExecuteMode) {
    this.cycleTimeClosure = this.methodClosure(this,
                                               GSblogBar.prototype.cycleTimeout,
                                               [null]);

    // if there is only a single item in the execute list, then
    // disable autoExecuteMode...
    if ( this.executeList.length == 1 ||
         this.cycleTime == GSblogBar.CYCLE_TIME_MANUAL ) {
      this.switchToListItem(0);
    } else {
      this.cycleTimeout();
    }
  }
}

// cycle time for selecting a news set
GSblogBar.CYCLE_TIME_EXTRA_SHORT = 3000;
GSblogBar.CYCLE_TIME_SHORT = 10000;
GSblogBar.CYCLE_TIME_MEDIUM = 15000;
GSblogBar.CYCLE_TIME_LONG = 30000;
GSblogBar.CYCLE_TIME_MANUAL = 3000000;

GSblogBar.ONE_SECOND = 1000;
GSblogBar.THREE_SECONDS = 3000;
GSblogBar.FIVE_SECONDS = 5000;
GSblogBar.TEN_SECONDS = 10000;

// cycle mode
GSblogBar.CYCLE_MODE_RANDOM = 1;
GSblogBar.CYCLE_MODE_LINEAR = 2;

GSblogBar.MAX_CACHE_LIFETIME = 50;
GSblogBar.MIN_CACHE_LIFETIME = 4;
GSblogBar.DEFAULT_CACHE_LIFETIME = 16;
GSblogBar.MAX_ERROR_COUNT = 4;
GSblogBar.DEFAULT_QUERY = "Google";
GSblogBar.MIN_STARTUP_DELAY = 50;
GSblogBar.MAX_STARTUP_DELAY = 2000;

// result style
GSblogBar.RESULT_STYLE_EXPANDED = 1;
GSblogBar.RESULT_STYLE_COMPRESSED = 2;
GSblogBar.prototype.processArguments = function(barRoot, opt_options) {
  this.retries = 0;
  this.barRoot = barRoot;
  this.statusRoot = null;
  this.autoExecuteMode = false;
  this.executeList = new Array();
  this.cycleTime = GSblogBar.CYCLE_TIME_MANUAL;
  this.cycleMode = GSblogBar.CYCLE_MODE_LINEAR;
  this.cycleNext = 0;
  this.cycleTimer = null;
  this.verticalMode = true;
  this.fadeTimer = null;
  this.mouseInResultArea = false;
  this.mouseOutCallFade = false;
  this.linkTarget = GSearch.LINK_TARGET_BLANK;
  this.currentResultRoot = null;
  this.currentResultContainer = null;
  this.cacheLifetime = GSblogBar.DEFAULT_CACHE_LIFETIME;
  this.orderBy = GSearch.ORDER_BY_DATE; 

  this.fadeIncrement = 10;
  this.fadeTime = 400;
  this.fadeInCallback = GSblogBar.methodCallback(this,
                                                 GSblogBar.prototype.fadeIn);
  this.fadeOutCallback = GSblogBar.methodCallback(this,
                                                  GSblogBar.prototype.fadeOut);
  this.fadeOpacity = 0;

  // set defaults that are changable via options
  this.resultSetSize = GSearch.SMALL_RESULTSET;
  this.ST_TITLE = "The blogsphere";
  this.resultsBoxClass = this.CL_RESULTSBOX_EXPANDED;
  this.verticalMode = true;

  if (opt_options) {

    // horizontal
    if (opt_options.horizontal && opt_options.horizontal == true ) {
      this.verticalMode = false;
    } else {
      this.verticalMode = true;
    }

    // option.largetResultSet
    if (opt_options.largeResultSet && opt_options.largeResultSet == true ) {
      this.resultSetSize = GSearch.LARGE_RESULTSET;
    } else {
      this.resultSetSize = GSearch.SMALL_RESULTSET;
    }

    // option.resultStyle
    if (opt_options.resultStyle) {
      if (opt_options.resultStyle == GSblogBar.RESULT_STYLE_EXPANDED) {
        this.resultsBoxClass = this.CL_RESULTSBOX_EXPANDED;
      } else if (opt_options.resultStyle == GSblogBar.RESULT_STYLE_COMPRESSED) {
        this.resultsBoxClass = this.CL_RESULTSBOX_COMPRESSED;
      }
    }

    if (opt_options.linkTarget) {
      this.linkTarget = opt_options.linkTarget;
    }

    // if currentResult is specified AND we are in horizontal mode,
    // then pick it up.
    if (opt_options.currentResult && !this.verticalMode) {
      this.currentResultRoot = opt_options.currentResult;
      this.removeChildren(this.currentResultRoot);
    }

    if (opt_options.title) {
      this.ST_TITLE = opt_options.title;
    }

    // startupDelay
    if (opt_options.startupDelay &&
        opt_options.startupDelay >= GSblogBar.MIN_STARTUP_DELAY &&
        opt_options.startupDelay <= GSblogBar.MAX_STARTUP_DELAY) {
      this.startupDelay = opt_options.startupDelay;
    }

    // cacheLifetime
    if (opt_options.cacheLifetime &&
        opt_options.cacheLifetime >= GSblogBar.MIN_CACHE_LIFETIME &&
        opt_options.cacheLifetime <= GSblogBar.MAX_CACHE_LIFETIME ) {
      this.cacheLifetime = opt_options.cacheLifetime;
    }

    if (opt_options.orderBy &&
        (opt_options.orderBy == GSearch.ORDER_BY_RELEVANCE ||
         opt_options.orderBy == GSearch.ORDER_BY_DATE)) {
        this.orderBy = opt_options.orderBy;
    }

    // the auto execute list contains
    // a cycleTime value, a cycleMode value, and an array
    // of searchExpressions
    if (opt_options.autoExecuteList) {

      // if specified and valid, then use it, otherwise
      // use default set above
      if (opt_options.autoExecuteList.cycleTime) {
        var cycleTime = opt_options.autoExecuteList.cycleTime;
        if (cycleTime == GSblogBar.CYCLE_TIME_EXTRA_SHORT ||
            cycleTime == GSblogBar.CYCLE_TIME_SHORT ||
            cycleTime == GSblogBar.CYCLE_TIME_MEDIUM ||
            cycleTime == GSblogBar.CYCLE_TIME_LONG ||
            cycleTime == GSblogBar.CYCLE_TIME_MANUAL ) {
          this.cycleTime = cycleTime;
        }
      }

      // in vertical mode, cycleTime says how long
      // between new searches. In horizontal mode,
      // it's how long to keep a result up
      if (!this.verticalMode) {
        switch (this.cycleTime) {
        case GSblogBar.CYCLE_TIME_EXTRA_SHORT:
        case GSblogBar.CYCLE_TIME_SHORT:
          this.cycleTime = GSblogBar.THREE_SECONDS;
          break;

        case GSblogBar.CYCLE_TIME_MEDIUM:
        case GSblogBar.CYCLE_TIME_MANUAL:
          this.cycleTime = GSblogBar.FIVE_SECONDS;
          break;

        case GSblogBar.CYCLE_TIME_LONG:
          this.cycleTime = GSblogBar.TEN_SECONDS;
          break;
        }
        if (this.ieMode) {
          // since we are not fading in/out, lengthen the cycleTime by 1s
          this.cycleTime += GSblogBar.ONE_SECOND;
        }
      }

      if (opt_options.autoExecuteList.cycleMode) {
        var cycleMode = opt_options.autoExecuteList.cycleMode;
        if (cycleMode == GSblogBar.CYCLE_MODE_RANDOM ||
            cycleMode == GSblogBar.CYCLE_MODE_LINEAR) {
          this.cycleMode = cycleMode;
        }
      }

      // now grab the list...
      if (opt_options.autoExecuteList.executeList &&
          opt_options.autoExecuteList.executeList.length > 0 ) {
        // grab from the list
        for (var i=0; i < opt_options.autoExecuteList.executeList.length; i++) {
          this.executeList.push(
            this.newListItem(opt_options.autoExecuteList.executeList[i]));
        }
        this.autoExecuteMode = true;
        this.currentIndex = 0;
        if (opt_options.autoExecuteList.statusRoot) {
          this.statusRoot = opt_options.autoExecuteList.statusRoot;
        }
      }
    }

    // horizontal mode MUST use autoExecute...
    if (!this.verticalMode && this.autoExecuteMode == false) {
      this.autoExecuteMode = true;
      this.currentIndex = 0;
      this.cycleTime = GSblogBar.THREE_SECONDS;
      this.executeList.push(this.newListItem(GSblogBar.DEFAULT_QUERY));
    }
  }

}

GSblogBar.prototype.testForDefaultQuery = function() {
  if (this.executeList.length == 1 &&
      this.executeList[0].query == GSblogBar.DEFAULT_QUERY) {
    return true;
  } else {
    return false;
  }
}

GSblogBar.prototype.resetAutoExecuteListItems = function(newList) {
  if (this.autoExecuteMode && newList.length > 0) {

    // stop the timers...
    this.clearCycleTimer();
    this.clearFadeTimer();

    // clear the status area
    if (this.statusRoot) {
      this.removeChildren(this.statusRoot);
    }

    // nuke the old list
    this.executeList = new Array();

    // build the new list
    for (var i=0; i < newList.length; i++) {
      this.executeList.push(this.newListItem(newList[i]));
    }
    this.currentIndex = 0;

    if (this.statusRoot) {
      this.populateStatusRoot();
    }

    if ( this.executeList.length == 1) {
      this.switchToListItem(0);
    } else {
      this.cycleTimeout();
    }
  }
}

GSblogBar.prototype.adjustGlobals = function() {
  // horizontal mode changes certain globals...
  // - results are always compressed
  if (this.verticalMode == false) {
    this.resultsBoxClass = this.CL_RESULTSBOX_COMPRESSED;
  }
}

GSblogBar.prototype.setGlobals = function() {

  // superstructure boxes
  this.CL_BLOGBARBOX = "blogBarBox_gsblb";
  this.CL_BLOGBARBOXFULL = "blogBarBox_gsblb full_gsblb";
  this.CL_BLOGBARBOXEMPTY = "blogBarBox_gsblb empty_gsblb";
  this.CL_BLOGBARINNERBOX = "blogBarInnerBox_gsblb";
  this.CL_VERTICAL = "vertical_gsblb";
  this.CL_HORIZONTAL = "horizontal_gsblb";

  // title
  this.CL_TITLEBOX = "titleBox_gsblb";

  // results
  this.CL_RESULTSBOX_EXPANDED = "resultsBox_gsblb expanded_gsblb";
  this.CL_RESULTSBOX_COMPRESSED = "resultsBox_gsblb compressed_gsblb";
  this.CL_BRANDINGBOX = "brandingBox_gsblb";
  this.CL_SNIPPET = "snippet_gsblb";

  // status
  this.CL_STATUSBOXROOT = "statusBoxRoot_gsblb";
  this.CL_STATUSBOX = "statusBox_gsblb";
  this.CL_STATUSBOX_ONEITEM = "statusBox_gsblb oneitem_gsblb";
  this.CL_STATUSITEMSEP = "statusItemSep_gsblb";
  this.CL_STATUSITEM = "statusItem_gsblb";
  this.CL_STATUSITEM_SELECTED = "statusItem_gsblb statusItemSelected_gsblb";
}

GSblogBar.prototype.getBarBoxClass = function(full) {
  var baseClass = full ? this.CL_BLOGBARBOXFULL : this.CL_BLOGBARBOXEMPTY;
  if (this.verticalMode) {
    baseClass += " " + this.CL_VERTICAL;
  } else {
    baseClass += " " + this.CL_HORIZONTAL;
  }
  return baseClass;
}

GSblogBar.prototype.buildSuperStructure = function() {

  // create the blogBar box
  this.removeChildren(this.barRoot);
  this.barBox = this.createDiv(null, this.CL_BLOGBARBOX);
  this.barRoot.appendChild(this.barBox);
  this.innerBox = this.createDiv(null, this.CL_BLOGBARINNERBOX);
  this.barBox.appendChild(this.innerBox);

  // add in the title, statusBox, resultsBox, and branding

  // title
  //this.titleBox = this.createDiv(this.ST_TITLE, this.CL_TITLEBOX);
  //this.innerBox.appendChild(this.titleBox);

  // optional statusRoot, statusBox
  if (this.statusRoot == null) {
    this.statusRoot = this.createDiv(null, this.CL_STATUSBOXROOT);
    this.innerBox.appendChild(this.statusRoot);
  }
  this.populateStatusRoot();

  // resultsBox
  this.resultsBox = this.createDiv(null, this.resultsBoxClass);
  this.innerBox.appendChild(this.resultsBox);

  if (this.currentResultRoot) {
    this.currentResultContainer = this.createDiv(null,
                                                 this.CL_RESULTSBOX_EXPANDED);
    this.currentResultRoot.appendChild(this.currentResultContainer);
  }

  // branding
  var branding = this.createDiv(null, this.CL_BRANDINGBOX);
  this.barBox.appendChild(branding);
  var orientation = GSearch.HORIZONTAL_BRANDING;
  if (this.verticalMode == false) {
    orientation = GSearch.VERTICAL_BRANDING;
  }
  GSearch.getBranding(branding, orientation, "http://blogsearch.google.com");

  this.cssSetClass(this.barBox, this.CL_BLOGBARBOXEMPTY);
}

GSblogBar.prototype.buildSearchControl = function() {
  this.bs = new GblogSearch();
  this.bs.setResultSetSize(this.resultSetSize);
  this.bs.setLinkTarget(this.linkTarget);
  this.bs.setSearchCompleteCallback(this, GSblogBar.prototype.searchComplete, [true]);
  this.bs.setResultOrder(this.orderBy);

  this.bsBypass = new GblogSearch();
  this.bsBypass.setResultSetSize(this.resultSetSize);
  this.bsBypass.setLinkTarget(this.linkTarget);
  this.bsBypass.setSearchCompleteCallback(this, GSblogBar.prototype.searchComplete, [false]);
  this.bsBypass.setResultOrder(this.orderBy);
}

GSblogBar.prototype.execute = function(query) {
  if (this.verticalMode == false) {
    this.clearFadeTimer();
    this.resetAutoExecuteListItems([query]);
  } else {
    this.populateStatusRoot();
    this.bsBypass.execute(query);
  }
}

GSblogBar.prototype.executeInternal = function(query) {
  this.bs.execute(query);
}

GSblogBar.prototype.clearAllResults = function() {
  this.cssSetClass(this.barBox, this.CL_BLOGBARBOXEMPTY);
}

GSblogBar.prototype.searchComplete = function(fromListItem) {
  var bs;
  var cacheResults = false;
  var currentListItem = null;
  if (fromListItem) {
    currentListItem = this.executeList[this.currentIndex];
    if (currentListItem.cacheCount == 0) {
      cacheResults = true;
      currentListItem.results = new Array();
    }
    bs = this.bs;
  } else {
    bs = this.bsBypass;
  }
  if ( bs.results && bs.results.length > 0) {
    this.cssSetClass(this.barBox, this.getBarBoxClass(true));
    this.removeChildren(this.resultsBox);

    if (!this.verticalMode) {
      // for horizontal mode, nuke the old results
      // and reset currentResultIndex
      this.results = new Array();
      this.currentResult = 0;
    }

    // iterate over the results and capture the .html node
    // and append into the resultBox, OR just capture so that
    // we can fade it in/out
    for (var i = 0; i < bs.results.length; i++) {
      // if we are listItem based search, then cache results
      if (cacheResults) {
        currentListItem.cacheCount = 1;
        currentListItem.results.push(bs.results[i]);

        // reset error count based on sucessful search
        currentListItem.errorCount = 0;
      }

      var res = bs.results[i];
      if (this.verticalMode) {
        var resultDiv = this.createDiv(null, this.CL_RESULTDIV);
        var node = res.html.cloneNode(true);
        this.resultsBox.appendChild(resultDiv);
        resultDiv.appendChild(node);
      } else {
        this.results[i] = res;
      }
    }

    // start the fadein, fadeout sequence
    if (!this.verticalMode) {
      this.linkContainer = this.createDiv(null, this.linkContainerClass);
      this.resultsBox.appendChild(this.linkContainer);
      this.link = document.createElement("a");
      this.link.target = this.linkTarget;
      this.snippet = this.createSpan("&nbsp;", this.CL_SNIPPET);
      this.setHorizontalResultContent(
                        this.results[this.currentResult]);
      this.setOpacity(this.linkContainer, 0);
      this.linkContainer.appendChild(this.link);
      this.linkContainer.appendChild(this.snippet);
      this.fadeOpacity = 0;
      this.fadeIn();
    }
  } else {
    // no results, mark the container as empty
    this.cssSetClass(this.barBox, this.getBarBoxClass(true));
    // retry another search expression
    if ( this.executeList.length == 1 ||
         this.cycleTime == GSblogBar.CYCLE_TIME_MANUAL ) {
      if (this.retries > 2) {

        // we failed the default query. Don't let this get caught
        // in a failure loop
        if (this.testForDefaultQuery()) {
          // stop the timers...
          this.clearCycleTimer();
          this.clearFadeTimer();

          // clear the status area
          if (this.statusRoot) {
            this.removeChildren(this.statusRoot);
          }
          return;
        } else {
          this.resetAutoExecuteListItems([GSblogBar.DEFAULT_QUERY]);
          this.retries = 0;
        }
      } else {
        this.retries++;
      }
      this.switchToListItem(0);
    } else {

      // this really means that this is a list item based search
      // that should have worked and if it had worked would have
      // produced results that we cache. in this case though, we
      // got no results so mark this, and if we get too many on
      // this term, throw away the search term
      if (cacheResults) {
        currentListItem.errorCount++;
        // if we are getting excessive errors from this entry
        // then reset the list without this entry
        if (bs.completionStatus == 200) {
          currentListItem.errorCount = GSblogBar.MAX_ERROR_COUNT + 1;
        }
        if (currentListItem.errorCount > GSblogBar.MAX_ERROR_COUNT) {
          var newList = new Array();
          for (var i=0; i<this.executeList.length; i++) {
            if (this.executeList[i].errorCount <= GSblogBar.MAX_ERROR_COUNT) {
              newList.push(this.executeList[i].query);
            }
          }
          if (newList.length == 0) {
            newList.push(GSblogBar.DEFAULT_QUERY);
          }
          this.resetAutoExecuteListItems(newList);
        }
      }
      this.cycleTimeout();
    }
  }
}

GSblogBar.prototype.setHorizontalResultContent = function(result) {
  var url = result.postUrl;
  var linkString = result.titleNoFormatting;
  var pubDate = new Date(result.publishedDate);
  var snippet =  " &nbsp;-&nbsp; " + 
    this.bs.formatToRelativeDate(new Date(result.publishedDate));
  this.link.href = url;
  this.link.target = this.linkTarget;
  if (linkString.length>30) linkString=linkString.substring(0,20)+" ...";
  this.link.innerHTML = linkString;
  this.snippet.innerHTML = snippet;

  if (this.currentResultContainer) {
    this.removeChildren(this.currentResultContainer);
    var div = this.createDiv(null, this.CL_RESULTDIV);
    var node = result.html.cloneNode(true);
    div.appendChild(node);
    this.currentResultContainer.appendChild(div);
  }
}

GSblogBar.prototype.clearCycleTimer = function() {
  if (this.cycleTimer) {
    clearTimeout(this.cycleTimer);
    this.cycleTimer = null;
  }
}

GSblogBar.prototype.clearFadeTimer = function() {
  if (this.fadeTimer) {
    clearTimeout(this.fadeTimer);
    this.fadeTimer = null;
  }
}

GSblogBar.prototype.setMouseIn = function() {
  this.mouseInResultArea = true;
}

GSblogBar.prototype.setMouseOut = function() {
  this.mouseInResultArea = false;
  if (this.mouseOutCallFade) {
    this.fadeOut();
  }
}

GSblogBar.prototype.cycleTimeout = function() {
  // select a new news topic
  // execute a search
  // restart the timer
  if ( this.executeList.length == 1 ||
       this.cycleTime == GSblogBar.CYCLE_TIME_MANUAL ) {
    this.switchToListItem(0);
  } else {
    var index = 0;
    if (this.cycleMode == GSblogBar.CYCLE_MODE_RANDOM) {
      var max = this.executeList.length - 1;
      index = Math.round(max * Math.random());
    } else if (this.cycleMode == GSblogBar.CYCLE_MODE_LINEAR){
      index = this.cycleNext;
      this.cycleNext++;
      if (this.cycleNext >= this.executeList.length) {
        this.cycleNext = 0;
      }
    }

    this.switchToListItem(index);
    if (this.verticalMode) {
      this.clearCycleTimer();
      this.cycleTimer = setTimeout(this.cycleTimeClosure, this.cycleTime);
    }
  }
}


GSblogBar.prototype.fadeIn = function() {
  if (this.ieMode) {
    // IE is very broken on the fade in/out
    // it ends up failing miserably on IE6 with cleartype on (well documented)
    // and on IE7, ends up turning off font-smoothing. So, on IE we do not
    // do the fade effect.
    this.fadeTimer = setTimeout(this.fadeOutCallback, this.cycleTime);
  } else {
    this.fadeOpacity = Math.min(this.fadeOpacity + this.fadeIncrement /
                                 this.fadeTime, 1);
    var fadeOpacity = this.fadeOpacity;

    // this trick prevents shifting on firefox/windows
    if (fadeOpacity >= 1 && this.shortOpacityMode) {
      fadeOpacity = 0.9999999;
    }
    this.setOpacity(this.linkContainer, fadeOpacity);
    if (this.fadeOpacity < 1) {
      this.fadeTimer = setTimeout(this.fadeInCallback, this.fadeIncrement);
    } else {
      this.fadeTimer = setTimeout(this.fadeOutCallback, this.cycleTime);
    }
  }
}

GSblogBar.prototype.fadeOut = function() {
  if (this.mouseInResultArea) {
    this.mouseOutCallFade = true;
    return;
  }

  // see above
  if (this.ieMode) {
    this.fadeOpacity = 0;
  } else {
    this.mouseOutCallFade = false;
    this.fadeOpacity = Math.max(this.fadeOpacity - this.fadeIncrement /
                                 this.fadeTime, 0);
    this.setOpacity(this.linkContainer, this.fadeOpacity);
    if (this.fadeOpacity > 1) {
      this.fadeOpacity = 1;
    }
  }
  if (this.fadeOpacity > 0) {
    this.fadeTimer = window.setTimeout(this.fadeOutCallback, this.fadeIncrement);
  } else {
    if (this.currentResult+1 < this.results.length) {
      this.currentResult++;
      this.setHorizontalResultContent(this.results[this.currentResult]);
      this.fadeIn();
    } else {
      this.cycleTimeout();
    }
  }
}

/**
 * Autoexecute List Item Support
*/
GSblogBar.prototype.newListItem = function(q) {
  var listItem = new Object();
  listItem.node = null;
  listItem.query = q;
  listItem.results = new Array();
  listItem.errorCount = 0;
  listItem.cacheCount = 0;
  return listItem;
}


GSblogBar.prototype.switchToListItem = function(i) {

  // if this is from a static query term, then just return
  if (i == -1) {
    return false;
  }
  // reset selcted class of previous item
  // note, first time through this sets
  // node 0
  if (this.executeList[this.currentIndex].node) {
    this.cssSetClass(this.executeList[this.currentIndex].node,
                     this.CL_STATUSITEM);

  }
  this.currentIndex = i;
  if (this.executeList[this.currentIndex].node) {
    this.cssSetClass(this.executeList[this.currentIndex].node,
                     this.CL_STATUSITEM_SELECTED);

  }
  var queryTerm = this.executeList[this.currentIndex].query;
  var cacheResults = false;
  var currentListItem = null;
  currentListItem = this.executeList[this.currentIndex];

  // if the listItem has no cached results, OR if
  // we have used the cached results several times
  // already, initiate a real search
  if (currentListItem.cacheCount == 0 ||
      currentListItem.cacheCount > this.cacheLifetime ) {
    currentListItem.cacheCount = 0;
    this.executeInternal(this.executeList[this.currentIndex].query);
  } else {

    // we have cached results and they are within the programmed
    // life time so use them. e.g., fake a search
    currentListItem.cacheCount++;
    this.bs.results = new Array();
    for (var ri=0; ri < currentListItem.results.length; ri++) {
      this.bs.results.push(currentListItem.results[ri]);
    }
    this.searchComplete(true);
  }
  return false;
}

GSblogBar.prototype.populateStatusRoot = function() {
  this.removeChildren(this.statusRoot);
  var sbClass = this.CL_STATUSBOX;
  if (this.executeList.length == 1) {
    var sbClass = this.CL_STATUSBOX_ONEITEM;
  }
  this.statusBox = this.createDiv(null, sbClass);
  this.statusRoot.appendChild(this.statusBox);
  //new
  //var gi= document.createElement("a");
  //gi.href = "http://blogsearch.google.com";
  //gi.target = this.linkTarget;
  //gi.innerHTML='<img src="http://www.google.com/uds/css/small-logo.png">';
  //gi.title = "Powered by Google";
  //this.statusBox.appendChild(gi);
  //...
  if ( this.executeList.length > 0) {
    for (var i=0; i < this.executeList.length; i++ ) {
      var listItem = this.executeList[i];
      var displayTerm = listItem.query;
      var cl;
      if (this.verticalMode) {
        cl = this.createClickLink(displayTerm, null, this.CL_STATUSITEM);

        // add click handler...
        cl.onclick = this.methodClosure(this,
                                         GSblogBar.prototype.switchToListItem,
                                         [i] );
      } else {
        var gwsUrl = "http://blogsearch.google.com/blogsearch?source=uds&q=" +displayTerm;
          //encodeURIComponent();
        cl = this.createClickLink("Tag "+displayTerm+" : ", gwsUrl, this.CL_STATUSITEM,
                                  GSearch.strings["more-results"] + ": " + displayTerm);
      }

      listItem.node = cl;
      this.statusBox.appendChild(cl);
      if (i+1 < this.executeList.length) {
        if (this.verticalMode) {
          this.statusBox.appendChild(this.createSpan("  ", this.CL_STATUSITEMSEP));
        }
      }
    }
  }
}

/**
 * Static Helper Method
*/
GSblogBar.methodCallback = function(object, method) {
  return function() {
    return method.apply(object, arguments);
  }
}

/**
 * Class methods
*/
GSblogBar.prototype.methodClosure = function(object, method, opt_argArray) {
  return function() {
    return method.apply(object, opt_argArray);
  }
}

GSblogBar.prototype.createDiv = function(opt_text, opt_className) {
  var el = document.createElement("span");
  if (opt_text) {
    el.innerHTML = opt_text;
  }
  if (opt_className) { el.className = opt_className; }
  return el;
}

GSblogBar.prototype.createSpan = function(opt_text, opt_className) {
  var el = document.createElement("span");
  if (opt_text) {
    el.innerHTML = opt_text;
  }
  if (opt_className) { el.className = opt_className; }
  return el;
}

GSblogBar.prototype.removeChildren = function(parent) {
  while (parent.firstChild) {
    parent.removeChild(parent.firstChild);
  }
}

GSblogBar.prototype.removeChild = function(parent, child) {
  parent.removeChild(child);
}

GSblogBar.prototype.cssSetClass = function(el, className) {
  el.className = className;
}

GSblogBar.prototype.createClickLink = function(text, opt_href,
                                               opt_className, opt_tooltip) {
  var el = document.createElement("a");
  if (opt_href) {
    el.href = opt_href;
    el.target = this.linkTarget;
  } else {
    el.href = "_nolink_";
  }
  el.appendChild(document.createTextNode(text));
  if (opt_className) {
    el.className = opt_className;
  }
  if (opt_tooltip) {
    el.title = opt_tooltip;
  }
  return el;
}


GSblogBar.prototype.br_AgentContains_ = function(str) {
  if (str in this.br_AgentContains_cache_) {
    return this.br_AgentContains_cache_[str];
  }

  return this.br_AgentContains_cache_[str] =
    (navigator.userAgent.toLowerCase().indexOf(str) != -1);
}

GSblogBar.prototype.br_IsIE = function() {
  return this.br_AgentContains_('msie');
}

GSblogBar.prototype.br_IsKonqueror = function() {
  return this.br_AgentContains_('konqueror');
}

GSblogBar.prototype.br_IsOpera = function() {
  return this.br_AgentContains_('opera');
}

GSblogBar.prototype.br_IsSafari = function() {
  return this.br_AgentContains_('safari') || this.br_IsKonqueror();
}

GSblogBar.prototype.br_IsNav = function() {
  return !this.br_IsIE() &&
         !this.br_IsSafari() &&
         this.br_AgentContains_('mozilla');
}

GSblogBar.prototype.br_IsWin = function() {
  return this.br_AgentContains_('win');
}


GSblogBar.prototype.br_IsMac = function() {
  return this.br_AgentContains_('macintosh') ||
         this.br_AgentContains_('mac_powerpc');
}

GSblogBar.prototype.br_IsLinux = function() {
  return this.br_AgentContains_('linux');
}


GSblogBar.prototype.setOpacity = function(element, opacity) {

  if (this.ieMode) {
    /*
    // on ie6, if the container doesn't have a background color
    // and cleartype is enabled, the text looks terrible
    // do not fade on ie6...
    // We tried limiting this to IE7, but that was a disaster
    // as well. IE7 seems to disable font-smoothing when you do this
    // making the newsbar look terrible. Fix is to just not do the
    // fade effect on IE at all
    if (navigator.userAgent.indexOf("MSIE 7") != -1) {
      var normalized = Math.round(opacity * 100);
      element.style.filter = "alpha(opacity=" + normalized + ");";
    }
    */
    return;
  } else {
    element.style.opacity = opacity;
  }
}

GSblogBar.prototype.getNodeWidth = function(node) {
  return node.offsetWidth;
}


