/*
HTTP Host: static.ak.fbcdn.net
Generated: March 19th 2010 9:13:50 AM PDT
Machine: 10.16.140.104
Locale: nu_ll
Path: js/aq90no4kiy8s4gss.pkg.js
*/

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/aq90no4kiy8s4gss.pkg.js"]); }

function update_activation_toolkit_for_friend_suggester(b,a){if(b&&a){var c=a.getUserData();if(c.new_user_score)update_activation_toolkit_ui(c.new_user_score,'profile_action_suggest_friends');}}function update_activation_toolkit_ui(b,a){if(ge(a)){CSS.addClass($(a),'completed');CSS.setStyle($('needy_progress_bar_progress'),'width',b+'px');}}
FriendSuggesterDialog={_dialog:null,_close_handler:null,_newcomer:null,show:function(d,c,b,e){this._close_handler=b||bagofholding;c=c||false;this._newcomer=d;var a=new AsyncRequest().setURI('/ajax/friend_suggester.php').setData({newcomer:d,friend_added:c}).setContextData('clicktype','Suggest a Friend',e==="profile_others");this._dialog=new Dialog().setAsync(a).show();},cancelMultiselect:function(){this._dialog.hide();this._close_handler(false,null);},submitMultiselect:function(){var b=serialize_form($('friend_suggester_popup_form'));if(!b['ids']){try{fs.notice_show(_tx("Et ole valinnut yht\u00e4\u00e4n kaveria. Valitse kaverit klikkaamalla heid\u00e4n kuviaan."),true);}catch(ex){this.cancelMultiselect();}return false;}b.suggest=1;var a=new AsyncRequest().setURI('/ajax/friend_suggester.php').setData(b);var c=new Dialog().setAsync(a);c.setCloseHandler(this._close_handler.bind(null,true,c));c.show();}};
function InstrumentedLogger(a){if(this===window)return new InstrumentedLogger(a);if(InstrumentedLogger._instances[a])return InstrumentedLogger._instances[a];copy_properties(this,{id:a,_phases:{}});return InstrumentedLogger._instances[a]=this;}copy_properties(InstrumentedLogger,{_instances:{}});copy_properties(InstrumentedLogger.prototype,{beginPhase:function(a){if(this._phases[a]&&this._phases[a].start)this.endPhase(a);if(typeof(this._phases[a])=='undefined')this._phases[a]={start:0,count:0,duration:0};this._phases[a].start=new Date().getTime();return this;},endPhase:function(a){var b=this._phases[a];if(b&&b.start){b.count++;b.duration+=new Date().getTime()-b.start;b.start=null;}return this;},dumpAndReset:function(){this.dump();return this.reset();},dump:function(){for(var b in this._phases){var c=this._phases[b];var a=(this.id?this.id+'::':'')+b;}return this;},get:function(a){if(this._phases[a])return this._phases[a].duration/this._phases[a].count;return 0;},reset:function(){this._phases={};return this;}});InstrumentedLogger.prototype.b=InstrumentedLogger.prototype.beginPhase;InstrumentedLogger.prototype.e=InstrumentedLogger.prototype.endPhase;InstrumentedLogger.prototype.d=InstrumentedLogger.prototype.dump;InstrumentedLogger.prototype.D=InstrumentedLogger.prototype.dumpAndReset;InstrumentedLogger.prototype.r=InstrumentedLogger.prototype.reset;var IL=InstrumentedLogger;
function DOMControl(a){copy_properties(this,{root:a&&$(a),updating:false});if(a)a.getControl=identity.bind(null,this);}copy_properties(DOMControl.prototype,{getRoot:function(){return this.root;},beginUpdate:function(){if(this.updating)return false;this.updating=true;return true;},endUpdate:function(){this.updating=false;},update:function(a){if(!this.beginUpdate())return this;this.onupdate(a);this.endUpdate();}});
function TextInputControl(b){this.parent.construct(this,b);copy_properties(this,{placeholderText:null,maxLength:this.getRoot().maxLength||null,radio:null,focused:false,interval:null,nativePlaceholder:false});var a=this.getRoot();if((String(a.type).toLowerCase()=='search')&&ua.safari()){this.nativePlaceholder=true;this.setPlaceholderText(a.getAttribute('placeholder'));}addEventBase(a,'focus',this.onfocus.bind(this));addEventBase(a,'blur',this.onblur.bind(this));var c=this.update.bind(this);Event.listen(a,{keyup:c,keydown:c,keypress:c});this.setFocused(false);}TextInputControl.extend('DOMControl');copy_properties(TextInputControl.prototype,{associateWithRadioButton:function(a){this.radio=a&&$(a);return this;},setMaxLength:function(a){var b=this.getRoot();this.maxLength=a;if(a){b.maxLength=a;}else b.removeAttribute('maxlength');return this;},getValue:function(){if(!this.focused&&this.getRoot().value==this.placeholderText)return null;return this.getRoot().value;},isEmpty:function(){var a=this.getValue();return (a===null||a=='');},setValue:function(a){this.getRoot().value=a;this.update();return this;},clear:function(){return this.setValue('');},isFocused:function(){return this.focused;},setFocused:function(b){var a=this.isEmpty();this.focused=b;if(this.placeholderText&&!this.nativePlaceholder){var c=this.getRoot();var d=c.value;if(this.focused){CSS.removeClass(c,'DOMControl_placeholder');if(a)this.clear();}else if(a){CSS.addClass(c,'DOMControl_placeholder');this.setValue(this.placeholderText);}}this.update();return this;},setPlaceholderText:function(a){this.placeholderText=a;if(this.nativePlaceholder)this.getRoot().setAttribute('placeholder',a);return this.setFocused(this.isFocused());},getPlaceholderText:function(){return this.placeholderText;},onupdate:function(){if(this.radio)if(this.focused)this.radio.checked=true;var d=this.getRoot();if(this.maxLength>0)if(d.value.length>this.maxLength){var e=d.value;var c=e.length-this.maxLength;var a=DOM.getCaretPosition(d);var b=a.end||e.length;d.value=e.substring(0,b-c)+e.substring(b);if(typeof a.start!='undefined')DOM.setCaretPosition(d,a.start-c,Math.max(a.start,a.end)-c);}this.setFocused(this.focused);},onfocus:function(){this.setFocused(true);if(this.interval)clearInterval(this.interval);this.interval=setInterval(this.update.bind(this),150);return this;},onblur:function(){this.setFocused(false);if(this.interval)this.interval=clearInterval(this.interval);return this;}});function placeholderSetup(a){if(!ge(a))return;if(!$(a).getAttribute('placeholder'))return;return new TextInputControl($(a)).setPlaceholderText($(a).getAttribute('placeholder'));}
function UISelectList(){this._callback=bagofholding;this.container=$N('div',{className:'UISelectList clearfix'});this._mode=UISelectList.MULTI_SELECT_MODE;this._inputName='UISelectList_name_'+(+new Date());this._items={};}copy_properties(UISelectList,{MULTI_SELECT_MODE:1,SINGLE_SELECT_MODE:2,MULTI_SELECT_MODE_CHECKED_CLASS_NAME:'UISelectList_check_Checked',SINGLE_SELECT_MODE_CHECKED_CLASS_NAME:'UISelectList_radio_Checked'});UISelectList.prototype={setMode:function(a){if(a!=UISelectList.MULTI_SELECT_MODE&&a!=UISelectList.SINGLE_SELECT_MODE)return this;if(!is_empty(this._items))return this;this._mode=a;return this;},setCallback:function(a){this._callback=a;return this;},addItem:function(d,a,c){var b={label:d,checked:a,key:c};this._renderItem(b);return this;},addItems:function(b){for(var a=0;a<b.length;a++)this.addItem(b[a].label,b[a].checked,b[a].key);return this;},clearItems:function(){this._items={};DOM.empty(this.container);return this;},setSelected:function(b,c){if(this._items[b]){var a=this._items[b].input;a.checked=!c;a.click();}return this;},getElement:function(){return this.container;},reset:function(){for(var b in this._items){var a=this._items[b].input;var c=this._items[b].label;a.checked=a.defaultChecked;CSS.conditionClass(c,this._getCheckedClass(),a.checked);}},_renderItem:function(b){var a=$N('input',{type:this._getInputType(),name:this._inputName});a.checked=b.checked;a.defaultChecked=b.checked;var c=$N('a',{className:'UISelectList_Label',href:'#'},b.label);if(b.checked)c.addClass(this._getCheckedClass());c.listen('click',this._linkClicked.bind(this,a));a.listen('click',this._clicked.bind(this,a,c,b.key));this.container.appendContent($N('div',{className:'UISelectList_Item'},[a,c]));b.input=a;b.label=c;this._items[b.key]=b;},_getInputType:function(){if(this._mode==UISelectList.MULTI_SELECT_MODE)return 'checkbox';return 'radio';},_getCheckedClass:function(){if(this._mode==UISelectList.MULTI_SELECT_MODE)return UISelectList.MULTI_SELECT_MODE_CHECKED_CLASS_NAME;return UISelectList.SINGLE_SELECT_MODE_CHECKED_CLASS_NAME;},_linkClicked:function(b,a){b.click();},_clicked:function(d,g,f,c){var b;if(this._mode==UISelectList.SINGLE_SELECT_MODE){for(var e in this._items){var a=d==this._items[e].input;CSS.conditionClass(this._items[e].label,this._getCheckedClass(),a);}b=true;}else{b=d.checked;CSS.conditionClass(g,this._getCheckedClass(),d.checked);}this._callback(b,f);$E(c).stop();}};
function typeaheadpro(a,c,b){if(!typeaheadpro.hacks){typeaheadpro.should_check_missing_events=ua.safari()<500;typeaheadpro.should_simulate_keypress=ua.ie()||(ua.safari()>500&&ua.safari()<523||ua.safari()>=525);if(typeaheadpro.should_use_iframe==undefined)typeaheadpro.should_use_iframe=ua.ie()<7;typeaheadpro.should_use_overflow=ua.opera()<9.5||ua.safari()<500;if(ua.firefox())this.activate_poll_on_focus_events=true;typeaheadpro.hacks=true;}typeaheadpro.instances=(typeaheadpro.instances||[]);typeaheadpro.instances.push(this);this.instance=typeaheadpro.instances.length-1;copy_properties(this,b||{});this.obj=a;this.obj.typeahead=this;this.obj.onfocus=this._onfocus.bind(this);this.obj.onblur=chain(this.obj.onblur,this._onblur.bind(this));this.obj.onchange=this._onchange.bind(this);this.obj.onkeyup=function(event){return this._onkeyup(event||window.event);}.bind(this);this.obj.onkeydown=function(event){return this._onkeydown(event||window.event);}.bind(this);this.obj.onkeypress=function(event){return this._onkeypress(event||window.event);}.bind(this);this.want_icon_list=false;this.showing_icon_list=false;this.stop_suggestion_select=false;if(this.typeahead_icon_class&&this.typeahead_icon_get_return){this.typeahead_icon=document.createElement('div');CSS.addClass(this.typeahead_icon,'typeahead_list_icon');CSS.addClass(this.typeahead_icon,this.typeahead_icon_class);this.typeahead_icon.innerHTML='&nbsp;';this.setup_typeahead_icon();setTimeout(function(){this.focus();}.bind(this),50);this.typeahead_icon.onmousedown=function(event){return this.typeahead_icon_onclick(event||window.event);}.bind(this);}this.focused=this.focused||this.obj.offsetWidth?true:false;this.anchor=this.setup_anchor();this.dropdown=document.createElement('div');CSS.addClass(this.dropdown,'typeahead_list');if(!this.focused)this.dropdown.style.display='none';this.anchor_block=this.anchor_block||this.anchor.tagName.toLowerCase()=='div';DOMScroll.getScrollRoot().appendChild(this.dropdown);this.dropdown.className+=' typeahead_list_absolute';this.list=$N('div');this.dropdown.appendChild(this.list);this.dropdown.onmousedown=function(event){return this.dropdown_onmousedown(event||window.event);}.bind(this);if(typeaheadpro.should_use_iframe&&!typeaheadpro.iframe){typeaheadpro.iframe=document.createElement('iframe');typeaheadpro.iframe.src="/common/blank.html";CSS.setClass(typeaheadpro.iframe,'typeahead_iframe');typeaheadpro.iframe.style.display='none';typeaheadpro.iframe.frameBorder=0;DOMScroll.getScrollRoot().appendChild(typeaheadpro.iframe);}if(typeaheadpro.should_use_iframe&&typeaheadpro.iframe)typeaheadpro.iframe.style.zIndex=parseInt(CSS.getStyle(this.dropdown,'zIndex'))-1;this.log_data={kt:0,kp:0,sm:null,ty:0,f:1};this.results_text='';this.last_key_suggestion=0;this.status=typeaheadpro.STATUS_BLOCK_ON_SOURCE_BOOTSTRAP;this.clear_placeholder();if(c)this.set_source(c);if(this.source){this.selectedindex=-1;if(this.focused){this._onfocus();this.show();this._onkeyup();this.set_class('');this.capture_submit();}}else this.hide();onunloadRegister(this._onunload.bind(this),true);}typeaheadpro.prototype.enumerate=false;typeaheadpro.prototype.interactive=false;typeaheadpro.prototype.changed=false;typeaheadpro.prototype.render_block_size=50;typeaheadpro.prototype.typeahead_icon_class=false;typeaheadpro.prototype.typeahead_icon_get_return=false;typeaheadpro.prototype.old_value=null;typeaheadpro.prototype.poll_handle=null;typeaheadpro.prototype.activate_poll_on_focus_events=false;typeaheadpro.prototype.suggestion_count=0;typeaheadpro.STATUS_IDLE=0;typeaheadpro.STATUS_WAITING_ON_SOURCE=1;typeaheadpro.STATUS_BLOCK_ON_SOURCE_BOOTSTRAP=2;typeaheadpro.prototype.clear_value_on_blur=true;typeaheadpro.prototype.max_results=0;typeaheadpro.prototype.max_display=10;typeaheadpro.prototype.allow_placeholders=false;typeaheadpro.prototype.auto_select=true;typeaheadpro.dirty_instances=function(){if(typeaheadpro.instances)typeaheadpro.instances.forEach(function(a){a.update_status(typeaheadpro.STATUS_BLOCK_ON_SOURCE_BOOTSTRAP);if(a.source)a.source.is_ready=false;});};typeaheadpro.prototype.set_source=function(a){this.source=a;this.source.set_owner(this);this.status=typeaheadpro.STATUS_IDLE;this.cache={};this.last_search=0;this.suggestions=[];};typeaheadpro.prototype.setup_anchor=function(){return this.obj;};typeaheadpro.prototype.destroy=function(){if(this.typeahead_icon){DOM.remove(this.typeahead_icon);this.toggle_icon_list=function(){};}this.clear_render_timeouts();if(!this.anchor_block&&this.anchor.nextSibling.tagName.toLowerCase()=='br')DOM.remove(this.anchor.nextSibling);if(this.dropdown)DOM.remove(this.dropdown);if(this.obj){this.obj.onfocus=this.obj.onblur=this.obj.onkeyup=this.obj.onkeydown=this.obj.onkeypress=this.obj.typeahead=null;DOM.remove(this.obj);}this.anchor=this.obj=this.dropdown=null;delete typeaheadpro.instances[this.instance];};typeaheadpro.prototype.check_value=function(){if(this.obj){var a=this.obj.value;if(a!=this.old_value){this.dirty_results();this.old_value=a;if(this.old_value==='')this._onselect(false);}}};typeaheadpro.prototype._onkeyup=function(a){a=$E(a);this.last_key=a?a.keyCode:-1;if(this.key_down==this.last_key)this.key_down=0;var b=true;switch(this.last_key){case KEYS.ESC:this.selectedindex=-1;this._onselect(false);this.hide();a.stop();b=false;break;}return b;};typeaheadpro.prototype._onkeydown=function(a){a=$E(a);this.key_down=this.last_key=a?a.keyCode:-1;this.interactive=true;switch(this.last_key){case KEYS.PAGE_UP:case KEYS.PAGE_DOWN:case KEYS.UP:case KEYS.DOWN:this.log_data.kt+=1;if(typeaheadpro.should_simulate_keypress)this._onkeypress({keyCode:this.last_key});return false;case KEYS.TAB:this.log_data.kt+=1;this.select_suggestion(this.selectedindex);if(a.shiftKey){this.reverse_focus();}else this.advance_focus();break;case KEYS.RETURN:this.log_data.sm='key_ret';if(this.select_suggestion(this.selectedindex))this.hide();if(typeof(this.submit_keydown_return)!='undefined')this.submit_keydown_return=this._onsubmit(this.get_current_selection());return this.submit_keydown_return;case 229:if(!this.poll_handle)this.poll_handle=setInterval(this.check_value.bind(this),100);break;default:this.log_data.kp+=1;setTimeout(bind(this,'check_value'),this.source.check_limit);}};typeaheadpro.prototype._onkeypress=function(a){a=$E(a);var b=1;this.last_key=a?Event.getKeyCode(a):-1;this.interactive=true;switch(this.last_key){case KEYS.PAGE_UP:b=this.max_display;case KEYS.UP:this.set_suggestion(b>1&&this.selectedindex>0&&this.selectedindex<b?0:this.selectedindex-b);this.last_key_suggestion=(new Date()).getTime();return false;case KEYS.PAGE_DOWN:b=this.max_display;case KEYS.DOWN:if(trim(this.get_value())==''&&!this.enumerate){this.enumerate=true;this.results_text=null;this.dirty_results();}else{this.set_suggestion(this.suggestions.length<=this.selectedindex+b?this.suggestions.length-1:this.selectedindex+b);this.last_key_suggestion=(new Date()).getTime();}return false;case KEYS.RETURN:var c=null;if(typeof(this.submit_keydown_return)=='undefined'){c=this.submit_keydown_return=this._onsubmit(this.get_current_selection());}else{c=this.submit_keydown_return;delete this.submit_keydown_return;}a.stop();return c;default:setTimeout(bind(this,'check_value'),this.source.check_limit);break;}return true;};typeaheadpro.prototype._onchange=function(){this.changed=true;};typeaheadpro.prototype._onfound=function(a){return this.onfound?this.onfound.call(this,a):true;};typeaheadpro.prototype._onsubmit=function(a){if(this.onsubmit){var b=this.onsubmit.call(this,a);if(b&&this.obj.form){if(!this.obj.form.onsubmit||this.obj.form.onsubmit())this.obj.form.submit();return false;}return b;}else{this.advance_focus();return false;}};typeaheadpro.prototype._onselect=function(c){var b=(function(){if(this.onselect)this.onselect.call(this,c);}).bind(this);if(c.no_email){var a=new AsyncRequest().setData({action:'require',require_field:'email',uid:c.i}).setMethod('GET').setReadOnly(true).setURI('/friends/ajax/external.php');new Dialog().setCloseHandler(function(e){var d=this.getUserData();if(d){b();}else e.set_value('');}.bind(null,this)).setAsync(a).show();}else b();};typeaheadpro.prototype._onfocus=function(){if(!this.poll_handle&&this.activate_poll_on_focus_events)this.poll_handle=setInterval(this.check_value.bind(this),100);if(this.source)this.source.bootstrap();if(this.last_dropdown_mouse>(new Date()).getTime()-10||this.focused)return;if(this.changed)this.dirty_results();this.focused=true;this.changed=false;this.clear_placeholder();this.results_text='';this.set_class('');this.show();this.capture_submit();if(this.typeahead_icon)show(this.typeahead_icon);};typeaheadpro.prototype._onblur=function(event){if(this.last_dropdown_mouse&&this.last_dropdown_mouse>(new Date()).getTime()-10&&this.is_showing_suggestions()){Event.kill(event);setTimeout(function(){this.focus();}.bind(this),0);return false;}if(!this.stop_hiding){if(this.showing_icon_list)this.toggle_icon_list(true);}else{this.focus();return false;}this.focused=false;if(this.changed&&!this.interactive){this.dirty_results();this.changed=false;return;}if(!this.suggestions){this._onselect(false);}else if(this.selectedindex>=0&&this.auto_select)this.select_suggestion(this.selectedindex);this.hide();this.update_class();if(this.clear_value_on_blur&&!this.get_value()){var a=this.allow_placeholders?this.source.gen_noinput():'';this.set_value(a?a:'');this.set_class('DOMControl_placeholder');}if(this.poll_handle){clearInterval(this.poll_handle);this.poll_handle=null;}};typeaheadpro.prototype._onunload=function(){if(typeaheadpro.instances[this.instance])this.hide();};typeaheadpro.prototype.typeahead_icon_onclick=function(event){this.stop_hiding=true;this.focus();setTimeout(function(){this.toggle_icon_list();}.bind(this),50);Event.kill(event);return false;};typeaheadpro.prototype.dropdown_onmousedown=function(event){this.last_dropdown_mouse=(new Date()).getTime();};typeaheadpro.prototype.setup_typeahead_icon=function(){this.typeahead_parent=document.createElement('div');CSS.addClass(this.typeahead_parent,'typeahead_parent');this.typeahead_parent.appendChild(this.typeahead_icon);this.obj.parentNode.insertBefore(this.typeahead_parent,this.obj);};typeaheadpro.prototype.mouse_set_suggestion=function(a){if(!this.visible)return;if((new Date()).getTime()-this.last_key_suggestion>50)this.set_suggestion(a);};typeaheadpro.prototype.capture_submit=function(){if(!typeaheadpro.should_check_missing_events)return;if((!this.captured_form||this.captured_substitute!=this.captured_form.onsubmit)&&this.obj.form){this.captured_form=this.obj.form;this.captured_event=this.obj.form.onsubmit;this.captured_substitute=this.obj.form.onsubmit=function(){return ((this.key_down&&this.key_down!=KEYS.RETURN&&this.key_down!=KEYS.TAB)?this.submit_keydown_return:(this.captured_event?this.captured_event.apply(arguments,this.captured_form):true))?true:false;}.bind(this);}};typeaheadpro.prototype.set_suggestion=function(b){this.stop_suggestion_select=false;if(!this.suggestions||this.suggestions.length<=b)return;var c=this.get_suggestion_node(this.selectedindex);this.selectedindex=(b<=-1)?-1:b;var a=this.get_suggestion_node(this.selectedindex);if(c){CSS.removeClass(c,'typeahead_selected');CSS.addClass(c,'typeahead_not_selected');}if(a){CSS.removeClass(a,'typeahead_not_selected');CSS.addClass(a,'typeahead_selected');}this.recalc_scroll();this._onfound(this.get_current_selection());};typeaheadpro.prototype.get_suggestion_node=function(a){var b=this.list.childNodes;return a==-1?null:b[Math.floor(a/this.render_block_size)].childNodes[a%this.render_block_size];};typeaheadpro.prototype.get_current_selection=function(){return this.selectedindex==-1?false:this.suggestions[this.selectedindex];};typeaheadpro.prototype.update_class=function(){if(this.suggestions&&this.selectedindex!=-1&&typeahead_source.flatten_string(this.get_current_selection().t)==typeahead_source.flatten_string(this.get_value())){this.set_class('typeahead_found');}else this.set_class('');};typeaheadpro.prototype.select_suggestion=function(a){if(!this.stop_suggestion_select&&this.current_selecting!=a)this.current_selecting=a;var b=true;if(!this.suggestions||a==undefined||a===false||this.suggestions.length<=a||a<0){this._onfound(false);this._onselect(false);this.selectedindex=-1;this.set_class('');b=false;}else{this.selectedindex=a;var c=this.suggestions[a].ty;if(c!='web'&&c!='search')this.set_value(this.suggestions[a].t);this.set_class('typeahead_found');this._onfound(this.suggestions[this.selectedindex]);this._onselect(this.suggestions[this.selectedindex]);}if(!this.interactive){this.hide();this.blur();}this.current_selecting=null;if(!b&&this.ignore_invalid_suggestion)return false;return true;};typeaheadpro.prototype.is_showing_suggestions=function(){return (this.suggestions)&&(this.suggestions.length>0);};typeaheadpro.prototype.set_value=function(a){this.obj.value=a;};typeaheadpro.prototype.get_value=function(){if(this.showing_icon_list&&this.old_typeahead_value!=this.obj.value)this.toggle_icon_list();if(this.want_icon_list){return this.typeahead_icon_get_return;}else if(this.showing_icon_list)this.toggle_icon_list();return this.obj.value;};typeaheadpro.prototype.found_suggestions=function(m,n,c){if(!m)m=[];this.suggestion_count=m.length;if(!c){this.status=typeaheadpro.STATUS_IDLE;this.add_cache(n,m);}this.clear_render_timeouts();if(this.get_value()==this.results_text){return;}else if(!c){this.results_text=typeahead_source.flatten_string(n);if(this.enumerate&&trim(this.results_text)!='')this.enumerate=false;}var b=-1;if(this.selectedindex!=-1){var k=this.suggestions[this.selectedindex].i;for(var f=0,g=m.length;f<g;f++)if(m[f].i==k){b=f;break;}}if(b==-1&&this.auto_select&&m.length){b=0;this._onfound(m[0]);}this.selectedindex=b;this.suggestions=m;if(!c)this.real_suggestions=m;if(m.length){var e=[],a=Math.ceil(m.length/this.render_block_size),h={},d,j=null;DOM.empty(this.list);for(var f=0;f<a;f++)this.list.appendChild(document.createElement('div'));if(b>-1){d=Math.floor(b/this.render_block_size);h[d]=true;if(b%this.render_block_size>this.render_block_size/2){h[d+1]=true;}else if(d!=0)h[d-1]=true;}else h[0]=true;for(var i in h){this.render_block(i);sample=this.list.childNodes[i].firstChild;}this.show();if(a){var l=sample.offsetHeight;this.render_timeouts=[];for(var f=1;f<a;f++)if(!h[f]){this.list.childNodes[f].style.height=l*Math.min(this.render_block_size,m.length-f*this.render_block_size)+'px';this.render_timeouts.push(setTimeout(this.render_block.bind(this,f),700+f*50));}}}else{this.selectedindex=-1;this.set_message(this.status==typeaheadpro.STATUS_IDLE?this.source.gen_nomatch():this.source.gen_loading());this._onfound(false);}this.recalc_scroll();if(!c&&this.results_text!=typeahead_source.flatten_string(this.get_value()))this.dirty_results();};typeaheadpro.prototype.render_block=function(a,h){var i=this.suggestions,g=this.selectedindex,j=this.get_value(),d=this.instance,b=[],f=this.list.childNodes[a];for(var c=a*this.render_block_size,e=Math.min(i.length,(a+1)*this.render_block_size);c<e;c++){b.push('<div class="');if(g==c){b.push('typeahead_suggestion typeahead_selected');}else b.push('typeahead_suggestion typeahead_not_selected');if(c>0&&i[c-1].o<0&&i[c].o>=0)b.push(' typeahead_delimiter');b.push('" onmouseover="typeaheadpro.instances[',d,'].mouse_set_suggestion(',c,')" ','onmousedown="var instance=typeaheadpro.instances[',d,']; instance.select_suggestion(',c,');instance.hide();Event.kill(event);">',this.source.gen_html(i[c],j),'</div>');}f.innerHTML=b.join('');f.style.height='auto';CSS.addClass(f,'typeahead_suggestions');};typeaheadpro.prototype.clear_render_timeouts=function(){if(this.render_timeouts){for(var a=0;a<this.render_timeouts.length;a++)clearTimeout(this.render_timeouts[a]);this.render_timeouts=null;}};typeaheadpro.prototype.recalc_scroll=function(){var a=this.list.firstChild;if(!a)return;if(a.childNodes.length>this.max_display){var c=a.childNodes[this.max_display-1];var b=c.offsetTop+c.offsetHeight;this.dropdown.style.height=b+'px';var e=this.get_suggestion_node(this.selectedindex);if(e){var d=this.dropdown.scrollTop;if(e.offsetTop<d){this.dropdown.scrollTop=e.offsetTop;}else if(e.offsetTop+e.offsetHeight>b+d)this.dropdown.scrollTop=e.offsetTop+e.offsetHeight-b;}if(!typeaheadpro.should_use_overflow){this.dropdown.style.overflowY='scroll';this.dropdown.style.overflowX='hidden';}}else{this.dropdown.style.height='auto';if(!typeaheadpro.should_use_overflow)this.dropdown.style.overflowY='hidden';}};typeaheadpro.prototype.search_cache=function(a){return this.cache[typeahead_source.flatten_string(a)];};typeaheadpro.prototype.add_cache=function(b,a){if(this.source.cache_results)this.cache[typeahead_source.flatten_string(b)]=a;};typeaheadpro.prototype.update_status=function(a){this.status=a;this.dirty_results();};typeaheadpro.prototype.set_class=function(a){CSS.setClass(this.obj,(this.obj.className.replace(/typeahead_[^\s]+/g,'')+' '+a).replace(/ {2,}/g,' '));};typeaheadpro.prototype.dirty_results=function(){if(!this.enumerate&&this.get_value().trim()==''){DOM.empty(this.list);this.results_text='';this.set_message(this.source.gen_placeholder());this.suggestions=[];this.selectedindex=-1;return;}else if(this.results_text==typeahead_source.flatten_string(this.get_value())){return;}else if(this.status==typeaheadpro.STATUS_BLOCK_ON_SOURCE_BOOTSTRAP){this.set_message(this.source.gen_loading());return;}var c=(new Date()).getTime();var e=false;if(this.last_search<=(c-this.source.search_limit)&&this.status==typeaheadpro.STATUS_IDLE){e=this.perform_search();}else if(this.status==typeaheadpro.STATUS_IDLE)if(!this.search_timeout)this.search_timeout=setTimeout(function(){this.search_timeout=false;if(this.status==typeaheadpro.STATUS_IDLE)this.dirty_results();}.bind(this),this.source.search_limit-(c-this.last_search));if(this.source.allow_fake_results&&this.real_suggestions&&!e){var d=typeahead_source.tokenize(this.get_value()).sort(typeahead_source._sort);var a=[];for(var b=0;b<this.real_suggestions.length;b++)if(typeahead_source.check_match(d,this.real_suggestions[b].t+' '+this.real_suggestions[b].n))a.push(this.real_suggestions[b]);if(a.length){this.found_suggestions(a,this.get_value(),true);}else{this.selectedindex=-1;this.set_message(this.source.gen_loading());}}};typeaheadpro.prototype.perform_search=function(){if(this.get_value()==this.results_text)return true;var a;if((a=this.search_cache(this.get_value()))===undefined&&!(a=this.source.search_value(this.get_value()))){this.status=typeaheadpro.STATUS_WAITING_ON_SOURCE;this.last_search=(new Date()).getTime();return false;}this.found_suggestions(a,this.get_value(),false);return true;};typeaheadpro.prototype.set_message=function(a){this.clear_render_timeouts();if(a){this.list.innerHTML='<div class="typeahead_message">'+a+'</div>';this.reset_iframe();}else this.hide();this.recalc_scroll();};typeaheadpro.prototype.reset_iframe=function(){if(!typeaheadpro.should_use_iframe)return;typeaheadpro.iframe.style.top=this.dropdown.style.top;typeaheadpro.iframe.style.left=this.dropdown.style.left;typeaheadpro.iframe.style.width=this.dropdown.offsetWidth+'px';typeaheadpro.iframe.style.height=this.dropdown.offsetHeight+'px';typeaheadpro.iframe.style.display='';};typeaheadpro.prototype.advance_focus=function(){return this._move_focus(true);};typeaheadpro.prototype.reverse_focus=function(){return this._move_focus(false);};typeaheadpro.prototype._move_focus=function(c){var b=this.obj.form?get_all_form_inputs(this.obj.form):get_all_form_inputs();var d=[];d._insert=c?d.push:d.unshift;var e=!c;for(var a=0;a<b.length;a++)if(!c&&b[a]==this.obj){e=false;}else if(e&&b[a].type!='hidden'&&b[a].tabIndex!=-1&&b[a].offsetParent){d._insert(b[a]);}else if(b[a]==this.obj)e=true;setTimeout(function(){for(var f=0;f<this.length;f++)try{if(this[f].offsetParent){this[f].focus();setTimeout(function(){try{this.focus();}catch(e){}}.bind(this[f]),0);return;}}catch(e){}}.bind(d?d:[]),0);this.blur();this.hide();};typeaheadpro.prototype.clear_placeholder=function(){if(this.obj.className.indexOf('DOMControl_placeholder')!=-1){this.set_value('');this.set_class('');}};typeaheadpro.prototype.clear=function(){this.set_value('');this.set_class('');this.selectedindex=-1;this.enumerate=false;this.dirty_results();};typeaheadpro.prototype.hide=function(){if(this.stop_hiding)return;this.visible=false;this.dropdown.style.display='none';this.clear_render_timeouts();if(typeaheadpro.should_use_iframe)typeaheadpro.iframe.style.display='none';};typeaheadpro.prototype.show=function(){this.visible=true;if(this.focused){this.dropdown.style.top=elementY(this.anchor)+this.anchor.offsetHeight+'px';this.dropdown.style.left=elementX(this.anchor)+'px';this.dropdown.style.width=(this.anchor.offsetWidth-2)+'px';this.dropdown.style.display='';if(typeaheadpro.should_use_iframe){typeaheadpro.iframe.style.display='';this.reset_iframe();}}};typeaheadpro.prototype.toggle_icon_list=function(a){if(this.showing_icon_list){this.showing_icon_list=false;this.source.showing_icon_list=false;if(!a)this.focus();CSS.removeClass(this.typeahead_icon,'on_selected');this.want_icon_list=false;this.showing_icon_list=false;this.stop_suggestion_select=true;if(this.obj)this.dirty_results();}else{this.source.showing_icon_list=true;this.old_typeahead_value=this.obj.value;this.stop_suggestion_select=true;this.want_icon_list=true;this.dirty_results();this.focus();CSS.addClass(this.typeahead_icon,'on_selected');this.show();this.set_suggestion(-1);this.showing_icon_list=true;}setTimeout(function(){this.stop_hiding=false;}.bind(this),100);};typeaheadpro.prototype.focus=function(){this.obj.focus();};typeaheadpro.prototype.blur=function(a){if(this.obj)this.obj.blur(a);};typeaheadpro.kill_typeahead=function(a){if(a.typeahead){if(!this.anchor_block)a.parentNode.removeChild(a.nextSibling);a.parentNode.removeChild(a.nextSibling);if(a.typeahead.source)a.typeahead.source=a.typeahead.source.owner=null;a.onfocus=a.onblur=a.onkeypress=a.onkeyup=a.onkeydown=a.typeahead=null;}};
function typeahead_source(){}typeahead_source.prototype.cache_results=false;typeahead_source.prototype.enumerable=false;typeahead_source.prototype.allow_fake_results=false;typeahead_source.prototype.search_limit=10;typeahead_source.prototype.check_limit=10;typeahead_source.prototype.bootstrap=bagofholding;typeahead_source.check_match=function(f,g){g=typeahead_source.tokenize(g);for(var b=0,c=f.length;b<c;b++)if(f[b].length){var a=false;for(var d=0,e=g.length;d<e;d++)if(g[d].length>=f[b].length&&g[d].substring(0,f[b].length)==f[b]){a=true;g[d]='';break;}if(!a)return false;}return true;};typeahead_source.tokenize=function(c,a,b){return (b?c:typeahead_source.flatten_string(c)).split(a?typeahead_source.normalizer_regex_capture:typeahead_source.normalizer_regex);};typeahead_source.normalizer_regex_str='(?:(?:^| +)["\'.\\-]+ *)|(?: *[\'".\\-]+(?: +|$)|[@_]| +)';typeahead_source.normalizer_regex=new RegExp(typeahead_source.normalizer_regex_str,'g');typeahead_source.normalizer_regex_capture=new RegExp('('+typeahead_source.normalizer_regex_str+')','g');typeahead_source.flatten_string=function(b){if(!typeahead_source.accents)typeahead_source.accents={a:/\u0430|\u00e0|\u00e1|\u00e2|\u00e3|\u00e4|\u00e5/g,b:/\u0431/g,c:/\u0446|\u00e7/g,d:/\u0434|\u00f0/g,e:/\u044d|\u0435|\u00e8|\u00e9|\u00ea|\u00eb/g,f:/\u0444/g,g:/\u0433/g,h:/\u0445/g,i:/\u0438|\u00ec|\u00ed|\u00ee|\u00ef/g,j:/\u0439/g,k:/\u043a/g,l:/\u043b/g,m:/\u043c/g,n:/\u043d|\u00f1/g,o:/\u043e|\u00f8|\u00f6|\u00f5|\u00f4|\u00f3|\u00f2/g,p:/\u043f/g,r:/\u0440/g,s:/\u0441/g,t:/\u0442/g,u:/\u0443|\u044e|\u00fc|\u00fb|\u00fa|\u00f9/g,v:/\u0432/g,y:/\u044b|\u00ff|\u00fd/g,z:/\u0437/g,ae:/\u00e6/g,oe:/\u0153/g,ts:/\u0446/g,ch:/\u0447/g,sh:/\u0448/g,ya:/\u044f/g};b=b.toLowerCase();for(var a in typeahead_source.accents)b=b.replace(typeahead_source.accents[a],a);return b;};typeahead_source.prototype.set_owner=function(a){this.owner=a;if(this.is_ready)this.owner.update_status(typeaheadpro.STATUS_IDLE);};typeahead_source.prototype.ready=function(){if(this.owner&&!this.is_ready){this.is_ready=true;this.owner.update_status(typeaheadpro.STATUS_IDLE);}else this.is_ready=true;};typeahead_source.highlight_found=function(g,h){var b=[];resultv=typeahead_source.tokenize(g,true,true);g=typeahead_source.tokenize(g,true);h=typeahead_source.tokenize(h);h.sort(typeahead_source._sort);for(var c=0,d=resultv.length;c<d;c++){var a=false;for(var e=0,f=h.length;e<f;e++)if(h[e]&&g[c].lastIndexOf(h[e],0)!=-1){b.push('<em>',htmlspecialchars(resultv[c].substring(0,h[e].length)),'</em>',htmlspecialchars(resultv[c].substring(h[e].length,resultv[c].length)));a=true;break;}if(!a)b.push(htmlspecialchars(resultv[c]));}return b.join('');};typeahead_source._sort=function(a,b){return b.length-a.length;};typeahead_source.prototype.gen_nomatch=function(){return this.text_nomatch!=null?this.text_nomatch:_tx("Tuloksia ei l\u00f6ytynyt");};typeahead_source.prototype.gen_loading=function(){return this.text_loading!=null?this.text_loading:_tx("Latautuu...");};typeahead_source.prototype.gen_placeholder=function(){return this.text_placeholder!=null?this.text_placeholder:_tx("Aloita kirjoittaminen...");};typeahead_source.prototype.gen_noinput=function(){return this.text_noinput!=null?this.text_noinput:_tx("Aloita kirjoittaminen...");};typeahead_source.prototype.onselect_not_found=function(){if(typeof this.tokenizer._ontokennotfound!='undefined')this.tokenizer._ontokennotfound(this.obj.value);if(typeof this.tokenizer.onselect!='undefined')return this.tokenizer.onselect();};
function static_source(){this.values=null;this.index=null;this.index_includes_hints=false;this.exclude_ids={};this.parent.construct(this);}static_source.extend('typeahead_source');static_source.prototype.enumerable=true;static_source.prototype.filter_excluded=function(a){return a.filter((function(b){return !this.exclude_ids[b.i];}).bind(this));};static_source.prototype.build_index=function(g){var d=[];var i=this.values;var a=i.length&&typeof i[0].i=='undefined';for(var b=0,c=i.length;b<c;b++){var h=typeahead_source.tokenize(i[b].t);for(var e=0,f=h.length;e<f;e++)d.push({t:h[e],o:i[b]});if(this.index_includes_hints&&i[b].s){var h=typeahead_source.tokenize(i[b].s);for(var e=0,f=h.length;e<f;e++)d.push({t:h[e],o:i[b]});}if(a)i[b].i=b;}d.sort(function(j,k){return (j.t==k.t)?0:(j.t<k.t?-1:1);});this.index=d;if(!g)this.ready();};static_source.prototype._sort_text_obj=function(a,b){if(a.e&&!b.e)return 1;if(!a.e&&b.e)return -1;return a.t.localeCompare(b.t);};static_source.prototype.search_value=function(k,a){if(!this.is_ready)return;var i;if(k==''){i=this.values;}else{var l=typeahead_source.tokenize(k).sort(typeahead_source._sort);var f=this.index;var g=0;var d=this.index.length-1;var h=Math.floor(d/2);while(g<=d){if(f[h].t>=l[0]){d=h-1;}else g=h+1;h=Math.floor(g+((d-g)/2));}var i=[];var j={};var b=typeof _ignoreList!='undefined';for(var e=g;e<f.length&&f[e].t.lastIndexOf(l[0],0)!=-1;e++){var c=f[e].o.flid?f[e].o.flid:f[e].o.i;if(typeof j[c]!='undefined'){continue;}else j[c]=true;if((!b||!_ignoreList[c])&&!this.exclude_ids[c]&&(l.length==1||typeahead_source.check_match(l,f[e].o.t)))i.push(f[e].o);}}i.sort(this._sort_text_obj.bind(this));if(this.owner&&this.owner.max_results)i=i.slice(0,this.owner.max_results);if(a)a(this,k,i);return i;};static_source.prototype.set_exclude_ids=function(a){this.exclude_ids=a;};
function RenderManager(a){copy_properties(this,{_isDirty:false,_obj:a});}copy_properties(RenderManager.prototype,{dirty:function(){if(!this._isDirty){this._isDirty=true;bind(this,this.doPaint).defer();}},doPaint:function(){this._isDirty=false;this._obj.paint();}});
var HistoryManager={_IFRAME_BASE_URI:'http://static.ak.facebook.com/common/history_manager.html',history:null,current:0,fragment:null,_setIframeSrcFragment:function(b){b=b.toString();var a=HistoryManager.history.length-1;HistoryManager.iframe.src=HistoryManager._IFRAME_BASE_URI+'?|index='+a+'#'+encodeURIComponent(b);return HistoryManager;},getIframeSrcFragment:function(){return decodeURIComponent(URI(HistoryManager.iframe.contentWindow.document.location.href).getFragment());},nextframe:function(a,b){if(b){HistoryManager._setIframeSrcFragment(a);return;}if(a!==undefined){HistoryManager.iframeQueue.push(a);}else{HistoryManager.iframeQueue.splice(0,1);HistoryManager.iframeTimeout=null;HistoryManager.checkURI();}if(HistoryManager.iframeQueue.length&&!HistoryManager.iframeTimeout){var c=HistoryManager.iframeQueue[0];HistoryManager.iframeTimeout=setTimeout(function(){HistoryManager._setIframeSrcFragment(c);},100,false);}},isInitialized:function(){return !!HistoryManager._initialized;},init:function(){if(URI.getRequestURI(false).getProtocol().toLowerCase()=='https')return;if(!env_get('ALLOW_TRANSITION_IN_IFRAME')&&window!=window.top)return;if(HistoryManager._initialized)return HistoryManager;var b=URI();var a=b.getFragment()||'';copy_properties(HistoryManager,{_initialized:true,fragment:a,orig_fragment:a,history:[b],callbacks:[],lastChanged:new Date().getTime(),canonical:URI('#'),fragmentTimeout:null,user:0,iframeTimeout:null,iframeQueue:[],enabled:true,debug:bagofholding});if(ua.safari()<500||ua.firefox()<2){HistoryManager.enabled=false;return HistoryManager;}if(ua.ie()<8){HistoryManager.iframe=document.createElement('iframe');copy_properties(HistoryManager.iframe.style,{width:'0',height:'0',frameborder:'0',left:'0',top:'0',position:'absolute'});onloadRegister(function(){HistoryManager._setIframeSrcFragment(a);document.body.insertBefore(HistoryManager.iframe,document.body.firstChild);});}else setInterval(HistoryManager.checkURI,42,false);HistoryManager._updateRefererURI(URI.getRequestURI(false));return HistoryManager;},registerURIHandler:function(a){HistoryManager.callbacks.push(a);return HistoryManager;},setCanonicalLocation:function(a){HistoryManager.canonical=URI(a);return HistoryManager;},notify:function(b){if(b==HistoryManager.orig_fragment)b=HistoryManager.canonical.getFragment();for(var a=0;a<HistoryManager.callbacks.length;a++)try{if(HistoryManager.callbacks[a](b))return true;}catch(ex){}return false;},checkURI:function(){if(new Date().getTime()-HistoryManager.lastChanged<400)return;if(ua.ie()<8&&HistoryManager.iframeQueue.length)return;if(ua.safari()&&window.history.length==200){if(!HistoryManager.warned)HistoryManager.warned=true;return;}var a=URI().getFragment();if(ua.ie()<8)a=HistoryManager.getIframeSrcFragment();if(a!=HistoryManager.fragment){HistoryManager.debug([a,' vs ',HistoryManager.fragment,'whl: ',window.history.length,'QHL: ',HistoryManager.history.length].join(' '));for(var b=HistoryManager.history.length-1;b>=0;--b)if(HistoryManager.history[b].getFragment()==a)break;++HistoryManager.user;if(b>=0){HistoryManager.go(b-HistoryManager.current);}else HistoryManager.go('#'+a);--HistoryManager.user;}delete a;},_updateRefererURI:function(a){a=a.toString();if(a.charAt(0)!='/'&&a.indexOf('//')==-1)return;setCookie('x-referer',URI(a).getQualifiedURI().setFragment('').toString());},go:function(c,e,f){HistoryManager.debug('go: '+c);if(e===undefined)e=true;if(!HistoryManager.enabled)if(!e)return false;if(typeof(c)=='number'){if(!c)return false;var b=c+HistoryManager.current;var d=Math.max(0,Math.min(HistoryManager.history.length-1,b));HistoryManager.current=d;b=HistoryManager.history[d].getFragment()||HistoryManager.orig_fragment;HistoryManager.fragment=b;HistoryManager.lastChanged=new Date().getTime();if(ua.ie()<8){if(HistoryManager.fragmentTimeout)clearTimeout(HistoryManager.fragmentTimeout);HistoryManager._temporary_fragment=b;HistoryManager.fragmentTimeout=setTimeout(function(){window.location.hash='#'+b;delete HistoryManager._temporary_fragment;},750,false);if(!HistoryManager.user)HistoryManager.nextframe(b,f);}else if(!HistoryManager.user)go_or_replace(window.location,window.location.href.split('#')[0]+'#'+b,f);if(e)HistoryManager.notify(b);HistoryManager._updateRefererURI(b);return false;}c=URI(c);if(c.getDomain()==URI().getDomain())c=URI('#'+c.getUnqualifiedURI());var a=HistoryManager.history[HistoryManager.current].getFragment();var g=c.getFragment();if(g==a||(a==HistoryManager.orig_fragment&&g==HistoryManager.canonical.getFragment())){if(e)HistoryManager.notify(g);HistoryManager._updateRefererURI(g);return false;}if(f)HistoryManager.current--;var h=(HistoryManager.history.length-HistoryManager.current)-1;HistoryManager.history.splice(HistoryManager.current+1,h);HistoryManager.history.push(URI(c));return HistoryManager.go(1,e,f);},getCurrentFragment:function(){var a=HistoryManager._temporary_fragment!==undefined?HistoryManager._temporary_fragment:URI.getRequestURI(false).getFragment();return a==HistoryManager.orig_fragment?HistoryManager.canonical.getFragment():a;}};var PageTransitions={_transition_handlers:[],_scroll_positions:{},isInitialized:function(){return !!PageTransitions._initialized;},_init:function(){if(URI.getRequestURI(false).getProtocol().toLowerCase()=='https')return;if(!env_get('ALLOW_TRANSITION_IN_IFRAME')&&window!=window.top)return;if(PageTransitions._initialized)return PageTransitions;PageTransitions._initialized=true;var c=URI.getRequestURI(false);var a=c.getUnqualifiedURI();var d=URI(a).setFragment(null);if(d.toString()===a.getFragment())a=d;copy_properties(PageTransitions,{_current_uri:a,_most_recent_uri:a,_next_uri:a});var b;if(c.getFragment().startsWith('/')){b=c.getFragment();}else b=a;HistoryManager.init().setCanonicalLocation('#'+b).registerURIHandler(PageTransitions._historyManagerHandler);LinkController.registerFallbackHandler(PageTransitions._rewriteHref,LinkController.TARGETS|LinkController.MODIFIERS);LinkController.registerFallbackHandler(PageTransitions._onlinkclick);FormController.registerFallbackHandler(PageTransitions._onformsubmit);window.onscroll=chain(window.onscroll,function(){var e=HistoryManager.getCurrentFragment();if(PageTransitions._current_uri==e)PageTransitions._scroll_positions[e]=Vector2.getScrollPosition();});return PageTransitions;},registerHandler:function(b,a){PageTransitions._init();PageTransitions._transition_handlers.contains(b);if(a){PageTransitions._transition_handlers.unshift(b);}else PageTransitions._transition_handlers.push(b);},getCurrentURI:function(a){if(!PageTransitions._current_uri&&!a)return new URI(PageTransitions._most_recent_uri);return new URI(PageTransitions._current_uri);},getMostRecentURI:function(){return new URI(PageTransitions._most_recent_uri);},getNextURI:function(){return new URI(PageTransitions._next_uri);},_rewriteHref:function(a){var c=a.getAttribute('href');var b=_computeRelativeURI(PageTransitions._most_recent_uri.getQualifiedURI(),c).toString();if(c!=b)a.setAttribute('href',b);},_onlinkclick:function(a){_BusyUIManager.lookBusy(a);PageTransitions.go(a.getAttribute('href'));return false;},_onformsubmit:function(a){var c=new URI(a.getAttribute('action')||''),b=_computeRelativeURI(PageTransitions._most_recent_uri,c);a.setAttribute('action',b.toString());if(!a.method||a.method.toUpperCase()=='GET'){PageTransitions.go(b.addQueryData(serialize_form(a)));return false;}},_rewriteSubDomain:function(c){c=URI(c);var b=c.getDomain();if(b.indexOf('apps.')===0){var a=URI.getRequestURI().getDomain();c.addQueryData({_fb_qsub:b}).setDomain(a);}return c;},_revertSubDomain:function(c){c=URI(c);var b=c.getQueryData();if('_fb_qsub' in b){var a=b._fb_qsub;c.removeQueryData('_fb_qsub').setDomain(a).setProtocol(URI().getProtocol());}return c;},go:function(d,b){var a=new URI(d).removeQueryData('quickling').getQualifiedURI();a=PageTransitions._rewriteSubDomain(a);var c=a.getUnqualifiedURI();delete PageTransitions._scroll_positions[c];_BusyUIManager.lookBusy();PageTransitions._loadPage(a,function(e){if(e){HistoryManager.go(a.toString(),false,b);}else{a=PageTransitions._revertSubDomain(a);go_or_replace(window.location,a,b);}});},_historyManagerHandler:function(a){if(a.charAt(0)!='/')return false;PageTransitions._loadPage(new URI(a),function(b){if(!b){a=PageTransitions._revertSubDomain(a);go_or_replace(window.location,a,true);}});return true;},_loadPage:function(e,c){if(e.getFragment()&&are_equal(URI(e).setFragment(null).getQualifiedURI(),URI(PageTransitions._current_uri).setFragment(null).getQualifiedURI())){PageTransitions._current_uri=PageTransitions._most_recent_uri=e;PageTransitions.restoreScrollPosition();_BusyUIManager.stopLookingBusy();return;}var d=PageTransitions._scroll_positions[PageTransitions._current_uri];PageTransitions._current_uri=null;PageTransitions._next_uri=e;if(d)DOMScroll.scrollTo(d,false);var b=function(){var f=PageTransitions._handleTransition(e);c&&c(f);};var a=_runHooks('onbeforeleavehooks');if(a){_BusyUIManager.stopLookingBusy();PageTransitions._warnBeforeLeaving(a,b);}else b();},_handleTransition:function(c){window.onbeforeleavehooks=undefined;_BusyUIManager.lookBusy();for(var a=PageTransitions._transition_handlers.length-1;a>=0;--a)if(PageTransitions._transition_handlers[a](c)===true){var b={sender:this,uri:c};Arbiter.inform(Arbiter.PAGE_TRANSITION,b);return true;}else PageTransitions._transition_handlers.splice(a,1);return false;},unifyURI:function(){PageTransitions._current_uri=PageTransitions._most_recent_uri=PageTransitions._next_uri;},transitionComplete:function(){_BusyUIManager.stopLookingBusy();PageTransitions.unifyURI();PageTransitions.restoreScrollPosition();},_warnBeforeLeaving:function(b,a){new Dialog().setTitle(_tx("Haluatko varmasti poistua t\u00e4lt\u00e4 sivulta?")).setSummary(_tx("Paina {ok} jatkaaksesi tai {cancel} j\u00e4\u00e4d\u00e4ksesi t\u00e4lle sivulle.",{ok:_tx("OK"),cancel:_tx("Peruuta")})).setBody(htmlize(b)).setButtons(Dialog.OK_AND_CANCEL).setHandler(a).setModal().show();},restoreScrollPosition:function(){var c=PageTransitions._current_uri;var e=PageTransitions._scroll_positions[c];if(e){DOMScroll.scrollTo(e,false);return;}function d(f){return (f||null)&&(DOM.find(document,sprintf('a[name=%e]',f))||ge(f));}var a=d(c.getFragment());if(a){var b=Vector2.getElementPosition(a);b.x=0;DOMScroll.scrollTo(b);}}};function _computeRelativeURI(d,b){var e=new URI(),c=b;d=new URI(d);b=new URI(b);if(!b.isFacebookURI())return c;var f=d;var a=['Protocol','Domain','Port','Path','QueryData','Fragment'];a.forEach(function(h){var g=h=='Path'&&f===d;if(g)e.setPath(_computeRelativePath(d.getPath(),b.getPath()));if(!is_empty(b['get'+h]()))f=b;if(!g)e['set'+h](f['get'+h]());});return e;}function _computeRelativePath(b,a){if(!a)return b;if(a.charAt(0)=='/')return a;var c=b.split('/').slice(0,-1);c[0]!=='';a.split('/').forEach(function(d){if(!(d=='.'))if(d=='..'){if(c.length>1)c=c.slice(0,-1);}else c.push(d);});return c.join('/');}function go_or_replace(a,d,c){var e=new URI(d);if(a.pathname=='/'&&e.getPath()!='/'&&e.isQuicklingEnabled()){var b=a.search?{}:{q:''};e=new URI().setPath('/').setQueryData(b).setFragment(e.getUnqualifiedURI()).toString();d=e.toString();}if(c&&!(ua.ie()<8)){a.replace(d);}else if(a.href==d){a.reload();}else a.href=d;}var _BusyUIManager={_looking_busy:false,_original_cursors:[],lookBusy:function(a){if(a)_BusyUIManager._giveProgressCursor(a);if(_BusyUIManager._looking_busy)return;_BusyUIManager._looking_busy=true;_BusyUIManager._giveProgressCursor(document.body);},stopLookingBusy:function(){if(!_BusyUIManager._looking_busy)return;_BusyUIManager._looking_busy=false;while(_BusyUIManager._original_cursors.length){var c=_BusyUIManager._original_cursors.pop();var b=c[0];var a=c[1];if(b.style)b.style.cursor=a||'';}},_giveProgressCursor:function(a){if(!ua.safari()){_BusyUIManager._original_cursors.push([a,a.style.cursor]);a.style.cursor='progress';}}};
function Template(a){copy_properties(this,{_templateSource:a});}copy_properties(Template,{_operatorRepeat:function(d,a){var f='';var c=d.match(/([^:]*):(.*)/);if(!(!c))if(!(!TemplateRegistry.hasTemplate(c[2])))if(a[c[1]]){var e=TemplateRegistry.getTemplate(c[2]);var b=arrayize(a[c[1]]);f+=b.map(function(h,g){return h.render(g);}.curry(e)).join(' ');}return f;}});copy_properties(Template.prototype,{getSource:function(){return this._templateSource;},render:function(b){var a=function(d,c,f,e){switch(f){case 'H':return d[e]||'';case 'R':return Template._operatorRepeat(e,d);default:return d[e]?htmlize(d[e]):'';}return d[e]?translator(d[e]):'';}.curry(b||{});return this._templateSource.replace(/\$(H|R)?{([^\}]*)\}/g,a);}});var TemplateRegistry={_storage:{},registerTemplate:function(a,b){if(typeof(b)=="string")b=new Template(b);this._storage[a]=b;return this;},unregisterTemplate:function(a){delete this._storage[a];},hasTemplate:function(a){return a in this._storage;},getTemplate:function(a){if(this.hasTemplate(a))return this._storage[a];return null;},registerServerSideTemplate:function(d,b,e,c){b=b||bagofholding;e=!!e;c=!!c;if(this.hasTemplate(d)){b();return this;}var a=new AsyncRequest(d).setReadOnly(true).setMethod('GET').setOption('asynchronous',!e).setOption('suppressEvaluation',!c);if(!e)a.setErrorHandler(this._registerErrorHandler.bind(this,d)).setHandler(this._registerHandler.bind(this,d,c,b));a.send();if(e){var f=this._stripHasteComments(a.transport.responseText);this.registerTemplate(d,new Template(f));b();}return this;},_registerErrorHandler:function(a,b){},_registerHandler:function(c,b,a,e){var d=e.getPayload();var f=null;if(b){if(d.template)f=d.template;}else f=this._stripHasteComments(d.responseText);if(f){this.registerTemplate(c,f);a();}},_stripHasteComments:function(a){return a.replace(/^\s*\/\*\*?(.|\n)*\*\//m,'');},_onRegisterTemplate:function(b,a){if(b=='template/registerTemplate'){if(!(!a||!a.name||!a.template))this.registerTemplate(a.name,a.template);return false;}return true;}};Arbiter.subscribe('template/registerTemplate',TemplateRegistry._onRegisterTemplate.bind(TemplateRegistry),Arbiter.SUBSCRIBE_ALL);
function TemplateObject(c,a){a=a||{};if(!(c instanceof Template))if(TemplateRegistry.hasTemplate(c)){c=TemplateRegistry.getTemplate(c);}else if(c instanceof URI){TemplateRegistry.registerServerSideTemplate(c.toString(),null,true);c=TemplateRegistry.getTemplate(c);}if(c==null)throw new Error("Template could not be found");var b=c.render(a);copy_properties(this,{_nodes:HTML(b).getNodes(),_template:c,_rendered:b});TemplateObject.bindNodes(this._nodes,this);}copy_properties(TemplateObject,{bindNodes:function(f,g){var a=[];for(var c=0;c<f.length;c++)if(f[c].nodeType==DOM.NODE_TYPES.ELEMENT){a.push(f[c]);var e=f[c].getElementsByTagName('*');a=a.concat(to_array(e));}for(var c=0;c<a.length;c++){var b=a[c].getAttribute('bindPoint');var d=a[c].getAttribute('listen');if(b)if(hasArrayNature(g[b])){g[b].push(a[c]);}else g[b]=a[c];if(d)d.replace(/(\w+) *: *(\w+)/g,function(k,j,h,i){if(typeof(this[i])=="function"){Event.listen(k,h,bind(this,this[i]));}else Event.listen(k,h,bind(this,TemplateObject._eventWrapper,i));}.bind(g,a[c]));}},_eventWrapper:function(a,event){if(typeof(this[a])=="function"){return this[a](event);}else return true;}});copy_properties(TemplateObject.prototype,{getNodes:function(){return this._nodes;},getRendered:function(){return this._rendered;}});
var SocialGraphManager=function(){var c=false;var a=-1;var d=-1;var b=null;var e=function(h){if(!c)return null;var i={node_id:d};i['class']=a;copy_properties(h,i);return h;};var f=function(j,h,i){new AsyncRequest().setURI(j).setData(e(h)).setHandler(i?i:bagofholding).send();return false;};var g=function(j,i){if(!(i=e(i)))return;var h=new AsyncRequest().setMethod('POST').setURI(j).setData(i);b=new Dialog().setModal(true).setAsync(h).show();return false;};return {init:function(h,i){c=true;a=h;d=i;return this;},getCurrentNodeID:function(){return d;},showInviteDialog:function(){g('/ajax/social_graph/invite_dialog.php',{});},showAddAdminDialog:function(){g('/ajax/social_graph/add_admin_dialog.php',{});},showBrowseDialog:function(h){var i=URI.getRequestURI().getQueryData();if('viewas' in i){if(h==null)h={};h.viewas=i.viewas;}g('/ajax/social_graph/dialog/browse.php',h||{});},submitDialog:function(i,j){if(Dialog.getCurrent()){var h=serialize_form($(i));Dialog.getCurrent().hide();if(h.ids||h.email_addresses)g(j,h);}},cancelDialog:function(){if(b)b.hide();},fetch:function(i,l,m,k,j){var o='/ajax/social_graph/fetch.php';var h={edge_type:i,page:m,limit:k};var n=URI.getRequestURI().getQueryData();if('viewas' in n)h.viewas=n.viewas;if(l)copy_properties(h,l);return f(o,h,j);},search:function(k,j,i){var l='/ajax/social_graph/search.php';var h={query:k};if(j)copy_properties(h,j);return f(l,h,i);},add:function(k,j,n,h,m,l){var o='/ajax/social_graph/add.php';var i={fbids:k,edge_type:j,app_id:h,message:m};if(n)copy_properties(i,n);return f(o,i,l);},remove:function(k,j,h,n,m,l){var o='/ajax/social_graph/remove.php';var i={fbid:k,edge_type:j,ban:h,message:m};if(n)copy_properties(i,n);return f(o,i,l);}};}();
Arbiter.inform("template\/registerTemplate", {"name":"\/templates\/UIActionMenu.tmpl","template":"\n<div class=\"UIActionMenu\" bindPoint=\"root\">\n  <a class=\"UIActionMenu_Wrap\" bindPoint=\"wrap\" href=\"#\">\n    <span class=\"UIActionMenu_Icon\" bindPoint=\"icon\"><\/span>\n    <span class=\"UIActionMenu_Text\" bindPoint=\"text\"><\/span>\n    <span class=\"UIActionMenu_Chevron\"><\/span>\n  <\/a>\n  <div class=\"UIActionMenu_Menu\" bindPoint=\"menu\"><\/div>\n<\/div>\n"}, Arbiter.BEHAVIOR_PERSISTENT);
function UIActionMenu(a){this.root=null;this.wrap=null;this.icon=null;this.text=null;this.menu=null;this._dirty=true;this._title=a;this._contentCallback=bagofholding;this._selectList=null;this.parent.construct(this,URI('/templates/UIActionMenu.tmpl'));this._initialize();}UIActionMenu.extend('TemplateObject');copy_properties(UIActionMenu,{ICONS:{LOCK:'UIActionMenu_Lock',PEOPLE:'UIActionMenu_People'},COLORS:{BLUE:'UIActionMenu_Blue'}});UIActionMenu.mixin('Arbiter',{_initialize:function(){Event.listen(this.wrap,'click',this.click.bind(this));Event.listen(this.menu,'mouseover',function(event){var a=DOM.getNearest(event.getTarget(),'a');a&&a.focus();});},hideMenu:function(){Toggler.hide();return this;},click:function(event){if(this._dirty){this.buildMenu();this.setDirty(false);}this.inform('menuActivated');Toggler.toggle(this.wrap);event.prevent();},setAlignRight:function(a){this._right=a;CSS.conditionClass(this.root,'UIActionMenu_AlignRight',a);return this;},setContentCallback:function(a){this._contentCallback=a;return this;},setSuppressButton:function(a){CSS.conditionClass(this.root,'UIActionMenu_SuppressButton',a);return this;},setSuppressText:function(a){CSS.conditionClass(this.root,'UIActionMenu_SuppressText',a);return this;},setColor:function(a){switch(a){case UIActionMenu.COLORS.BLUE:if(this.color)CSS.removeClass(this.root,this.color);CSS.addClass(this.root,a);this.color=a;break;default:if(this.color){CSS.removeClass(this.root,this.color);this.color=null;}}return this;},setIcon:function(a){switch(a){case UIActionMenu.ICONS.LOCK:case UIActionMenu.ICONS.PEOPLE:CSS.addClass(this.root,'UIActionMenu_IconIncluded');CSS.addClass(this.icon,a);break;default:CSS.removeClass(this.root,'UIActionMenu_IconIncluded');}return this;},_getContent:function(){var a=this._contentCallback();return a;},setTitle:function(a){this._title=a;DOM.setContent(this.text,this._title);return this;},setTooltip:function(a){if(this.tooltip){if(a){DOM.setContent(this.tooltip.firstChild,a);}else{DOM.remove(this.tooltip);CSS.removeClass(this.wrap,'uiTooltip');this.tooltip=null;}}else{this.tooltip=$N('span',{className:'uiTooltipWrap'},$N('span',{className:'uiTooltipText'},a));CSS.addClass(this.wrap,'uiTooltip');if(this._right)CSS.addClass(this.tooltip,'right');DOM.prependContent(this.wrap,this.tooltip);}return this;},getNodes:function(){DOM.setContent(this.text,this._title);return [this.root];},buildMenu:function(){DOM.setContent(this.menu,this._getContent());return this;},useSelectList:function(b,a,c){c=c||UISelectList.MULTI_SELECT_MODE;this.setContentCallback(function(){this._selectList=new UISelectList().setMode(c).setCallback(function(d,e){this.hideMenu();a&&a(d,e);}.bind(this)).addItems(b);return this._selectList.getElement();}.bind(this));return this;},resetSelectList:function(){this._selectList&&this._selectList.reset();},getSelectList:function(){return this._selectList;},setDirty:function(a){this._dirty=a;return this;}});
Arbiter.inform("template\/registerTemplate", {"name":"\/templates\/UIPager.tmpl","template":"\n<span class=\"UIPager\" bindPoint =\"root\">\n  <span class=\"UIPager_PageNum\" bindPoint=\"pageNumber\"><\/span>\n  <span class=\"UIPager_ButtonWrapper\" bindPoint=\"backWrapper\">\n    <a class=\"UIPager_Button UIPager_ButtonBack\" bindPoint=\"backRoot\" href=\"#\"><\/a>\n  <\/span>\n  <span class=\"UIPager_ButtonWrapper\" bindPoint=\"forwardWrapper\">\n    <a class=\"UIPager_Button UIPager_ButtonForward\" bindPoint=\"forwardRoot\" href=\"#\"><\/a>\n  <\/span>\n<\/span>\n"}, Arbiter.BEHAVIOR_PERSISTENT);
function UIPager(d,b,c,a){copy_properties(this,{_rm:new RenderManager(this),_callback:a||bagofholding,_backHandler:null,_forwardHandler:null,_maxPerPage:b,_total:d,_offset:c,_isDisabled:false,root:null,backRoot:null,forwardRoot:null,pageNumber:null,backWrapper:null,fowardWrapper:null});this.parent.construct(this,URI('/templates/UIPager.tmpl'));this._summaryTextHandler=this._getSummaryText;this._rm.dirty();this._setupHandlers();return this;}UIPager.extend('TemplateObject');UIPager.prototype._setupHandlers=function(){this._backHandler=Event.listen(this.backRoot,'click',this._handleClick.bind(this,'back'));this._forwardHandler=Event.listen(this.forwardRoot,'click',this._handleClick.bind(this,'forward'));};UIPager.prototype._handleClick=function(b){var c;var a;if(b=='forward'){c=this.forwardWrapper;a=1;}else{c=this.backWrapper;a=-1;}if(!CSS.hasClass(c,'UIPager_ButtonDisabled')){this._offset=this._offset+(a*this._maxPerPage);this._callback(this._offset,a);this._rm.dirty();}return false;};UIPager.prototype._getSummaryText=function(a,e,b){if(e==0)return '';if(e<=b){if(e==1){return _tx("1 tulos");}else return _tx("{number_of_results} tulosta",{number_of_results:e});}else{if(a+b<e){var c=((a/b+1)*b);}else var c=e;if(e>500){var d=_tx("{starting_offset}-{ending_offset} \/ yli {number_of_results} tuloksesta",{starting_offset:(a+1),ending_offset:c,number_of_results:500});}else var d=_tx("{starting_offset}-{ending_offset} \/ {number_of_results} tulosta",{starting_offset:(a+1),ending_offset:c,number_of_results:e});return d;}};UIPager.prototype.setCallback=function(a){this._callback=a;return this;};UIPager.prototype.setMaxPerPage=function(a){this._maxPerPage=Math.max(a,0);this._rm.dirty();return this;};UIPager.prototype.setTotal=function(a){this._total=Math.max(a,0);this._rm.dirty();return this;};UIPager.prototype.setOffset=function(a){this._offset=Math.max(a,0);this._rm.dirty();return this;};UIPager.prototype.setPage=function(a){this._offset=Math.max(a-1,0)*this._maxPerPage;this._rm.dirty();return this;};UIPager.prototype.setDisabled=function(a){this._isDisabled=a;this._rm.dirty();return this;};UIPager.prototype.setVertical=function(a){CSS.conditionClass(this.root,'UIPager_Vertical',a);this._rm.dirty();return this;};UIPager.prototype._getCurrentPage=function(){return this._offset/this._maxPerPage+1;};UIPager.prototype._getPageCount=function(){return Math.ceil(this._total/this._maxPerPage);};UIPager.prototype.setSummaryTextHandler=function(a){this._summaryTextHandler=a;this._rm.dirty();return this;};UIPager.prototype._setDisabled=function(a,c){var b;if(a=="back"){b=this.backWrapper;}else if(a=="forward")b=this.forwardWrapper;CSS.conditionClass(b,'UIPager_ButtonDisabled',c);return this;};UIPager.prototype.paint=function(){if(this._offset==0||this._isDisabled){this._setDisabled("back",true);}else this._setDisabled("back",false);if((this._offset+this._maxPerPage)>=this._total||this._isDisabled){this._setDisabled("forward",true);}else this._setDisabled("forward",false);var a=this._summaryTextHandler(this._offset,this._total,this._maxPerPage);if(a){DOM.setContent(this.pageNumber,a);}else hide(this.pageNumber);};UIPager.prototype.resetPager=function(d,b,c,a){this.setOffset(c);this.setTotal(d);this.setMaxPerPage(b);if(a)this._callback=a;this._rm.dirty();};UIPager.prototype.getRoot=function(){return this.root;};UIPager.prototype.setHidden=function(a){CSS.conditionClass(this.root,'hidden_elem',a);return this;};UIPager.prototype.getHidden=function(){return CSS.hasClass(this.root,'hidden_elem');};
Arbiter.inform("template\/registerTemplate", {"name":"\/templates\/UIObjectListing.tmpl","template":"\n\n<div bindPoint=\"root\" class=\"UIObjectListing clearfix\">\n    <div class=\"UIObjectListing_Pic\">\n      <a href=\"${href}\">\n        <img class = \"UIProfileImage UIProfileImage_LARGE\" bindPoint=\"pic\" \/>\n      <\/a>\n    <\/div>\n    <div class=\"UIObjectListing_MetaData\">\n      <a bindPoint=\"title\" class=\"UIObjectListing_Title\" href=\"${href}\"\/>\n      <div class=\"UIObjectListing_MetaDataSecondary\">\n        <span bindPoint=\"subtitle\" class=\"UIObjectListing_Subtitle\"\/>\n        <span bindPoint=\"subtext\" class=\"UIObjectListing_Subtext\"\/>\n      <\/div>\n    <\/div>\n    <div class=\"UIObjectListing_RightContent\" bindPoint=\"rightContent\">\n      <div class=\"UIObjectListing_RemoveContainer hidden_elem\" bindPoint=\"removeContainer\">\n        <a class=\"UIObjectListing_RemoveLink\" bindPoint=\"removeLink\" href=\"#\">&nbsp;<\/a>\n      <\/div>\n      <div class=\"UIObjectListing_ActionContainer hidden_elem\" bindPoint=\"actionContainer\">\n      <\/div>\n    <\/div>\n<\/div>\n"}, Arbiter.BEHAVIOR_PERSISTENT);

if (window.Bootloader) { Bootloader.done(["js\/aq90no4kiy8s4gss.pkg.js"]); }