/*    HTTP Host:  static.ak.fbcdn.net                                          */
/*    Generated:  November 3rd 2009 10:10:45 AM PST                            */
/*      Machine:  10.16.139.109                                                */
/*       Source:  Backing Store                                                */
/*     Location:  js/lib/ui/typeaheadpro/search_typeaheadpro.js h:2yg40lso     */
/*       Locale:  nu_ll                                                        */
/*         Path:  js/lib/ui/typeaheadpro/search_typeaheadpro.js                */

function search_typeaheadpro(obj,_L1,_L2){this.parent.construct(this,obj,_L1,_L2);this._onunload_registered=false;}search_typeaheadpro.extend('typeaheadpro');search_typeaheadpro.prototype.auto_select=false;search_typeaheadpro.prototype.less_than_n_chars=false;search_typeaheadpro.prototype.dirty_results=function(){this.parent.dirty_results();if(!this._onunload_registered){this._onunload_registered=true;onunloadRegister(bind(this,function(){this.clear();this.blur();search_friend_source.hasSubmitted=false;search_friend_source.already_logged=false;bind(this,function(){this._onunload_registered=false;}).defer();}));}};search_typeaheadpro.prototype.show=function(){this.dropdown.style.border='0px none';if(this.suggestions.length){CSS.addClass(this.list,'typeahead_list_with_shadow');}else CSS.removeClass(this.list,'typeahead_list_with_shadow');var _L0=this.is_fbx?237:191;if(!this.less_than_n_chars){CSS.addClass(this.dropdown,'typeahead_search');this.parent.show();var _L1=Vector2.getElementDimensions(this.anchor);this.dropdown.style.left=(elementX(this.anchor)-(_L0-_L1.x)+4)+'px';this.dropdown.style.width=_L0+'px';}else this.hide();};search_typeaheadpro.prototype.select_suggestion=function(_L0){this.log_data.sm=this.log_data.sm?this.log_data.sm:'mouse';if(this.suggestions&&this.suggestions.length>_L0){this.log_data.ty=_L0>=0?this.suggestions[_L0].ty:'fs';this.log_data.i=_L0>=0?this.suggestions[_L0].i:'0';this.log_data.f=this.suggestions.length>0?0:1;}this.log_data.si=_L0;search_typeahead_log_data(this);if(this.suggestions&&this.source.history!=undefined&&this.suggestions.length>_L0&&_L0>=0){this.suggestions[_L0].o=-1;this.source.history[this.suggestions[_L0].i]=-1;}return this.parent.select_suggestion.call(this,_L0);};search_typeaheadpro.prototype.hide=function(){this.parent.hide();};search_typeaheadpro.prototype.found_suggestions=function(_L0,_L1,_L2){this.parent.found_suggestions(_L0,_L1,_L2);if(_L0.length>0&&_L0[0].ty=='search')this.parent.set_suggestion(0);if(this.suggestion_count>0){CSS.addClass(this.list.firstChild.firstChild,'suggestions_top_border');CSS.removeClass(this.list,'no_border_list');CSS.addClass(this.list.lastChild.lastChild,'suggestions_bottom_border');}else CSS.addClass(this.list,'no_border_list');};search_typeaheadpro.prototype._onkeydown=function(e){this.last_key=e?Event.getKeyCode(e):-1;this.interactive=true;if(this.last_key==KEYS.TAB&&this.suggestions.length>0){var _L1=this.selectedindex+(e.shiftKey?-1:1);if(_L1<-1||_L1>=this.suggestions.length)return true;this.log_data.kt+=1;return false;}this.parent._onkeydown(e);};search_typeaheadpro.prototype._onkeypress=function(e){this.last_key=e?Event.getKeyCode(e):-1;this.interactive=true;if(this.last_key==KEYS.TAB&&this.suggestions.length>0){var _L1=this.selectedindex+(e.shiftKey?-1:1);if(_L1>=-1&&_L1<this.suggestions.length){this.set_suggestion(_L1);this.last_key_suggestion=(new Date()).getTime();return false;}}return this.parent._onkeypress(e);};function search_typeahead_onselect(_L0){if(_L0&&!search_friend_source.hasSubmitted){search_friend_source.hasSubmitted=true;}else return false;var url=_L0.u;if(!url){var _L2=search_friend_source.url_templates[_L0.ty];if(_L2){var id;if(_L0.a&&_L2.alias_url){url=_L2.alias_url;id=_L0.a;}else{url=_L2.default_url;id=_L0.i;}url=sprintf(url,escapeURI(id));}}if(!url){return undefined;}else if(url.indexOf('?')!=-1){goURI(url+'&ref=ts');}else goURI(url+'?ref=ts');bind(this,this.blur).defer();return false;}function search_typeahead_wstest(_L0){new AsyncSignal('/ajax/search/web.php',{q:_L0}).send();}function search_typeahead_log_data(_L0){var _L1=_L0.udata;for(var key in _L0.log_data)_L1[key]=_L0.log_data[key];search_typeahead_log(_L1,'onsubmit');}function search_typeahead_onsubmit(_L0){return !search_friend_source.hasSubmitted;}

if (window.Bootloader) { Bootloader.done(["js\/lib\/ui\/typeaheadpro\/search_typeaheadpro.js"]); }