/*1319064840,176832698*/

if (window.CavalryLogger) { CavalryLogger.start_js(["D+B41"]); }

function EmuController(a,b){this.impression=b;this.containerId=a;DataStore.set($(a),'emuController',this);return this;}copy_properties(EmuController,{fromContainer:function(a){var b=ge(a);if(!b)return null;return DataStore.get(b,'emuController');},getEventClass:function(a){return "emuEvent"+String(a).trim();}});copy_properties(EmuController.prototype,{EVENT_HANDLER_PATH:'/ajax/emu/end.php',CLICK:1,FAN:"fad_fan",event:function(c,b,d,a){var e={eid:this.impression,f:0,ui:this.containerId,en:c,a:1};if(b)e.ed=JSON.stringify(b);if(!a)var a=bagofholding;var f=new AsyncRequest().setURI(this.EVENT_HANDLER_PATH).setData(e).setErrorHandler(a);if(d)f.setHandler(d);f.send();},redirect:function(){var a={eid:this.impression,f:0,ui:this.containerId,en:this.CLICK,a:0,sig:Math.floor(Math.random()*65535)+65536};var b=new URI(this.EVENT_HANDLER_PATH);b.setQueryData(a);goURI(b);}});
var ShortClickHandlers={EVENT_NAME_CAME_BACK:'cameback',onclicked:function(a){if(this.onsite)return;if(a.button!==0||a.getModifiers().any)return;this.click_ts=(+new Date());if(this.listeners!==undefined)for(var b in this.listeners)this.listeners[b].remove();this.listeners={focus:Event.listen(window,'focus',ShortClickHandlers.oncameback.bind(this))};},oncameback:function(c){var b=(+new Date())-this.click_ts;this.listeners[c.type].remove();var a={click_ts:this.click_ts,length:b,trigger:c.type};this.sendData(ShortClickHandlers.EVENT_NAME_CAME_BACK,a);}};
function EmuTracker(a,c){this.base=EmuController.fromContainer(a);!this.base;this.onsite=c;var b=DOM.scry($(a),"a."+EmuController.getEventClass(EmuTracker.EVENT_CLICK));b.each(function(d){Event.listen(d,'click',ShortClickHandlers.onclicked.bind(this));}.bind(this));return this;}copy_properties(EmuTracker,{EVENT_CLICK:1});copy_properties(EmuTracker.prototype,{sendData:function(b,a){this.base.event(b,a);}});
(function(){if(!window.channel){window.channel={};}else if(channel.OK)return;var a='presence/';copy_properties(channel,{ON_CONNECT:a+'connect',ON_IDLE:a+'idle',ON_SHUTDOWN:a+'shutdown',ON_INVALID_HISTORY:a+'invalid_history',ON_CONFIG:a+'config',ON_ENTER_STATE:a+'enter_state',ON_EXIT_STATE:a+'exit_state',OK:'ok',ERROR:'error',ERROR_CONN:'error_conn',ERROR_MAX:'error_max',ERROR_MISSING:'error_missing',ERROR_MSG_TYPE:'error_msg_type',ERROR_REFRESH:'error_refresh',ERROR_SHUTDOWN:'error_shutdown',ERROR_DOS:'error_dos',HINT_AUTH:'shutdown auth',HINT_CONN:'shutdown conn',HINT_MAINT:'shutdown maint',reason_Unknown:0,reason_AsyncError:1,reason_TooLong:2,reason_Refresh:3,reason_RefreshDelay:4,reason_UIRestart:5,reason_NeedSeq:6,reason_PrevFailed:7,reason_IFrameLoadGiveUp:8,reason_IFrameLoadRetry:9,reason_IFrameLoadRetryWorked:10,reason_PageTransitionRetry:11,reason_IFrameLoadMaxSubdomain:12,reason_NoChannelInfo:13,reason_NoChannelHost:14,reason_ChannelUnknown:100,reason_ChannelNoCUser:101,reason_ChannelInvalidCUser:102,reason_ChannelInvalidChanstr:103,reason_ChannelChDistribTimeout:104,reason_ChannelGetChannelOther:105,reason_ChannelNodeShutdown:106,reason_ChannelTermination:107,reason_ChannelUserMismatch:108,reason_ChannelUserMismatchShady:109,reason_ChannelBadXs:110,reason_ChannelSeqNeg:111,reason_ChannelSeqTooBig:112,reason_ChannelSeqTooSmall:113,reason_ChannelUnexpectedJoin:114,reason_ChannelInvalidXsCookie:115,reason_ChannelRelocate:116,reason_ChannelWrongPartition:117,getArbiterType:function(b){return a+'message:'+b;}});})();
(function(){if(window.channel_cookie)return;window.channel_cookie={subdomainIndex:null,init:function(){var a=presenceCookieManager.getSubCookie('ch');this.retryInterval=presenceCookieManager.getSubCookie('ri')||0;if(!channel.getConfig('nosubdomain')){this.subdomainIndex=0;if(a&&a.sub){for(var b=0;b<a.sub.length;b++)if(!a.sub[b]){this.subdomainIndex=b;break;}if(b==a.sub.length)if(b==channel_manager.MAX_SUBDOMAINS&&URI().isSecure()){this.subdomainIndex=null;presence.error('channel: iframe max subdomains reached');channel_manager._sendIframeError(ChannelRebuildReasons.IFrameLoadMaxSubdomain);}else this.subdomainIndex=a.sub.length;}}presenceCookieManager.register('ch',this.getInfo.bind(this));var c=(function(){this._clearSubdomain=true;presence.doSync(true);}).bind(this);if(typeof window.onpageshow!='undefined'){Event.listen(window,'pagehide',c);}else onunloadRegister(c);},getInfo:function(){var b={};var c=channel.getConfig('host');var e=channel.getConfig('port');if(c){if(null!==this.subdomainIndex){var a=presenceCookieManager.getSubCookie('ch');var f=(a&&a.sub)?a.sub:[];var d=f.length;f[this.subdomainIndex]=this._clearSubdomain?0:1;b.sub=f.map(function(g){return g?1:0;});}b[channel.getConfig('user_channel')]=channel.getConfig('seq',0);}b.ri=this.retryInterval;return b;}};})();
(function(){if(!window.channel){window.channel={};}else if(channel.init)return;copy_properties(channel,{inner:function(){return this.manager.transport._iframe.contentWindow.transport;},_sitevars:{},_config:{userActive:new Date().getTime(),sessionID:(Math.random()*2147483648|0).toString(16)},init:function(){channel_cookie.init();this._config.subdomainIndex=channel_cookie.subdomainIndex;this.log=bind(this,'_log','log');this.error=bind(this,'_log','error');this.warn=bind(this,'_log','warn');if(typeof(UserActivity)!='undefined')UserActivity.subscribe(function(){this._config.userActive=new Date().getTime();}.bind(this));},_log:function(b,c){var d=this.manager&&this.manager.transport;var a='channel2:'+(d?(d.logName+':'):'');if(b=='log'){return false;}else if(b=='warn'){return presence.warn(a+c);}else if(b=='error')return presence.error(a+c);},log:function(a){this._log('log',a);},warn:function(a){this._log('warn',a);},error:function(a){this._log('error',a);},configure:function(){$A(arguments).each(copy_properties.bind(null,this._config));Arbiter.inform(channel.ON_CONFIG,this);},getConfig:function(b,a){return b in this._config?this._config[b]:a;}});})();
function SimpleDrag(a){Event.listen(a,'mousedown',this._start.bind(this));}Class.mixin(SimpleDrag,'Arbiter',{_start:function(event){this.inform('start',event);var b=ua.ie()<9?document.documentElement:window;var a=Event.listen(b,{selectstart:Event.prevent,mousemove:this.inform.bind(this,'update'),mouseup:function(event){for(var c in a)a[c].remove();this.inform('end',event);}.bind(this)});return false;}});
function ScrollableArea(){}copy_properties(ScrollableArea,{getInstance:function(a){var b=Parent.byClass(a,'uiScrollableArea');return b?DataStore.get(b,'ScrollableArea'):null;}});ScrollableArea.prototype={init:function(a,b){b=b||{};this._elem=a;this._wrap=DOM.find(a,'div.uiScrollableAreaWrap');this._body=DOM.find(this._wrap,'div.uiScrollableAreaBody');this._track=DOM.find(a,'div.uiScrollableAreaTrack');this._gripper=DOM.find(this._track,'div.uiScrollableAreaGripper');this._options=b;this.adjustGripper();this._listeners=[Event.listen(this._wrap,'scroll',this._handleScroll.bind(this))];if(b.fade!==false)this._listeners.push(Event.listen(a,'mouseenter',this.adjustGripper.shield(this)),Event.listen(a,'mouseenter',this.showScrollbar.shield(this)),Event.listen(a,'mousemove',this._handleMousemove.bind(this)),Event.listen(a,'mouseout',this.hideScrollbar.shield(this)));this.initDrag();DataStore.set(this._elem,'ScrollableArea',this);if(!b.persistent)onleaveRegister(this.destroy.bind(this));},initDrag:function(){var a=new SimpleDrag(this._gripper);a.subscribe('start',function(b,event){if(!((event.which&&event.which===1)||(event.button&&event.button===1)))return;var d=this._getPageY(event);var e=this._gripper.offsetTop;var f=a.subscribe('update',function(g,event){var j=this._getPageY(event)-d;var i=this._elem.clientHeight;var h=this._body.offsetHeight;var p=this._track.offsetHeight;var k=i/h*p;var m=h-this._wrap.offsetHeight;var l=e+j;var n=p-k;l=Math.max(Math.min(l,n),0);var o=l/n*m;this._wrap.scrollTop=o;}.bind(this));var c=a.subscribe('end',function(){a.unsubscribe(f);a.unsubscribe(c);});}.bind(this));},adjustGripper:function(){var b=this._elem.clientHeight;var a=this._body.offsetHeight;var e=this._track.offsetHeight;var c=b/a*e;if(c<e){CSS.setStyle(this._gripper,'height',c+'px');var d=this._wrap.scrollTop/a*e;CSS.setStyle(this._gripper,'top',d+'px');CSS.show(this._gripper);}else CSS.hide(this._gripper);this._checkContentBoundaries();return this;},_checkContentBoundaries:function(){var a=this._wrap.scrollTop;var b=this._wrap.scrollHeight-this._wrap.clientHeight;CSS.conditionClass(this._elem,'contentBefore',a>0);CSS.conditionClass(this._elem,'contentAfter',a<b);},destroy:function(){this._listeners.forEach(function(a){a.remove();});this._listeners.length=0;},_getPageX:function(event){return event.pageX!=null?event.pageX:event.clientX+document.body.scrollLeft;},_getPageY:function(event){return event.pageY!=null?event.pageY:event.clientY+document.body.scrollTop;},_handleMousemove:function(event){var a=Vector2.getElementPosition(this._track).x;var b=Vector2.getElementDimensions(this._track).x;if(Math.abs(a+b/2-this._getPageX(event))<25){this.showScrollbar(false);}else this.hideScrollbar();},_handleScroll:function(event){this.adjustGripper();if(this._options.fade!==false)this.showScrollbar();},hideScrollbar:function(){if(!this._scrollbarVisible)return this;this._scrollbarVisible=false;if(this._hideTimeout){clearTimeout(this._hideTimeout);this._hideTimeout=null;}this._hideTimeout=function(){if(this._scrollbarAnimation){this._scrollbarAnimation.stop();this._scrollbarAnimation=null;}this._scrollbarAnimation=animation(this._track).from('opacity',1).to('opacity',0).duration(250).ondone(CSS.addClass.curry(this._track,'invisible_elem')).go();}.bind(this).defer(750);return this;},showScrollbar:function(a){if(this._scrollbarVisible)return this;this._scrollbarVisible=true;if(this._hideTimeout){clearTimeout(this._hideTimeout);this._hideTimeout=null;}if(this._scrollbarAnimation){this._scrollbarAnimation.stop();this._scrollbarAnimation=null;}CSS.setStyle(this._track,'opacity',1);CSS.removeClass(this._track,'invisible_elem');if(a!==false)this.hideScrollbar();return this;},scrollToBottom:function(){animation(this._wrap).to('scrollTop',this._wrap.scrollHeight).ease(animation.ease.end).go();}};
FriendRequestMessage={STATUS:'FriendRequest/change',UNFRIEND:'FriendRequest/unfriend',CANCEL:'FriendRequest/cancel',CANCELLING:'FriendRequest/cancelling',CANCEL_FAIL:'FriendRequest/cancelFail',SENT:'FriendRequest/sent',SENDING:'FriendRequest/sending',SEND_FAIL:'FriendRequest/sendFail',CONFIRM:'FriendRequest/confirm',CONFIRMING:'FriendRequest/confirming',CONFIRM_FAIL:'FriendRequest/confirmFail'};function FriendStatus(a,c,b){this.id=a;this.update(c,b);}FriendStatus.prototype={update:function(b,a){b&&(this.status=b);if(a){this.lists=$A(a).map(String);this._informListChange();}},isComplete:function(){return !!this.lists;},addToList:function(a){if(this.lists&&!this.lists.contains(a))this.lists.push(a);this._informListChange();},removeFromList:function(b){if(this.lists){var a=this.lists.indexOf(b);a!==-1&&this.lists.splice(a,1);}this._informListChange();},updateList:function(b,a){a?this.addToList(b):this.removeFromList(b);},_informListChange:function(){Arbiter.inform('FriendListMembershipChange',{uid:this.id,lists:this.lists});}};copy_properties(FriendStatus,{ARE_FRIENDS:1,INCOMING_REQUEST:2,OUTGOING_REQUEST:3,CAN_REQUEST:4});(function(){var a={};var b={};function c(f,d,e){if(!a[e.uid]){a[e.uid]=new FriendStatus(e.uid,f);}else a[e.uid].update(f);Arbiter.inform(FriendRequestMessage.STATUS,{uid:e.uid,status:f});}onloadRegister(function(){Arbiter.subscribe([FriendRequestMessage.CANCEL,FriendRequestMessage.UNFRIEND,FriendRequestMessage.SEND_FAIL],c.curry(FriendStatus.CAN_REQUEST));Arbiter.subscribe([FriendRequestMessage.CONFIRM_FAIL],c.curry(FriendStatus.INCOMING_REQUEST));Arbiter.subscribe([FriendRequestMessage.CANCEL_FAIL,FriendRequestMessage.SENT,FriendRequestMessage.SENDING],c.curry(FriendStatus.OUTGOING_REQUEST));Arbiter.subscribe([FriendRequestMessage.CONFIRM,FriendRequestMessage.CONFIRMING],c.curry(FriendStatus.ARE_FRIENDS));});copy_properties(FriendStatus,{CLOSE_FRIENDS:null,ACQUAINTANCES:null,getFriend:function(d,e){if(a[d]&&a[d].isComplete()){e(a[d]);}else if(b[d]){b[d].push(e);}else{b[d]=[e];new AsyncRequest().setURI("/ajax/friends/status.php").setData({friend:d}).setHandler(function(g){var f=g.getPayload();FriendStatus.initFriend(d,f.status,f.lists);}).send();}},initFriend:function(e,g,f){var d=a[e]||new FriendStatus(e);d.update(d.status||g,d.lists||f);a[e]=d;b[e]&&b[e].forEach(function(h){h(d);});b[e]=null;},setSpecialLists:function(d){FriendStatus.CLOSE_FRIENDS=d.close+'';FriendStatus.ACQUAINTANCES=d.acq+'';}});})();
var DynamicFriendListEducation=(function(){var h;var e;var d;var c;var a;var i;var g=function(){d&&d.hide();c&&c.hide();};var f=function(j){e.remove(j);g();a({accept_tag_education:true});};var b=function(){g();a({nux_cancel:true});};return {init:function(k,j){h=k;e=$A(j).map(String);PageTransitions.registerHandler(function(){g();h=false;a=undefined;e=[];});},showDialog:function(k,l,j){if(h&&e.contains(k)){g();Arbiter.inform('DynamicFriendListEducation/dialogOpen',{uid:l,flid:k});a=j;d=new Dialog().setAsync(new AsyncRequest('/ajax/friends/lists/smart_list_education.php').setMethod('GET').setData({flid:k,uid:l}).setReadOnly(true)).setHandler(f.bind(this,k)).setCloseHandler(function(){Arbiter.inform('DynamicFriendListEducation/dialogClosed',{uid:l,flid:k});}).setCancelHandler(function(){Arbiter.inform('DynamicFriendListEducation/dialogCancel',{uid:l,flid:k});}).show();}else j();},showContextualDialog:function(k,m,l,j){if(h&&e.contains(k)){g();i=l;a=j;new AsyncRequest('/ajax/friends/lists/smart_list_contextual_education.php').setMethod('GET').setData({flid:k,uid:m}).setReadOnly(true).send();}else j();},setContextualDialog:function(l,j,k,m){c=l;c.setContext(i);c.show();Event.listen(j,'click',f.bind(this,m));Event.listen(k,'click',b);}};})();
var FriendEditLists=(function(){var a=7;var c={};var m="/ajax/profile/removefriendconfirm.php";var b="/friends/ajax/remove_friend.php?type=friend&fbx=1";var h;function j(p,q,o){var r=c[p.id];var n=function(u){var t={action:o?'add_list':'del_list',to_friend:r.id,friendlists:[q],source:h};if(u)copy_properties(t,u);r.updateList(q,o);var v;if(o&&q==FriendStatus.CLOSE_FRIENDS){v=e(p,FriendStatus.ACQUAINTANCES);if(Menu.isItemChecked(v)){Menu.toggleItem(v);j(p,FriendStatus.ACQUAINTANCES,false);}}else if(o&&q==FriendStatus.ACQUAINTANCES){v=e(p,FriendStatus.CLOSE_FRIENDS);if(Menu.isItemChecked(v)){Menu.toggleItem(v);j(p,FriendStatus.CLOSE_FRIENDS,false);}}var w={flid:q,uid:r.id};var s=o?'FriendListHovercard/add':'FriendListHovercard/remove';Arbiter.inform(s,w);new AsyncRequest().setURI('/ajax/add_friend/action.php').setData(t).send();};if(o){DynamicFriendListEducation.showDialog(q,r.id,n);}else n();}function d(o){var n=DOM.scry(o,'input')[0];return n&&n.value;}function f(n,p,q){var o={uid:p.id};new AsyncRequest().setURI(b).setMethod('POST').setData({friend:p.id}).setHandler(Arbiter.inform.bind(Arbiter,FriendRequestMessage.CANCEL,o)).setErrorHandler(Arbiter.inform.bind(Arbiter,FriendRequestMessage.CANCEL_FAIL,o)).setStatusElement(q).send();}function e(n,o){var q=Menu.getItems(n);for(var p=0;p<q.length;p++)if(d(q[p])==o)return q[p];return null;}function k(n,o){var p=Menu.getItems(n);p.forEach(function(s){var r=d(s);var q=o.lists.contains(r);if(Menu.isItemChecked(s)!==q)Menu.toggleItem(s);});}function i(o){var p=Menu.getItems(o);var n=[];var s=[];var u=0;var t=0;p.forEach(function(x){if(CSS.hasClass(x,'neverHide')){CSS.removeClass(x,'underShowMore');u++;}else if(Menu.isItemChecked(x)){n.push(x);}else if(CSS.hasClass(x,'neverShow')||CSS.hasClass(x,'FriendListCreateTrigger')){CSS.addClass(x,'underShowMore');t++;}else s.push(x);});var w=a-u;var r=n.concat(s);var q=t;r.forEach(function(x){if(CSS.hasClass(x,'ShowMoreItem')){w--;return;}if(w){CSS.removeClass(x,'underShowMore');w--;}else{CSS.addClass(x,'underShowMore');q=true;}});CSS.conditionClass(o,'hasMoreFriendListItems',q);var v=DOM.scry(o,'.FriendListMenuShowMore');v.forEach(function(x){CSS.removeClass(x,'FriendListMenuShowMore');});}function l(o,p){var q=DOM.scry(o,'.FriendListUnfriend')[0];var n=DOM.scry(o,'.FriendListCancel')[0];if(n)CSS.conditionShow(n,p.status==FriendStatus.OUTGOING_REQUEST);if(q){CSS.conditionShow(q,p.status==FriendStatus.ARE_FRIENDS);DOM.find(q,'a').href=URI(m).addQueryData({uid:p.id});}}var g=function(){g=bagofholding;Arbiter.subscribe(FriendRequestMessage.STATUS,function(r,q){for(var p in c){var n=ge(p);var o=c[p];if(n&&o&&o.id==q.uid){k(n,o);l(n,o);i(n);}}});Menu.subscribe('select',function(n,o){if(CSS.hasClass(o.item,'ShowMoreItem')&&CSS.hasClass(o.menu,'FriendListMenu')){CSS.addClass(o.menu,'FriendListMenuShowMore');var p=ScrollableArea.getInstance(o.item);p&&p.adjustGripper().showScrollbar(false);}});};return {init:function(n,o,p){n=$(n);h=p;g();if(!c[n.id])Menu.subscribe('select',function(q,r){if(DOM.contains(n,r.item))if(Parent.byClass(r.item,'FriendListItem')){Menu.toggleItem(r.item);var s=d(r.item);j(n,s,Menu.isItemChecked(r.item));}else if(Parent.byClass(r.item,'FriendListCancel')){f(n,c[n.id],r.item);}else if(Parent.byClass(r.item,'FriendListUnfriend'))FriendListFlyoutController.hide(false);});CSS.addClass(n,'async_saving');FriendStatus.getFriend(o,function(q){k(n,q);l(n,q);c[n.id]=q;i(n);CSS.removeClass(n,'async_saving');}.bind(this));}};})();
var FriendListFlyoutController=(function(){var d;var e;var n;var a;var o;var v;var l;var s;var f;var c=1500;function h(x){if(DOM.isNodeOfType(x,['body','html']))return document.body;while((x=x.parentNode)&&x!==document.body)if(CSS.getStyle(x,'position')!=='static')return x;return document.body;}function m(x){while(x&&x!==document.body){if(CSS.getStyle(x,'position')==='fixed')return true;x=h(x);}return false;}function q(){clearTimeout(l);}function p(){if(a){CSS.removeClass(a,'selected');CSS.removeClass(a,'uiButtonHover');if(DataStore.get(a,'flfcloselistener')){var x=a;DataStore.set(a,'flfcloselistenertimeout',g.curry(x).defer(c));}}e=false;b();a=null;}function i(x){if(DOM.isNodeOfType(x,'label')&&CSS.hasClass(x,'uiButton'))x=Button.getInputElement(x);return DataStore.get(x,'profileid');}function b(){o&&o.remove();o=null;s&&Arbiter.unsubscribe(s);s=null;l&&clearTimeout(l);l=null;}function u(y){if(!d||e)return;d.setContext(y);var z=i(y);var x=DataStore.get(y,'flloc');FriendEditLists.init(n,z,x);CSS.addClass(y,'selected');CSS.addClass(y,'uiButtonHover');d.setFixed(m(y)).show();a=y;e=true;var za=DOM.scry(n,'div.uiScrollableArea')[0];za&&ScrollableArea.getInstance(za).adjustGripper().showScrollbar();b();o=Event.listen(y,'mouseleave',j);s=Arbiter.subscribe('Overlay/show',k);if(DataStore.get(y,'flfcloselistener'))clearTimeout(DataStore.remove(y,'flfcloselistenertimeout'));FriendStatus.getFriend(z,function(zc){var zb=DOM.scry(d.getContent(),'.FlyoutFriendListMenuNUX')[0];if(!zb)return;if(zc.status==FriendStatus.OUTGOING_REQUEST){CSS.show(zb);AsyncRequest.bootstrap('/ajax/friends/lists/nux_flyout.php',null,true);}else CSS.hide(zb);});}function t(x){a=x;v=u.curry(x).defer(100);o=Event.listen(x,'mouseleave',function(){clearTimeout(v);a=null;o&&o.remove();});}function j(){l=k.defer(150);}function w(){var y=Dialog.getCurrent();var x=y&&y.getBody();return !!(x&&DOM.scry(x,'.friendListDialogTourCarousel')[0]);}function k(){if(f||w())return;ua.ie()<8&&document.documentElement.focus();d&&d.hide();}function r(event){var x=Parent.byTag(event.getTarget(),'a');if(x&&CSS.hasClass(x,'FriendListActionItem'))j();}function g(y){var x=DataStore.remove(y,'flfcloselistener');x&&x();}return {init:function(x,y){FriendListFlyoutController.init=bagofholding;d=x;n=y;d.subscribe('mouseenter',q);d.subscribe('mouseleave',j);d.subscribe('hide',p);Event.listen(n,'click',r);Event.listen(document.documentElement,'mouseover',function(z){var za=Parent.byClass(z.getTarget(),'enableFriendListFlyout');if(za)if(a===za){clearTimeout(l);}else{e&&k();t(za);}});Arbiter.subscribe('DynamicFriendListEducation/dialogOpen',function(){f=true;});Arbiter.subscribe('DynamicFriendListEducation/dialogClosed',function(){f=false;j();});},show:function(x){u(x);},hide:function(x){x===false?k():j();},setCloseListener:function(y,x){DataStore.set(y,'flfcloselistener',x);if(a!=y)DataStore.set(y,'flfcloselistenertimeout',g.curry(y).defer(c));},setCloseListenerTimeout:function(x){c=x;}};})();
var AddFriendButton={ERROR_ALREADY_ADDED:1431005,init:function(f,l,j,g,m,o,h,n,i,k){function b(p,s,r){var q=new URI(f.getAttribute('ajaxify'));new AsyncRequest().setURI(i).setData({to_friend:m,action:p,how_found:h,ref_param:n,outgoing_id:l.id,xids:q.getQueryData().xids,logging_location:k}).setErrorHandler(s).setServerDialogCancelHandler(r).setRelativeTo(l).send();}function e(p){f&&CSS.hide(f);l&&CSS.hide(l);j&&CSS.hide(j);g&&CSS.hide(g);if(p)CSS.show(p);}function c(p){if(CSS.hasClass(p,'enableFriendListFlyout')){FriendListFlyoutController.show(p);}else FriendListFlyoutController.hide();}var d=Arbiter.subscribe(FriendRequestMessage.STATUS,function(q,p){if(p.uid!=m)return;switch(p.status){case FriendStatus.ARE_FRIENDS:return e(g);case FriendStatus.INCOMING_REQUEST:return e(j);case FriendStatus.OUTGOING_REQUEST:return e(l);case FriendStatus.CAN_REQUEST:return e(f);}});var a;if(o)a=Arbiter.subscribe(FriendRequestMessage.CONFIRM,function(p,q){q.uid==m&&goURI(o);});f&&Event.listen(f,'click',function(){Arbiter.inform(FriendRequestMessage.SENDING,{uid:m});c(l);b("add_friend",function(q){var p=q.error==AddFriendButton.ERROR_ALREADY_ADDED?FriendRequestMessage.SENT:FriendRequestMessage.SEND_FAIL;Arbiter.inform(p,{uid:m});FriendListFlyoutController.hide();AsyncResponse.defaultErrorHandler(q);},function(p){Arbiter.inform(FriendRequestMessage.SEND_FAIL,{uid:m});FriendListFlyoutController.hide();});});PageTransitions.registerHandler(function(){Arbiter.unsubscribe(d);a&&Arbiter.unsubscribe(a);});}};
var FriendButtonIcon={init:function(b,e,f){var d=DOM.find(e,'.defaultIcon');var c=DOM.find(e,'.closeIcon');var a=DOM.find(e,'.acqIcon');Arbiter.subscribe('FriendListMembershipChange',function(g,h){if(h.uid==f){var j=h.lists.contains(FriendStatus.CLOSE_FRIENDS);var i=h.lists.contains(FriendStatus.ACQUAINTANCES);if(j&&!i){Button.setIcon(b,c);}else if(i&&!j){Button.setIcon(b,a);}else Button.setIcon(b,d);}});}};
var DynamicIconSelector=function(){onloadRegister(function(){Selector.subscribe('change',function(a,b){var c=b.selector;if(CSS.hasClass(c,'dynamicIconSelector'))DynamicIconSelector.swapIcon(c);});});return {swapIcon:function(e){var d=Selector.getSelectedOptions(e)[0];var c=d&&DOM.scry(d,'.itemIcon')[0];var a=Selector.getSelectorButton(e);if(c){Button.setIcon(a,c.cloneNode(true));}else{var b=DOM.scry(a,'.img')[0];b&&DOM.remove(b);}CSS.conditionClass(a,'uiSelectorChevronOnly',!c);}};}();
var AudienceSelector=function(){onloadRegister(function(){Selector.subscribe('select',function(a,b){if(!CSS.hasClass(b.selector,'audienceSelector'))return;var e=Selector.getOptionValue(b.option);if(e==PrivacyBaseValue.CUSTOM){Selector.toggle(b.selector);return false;}if(CSS.hasClass(b.selector,'dataTooltip')){var c=DOM.find(b.option,'.itemAnchor').getAttribute('data-tooltip');Selector.setButtonTooltip(b.selector,c||null);}if(!CSS.hasClass(b.option,'specialOption'))return;var d=DOM.find(b.option,'a').getAttribute('data-type');if(CSS.hasClass(b.option,'moreOption')){CSS.addClass(b.selector,d);CSS.addClass(b.selector,'showSecondaryOptions');return false;}else if(CSS.hasClass(b.option,'returnOption')){CSS.removeClass(b.selector,'showSecondaryOptions');CSS.removeClass(b.selector,'friendList');return false;}});Arbiter.subscribe('CustomPrivacyOption/update',function(a,b){if(!CSS.hasClass(b.selector,'audienceSelector'))return;Selector.setSelected(b.selector,Selector.getOptionValue(b.option));DynamicIconSelector.swapIcon(b.selector);Selector.setButtonTooltip(b.selector,b.tooltip);Arbiter.inform('AudienceSelector/update',b.selector);});});}();
var ComposerAudienceSelector=function(){var b={};var a={};onloadRegister(function(){Selector.subscribe('select',function(c,d){if(!CSS.hasClass(d.selector,'composerAudienceSelector'))return;if(!CSS.hasClass(d.option,'groupOption'))Arbiter.inform('ComposerAudienceSelector/nongroup');if(!CSS.hasClass(d.option,'specialOption'))return;var e=DOM.find(d.option,'a').getAttribute('data-type');if(e=='group')Arbiter.inform('ComposerAudienceSelector/group',{group:Selector.getOptionValue(d.option)});});Arbiter.subscribe('CustomPrivacyOption/update',function(c,d){if(CSS.hasClass(d.selector,'composerAudienceSelector'))Arbiter.inform('ComposerAudienceSelector/nongroup');});Selector.subscribe('close',function(c,d){if(!CSS.hasClass(d.selector,'composerAudienceSelector'))return;var e=Selector.getSelectedOptions(d.selector)[0];CSS.conditionClass(d.selector,'showSecondaryGroups',CSS.hasClass(e,'secondaryGroup'));});});return {syncSelector:function(e){b[e]&&Selector.setSelected(e,b[e]);if(b[e]==PrivacyBaseValue.CUSTOM&&a[e]){var c=Selector.getOption(e,PrivacyBaseValue.CUSTOM+'');var d=a[e];(function(){CustomPrivacyOption.update(c.id,d.data,d.audience,d.tooltip);}).defer();}}};}();
function CustomPrivacyOption(){}copy_properties(CustomPrivacyOption,{_instances:{},update:function(c,b,a,e){var d=CustomPrivacyOption._instances[c];d._update(b,a)._updateSelector(a,e);Arbiter.inform('Form/change',{node:d._container});},getData:function(a){return CustomPrivacyOption._instances[a]._privacyData;}});CustomPrivacyOption.prototype={init:function(d,c,b,e,a){(function(){var g=ge(d);if(!g)return;CustomPrivacyOption._instances[d]=this;this._selector=Parent.byClass(g,'uiSelector');this._container=DOM.find(g,'.customPrivacyInputs');this._id=c;this._privacyData={};var f=Form.serialize(this._container);if(f.audience)this._privacyData=f.audience[c];Event.listen(g,'click',function(h){var i=new AsyncRequest('/ajax/privacy/custom_dialog/').setData({option_id:d,id:this._id,privacy_data:this._privacyData,explain_tags:b,autosave:a});new Dialog().setAsync(i).setModal(true).show();}.bind(this));Selector.listen(this._selector,'select',function(h){if(h.option._id!=this._id)this._clear();}.bind(this));if(e)Selector.setButtonTooltip(this._selector,e);}).bind(this).defer();},_updateSelector:function(c,b){var a=Selector.getOption(this._selector,c)||Selector.getOption(this._selector,PrivacyBaseValue.CUSTOM+'');Arbiter.inform('CustomPrivacyOption/update',{selector:this._selector,option:a,tooltip:b});return this;},_clear:function(){this._privacyData={};DOM.empty(this._container);},_update:function(b,a){this._clear();this._privacyData=copy_properties({},b);var c=(a==PrivacyBaseValue.CUSTOM||!Selector.getOption(this._selector,a));if(c){var d=this._selector.getAttribute('data-name');if(d){d=d.slice(0,-'[value]'.length);var e={};e[d]=b;Form.createHiddenInputs(e,this._container,null,true);}}return this;}};
var FriendListPrivacyOptions=(function(){var e=false;var d=false;var a=null;var c={};var b=function(g){if(is_empty(c))PageTransitions.registerHandler(function(){c={};e=false;d=false;});var f=g.getAttribute('data-name');c[f]=g;Selector.listen(g,'select',function(h){var l=h.option;var k=DOM.find(l,'a.itemAnchor');var j=k.getAttribute('data-flid');if(!j)return;var i=k.getAttribute('data-dynamic');if(i&&e){FriendListPrivacyOptions.showSmartListNux(l,j);}else if(!i&&d)FriendListPrivacyOptions.showDumbListNux([j]);});};return {listen:function(h,j,f){var g=ge(h);if(!g)return;var i=Parent.byClass(g,'audienceSelector');if(i){b(i);e=j;d=f;}},showSmartListNux:function(g,f){new AsyncRequest('/ajax/friends/lists/smart_list_publish_nux.php').setData({option_id:g.id,flid:f}).send();e=false;},setContextualDialog:function(f,g){var h=Parent.byClass(g,'audienceSelector');if(h){f.setContext(h);f.show();var i=Arbiter.subscribe('composer/publish',function(){f.hide();});f.subscribe('hide',function(){Arbiter.unsubscribe(i);});}},showDumbListNux:function(f){new AsyncRequest('/ajax/friends/lists/dumb_list_publish_nux.php').setData({flids:f}).send();d=false;},showBothListsNux:function(g,f){a=g;FriendListPrivacyOptions.showDumbListNux(f);},setDialog:function(){if(!a)return;var f=Dialog.getCurrent();if(f)f.setCloseHandler(function(){FriendListPrivacyOptions.showSmartListNux(a);a=null;});}};})();
function FriendsPrivacyOption(){}FriendsPrivacyOption.prototype={init:function(a,b){this._selector=Parent.byClass(a,'composerAudienceSelector');if(!this._selector)return;this._elem=a;this._hasRestricted=b;this._plusLabel=DOM.find(a,'.plusLabel');this._tags=[];this._recalculateTooltipAndLabel();this._updateSelector();Arbiter.subscribe('Composer/changedtags',function(c,d){this._tags=d.withTags.map(function(g){return g.getText();});var f=d.withTags.map(function(g){return g.getValue();});for(var e in d.mention)if(d.mention[e].type=='user'){this._tags.push(d.mention[e].text);f.push(d.mention[e].uid);}if(this._recalculateTooltipAndLabel()&&this._updateSelector())Arbiter.inform('FriendsPrivacyOption/changed',f);}.bind(this));Selector.listen(this._selector,'change',this._updateSelector.bind(this));},_recalculateTooltipAndLabel:function(){var a=this._tags.length,b=this._tooltip;if(a>2){this._tooltip=this._hasRestricted?_tx("\u039f\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03c3\u03b1\u03c2 \u03ba\u03b1\u03b9 \u03bf\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03cc\u03c3\u03c9\u03bd \u03ad\u03c7\u03bf\u03c5\u03bd \u03c0\u03c1\u03bf\u03c3\u03c4\u03b5\u03b8\u03b5\u03af \u03bc\u03b5 \u03b5\u03c4\u03b9\u03ba\u03ad\u03c4\u03b1. \u0395\u03be\u03b1\u03b9\u03c1\u03bf\u03cd\u03bd\u03c4\u03b1\u03b9 \u03bf\u03b9 \u03a0\u03b5\u03c1\u03b9\u03bf\u03c1\u03b9\u03c3\u03bc\u03ad\u03bd\u03bf\u03b9"):_tx("\u039f\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03c3\u03b1\u03c2 \u03ba\u03b1\u03b9 \u03bf\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03cc\u03c3\u03c9\u03bd \u03ad\u03c7\u03bf\u03c5\u03bd \u03c0\u03c1\u03bf\u03c3\u03c4\u03b5\u03b8\u03b5\u03af \u03bc\u03b5 \u03b5\u03c4\u03b9\u03ba\u03ad\u03c4\u03b1");}else if(a==2){if(this._hasRestricted){this._tooltip=_tx("\u039f\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03c3\u03b1\u03c2, \u03ba\u03b1\u03b8\u03ce\u03c2 \u03ba\u03b1\u03b9 \u03bf\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03c4\u03c9\u03bd \u03c7\u03c1\u03b7\u03c3\u03c4\u03ce\u03bd {user} \u03ba\u03b1\u03b9 {user2}. \u0395\u03be\u03b1\u03b9\u03c1\u03bf\u03cd\u03bd\u03c4\u03b1\u03b9 \u03bf\u03b9 \u03a0\u03b5\u03c1\u03b9\u03bf\u03c1\u03b9\u03c3\u03bc\u03ad\u03bd\u03bf\u03b9",{user:this._tags[0],user2:this._tags[1]});}else this._tooltip=_tx("Your friends, {user}'s friends and {user2}'s friends",{user:this._tags[0],user2:this._tags[1]});}else if(a==1){if(this._hasRestricted){this._tooltip=_tx("\u039f\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03c3\u03b1\u03c2 \u03ba\u03b1\u03b9 \u03bf\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03c4\u03bf\u03c5 \u03c7\u03c1\u03ae\u03c3\u03c4\u03b7 {user}. \u0395\u03be\u03b1\u03b9\u03c1\u03bf\u03cd\u03bd\u03c4\u03b1\u03b9 \u03bf\u03b9 \u03a0\u03b5\u03c1\u03b9\u03bf\u03c1\u03b9\u03c3\u03bc\u03ad\u03bd\u03bf\u03b9",{user:this._tags[0]});}else this._tooltip=_tx("Your friends and {user}'s friends",{user:this._tags[0]});}else this._tooltip=this._hasRestricted?_tx("\u039f\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03c3\u03b1\u03c2. \u0395\u03be\u03b1\u03b9\u03c1\u03bf\u03cd\u03bd\u03c4\u03b1\u03b9 \u03bf\u03b9 \u03a0\u03b5\u03c1\u03b9\u03bf\u03c1\u03b9\u03c3\u03bc\u03ad\u03bd\u03bf\u03b9"):_tx("\u039f\u03b9 \u03c6\u03af\u03bb\u03bf\u03b9 \u03c3\u03b1\u03c2");CSS.conditionShow(this._plusLabel,this._tags.length);return b!=this._tooltip;},_updateSelector:function(){if(!Selector.isOptionSelected(this._elem))return false;var a=this._elem.getAttribute('data-label');if(this._tags.length)a+=' (+)';Selector.setButtonLabel(this._selector,a);Selector.setButtonTooltip(this._selector,this._tooltip);return true;}};
function MetaComposerEdDialog(){}MetaComposerEdDialog.prototype={init:function(a,b){MetaComposerEdDialog.timesEnabled=b;if(MetaComposerEdDialog.singleton){a.destroy();return;}MetaComposerEdDialog.singleton=this;this._dialog=a;Arbiter.subscribe('FriendsPrivacyOption/changed',function(c,d){if(!this._updateContext())return;this._async&&this._async.abort();this._async=new AsyncRequest('/ajax/composer/audience_education');this._async.setData({ids:d,num:MetaComposerEdDialog.timesEnabled}).setHandler(this._handler.bind(this)).send();}.bind(this));Selector.subscribe('open',this._killAnim.bind(this));},_updateContext:function(){var a=DOM.scry(document.body,'div.composerAudienceWrapper')[0];var b=Vector2.getElementPosition(a);if(a&&b.x>0&&b.y>0){this._dialog.setContext(a);return true;}return false;},_handler:function(c){var d=c.payload;if(!d||!this._updateContext())return;var a=this._dialog.getContent();DOM.setContent(a,HTML(d));this._dialog.setDestroyOnHide(false).show();var b=Parent.byClass(a,'metaComposerUserEd');if(this._anim){this._anim.stop();this._anim=animation(b);}else this._anim=animation(b).from('opacity',0);this._anim.by('opacity',1).checkpoint().duration(3000).checkpoint().to('opacity',0).checkpoint().ondone(this._killAnim.bind(this)).go();},_killAnim:function(a,b){if(this._anim){this._anim.stop();this._dialog.hide(false);this._anim=null;}}};
function ScrollingPager(d,c,a,b){this.scroll_loader_id=d;this.pagelet_src=c;this.data=a;this.options=b||{};if(this.options.target_id){this.target_id=this.options.target_id;this.options.append=true;}else this.target_id=d;this.handler=null;}ScrollingPager.prototype={register:function(){this.onvisible=new OnVisible($(this.scroll_loader_id),this.getHandler(),false,this.options.buffer,this.options);},getHandler:function(){if(this.handler)return this.handler;function a(){var c=ge(this.scroll_loader_id);if(!c){this.onvisible.remove();return;}CSS.addClass(c.firstChild,'async_saving');var b=this.options.handler;this.options.handler=function(){Arbiter.inform('ScrollingPager/loadingComplete');b&&b.apply(null,arguments);};UIPagelet.loadFromEndpoint(this.pagelet_src,this.target_id,this.data,this.options);}return a.bind(this);},setHandler:function(a){this.handler=a;}};
function SideNav(){SideNav.instance=this;}SideNav.instance=null;SideNav.getInstance=function(){if(SideNav.instance===null)return new SideNav();return SideNav.instance;};SideNav.prototype={init:function(c,a,b,d,e){this.selectedKey=d;this.loadingKey=null;this.loadingNode=null;this.editNav={};this.path=URI.getRequestURI().getPath();this.domain=URI.getRequestURI().getDomain();this.navData={};this.root=c;this.defaultKey=a;this.endpoints=b;this.keyParam='sk';this.useAjaxPipe=e;PageTransitions.registerHandler(this.catchPageTransition.bind(this));this._subscriptions=[Arbiter.subscribe(NavigationMessage.NAVIGATION_COMPLETED,this.navigationComplete.bind(this)),Arbiter.subscribe(NavigationMessage.NAVIGATION_FAILED,this.navigationFailed.bind(this)),Arbiter.subscribe(NavigationMessage.NAVIGATION_COUNT_UPDATE,this.navigationCountUpdate.bind(this)),Arbiter.subscribe(PresenceMessage.getArbiterMessageType('nav_count'),this.navigationCountUpdateFromPresence.bind(this)),Arbiter.subscribe(NavigationMessage.NAVIGATION_SELECT,this.navigationSelect.bind(this))];if(this.selectedKey){Arbiter.inform('SideNav.selectedKey',this.selectedKey,Arbiter.BEHAVIOR_STATE);}else{selected=Arbiter.query('SideNav.selectedKey');if(selected){data={asLoading:false};data[this.keyParam]=selected;this.navigationSelect(null,data);}}this._listeners=[Event.listen(this.root,'click',(function(event){var f=event.getTarget();if(CSS.hasClass(f,'uiCloseButton')&&f.parentNode.tagName=='LI'){CSS.hide(Parent.byTag(f,'li'));return;}if(!(CSS.hasClass(f,'navMoreLess')||CSS.hasClass(f,'navEditDone')))f=Parent.byTag(f,'a');if(f&&CSS.hasClass(f,'navEditDone')){this.toggleEditMode(f);event.kill();}}).bind(this))];onleaveRegister(this._destroy.bind(this));},toggleEditMode:function(a){this.toggleSortMode(DOM.find(Parent.byClass(a,'expandedMode'),'ul.uiSideNav'),a.getAttribute('data-endpoint'));},addEndpoints:function(a){this.endpoints=merge(this.endpoints,a);},addToURLMap:function(){},updateCloseButtons:function(b,a){DOM.scry(b,'span.buttonWrap').each((function(c){Event.listen(c,'click',(function(event){var d=Parent.byClass(event.getTarget(),'uiCloseButton');if(d){d=DOM.find(d,'input');Form.bootstrap(d.form,d);if(a)CSS.hide(Parent.byTag(d,'li'));}Event.kill(event);}).bind(this));CSS.show(c);}).bind(this));},getEndpoint:function(a){return this.endpoints?this.endpoints[a]||this.endpoints:'';},catchPageTransition:function(c){var b=c.getQueryData(),a=this.resolveKey(b[this.keyParam],c);if(a===false)return false;if(a===undefined)a=this.defaultKey;this.loadKey(a);return this.handlePageTransition(c,b,a);},resolveKey:function(a,b){if(this.path!=b.getPath()||this.domain!=b.getDomain())return false;return a;},loadKey:function(b,c){var a=DOM.scry(this.root,'li.key-'+b);this.loadingNode&&!c&&CSS.removeClass(this.loadingNode,'loading');this.loadingKey=b;if(a.length){this.loadingNode=a[0];!c&&CSS.addClass(this.loadingNode,'loading');}else this.loadingNode=null;this.refreshRightColumn=this.shouldRefreshRightColumn(this.loadingNode,b);},shouldRefreshRightColumn:function(b,a){return b&&this.isTopLevelNode(b);},handlePageTransition:function(d,c,b){var a=this.getEndpoint(b);if(!(typeof a=='string'))return false;copy_properties(c,{key:b,endpoint:a,sidecol:this.refreshRightColumn});c={params:c};c.useAjaxPipe=this.useAjaxPipe||c.params.ap;Arbiter.inform(NavigationMessage.NAVIGATION_BEGIN,c);return true;},isTopLevelNode:function(a){return (a&&a.firstChild&&(CSS.hasClass(a.firstChild,'item')||CSS.hasClass(a.firstChild,'inputsearch')));},navigationSelect:function(c,a){var b=a[this.keyParam];if(b!==undefined){this.loadKey(b);if(!a.asLoading)this.navigationComplete();}},navigationFailed:function(){CSS.removeClass(this.loadingNode,'loading');this.loadingNode=null;},navigationComplete:function(){if(Arbiter.inform('sidenav/scrolltop')!==false)DOMScroll.scrollTo(document.documentElement,false);if(this.loadingKey)DOM.scry(this.root,'li.selectedItem').each(function(c){CSS.removeClass(c,'selectedItem');});if(this.loadingNode){CSS.removeClass(this.loadingNode,'loading');var b=null;if(this.isTopLevelNode(this.loadingNode)){b=this.loadingNode;}else b=this.loadingNode.parentNode.parentNode;if(!CSS.hasClass(b,'open')){DOM.scry(this.root,'li.open').each(function(c){CSS.removeClass(c,'open');});CSS.addClass(b,'open');}CSS.addClass(this.loadingNode,'selectedItem');var a=CSS.hasClass(this.loadingNode,'hider');DOM.scry(this.root,'div.navFold').forEach(function(c){CSS.conditionClass(c,'hideContent',a);});if(CSS.hasClass(this.loadingNode,'expander'))CSS.addClass(Parent.byClass(this.loadingNode,'expandableSideNav'),'expandedMode');this.selectedKey=this.loadingKey;Arbiter.inform('SideNav.selectedKey',this.selectedKey,Arbiter.BEHAVIOR_STATE);this.loadingNode=null;this.loadingKey=null;}},navigationCountUpdate:function(g,c){if(!c||!c['key']||(c.count===undefined&&c.increment===undefined))return;var f=DOM.scry(this.root,'li.key-'+c.key);if(f&&f.length>0){var e=f[0];var a=DOM.scry(e,'span.count');if(a&&a.length>0){var b=DOM.find(a[0],'span.countValue');var h=0;if(b){if(c.count){h=c.count;}else if(c.increment){h=c.increment+parseInt(DOM.getText(b),10);if(h<0)h=0;}DOM.setContent(b,h);}CSS.conditionClass(a[0],'hidden_elem',!h);if(c.hide){var d='hidden';if(CSS.hasClass(e,'subitem'))d='hiddenSubitem';CSS.conditionClass(e,d,h);}}}},navigationCountUpdateFromPresence:function(b,a){a=a.obj;if(!a||!a['class_name']||!CSS.hasClass(this.root,a['class_name']))return;this.navigationCountUpdate(b,a);},toggleSortMode:function(c,a){if(!this.editNav[c]){Bootloader.loadComponents('sortable-side-nav-js',this.initializeSortable.bind(this,c,a));}else{var d=c.parentNode,b=this.editNav[c].inEditMode();CSS.conditionClass($('sideNav'),'editMode',!b);this.editNav[c][(b?'endEdit':'beginEdit')]();}return false;},initializeSortable:function(b,a){this.editNav[b]=new SortableSideNav(b,a);this.toggleSortMode(b);},_destroy:function(){this._subscriptions.forEach(Arbiter.unsubscribe);this._subscriptions.length=0;this._listeners.forEach(function(a){a.remove();});this._listeners.length=0;}};
add_properties('TypeaheadRenderers',{basic:function(a,b){var c=[];if(a.icon)c.push($N('img',{alt:'',src:a.icon}));if(a.text)c.push($N('span',{className:'text'},[a.text]));if(a.subtext)c.push($N('span',{className:'subtext'},[a.subtext]));return $N('li',{className:a.type||''},c);}});
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();}});
function CounterDisplay(a,g,h,e,d,b){copy_properties(this,{_name:a,_valueNode:$(g),_wrapperNode:$(h)||null,_statusClass:d,_rm:new RenderManager(this),_arbiterSubscription:null,_count:0});var c=this._valueNode.firstChild;if(c){var f=parseInt(c.nodeValue,10);if(!isNaN(f))this._count=f;}this._statusNode=e?$(e):null;this._subscribeAll();CounterDisplay.instances.push(this);if(!b)onleaveRegister(this._destroy.bind(this),true);}copy_properties(CounterDisplay,{EVENT_TYPE_ADJUST:'CounterDisplay/adjust',EVENT_TYPE_UPDATE:'CounterDisplay/update',instances:[],adjustCount:function(a,b){Arbiter.inform(CounterDisplay.EVENT_TYPE_ADJUST+'/'+a,b);},setCount:function(a,b){Arbiter.inform(CounterDisplay.EVENT_TYPE_UPDATE+'/'+a,b);}});Class.mixin(CounterDisplay,{_destroy:function(){delete this._valueNode;delete this._wrapperNode;if(this._arbiterSubscription){Arbiter.unsubscribe(this._arbiterSubscription);delete this._arbiterSubscription;}CounterDisplay.instances.remove(this);},adjustCount:function(a){this._count=Math.max(0,this._count+a);this._rm.dirty();return this;},setCount:function(a){this._count=Math.max(0,a);this._rm.dirty();return this;},paint:function(){DOM.setContent(this._valueNode,this._count);this._toggleNodes();},_toggleNodes:function(){if(this._wrapperNode)CSS.conditionClass(this._wrapperNode,'hidden_elem',this._count<=0);if(this._statusClass&&this._statusNode)CSS.conditionClass(this._statusNode,this._statusClass,this._count>0);},_subscribeAll:function(){var a=[CounterDisplay.EVENT_TYPE_ADJUST+'/'+this._name,CounterDisplay.EVENT_TYPE_UPDATE+'/'+this._name];this._arbiterSubscription=Arbiter.subscribe(a,this._onInform.bind(this),Arbiter.SUBSCRIBE_NEW);},_onInform:function(a,b){b=parseInt(b);if(isNaN(b))return;if(a.indexOf(CounterDisplay.EVENT_TYPE_ADJUST)!=-1){this.adjustCount(b);}else if(a.indexOf(CounterDisplay.EVENT_TYPE_UPDATE)!=-1){this.setCount(b);}else return;return;}});
add_properties('TypeaheadBehaviors',{showLoadingIndicator:function(a){a.subscribe('activity',function(b,c){CSS.conditionClass(a.getElement(),'typeaheadLoading',c.activity);});}});
function ContextualDialog(b){var a=new Dialog();copy_properties(a,ContextualDialog.prototype);a._buildDialog();a._setFromModel(b);return a;}ContextualDialog.prototype={setContext:function(a){this._context=a;this.resetDialogPosition();return this;},_buildDialogContainer:function(){CSS.addClass(this._obj,'contextual_dialog');this._content=this._frame=$N('div',{className:'contextual_dialog_content'});this._arrow=$N('div',{className:'arrow'});DOM.setContent(this._popup,[this._content,this._arrow]);},_resetDialogObj:function(){if(!this._context||!this._showing)return;var g=Vector2.getElementPosition(this._context);var k=this._context.offsetWidth,h=this._context.offsetHeight;var l=g.x,m=g.y+h;var i=Vector2.getViewportDimensions().x;var j=Vector2.getScrollPosition().x;var e=Vector2.getDocumentDimensions().x;var d=Vector2.getElementDimensions(this._popup).x;var f=0;var c;if(k<64){c=l+k/2;}else c=l+32;if(e>0&&e<d){f=-l;}else{if(i>0&&l+d>j+i){f=(j+i-d)-l;if(l+f<j)f=j-l;}if(e>0&&l+d>e)f=(e-d)-l;}l+=f;if(c-l<32){l=c-32;if(l<0)l=0;}var b=Vector2.getElementDimensions(this._arrow).x;var a=c-l-b/2;if(a<0)a=0;if(a>d-32)a=d-32;CSS.setStyle(this._arrow,'marginLeft',a+'px');new Vector2(l,m,'document').setElementPosition(this._popup);},_renderDialog:function(a){if(window!=top)this._auto_focus=false;Dialog.prototype._renderDialog.call(this,a);}};
var XD={_callbacks:[],_opts:{autoResize:false,allowShrink:true,channelUrl:null,hideOverflow:false,newResizeMethod:false,resizeTimeout:100,resizeWidth:false,expectResizeAck:false,resizeAckTimeout:6000},_lastResizeAckId:0,_resizeCount:0,_resizeTimestamp:0,init:function(a){this._opts=copy_properties(copy_properties({},this._opts),a);if(this._opts.autoResize)this._startResizeMonitor();Arbiter.subscribe('Connect.Unsafe.resize.ack',function(c,b){if(!b.id)b.id=this._resizeCount;if(b.id>this._lastResizeAckId)this._lastResizeAckId=b.id;}.bind(this));},send:function(b,a){a=a||this._opts.channelUrl;if(!a)return;if(a.substr(0,4)!='http')return;var i=a+'&'+URI.implodeQuery(b),e='f'+(Math.random()*(1<<30)).toString(16).replace('.',''),c=document.body.appendChild(document.createElement('div')),h=false;c.style.position='absolute';c.style.top='-10000px';c.style.width='1px';c.style.height='1px';XD._callbacks[e]=function(){if(h){(function(){c.parentNode.removeChild(c);}).defer(3000);delete XD._callbacks[e];}};if(ua.ie()){var f,d=document.createElement('div');f='<iframe onload="XD._callbacks.'+e+'()"></iframe>';d.innerHTML=f;d.firstChild.setAttribute('src',i);f=d.innerHTML;c.innerHTML='<iframe src="javascript:false"></iframe>';h=true;(function(){c.innerHTML=f;}).defer();}else{var g=document.createElement('iframe');g.onload=XD._callbacks[e];c.appendChild(g);h=true;g.src=i;}},_computeSize:function(){return {width:this._opts.resizeWidth?this._calcWidth(XD.forced_min_width):0,height:this._calcHeight(this._opts.newResizeMethod)};},_calcHeight:function(d){var a=document.body,b=document.documentElement,c=0;if(d){c=Math.max(Math.max(a.offsetHeight,a.scrollHeight)+a.offsetTop,Math.max(b.offsetHeight,b.scrollHeight)+b.offsetTop);}else{if(ua.ie()){c=Math.max(a.offsetHeight,a.scrollHeight)+a.offsetTop;}else c=b.offsetHeight+b.offsetTop;if(window.Dialog)c=Math.max(c,Dialog.max_bottom);}return c;},_calcWidth:function(g){var a=document.body,e=document.documentElement,h=0;if(a.offsetWidth<a.scrollWidth){h=a.scrollWidth+a.offsetLeft;}else{var d=a.childNodes;for(var f=0;f<d.length;f++){var b=d[f];var c=b.offsetWidth+b.offsetLeft;if(c>h)h=c;}}if(g)h=Math.max(h,g);if(e.clientLeft>0)h+=(e.clientLeft*2);if(e.clientTop>0)height+=(e.clientTop*2);return h;},_startResizeMonitor:function(){var b,a=document.documentElement;if(this._opts.hideOverflow){a.style.overflow='hidden';document.body.style.overflow='hidden';}setInterval((function(){var f=this._computeSize();var g=new Date().getTime();var c=this._lastResizeAckId<this._resizeCount&&(g-this._resizeTimestamp)>this._opts.resizeAckTimeout;if(!b||(this._opts.expectResizeAck&&c)||(this._opts.allowShrink&&b.width!=f.width)||(!this._opts.allowShrink&&b.width<f.width)||(this._opts.allowShrink&&b.height!=f.height)||(!this._opts.allowShrink&&b.height<f.height)){b=f;this._resizeCount++;this._resizeTimestamp=g;var e={type:'resize',height:f.height,ackData:{id:this._resizeCount}};if(f.width&&f.width!=0)e.width=f.width;try{if(URI(document.referrer).isFacebookURI()&&window.parent!=window&&window.name&&window.parent.location&&URI(window.parent.location).isFacebookURI()){var iframes=window.parent.document.getElementsByTagName('iframe');for(var i=0;i<iframes.length;i=i+1)if(iframes[i].name==window.name){if(this._opts.resizeWidth)iframes[i].style.width=e.width+'px';iframes[i].style.height=e.height+'px';}}this.send(e);}catch(d){this.send(e);}}}).bind(this),this._opts.resizeTimeout);}};var UnverifiedXD=copy_properties({},XD);
function fbpage_set_fan_status(c,f,a,h,g,d,e){g=g?g:function(j){_fbpage_show_change_status_feedback(c,j.getPayload());};var b={fbpage_id:f,add:a,reload:h};if(e!=null)copy_properties(b,e);var i=new AsyncRequest().setURI('/ajax/pages/fan_status.php').setData(b).setNectarModuleDataSafe(c).setHandler(g);if(d)i.setErrorHandler(d);i.send();return false;}function fbpage_set_favorite_status(d,e,a){var f=function(){_fbpage_show_change_status_feedback(d,this.getUserData());};var c={fbpage_id:e,add:a};var b=new AsyncRequest().setMethod('POST').setURI('/ajax/pages/favorite_status.php').setData(c);new Dialog().setAsync(b).setCloseHandler(f).show();return false;}function _fbpage_show_change_status_feedback(b,a){if(!a||!b)return;if(a.reload){fbpage_reload_on_fan_status_changed(a.preserve_tab);}else fbpage_redraw_on_fan_status_changed(b,a.feedback);}function fbpage_reload_on_fan_status_changed(a){var c=URI.getRequestURI();if(a){var b=window.FutureSideNav?FutureSideNav.getInstance().selected.textKey:Arbiter.query('SideNav.selectedKey');if(!c.getQueryData().sk&&b)c.addQueryData({sk:b});}window.location.href=c;}function fbpage_redraw_on_fan_status_changed(a,b){if(!b)return;var d=document.createElement('span');d.innerHTML=b;CSS.setClass(d,'fan_status_inactive');a.parentNode.replaceChild(d,a);var c=function(){if(data.can_repeat_action)d.parentNode.replaceChild(a,d);};animation(d).duration(3000).checkpoint().to('backgroundColor','#FFFFFF').duration(1000).ondone(c).go();}
var PopupResizer={_opts:{allowShrink:true,timeout:100},init:function(a){copy_properties(PopupResizer._opts,a);setInterval(PopupResizer._resizeCheck,PopupResizer._opts.timeout);},_resizeCheck:function(){var e=Vector2.getViewportDimensions(),a=PopupResizer._getDocumentSize(),c=a.y-e.y,d=a.x-e.x;if(d<0)d=0;if(!PopupResizer._opts.allowShrink&&c<0)c=0;if(c||d)try{window.resizeBy(d,c);if(d)window.moveBy(d/-2,0);}catch(b){}},_getDocumentSize:function(){var a={x:ua.firefox()?document.documentElement.scrollWidth:document.body.scrollWidth,y:document.body.scrollHeight};if(a.x<=0||a.x>document.documentElement.scrollWidth)a.x=document.documentElement.scrollWidth;if(a.y<=0||a.y>document.documentElement.scrollHeight)a.y=document.documentElement.scrollHeight;if(window.Dialog&&Dialog.max_bottom&&Dialog.max_bottom>a.y)a.y=Dialog.max_bottom;return a;},open:function(i,b,j){var f=typeof window.screenX!='undefined'?window.screenX:window.screenLeft,g=typeof window.screenY!='undefined'?window.screenY:window.screenTop,e=typeof window.outerWidth!='undefined'?window.outerWidth:document.body.clientWidth,d=typeof window.outerHeight!='undefined'?window.outerHeight:(document.body.clientHeight-22),c=parseInt(f+((e-j)/2),10),h=parseInt(g+((d-b)/2.5),10),a=('width='+j+',height='+b+',left='+c+',top='+h);return window.open(i,'_blank',a);}};
WidgetArbiter={_findSiblings:function(){if(WidgetArbiter._siblings)return;WidgetArbiter._siblings=[];for(var b=parent.frames.length-1;b>=0;b--)try{if(parent.frames[b]&&parent.frames[b].Arbiter&&parent.frames[b].Arbiter.inform)WidgetArbiter._siblings.push(parent.frames[b].Arbiter);}catch(a){}},inform:function(){WidgetArbiter._findSiblings();var a=$A(arguments);WidgetArbiter._siblings.each(function(b){b.inform.apply(b,a);});}};
var PlatformOptInPopup=function(){};copy_properties(PlatformOptInPopup,{DIALOG_URL:'/connect/uiserver.php',DIALOG_WIDTH:420,DIALOG_HEIGHT:450,APP_ID:127760087237610,open:function(d,c,a){if(!d)d='generic';if(!c)c='opt.in';var b=new URI(PlatformOptInPopup.DIALOG_URL);b.addQueryData({social_plugin:d,method:c,display:'popup',secure:URI.getRequestURI().isSecure(),app_id:PlatformOptInPopup.APP_ID});if(a)b.addQueryData(a);return PopupResizer.open(b.toString(),PlatformOptInPopup.DIALOG_WIDTH,PlatformOptInPopup.DIALOG_HEIGHT);}});
WindowComm={_callbacks:{},makeHandler:function(a,c){c=c||'opener';var b='f'+(Math.random()*(1<<30)).toString(16).replace('.','');WindowComm._callbacks[b]=a;return new URI('/connect/window_comm.php').setQueryData({_id:b,_relation:c}).getQualifiedURI().toString();},_recv:function(b){var a=new URI(b).getQueryData();WindowComm._callbacks[a._id](a);}};
function object(b){var a=new Function();a.prototype=b;return new a();}function is_scalar(a){return (/string|number|boolean/).test(typeof a);}function keys(c){var b=[];for(var a in c)b.push(a);return b;}function values(b){var c=[];for(var a in b)c.push(b[a]);return c;}function count(c){var a=0;for(var b in c)a++;return a;}function are_equal(a,b){return JSON.stringify(a)==JSON.stringify(b);}function merge(){var b={};for(var a=0;a<arguments.length;a++)copy_properties(b,arguments[a]);return b;}Object.from=function(c,e){var d={};var b=hasArrayNature(e);if(typeof e=='undefined')e=true;for(var a=c.length;a--;)d[c[a]]=b?e[a]:e;return d;};function coalesce(){for(var a=0;a<arguments.length;++a)if(arguments[a]!=null)return arguments[a];return null;}
!function(){function a(b){return function(){if(this===window)throw new TypeError();return b.apply(this,arguments);};}copy_properties(Array.prototype,{map:function(c,b){if(this===window||typeof c!='function')throw new TypeError();var d;var e=this.length;var f=new Array(e);for(d=0;d<e;++d)if(d in this)f[d]=c.call(b,this[d],d,this);return f;},forEach:function(c,b){this.map(c,b);return this;},filter:function(c,b){c=c||function(h){return h;};if(this===window||typeof c!='function')throw new TypeError();var d,g,e=this.length,f=[];for(d=0;d<e;++d)if(d in this){g=this[d];if(c.call(b,g,d,this))f.push(g);}return f;},every:function(d,c){var b=this.filter(function(){return 1;});return (this.filter(d,c).length==b.length);},some:function(c,b){return (this.filter(c,b).length>0);},reduce:null,reduceRight:null,sort:a(Array.prototype.sort),reverse:a(Array.prototype.reverse),concat:a(Array.prototype.concat),slice:a(Array.prototype.slice),indexOf:a(Array.prototype.indexOf||function(d,b){var c=this.length;b|=0;if(b<0)b+=c;for(;b<c;b++)if(b in this&&this[b]===d)return b;return -1;}),contains:function(b){return this.indexOf(b)!=-1;},remove:function(c){var b=this.indexOf(c);if(b!=-1)this.splice(b,1);}});Array.prototype.each=Array.prototype.forEach;Array.prototype.clone=Array.prototype.slice;}();
function muffinize(d){var c='a';var b='d';var a=[c,b].join('');return d.replace(/muffin/g,a);}if(typeof console=='undefined')console={log:bagofholding,info:bagofholding,warn:bagofholding,debug:bagofholding,dir:bagofholding,error:bagofholding};window.Util=console;
window.onloadRegister=function(a){window.loaded?_runHook(a):_addHook('onloadhooks',a);};function onafterloadRegister(a){window.afterloaded?setTimeout(function(){_runHook(a);},0):_addHook('onafterloadhooks',a);}function _onloadHook(){!window.loaded&&window.CavalryLogger&&CavalryLogger.getInstance().setTimeStamp('t_prehooks');_runHooks('onloadhooks');!window.loaded&&window.CavalryLogger&&CavalryLogger.getInstance().setTimeStamp('t_hooks');window.loaded=true;Arbiter.inform('uipage_onload',true,Arbiter.BEHAVIOR_STATE);}function _onafterloadHook(){_runHooks('onafterloadhooks');window.afterloaded=true;}function _runHook(b){try{return b();}catch(a){}}function _runHooks(b){var d=b=='onbeforeleavehooks'||b=='onbeforeunloadhooks';var e=null;do{var a=window[b];if(!d)window[b]=null;if(!a)break;for(var c=0;c<a.length;c++)if(d){e=e||_runHook(a[c]);}else _runHook(a[c]);if(d)break;}while(window[b]);if(d&&e)return e;}function keep_window_set_as_loaded(){if(window.loaded==false){window.loaded=true;_runHooks('onloadhooks');}if(window.afterloaded==false){window.afterloaded=true;_runHooks('onafterloadhooks');}}Arbiter.registerCallback(_onloadHook,[OnloadEvent.ONLOAD_DOMCONTENT_CALLBACK,InitialJSLoader.INITIAL_JS_READY]);Arbiter.registerCallback(_onafterloadHook,[OnloadEvent.ONLOAD_DOMCONTENT_CALLBACK,OnloadEvent.ONLOAD_CALLBACK,InitialJSLoader.INITIAL_JS_READY]);Arbiter.subscribe(OnloadEvent.ONBEFOREUNLOAD,function(b,a){a.warn=_runHooks('onbeforeleavehooks')||_runHooks('onbeforeunloadhooks');if(!a.warn){window.loaded=false;window.afterloaded=false;}},Arbiter.SUBSCRIBE_NEW);Arbiter.subscribe(OnloadEvent.ONUNLOAD,function(b,a){_runHooks('onunloadhooks');},Arbiter.SUBSCRIBE_NEW);
void(0);
__d("async-signal",[],function(c,d,e,b){function a(g,f){this.data=f||{};if(window.Env&&Env.tracking_domain&&g.charAt(0)=='/')g=Env.tracking_domain+g;this.uri=g;this.handler=null;}a.prototype.setHandler=function(f){this.handler=f;return this;};a.prototype.send=function(){var h=this.handler,g=this.data,l=this.uri,k=[],i=new Image(),f=document.getElementById('post_form_id');g.asyncSignal=Math.floor(Math.random()*10000)+1;if(f)g.post_form_id=f.value;if(window.Env){g.__user=Env.user;if(Env.fb_isb)g.fb_isb=Env.fb_isb;}for(var j in g)k.push(encodeURIComponent(j)+'='+encodeURIComponent(g[j]));if(l.indexOf('?')==-1)l+='?';l+=k.join('&');if(h)i.onload=i.onerror=(function(n,m){return function(){m((n.height==1));};})(i,h);i.src=l;return this;};c.AsyncSignal=d.exports=a;},3);
function setCookie(a,b,d,e){if(env_get('no_cookies')&&a!='tpa')return;if(d){var f=new Date();var c=new Date();c.setTime(f.getTime()+d);}document.cookie=a+"="+encodeURIComponent(b)+"; "+(d?"expires="+c.toGMTString()+"; ":"")+"path="+(e||'/')+"; domain="+window.location.hostname.replace(/^.*(\.facebook\..*)$/i,'$1');}function clearCookie(a){document.cookie=a+"=; expires=Sat, 01 Jan 2000 00:00:00 GMT; "+"path=/; domain="+window.location.hostname.replace(/^.*(\.facebook\..*)$/i,'$1');}function getCookie(d){var e=d+"=";var b=document.cookie.split(';');for(var c=0;c<b.length;c++){var a=b[c];while(a.charAt(0)==' ')a=a.substring(1,a.length);if(a.indexOf(e)==0)return decodeURIComponent(a.substring(e.length,a.length));}return null;}
__d("dom-html",[],function(c,d,e,b){function a(f){if(f&&f.__html)f=f.__html;if(!(this instanceof a)){if(f instanceof a)return f;return new a(f);}this._content=f;this._defer=false;this._extra_action='';this._nodes=null;this._inline_js=bagofholding;this._ie_clone_bug=false;return this;}a.isHTML=function(f){return f&&(f instanceof a||f.__html!==undefined);};a.replaceJSONWrapper=function(f){return f&&f.__html!==undefined?new a(f.__html):f;};copy_properties(a.prototype,{toString:function(){var f=this._content||'';if(this._extra_action)f+='<script type="text/javascript">'+this._extra_action+'</scr'+'ipt>';return f;},setAction:function(f){this._extra_action=f;return this;},getAction:function(){this._fillCache();var f=function(){this._inline_js();eval_global(this._extra_action);}.bind(this);if(this.getDeferred()){return f.defer.bind(f);}else return f;},setDeferred:function(f){this._defer=!!f;return this;},getDeferred:function(){return this._defer;},getContent:function(){return this._content;},getNodes:function(){this._fillCache();return this._nodes;},getRootNode:function(){return this.getNodes()[0];},ieCloneBug:function(){this._fillCache();return this._ie_clone_bug;},_fillCache:function(){if(null!==this._nodes)return;var i=this._content;if(!i){this._nodes=[];return;}i=i.replace(/(<(\w+)[^>]*?)\/>/g,function(q,r,s){return s.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?q:r+'></'+s+'>';});var m=i.trim().toLowerCase(),p=document.createElement('div'),g=false;var o=(!m.indexOf('<opt')&&[1,'<select multiple="multiple" class="__WRAPPER">','</select>'])||(!m.indexOf('<leg')&&[1,'<fieldset class="__WRAPPER">','</fieldset>'])||(m.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,'<table class="__WRAPPER">','</table>'])||(!m.indexOf('<tr')&&[2,'<table><tbody class="__WRAPPER">','</tbody></table>'])||((!m.indexOf('<td')||!m.indexOf('<th'))&&[3,'<table><tbody><tr class="__WRAPPER">','</tr></tbody></table>'])||(!m.indexOf('<col')&&[2,'<table><tbody></tbody><colgroup class="__WRAPPER">','</colgroup></table>'])||null;if(null===o){p.className='__WRAPPER';if(ua.ie()){o=[0,'<span style="display:none">&nbsp;</span>',''];g=true;}else o=[0,'',''];}p.innerHTML=o[1]+i+o[2];while(o[0]--)p=p.lastChild;if(g)p.removeChild(p.firstChild);p.className!='__WRAPPER';if(0!==p.getElementsByTagName('option').length||0!==p.getElementsByTagName('object').length)this._ie_clone_bug=true;if(ua.ie()){var n;if(!m.indexOf('<table')&&-1==m.indexOf('<tbody')){n=p.firstChild&&p.firstChild.childNodes;}else if(o[1]=='<table>'&&-1==m.indexOf('<tbody')){n=p.childNodes;}else n=[];for(var k=n.length-1;k>=0;--k)if(n[k].nodeName&&n[k].nodeName.toLowerCase()=='tbody'&&n[k].childNodes.length==0)n[k].parentNode.removeChild(n[k]);}var l=p.getElementsByTagName('script');var f=[];for(var j=0;j<l.length;j++)if(l[j].src){f.push(Bootloader.requestResource.bind(Bootloader,'js',l[j].src));}else f.push(eval_global.bind(null,l[j].innerHTML));for(var j=l.length-1;j>=0;j--)l[j].parentNode.removeChild(l[j]);var h=function(){for(var q=0;q<f.length;q++)f[q]();};this._nodes=$A(p.childNodes);this._inline_js=h;}});c.HTML=d.exports=a;},3);
__d("dom",["dom-core","css-core","dom-html"],function(h,i,j,f){var a=j('dom-core').$;var g=j('dom-core').ge;var c=j('css-core');var e=j('dom-html');var d={find:function(k,m){var l=d.scry(k,m);return l[0];},scry:function(t,zf){if(!t)return [];var zg=zf.split(' ');var n=[t];var s=t===document;for(var w=0;w<zg.length;w++){if(n.length==0)break;if(zg[w]=='')continue;var ze=zg[w];var zc=[];var zn=false;if(ze.charAt(0)=='^')if(w==0){zn=true;ze=ze.slice(1);}else return [];ze=ze.replace(/\./g,' .');ze=ze.replace(/\#/g,' #');ze=ze.replace(/\[/g,' [');var zj=ze.split(' ');var zk=zj[0]||'*';var x=zj[1]&&zj[1].charAt(0)=='#';if(x){var r=g(zj[1].slice(1),true);if(r&&('*'==zk||r.tagName.toLowerCase()==zk))for(var za=0;za<n.length;za++)if(zn&&d.contains(r,n[za])){zc=[r];break;}else if(document==n[za]||d.contains(n[za],r)){zc=[r];break;}}else{var zm=[];var m=n.length;for(var y=0;y<m;y++){if(zn){var u=[];var q=n[y].parentNode;var k=zk=='*';while(d.isElementNode(q)){if(k||q.tagName.toLowerCase()==zk)u.push(q);q=q.parentNode;}}else var u=n[y].getElementsByTagName(zk);var v=u.length;for(var zb=0;zb<v;zb++)zm.push(u[zb]);}for(var zh=1;zh<zj.length;zh++){var zi=zj[zh];var z=zi.charAt(0)=='.';var o=zi.substring(1);for(var y=0;y<zm.length;y++){var zl=zm[y];if(!zl)continue;if(z){if(!c.hasClass(zl,o))delete zm[y];continue;}else{var p=zi.slice(1,zi.length-1);if(p.indexOf('=')==-1){if(zl.getAttribute(p)===null){delete zm[y];continue;}}else{var zd=p.split('=');var l=zd[0];var zo=zd[1];zo=zo.slice(1,zo.length-1);if(zl.getAttribute(l)!=zo){delete zm[y];continue;}}}}}for(var y=0;y<zm.length;y++)if(zm[y]){zc.push(zm[y]);if(zn)break;}}n=zc;}return n;},getText:(function(){var k=document.createElement('div'),l=k.textContent!=null?'textContent':'innerText';return function(m){if(!m){return '';}else if(d.isTextNode(m)){return m.data;}else return m[l];};})(),getSelection:function(){var l=window.getSelection,k=document.selection;if(l){return l()+'';}else if(k)return k.createRange().text;return null;},create:function(m,k,l){m=document.createElement(m);if(k){k=copy_properties({},k);if(k.style){copy_properties(m.style,k.style);delete k.style;}for(var n in k)if(n.toLowerCase().indexOf('on')==0){if(!(typeof k[n]!='function'))if(window.Event&&Event.listen){Event.listen(m,n.substr(2),k[n]);}else m[n]=k[n];delete k[n];}copy_properties(m,k);}if(l!=undefined)d.setContent(m,l);return m;},prependContent:function(m,l){if(!d.isNode(m))throw new Error('DOM.prependContent: reference element is not a node');var k=function(n){if(m.firstChild){m.insertBefore(n,m.firstChild);}else m.appendChild(n);};return d._addContent(l,k,m);},insertAfter:function(m,l){if(!d.isNode(m)||!m.parentNode)throw new Error('DOM.insertAfter: reference element is not a node');var k=function(n){if(m.nextSibling){m.parentNode.insertBefore(n,m.nextSibling);}else m.parentNode.appendChild(n);};return d._addContent(l,k,m.parentNode);},insertBefore:function(l,m){if(!d.isNode(m)||!m.parentNode)throw new Error('DOM.insertBefore: reference element is not a node or '+'does not have a parent.');var k=function(n){m.parentNode.insertBefore(n,m);};return d._addContent(l,k,m.parentNode);},setContent:function(l,k){if(!d.isNode(l))throw new Error('DOM.setContent: reference element is not a node');d.empty(l);return d.appendContent(l,k);},appendContent:function(m,l){if(!d.isNode(m))throw new Error('DOM.appendContent: reference element is not a node');var k=function(n){m.appendChild(n);};return d._addContent(l,k,m);},replace:function(m,l){if(!d.isNode(m)||!m.parentNode)throw new Error('DOM.replace: reference element must be a node with a'+' parent');var k=function(n){m.parentNode.replaceChild(n,m);};return d._addContent(l,k,m.parentNode);},remove:function(k){k=a(k);if(k.parentNode)k.parentNode.removeChild(k);},empty:function(k){k=a(k);while(k.firstChild)d.remove(k.firstChild);},contains:function(l,k){l=g(l);k=g(k);if(!l||!k){return false;}else if(l===k){return true;}else if(d.isTextNode(l)){return false;}else if(d.isTextNode(k)){return d.contains(l,k.parentNode);}else if(l.contains){return l.contains(k);}else if(l.compareDocumentPosition){return !!(l.compareDocumentPosition(k)&16);}else return false;},getRootElement:function(){var k=null;if(window.Quickling&&Quickling.isActive())k=g('content');return k||document.body;},isNode:function(k){return !!(k&&(typeof Node=='object'?k instanceof Node:typeof k=="object"&&typeof k.nodeType=='number'&&typeof k.nodeName=='string'));},isNodeOfType:function(l,m){var k=Object.from($A(m).join('|').toUpperCase().split('|'));return d.isNode(l)&&l.nodeName in k;},isElementNode:function(k){return d.isNode(k)&&k.nodeType==1;},isTextNode:function(k){return d.isNode(k)&&k.nodeType==3;},_addContent:function(n,k,w){n=e.replaceJSONWrapper(n);if(n instanceof e&&-1==n.toString().indexOf('<scr'+'ipt')&&''==w.innerHTML){var q=ua.ie();if(!q||(q>7&&!d.isNodeOfType(w,['table','tbody','thead','tfoot','tr','select','fieldset']))){var r=q?"<em style=\"display:none;\">&nbsp;</em>":"";w.innerHTML=r+n;q&&w.removeChild(w.firstChild);return $A(w.childNodes);}}else if(d.isTextNode(w)){w.data=n;return [n];}var t,o=[],l=[];var p=document.createDocumentFragment();if(!(n instanceof Array))n=[n];for(var s=0;s<n.length;s++){t=e.replaceJSONWrapper(n[s]);if(t instanceof e){l.push(t.getAction());var v=t.getNodes(),m;for(var u=0;u<v.length;u++){m=(ua.safari()||(ua.ie()&&t.ieCloneBug()))?v[u]:v[u].cloneNode(true);o.push(m);p.appendChild(m);}}else if(is_scalar(t)){var x=document.createTextNode(t);o.push(x);p.appendChild(x);}else if(d.isNode(t)){o.push(t);p.appendChild(t);}else if(!(t instanceof Array))t!==null;}k(p);for(var s=0;s<l.length;s++)l[s]();return o;}};function b(m,k,l){if(typeof k!='object'||d.isNode(k)||k instanceof Array||e.isHTML(k)){l=k;k=null;}return d.create(m,k,l);}h.$N=d.$N=b;h.DOM=i.exports=d;},3);
function URI(a){if(a===window)return;if(this===window)return new URI(a||window.location.href);this.parse(a||'');}copy_properties(URI,{getRequestURI:function(a,b){a=a===undefined||a;if(a&&window.PageTransitions&&PageTransitions.isInitialized()){return PageTransitions.getCurrentURI(!!b).getQualifiedURI();}else return new URI(window.location.href);},getMostRecentURI:function(){if(window.PageTransitions&&PageTransitions.isInitialized()){return PageTransitions.getMostRecentURI().getQualifiedURI();}else return new URI(window.location.href);},getNextURI:function(){if(window.PageTransitions&&PageTransitions.isInitialized()){return PageTransitions.getNextURI().getQualifiedURI();}else return new URI(window.location.href);},expression:/(((\w+):\/\/)([^\/:]*)(:(\d+))?)?([^#?]*)(\?([^#]*))?(#(.*))?/,arrayQueryExpression:/^(\w+)((?:\[\w*\])+)=?(.*)/,explodeQuery:function(g){if(!g)return {};var h={};g=g.replace(/%5B/ig,'[').replace(/%5D/ig,']');g=g.split('&');for(var b=0,d=g.length;b<d;b++){var e=g[b].match(URI.arrayQueryExpression);if(!e){var j=g[b].split('=');h[URI.decodeComponent(j[0])]=j[1]===undefined?null:URI.decodeComponent(j[1]);}else{var c=e[2].split(/\]\[|\[|\]/).slice(0,-1);var f=e[1];var k=URI.decodeComponent(e[3]||'');c[0]=f;var i=h;for(var a=0;a<c.length-1;a++)if(c[a]){if(i[c[a]]===undefined)if(c[a+1]&&!c[a+1].match(/\d+$/)){i[c[a]]={};}else i[c[a]]=[];i=i[c[a]];}else{if(c[a+1]&&!c[a+1].match(/\d+$/)){i.push({});}else i.push([]);i=i[i.length-1];}if(i instanceof Array&&c[c.length-1]==''){i.push(k);}else i[c[c.length-1]]=k;}}return h;},implodeQuery:function(f,e,a){e=e||'';if(a===undefined)a=true;var g=[];if(f===null||f===undefined){g.push(a?URI.encodeComponent(e):e);}else if(f instanceof Array){for(var c=0;c<f.length;++c)try{if(f[c]!==undefined)g.push(URI.implodeQuery(f[c],e?(e+'['+c+']'):c));}catch(b){}}else if(typeof(f)=='object'){if(DOM.isNode(f)){g.push('{node}');}else for(var d in f)try{if(f[d]!==undefined)g.push(URI.implodeQuery(f[d],e?(e+'['+d+']'):d));}catch(b){}}else if(a){g.push(URI.encodeComponent(e)+'='+URI.encodeComponent(f));}else g.push(e+'='+f);return g.join('&');},encodeComponent:function(d){var c=String(d).split(/([\[\]])/);for(var a=0,b=c.length;a<b;a+=2)c[a]=window.encodeURIComponent(c[a]);return c.join('');},decodeComponent:function(a){return window.decodeURIComponent(a.replace(/\+/g,' '));},INVALID_DOMAIN:'invalid.invalid',sanitizeDomain:function(a){var b=new RegExp('[\\x00-\\x2c\\x2f\\x3b-\\x40\\x5c\\x5e\\x60\\x7b-\\x7f'+'\\uFDD0-\\uFDEF\\uFFF0-\\uFFFF'+'\\u2047\\u2048\\uFE56\\uFE5F\\uFF03\\uFF0F\\uFF1F]');if(b.test(a)){return URI.INVALID_DOMAIN;}else return a;}});copy_properties(URI.prototype,{parse:function(b){var a=b.toString().match(URI.expression);copy_properties(this,{protocol:a[3]||'',domain:URI.sanitizeDomain(a[4]||''),port:a[6]||'',path:a[7]||'',query_s:a[9]||'',fragment:a[11]||''});return this;},setProtocol:function(a){this.protocol=a;return this;},getProtocol:function(){return this.protocol;},setQueryData:function(a){this.query_s=URI.implodeQuery(a);return this;},addQueryData:function(a){return this.setQueryData(copy_properties(this.getQueryData(),a));},removeQueryData:function(b){if(!(b instanceof Array))b=[b];var d=this.getQueryData();for(var a=0,c=b.length;a<c;++a)delete d[b[a]];return this.setQueryData(d);},getQueryData:function(){return URI.explodeQuery(this.query_s);},setFragment:function(a){this.fragment=a;return this;},getFragment:function(){return this.fragment;},setDomain:function(a){this.domain=URI.sanitizeDomain(a);return this;},getDomain:function(){return this.domain;},setPort:function(a){this.port=a;return this;},getPort:function(){return this.port;},setPath:function(a){this.path=a;return this;},getPath:function(){return this.path.replace(/^\/+/,'/');},isEmpty:function(){return !(this.path||this.protocol||this.domain||this.port||this.query_s||this.fragment);},toString:function(){var a='';this.protocol&&(a+=this.protocol+'://');this.domain&&(a+=this.domain);this.port&&(a+=':'+this.port);if(this.domain&&!this.path)a+='/';this.path&&(a+=this.path);this.query_s&&(a+='?'+this.query_s);this.fragment&&(a+='#'+this.fragment);return a;},valueOf:function(){return this.toString();},isFacebookURI:function(){if(!URI._facebookURIRegex)URI._facebookURIRegex=new RegExp('(^|\\.)facebook\\.com([^.]*)$','i');return (!this.domain||URI._facebookURIRegex.test(this.domain));},isQuicklingEnabled:function(){return window.Quickling&&Quickling.isActive()&&Quickling.isPageActive(this);},getRegisteredDomain:function(){if(!this.domain)return '';if(!this.isFacebookURI())return null;var b=this.domain.split('.');var a=b.indexOf('facebook');return b.slice(a).join('.');},getUnqualifiedURI:function(){return new URI(this).setProtocol(null).setDomain(null).setPort(null);},getQualifiedURI:function(){var b=new URI(this);if(!b.getDomain()){var a=URI();b.setProtocol(a.getProtocol()).setDomain(a.getDomain()).setPort(a.getPort());}return b;},isSameOrigin:function(a){var b=a||window.location.href;if(!(b instanceof URI))b=new URI(b.toString());if(this.getProtocol()&&this.getProtocol()!=b.getProtocol())return false;if(this.getDomain()&&this.getDomain()!=b.getDomain())return false;return true;},go:function(a){goURI(this,a);},setSubdomain:function(b){var c=new URI(this).getQualifiedURI();var a=c.getDomain().split('.');if(a.length<=2){a.unshift(b);}else a[0]=b;return c.setDomain(a.join('.'));},getSubdomain:function(){if(!this.getDomain())return '';var a=this.getDomain().split('.');if(a.length<=2){return '';}else return a[0];},setSecure:function(a){return this.setProtocol(a?'https':'http');},isSecure:function(){return this.getProtocol()=='https';}});
function detect_broken_proxy_cache(d,a){var b=getCookie(a);if((b!=d)&&(b!=null)&&(d!='0')){var c={c:'si_detect_broken_proxy_cache',m:a+' '+d+' '+b};var e=new URI('/common/scribe_endpoint.php').getQualifiedURI().toString();new AsyncSignal(e,c).send();}}
__d("css",["dom","css-core"],function(d,e,f,c){var b=f('dom');var a=f('css-core');copy_properties(a,{shown:function(g){return !a.hasClass(g,'hidden_elem');},toggle:function(g){a.conditionShow(g,!a.shown(g));},setClass:function(h,g){$(h).className=g||'';return h;},setStyle:function(g,h,i){switch(h){case 'opacity':g.style.opacity=i;g.style.filter=i!==''?'alpha(opacity='+i*100+')':'';break;case 'float':g.style.cssFloat=g.style.styleFloat=i;break;default:h=h.replace(/-(.)/g,function(j,k){return k.toUpperCase();});g.style[h]=i;}return g;},getStyle:function(h,j){h=$(h);j=j.replace(/-(.)/g,function(k,l){return l.toUpperCase();});function i(k){return k.replace(/([A-Z])/g,'-$1').toLowerCase();}if(window.getComputedStyle){var g=window.getComputedStyle(h,null);if(g)return g.getPropertyValue(i(j));}if(document.defaultView&&document.defaultView.getComputedStyle){var g=document.defaultView.getComputedStyle(h,null);if(g)return g.getPropertyValue(i(j));if(j=="display")return "none";}if(h.currentStyle)return h.currentStyle[j];return h.style[j];},getStyleFloat:function(g,h){return parseFloat(a.getStyle(g,h),10);},getOpacity:function(g){g=$(g);var h=a.getStyle(g,'filter');var i=null;if(h&&(i=/(\d+(?:\.\d+)?)/.exec(h))){return parseFloat(i.pop())/100;}else if(h=a.getStyle(g,'opacity')){return parseFloat(h);}else return 1;},isFixed:function(g){while(g!==document.documentElement){if(a.getStyle(g,'position')==='fixed')return true;g=g.parentNode;}return false;}});e.exports=a;},3);
function intl_locale_is_rtl(){return ('rtl'==CSS.getStyle(document.body,'direction'));}
DataStore=window.DataStore||{_storage:{},_elements:{},_tokenCounter:1,_NOT_IN_DOM_CONST:1,_getStorage:function(a){var b;if(typeof a=='string'){b='str_'+a;}else{b='elem_'+(a.__FB_TOKEN||(a.__FB_TOKEN=[DataStore._tokenCounter++]))[0];DataStore._elements[b]=a;}return DataStore._storage[b]||(DataStore._storage[b]={});},_shouldDeleteData:function(a){if(!a.nodeName)return false;try{if(null!=a.offsetParent)return false;}catch(b){}if(document.documentElement.contains){return !document.documentElement.contains(a);}else return (document.documentElement.compareDocumentPosition(a)&DataStore._NOT_IN_DOM_CONST);},set:function(c,b,d){var a=DataStore._getStorage(c);a[b]=d;return c;},get:function(e,d,c){var b=DataStore._getStorage(e),f=b[d];if(typeof f==='undefined'&&e.getAttribute){var a=e.getAttribute('data-'+d);f=(null===a)?undefined:a;}if((c!==undefined)&&(f===undefined))f=b[d]=c;return f;},remove:function(c,b){var a=DataStore._getStorage(c),d=a[b];delete a[b];return d;},cleanup:function(){var b,a;for(b in DataStore._elements){a=DataStore._elements[b];if(DataStore._shouldDeleteData(a)){delete DataStore._storage[b];delete DataStore._elements[b];}}}};
function DOMControl(a){this.root=$(a);this.updating=false;DataStore.set(a,'DOMControl',this);}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();},onupdate:function(a){}};DOMControl.getInstance=function(a){return DataStore.get(a,'DOMControl');};
__d("css-support",["css-core"],function(c,d,e,b){var a=e('css-core');copy_properties(a,{supportsBorderRadius:function(){var h=['KhtmlBorderRadius','OBorderRadius','MozBorderRadius','WebkitBorderRadius','msBorderRadius','borderRadius'];var i=false,f=document.createElement('div');for(var g=h.length;g>=0;g--)if(i=f.style[h[g]]!==undefined)break;a.supportsBorderRadius=bagof(i);return i;}});d.exports=a;},3);
add_properties('Input',{focus:function(a){try{a.focus();}catch(b){}},isEmpty:function(a){return !(/\S/).test(a.value||'')||CSS.hasClass(a,'DOMControl_placeholder');},getValue:function(a){return Input.isEmpty(a)?'':a.value;},setValue:function(b,d){CSS.removeClass(b,'DOMControl_placeholder');b.value=d||'';var c=b.getAttribute('maxlength');if(c>0)Bootloader.loadComponents('maxlength-form-listener',function(){Input.enforceMaxLength(b,c);});var a=DOMControl.getInstance(b);a&&a.resetHeight&&a.resetHeight();},setPlaceholder:function(a,b){a.setAttribute('title',b);a.setAttribute('placeholder',b);if(a==document.activeElement)return;if(Input.isEmpty(a)){CSS.conditionClass(a,'DOMControl_placeholder',b);a.value=b||'';}},reset:function(a){var b=a!==document.activeElement?(a.getAttribute('placeholder')||''):'';a.value=b;CSS.conditionClass(a,'DOMControl_placeholder',b);a.style.height='';},setSubmitOnEnter:function(a,b){CSS.conditionClass(a,'enter_submit',b);},getSubmitOnEnter:function(a){return CSS.hasClass(a,'enter_submit');}});
Event.DATASTORE_KEY='Event.listeners';if(!Event.prototype)Event.prototype={};function $E(a){a=a||window.event||{};if(!a._inherits_from_prototype)for(var c in Event.prototype)try{a[c]=Event.prototype[c];}catch(b){}return a;}(function(){copy_properties(Event.prototype,{_inherits_from_prototype:true,stop:function(){this.cancelBubble=true;this.stopPropagation&&this.stopPropagation();return this;},prevent:function(){this.returnValue=false;this.preventDefault&&this.preventDefault();return this;},kill:function(){this.stop().prevent();return false;},getTarget:function(){var g=this.target||this.srcElement;return g?$(g):null;},getRelatedTarget:function(){var g=this.relatedTarget||(this.fromElement===this.srcElement?this.toElement:this.fromElement);return g?$(g):null;},getModifiers:function(){var g={control:!!this.ctrlKey,shift:!!this.shiftKey,alt:!!this.altKey,meta:!!this.metaKey};g.access=ua.osx()?g.control:g.alt;g.any=g.control||g.shift||g.alt||g.meta;return g;}});copy_properties(Event,{listen:function(h,q,j,n){if(typeof h=='string')h=$(h);if(typeof n=='undefined')n=Event.Priority.NORMAL;if(typeof q=='object'){var i={};for(var p in q)i[p]=Event.listen(h,p,q[p],n);return i;}if(q.match(/^on/i))throw new TypeError("Bad event name `"+event+"': use `click', not `onclick'.");q=q.toLowerCase();if(h.nodeName=='LABEL'&&q=='click'){var m=h.getElementsByTagName('input');h=m.length==1?m[0]:h;}var k=DataStore.get(h,b,{});if(f[q]){var g=f[q];q=g.base;j=g.wrap(j);}a(h,q);var r=k[q];if(!(n in r))r[n]=[];var l=r[n].length,o=new EventHandlerRef(j,r[n],l);r[n].push(o);return o;},stop:function(g){return $E(g).stop();},prevent:function(g){return $E(g).prevent();},kill:function(g){return $E(g).kill();},getKeyCode:function(event){event=$E(event);if(!event)return false;switch(event.keyCode){case 63232:return 38;case 63233:return 40;case 63234:return 37;case 63235:return 39;case 63272:case 63273:case 63275:return null;case 63276:return 33;case 63277:return 34;}if(event.shiftKey)switch(event.keyCode){case 33:case 34:case 37:case 38:case 39:case 40:return null;}return event.keyCode;},getPriorities:function(){if(!e){var g=values(Event.Priority);g.sort(function(h,i){return h-i;});e=g;}return e;},__fire:function(g,i,event){var h=Event.__getHandler(g,i);if(h)return h($E(event));},__getHandler:function(g,h){return DataStore.get(g,Event.DATASTORE_KEY+h);}});var e=null,b=Event.DATASTORE_KEY;var c=function(g){return function(h){if(!DOM.contains(this,h.getRelatedTarget()))return g.call(this,h);};};var f={mouseenter:{base:'mouseover',wrap:c},mouseleave:{base:'mouseout',wrap:c}};var a=function(g,m){var h='on'+m;var k=d.bind(g);var j=DataStore.get(g,b);if(m in j)return;j[m]={};if(g.addEventListener){g.addEventListener(m,k,false);}else if(g.attachEvent)g.attachEvent(h,k);DataStore.set(g,b+m,k);if(g[h]){var l=g===document.documentElement?Event.Priority._BUBBLE:Event.Priority.TRADITIONAL;var i=g[h];g[h]=null;Event.listen(g,m,i,l);}if(g.nodeName==='FORM'&&m==='submit')Event.listen(g,m,Event.__bubbleSubmit.curry(g),Event.Priority._BUBBLE);};var d=function(event){event=$E(event);var n=event.type;if(!DataStore.get(this,b))throw new Error("Bad listenHandler context.");var o=DataStore.get(this,b)[n];if(!o)throw new Error("No registered handlers for `"+n+"'.");if(n=='click'){var i=Parent.byTag(event.getTarget(),'a');var p=user_action(i,'click',event);if(window.ArbiterMonitor)ArbiterMonitor.initUA(p,[i]);}var k=Event.getPriorities();for(var j=0;j<k.length;j++){var l=k[j];if(l in o){var g=o[l];for(var h=0;h<g.length;h++){if(!g[h])continue;var m=g[h].fire(this,event);if(m===false){return event.kill();}else if(event.cancelBubble)event.stop();}}}return event.returnValue;};})();Event.Priority={URGENT:-20,TRADITIONAL:-10,NORMAL:0,_BUBBLE:1000};function EventHandlerRef(b,a,c){this._handler=b;this._container=a;this._index=c;}EventHandlerRef.prototype={remove:function(){delete this._handler;delete this._container[this._index];},fire:function(a,event){return this._handler.call(a,event);}};
__d("vector",[],function(e,f,g,d){function a(i,j,h){copy_properties(this,{x:parseFloat(i),y:parseFloat(j),domain:h||'pure'});}copy_properties(a.prototype,{toString:function(){return '('+this.x+', '+this.y+')';},add:function(j,k){if(arguments.length==1){if(j.domain!='pure')j=j.convertTo(this.domain);return this.add(j.x,j.y);}var h=parseFloat(j);var i=parseFloat(k);return new a(this.x+h,this.y+i,this.domain);},mul:function(h,i){if(typeof(i)=="undefined")i=h;return new a(this.x*h,this.y*i,this.domain);},sub:function(h,i){if(arguments.length==1){return this.add(h.mul(-1));}else return this.add(-h,-i);},distanceTo:function(h){return this.sub(h).magnitude();},magnitude:function(){return Math.sqrt((this.x*this.x)+(this.y*this.y));},convertTo:function(h){if(h!='pure'&&h!='viewport'&&h!='document')return new a(0,0);if(h==this.domain)return new a(this.x,this.y,this.domain);if(h=='pure')return new a(this.x,this.y);if(this.domain=='pure')return new a(0,0);var i=a.getScrollPosition('document');var j=this.x,k=this.y;if(this.domain=='document'){j-=i.x;k-=i.y;}else{j+=i.x;k+=i.y;}return new a(j,k,h);},setElementPosition:function(h){var i=this.convertTo('document');h.style.left=parseInt(i.x)+'px';h.style.top=parseInt(i.y)+'px';return this;},setElementDimensions:function(h){return this.setElementWidth(h).setElementHeight(h);},setElementWidth:function(h){h.style.width=parseInt(this.x,10)+'px';return this;},setElementHeight:function(h){h.style.height=parseInt(this.y,10)+'px';return this;},scrollElementBy:function(h){if(h==document.body){window.scrollBy(this.x,this.y);}else{h.scrollLeft+=this.x;h.scrollTop+=this.y;}return this;}});copy_properties(a,{getEventPosition:function(i,h){h=h||'document';i=$E(i);var k=i.pageX||(i.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var l=i.pageY||(i.clientY+(document.documentElement.scrollTop||document.body.scrollTop));var j=new a(k,l,'document');return j.convertTo(h);},getScrollPosition:function(h){h=h||'document';var i=document.body.scrollLeft||document.documentElement.scrollLeft;var j=document.body.scrollTop||document.documentElement.scrollTop;return new a(i,j,'document').convertTo(h);},getElementPosition:function(j,i){i=i||'document';if(!j)return;if(!('getBoundingClientRect' in j))return new a(0,0,'document');var l=j.getBoundingClientRect(),h=document.documentElement,k=Math.round(l.left)-h.clientLeft,m=Math.round(l.top)-h.clientTop;return new a(k,m,'viewport').convertTo(i);},getElementDimensions:function(h){return new a(h.offsetWidth||0,h.offsetHeight||0);},getViewportDimensions:function(){var h=(window&&window.innerWidth)||(document&&document.documentElement&&document.documentElement.clientWidth)||(document&&document.body&&document.body.clientWidth)||0;var i=(window&&window.innerHeight)||(document&&document.documentElement&&document.documentElement.clientHeight)||(document&&document.body&&document.body.clientHeight)||0;return new a(h,i,'viewport');},getDocumentDimensions:function(){var h=(document&&document.documentElement&&document.documentElement.scrollWidth)||(document&&document.body&&document.body.scrollWidth)||0;var i=(document&&document.documentElement&&document.documentElement.scrollHeight)||(document&&document.body&&document.body.scrollHeight)||0;return new a(h,i,'document');},deserialize:function(i){var h=i.split(',');return new a(h[0],h[1]);}});function b(h){return a.getElementPosition(h,'document').x;}function c(h){return a.getElementPosition(h,'document').y;}e.elementY=c;e.elementX=b;e.Vector2=f.exports=a;},3);
function animation(a){if(a==undefined)return;if(this==window){return new animation(a);}else{this.obj=a;this._reset_state();this.queue=[];this.last_attr=null;}}animation.resolution=20;animation.offset=0;animation.prototype._reset_state=function(){this.state={attrs:{},duration:500};};animation.prototype.stop=function(){this._reset_state();this.queue=[];return this;};animation.prototype._build_container=function(){if(this.container_div){this._refresh_container();return;}if(this.obj.firstChild&&this.obj.firstChild.__animation_refs){this.container_div=this.obj.firstChild;this.container_div.__animation_refs++;this._refresh_container();return;}var b=document.createElement('div');b.style.padding='0px';b.style.margin='0px';b.style.border='0px';b.__animation_refs=1;var a=this.obj.childNodes;while(a.length)b.appendChild(a[0]);this.obj.appendChild(b);this._orig_overflow=this.obj.style.overflow;this.obj.style.overflow='hidden';this.container_div=b;this._refresh_container();};animation.prototype._refresh_container=function(){this.container_div.style.height='auto';this.container_div.style.width='auto';this.container_div.style.height=this.container_div.offsetHeight+'px';this.container_div.style.width=this.container_div.offsetWidth+'px';};animation.prototype._destroy_container=function(){if(!this.container_div)return;if(!--this.container_div.__animation_refs){var a=this.container_div.childNodes;while(a.length)this.obj.appendChild(a[0]);this.obj.removeChild(this.container_div);}this.container_div=null;this.obj.style.overflow=this._orig_overflow;};animation.ATTR_TO=1;animation.ATTR_BY=2;animation.ATTR_FROM=3;animation.prototype._attr=function(a,d,c){a=a.replace(/-[a-z]/gi,function(e){return e.substring(1).toUpperCase();});var b=false;switch(a){case 'background':this._attr('backgroundColor',d,c);return this;case 'margin':d=animation.parse_group(d);this._attr('marginBottom',d[0],c);this._attr('marginLeft',d[1],c);this._attr('marginRight',d[2],c);this._attr('marginTop',d[3],c);return this;case 'padding':d=animation.parse_group(d);this._attr('paddingBottom',d[0],c);this._attr('paddingLeft',d[1],c);this._attr('paddingRight',d[2],c);this._attr('paddingTop',d[3],c);return this;case 'backgroundColor':case 'borderColor':case 'color':d=animation.parse_color(d);break;case 'opacity':d=parseFloat(d,10);break;case 'height':case 'width':if(d=='auto'){b=true;}else d=parseInt(d,10);break;case 'borderWidth':case 'lineHeight':case 'fontSize':case 'marginBottom':case 'marginLeft':case 'marginRight':case 'marginTop':case 'paddingBottom':case 'paddingLeft':case 'paddingRight':case 'paddingTop':case 'bottom':case 'left':case 'right':case 'top':case 'scrollTop':case 'scrollLeft':d=parseInt(d,10);break;default:throw new Error(a+' is not a supported attribute!');}if(this.state.attrs[a]===undefined)this.state.attrs[a]={};if(b)this.state.attrs[a].auto=true;switch(c){case animation.ATTR_FROM:this.state.attrs[a].start=d;break;case animation.ATTR_BY:this.state.attrs[a].by=true;case animation.ATTR_TO:this.state.attrs[a].value=d;break;}};animation._get_box_width=function(c){var d=parseInt(CSS.getStyle(c,'paddingLeft'),10),e=parseInt(CSS.getStyle(c,'paddingRight'),10),a=parseInt(CSS.getStyle(c,'borderLeftWidth'),10),b=parseInt(CSS.getStyle(c,'borderRightWidth'),10);return c.offsetWidth-(d?d:0)-(e?e:0)-(a?a:0)-(b?b:0);};animation._get_box_height=function(c){var e=parseInt(CSS.getStyle(c,'paddingTop'),10),d=parseInt(CSS.getStyle(c,'paddingBottom'),10),a=parseInt(CSS.getStyle(c,'borderTopWidth'),10),b=parseInt(CSS.getStyle(c,'borderBottomWidth'),10);return c.offsetHeight-(e?e:0)-(d?d:0)-(a?a:0)-(b?b:0);};animation.prototype.to=function(a,b){if(b===undefined){this._attr(this.last_attr,a,animation.ATTR_TO);}else{this._attr(a,b,animation.ATTR_TO);this.last_attr=a;}return this;};animation.prototype.by=function(a,b){if(b===undefined){this._attr(this.last_attr,a,animation.ATTR_BY);}else{this._attr(a,b,animation.ATTR_BY);this.last_attr=a;}return this;};animation.prototype.from=function(a,b){if(b===undefined){this._attr(this.last_attr,a,animation.ATTR_FROM);}else{this._attr(a,b,animation.ATTR_FROM);this.last_attr=a;}return this;};animation.prototype.duration=function(a){this.state.duration=a?a:0;return this;};animation.prototype.checkpoint=function(b,a){if(b===undefined)b=1;this.state.checkpoint=b;this.queue.push(this.state);this._reset_state();this.state.checkpointcb=a;return this;};animation.prototype.blind=function(){this.state.blind=true;return this;};animation.prototype.hide=function(){this.state.hide=true;return this;};animation.prototype.show=function(){this.state.show=true;return this;};animation.prototype.ease=function(a){this.state.ease=a;return this;};animation.prototype.go=function(){var b=(new Date()).getTime();this.queue.push(this.state);for(var a=0;a<this.queue.length;a++){this.queue[a].start=b-animation.offset;if(this.queue[a].checkpoint)b+=this.queue[a].checkpoint*this.queue[a].duration;}animation.push(this);return this;};animation.prototype._show=function(){CSS.show(this.obj);};animation.prototype._hide=function(){CSS.hide(this.obj);};animation.prototype._frame=function(m){var c=true;var l=false;var o=false;var n;function d(p){return document.documentElement[p]||document.body[p];}for(var e=0;e<this.queue.length;e++){var b=this.queue[e];if(b.start>m){c=false;continue;}if(b.checkpointcb){this._callback(b.checkpointcb,m-b.start);b.checkpointcb=null;}if(b.started===undefined){if(b.show)this._show();for(var a in b.attrs){if(b.attrs[a].start!==undefined)continue;switch(a){case 'backgroundColor':case 'borderColor':case 'color':n=animation.parse_color(CSS.getStyle(this.obj,a=='borderColor'?'borderLeftColor':a));if(b.attrs[a].by){b.attrs[a].value[0]=Math.min(255,Math.max(0,b.attrs[a].value[0]+n[0]));b.attrs[a].value[1]=Math.min(255,Math.max(0,b.attrs[a].value[1]+n[1]));b.attrs[a].value[2]=Math.min(255,Math.max(0,b.attrs[a].value[2]+n[2]));}break;case 'opacity':n=CSS.getOpacity(this.obj);if(b.attrs[a].by)b.attrs[a].value=Math.min(1,Math.max(0,b.attrs[a].value+n));break;case 'height':n=animation._get_box_height(this.obj);if(b.attrs[a].by)b.attrs[a].value+=n;break;case 'width':n=animation._get_box_width(this.obj);if(b.attrs[a].by)b.attrs[a].value+=n;break;case 'scrollLeft':case 'scrollTop':n=(this.obj===document.body)?d(a):this.obj[a];if(b.attrs[a].by)b.attrs[a].value+=n;b['last'+a]=n;break;default:n=parseInt(CSS.getStyle(this.obj,a),10)||0;if(b.attrs[a].by)b.attrs[a].value+=n;break;}b.attrs[a].start=n;}if((b.attrs.height&&b.attrs.height.auto)||(b.attrs.width&&b.attrs.width.auto)){if(ua.firefox()<3)o=true;this._destroy_container();for(var a in {height:1,width:1,fontSize:1,borderLeftWidth:1,borderRightWidth:1,borderTopWidth:1,borderBottomWidth:1,paddingLeft:1,paddingRight:1,paddingTop:1,paddingBottom:1})if(b.attrs[a])this.obj.style[a]=b.attrs[a].value+(typeof b.attrs[a].value=='number'?'px':'');if(b.attrs.height&&b.attrs.height.auto)b.attrs.height.value=animation._get_box_height(this.obj);if(b.attrs.width&&b.attrs.width.auto)b.attrs.width.value=animation._get_box_width(this.obj);}b.started=true;if(b.blind)this._build_container();}var i=(m-b.start)/b.duration;if(i>=1){i=1;if(b.hide)this._hide();}else c=false;var k=b.ease?b.ease(i):i;if(!l&&i!=1&&b.blind)l=true;if(o&&this.obj.parentNode){var j=this.obj.parentNode;var h=this.obj.nextSibling;j.removeChild(this.obj);}for(var a in b.attrs)switch(a){case 'backgroundColor':case 'borderColor':case 'color':this.obj.style[a]='rgb('+animation.calc_tween(k,b.attrs[a].start[0],b.attrs[a].value[0],true)+','+animation.calc_tween(k,b.attrs[a].start[1],b.attrs[a].value[1],true)+','+animation.calc_tween(k,b.attrs[a].start[2],b.attrs[a].value[2],true)+')';break;case 'opacity':CSS.setStyle(this.obj,'opacity',animation.calc_tween(k,b.attrs[a].start,b.attrs[a].value));break;case 'height':case 'width':this.obj.style[a]=k==1&&b.attrs[a].auto?'auto':animation.calc_tween(k,b.attrs[a].start,b.attrs[a].value,true)+'px';break;case 'scrollLeft':case 'scrollTop':var f=this.obj===document.body;n=f?d(a):this.obj[a];if(b['last'+a]!==n){delete b.attrs[a];}else{var g=animation.calc_tween(k,b.attrs[a].start,b.attrs[a].value,true);if(!f){g=this.obj[a]=g;}else{if(a=='scrollLeft'){window.scrollTo(g,d('scrollTop'));}else window.scrollTo(d('scrollLeft'),g);g=d(a);}b['last'+a]=g;}break;default:this.obj.style[a]=animation.calc_tween(k,b.attrs[a].start,b.attrs[a].value,true)+'px';break;}if(i==1){this.queue.splice(e--,1);this._callback(b.ondone,m-b.start-b.duration);}}if(o)j[h?'insertBefore':'appendChild'](this.obj,h);if(!l&&this.container_div)this._destroy_container();return !c;};animation.prototype.ondone=function(a){this.state.ondone=a;return this;};animation.prototype._callback=function(a,b){if(a){animation.offset=b;a.call(this);animation.offset=0;}};animation.calc_tween=function(a,b,c,d){return (d?parseInt:parseFloat)((c-b)*a+b,10);};animation.parse_color=function(a){var b=/^#([a-f0-9]{1,2})([a-f0-9]{1,2})([a-f0-9]{1,2})$/i.exec(a);if(b){return [parseInt(b[1].length==1?b[1]+b[1]:b[1],16),parseInt(b[2].length==1?b[2]+b[2]:b[2],16),parseInt(b[3].length==1?b[3]+b[3]:b[3],16)];}else{var c=/^rgba? *\(([0-9]+), *([0-9]+), *([0-9]+)(?:, *([0-9]+))?\)$/.exec(a);if(c){if(c[4]==='0'){return [255,255,255];}else return [parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3],10)];}else if(a=='transparent'){return [255,255,255];}else throw 'Named color attributes are not supported.';}};animation.parse_group=function(a){a=trim(a).split(/ +/);if(a.length==4){return a;}else if(a.length==3){return [a[0],a[1],a[2],a[1]];}else if(a.length==2){return [a[0],a[1],a[0],a[1]];}else return [a[0],a[0],a[0],a[0]];};animation.push=function(a){if(!animation.active)animation.active=[];animation.active.push(a);if(animation.active.length===1){if(!animation.requestAnimationFrame){var b=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame;if(b)animation.requestAnimationFrame=b.bind(window);}if(animation.requestAnimationFrame){animation.requestAnimationFrame(animation._animate);}else animation.timeout=setInterval(animation._animate,animation.resolution,false);}if(animation.requestAnimationFrame)animation._updateEndingTimer();animation._animate(new Date().getTime(),true);};animation._updateEndingTimer=function(){if(!animation.requestAnimationFrame)throw new Error('Ending timer only valid with requestAnimationFrame');var d=0;for(var a=0;a<animation.active.length;a++){var f=animation.active[a];for(var e=0;e<f.queue.length;e++){var b=f.queue[e].start+f.queue[e].duration;if(b>d)d=b;}}if(animation.timeout){clearTimeout(animation.timeout);delete animation.timeout;}var c=new Date().getTime();if(d>c)animation.timeout=setTimeout(animation._animate.shield(),d-c,false);};animation._animate=function(d,c){d=d||new Date().getTime();for(var b=(c===true)?animation.active.length-1:0;b<animation.active.length;b++)try{if(!animation.active[b]._frame(d))animation.active.splice(b--,1);}catch(a){animation.active.splice(b--,1);}if(animation.active.length===0){if(animation.timeout){if(animation.requestAnimationFrame){clearTimeout(animation.timeout);}else clearInterval(animation.timeout);delete animation.timeout;}}else if(animation.requestAnimationFrame)animation.requestAnimationFrame(animation._animate);};animation.ease={};animation.ease.begin=function(a){return Math.sin(Math.PI/2*(a-1))+1;};animation.ease.end=function(a){return Math.sin(.5*Math.PI*a);};animation.ease.both=function(a){return .5*Math.sin(Math.PI*(a-.5))+.5;};animation.prependInsert=function(b,a){animation.insert(b,a,DOM.prependContent);};animation.appendInsert=function(b,a){animation.insert(b,a,DOM.appendContent);};animation.insert=function(c,a,b){CSS.setStyle(a,'opacity',0);b(c,a);animation(a).from('opacity',0).to('opacity',1).duration(400).go();};
var Button=(function(){var b='uiButtonDisabled';var a='uiButtonDepressed';var d='button:blocker';var c='href';function e(j,i){var h=DataStore.get(j,d);if(i){if(h){h.remove();DataStore.remove(j,d);}}else if(!h)DataStore.set(j,d,Event.listen(j,'click',bagof(false),Event.Priority.URGENT));}function f(h){var i=Parent.byClass(h,'uiButton');if(!i)throw new Error('invalid use case');return i;}function g(h){return DOM.isNodeOfType(h,'a');}return {getInputElement:function(h){h=f(h);if(g(h))throw new Error('invalid use case');return DOM.find(h,'input');},isEnabled:function(h){return !CSS.hasClass(f(h),b);},setEnabled:function(k,h){k=f(k);CSS.conditionClass(k,b,!h);if(g(k)){var i=k.href;var l=DataStore.get(k,c,'#');if(h){if(!i)k.href=l;}else{if(i&&i!==l)DataStore.set(k,c,i);k.removeAttribute('href');}e(k,h);}else{var j=Button.getInputElement(k);j.disabled=!h;e(j,h);}},setDepressed:function(i,h){CSS.conditionClass(f(i),a,h);},isDepressed:function(h){return CSS.hasClass(f(h),a);},setLabel:function(i,h){i=f(i);if(g(i)){var j=DOM.find(i,'span.uiButtonText');DOM.setContent(j,h);}else Button.getInputElement(i).value=h;CSS.conditionClass(i,'uiButtonNoText',!h);},setIcon:function(i,h){if(!DOM.isNode(h))return;CSS.addClass(h,'customimg');i=f(i);var j=DOM.scry(i,'.img')[0];if(j!=h)if(j){DOM.replace(j,h);}else DOM.prependContent(i,h);}};})();
function show(){for(var b=0;b<arguments.length;b++){var a=ge(arguments[b]);if(a&&a.style)a.style.display='';}return false;}function hide(){for(var b=0;b<arguments.length;b++){var a=ge(arguments[b]);if(a&&a.style)a.style.display='none';}return false;}function shown(a){a=ge(a);return (a.style.display!='none'&&!(a.style.display==''&&a.offsetWidth==0));}function toggle(){for(var b=0;b<arguments.length;b++){var a=$(arguments[b]);a.style.display=CSS.getStyle(a,"display")=='block'?'none':'block';}return false;}function toggleDisplayNone(){for(var b=0;b<arguments.length;b++){var a=$(arguments[b]);if(shown(a)){hide(a);}else show(a);}return false;}
var KEYS={BACKSPACE:8,TAB:9,RETURN:13,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46,COMMA:188};
if(!this.JSON)this.JSON=function(){function f(n){return n<10?'0'+n:n;}Date.prototype.toJSON=function(){return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z';};var m={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};function stringify(value,whitelist){var a,i,k,l,v;switch(typeof value){case 'string':return (new RegExp('[\x00-\x1f\\\\"]')).test(value)?'"'+value.replace(/[\x00-\x1f\\"]/g,function(a){var c=m[a];if(c)return c;c=a.charCodeAt();return '\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"':'"'+value+'"';case 'number':return isFinite(value)?String(value):'null';case 'boolean':return String(value);case 'null':return 'null';case 'object':if(!value)return 'null';if('nodeName' in value)return null;if(typeof value.toJSON==='function')return stringify(value.toJSON());a=[];if(typeof value.length==='number'&&!(propertyIsEnumerable(value,'length'))){l=value.length;for(i=0;i<l;i+=1)a.push(stringify(value[i],whitelist)||'null');return '['+a.join(',')+']';}if(whitelist){l=whitelist.length;for(i=0;i<l;i+=1){k=whitelist[i];if(typeof k==='string'){v=stringify(value[k],whitelist);if(v)a.push(stringify(k)+':'+v);}}}else for(k in value)if(typeof k==='string'){v=stringify(value[k],whitelist);if(v)a.push(stringify(k)+':'+v);}return '{'+a.join(',')+'}';}}return {stringify:stringify,parse:function(text,filter){var j;function walk(k,v){var i,n;if(v&&typeof v==='object')for(i in v)if(Object.prototype.hasOwnProperty.apply(v,[i])){n=walk(i,v[i]);if(n!==undefined)v[i]=n;}return filter(k,v);}if(text&&/^[\],:{}\s]*$/.test(text.replace(/\\./g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof filter==='function'?walk('',j):j;}throw new SyntaxError('decodeJSON');}};}();function propertyIsEnumerable(a,b){if(a.propertyIsEnumerable)return a.propertyIsEnumerable(b);for(var c in a)if(c==b)return true;return false;}
var ErrorDialog={showAsyncError:function(b){try{return ErrorDialog.show(b.getErrorSummary(),b.getErrorDescription());}catch(a){alert(b);}},show:function(d,c,b,a){return (new Dialog()).setTitle(d).setBody(c).setButtons([Dialog.OK]).setStackable(true).setModal(true).setHandler(b||bagofholding).setButtonsMessage(a||'').show();}};
add_properties('Form',{getInputs:function(a){a=a||document;return [].concat($A(DOM.scry(a,'input')),$A(DOM.scry(a,'select')),$A(DOM.scry(a,'textarea')),$A(DOM.scry(a,'button')));},getSelectValue:function(a){return a.options[a.selectedIndex].value;},setSelectValue:function(b,c){for(var a=0;a<b.options.length;++a)if(b.options[a].value==c){b.selectedIndex=a;break;}},getRadioValue:function(b){for(var a=0;a<b.length;a++)if(b[a].checked)return b[a].value;return null;},getElements:function(a){return $A(a.tagName=='FORM'?a.elements:Form.getInputs(a));},getAttribute:function(b,a){return (b.getAttributeNode(a)||{}).value||null;},setDisabled:function(b,a){Form.getElements(b).forEach(function(c){if(c.disabled!=undefined){var d=DataStore.get(c,'origDisabledState');if(a){if(d===undefined)DataStore.set(c,'origDisabledState',c.disabled);c.disabled=a;}else{if(d!==true)c.disabled=false;DataStore.remove(c,'origDisabledState');}}});},bootstrap:function(d,e){var f=(Form.getAttribute(d,'method')||'GET').toUpperCase();e=Parent.byTag(e,'button')||e;var h=Parent.byClass(e,'stat_elem')||d;if(CSS.hasClass(h,'async_saving'))return;if(e&&(e.form!==d||(e.nodeName!='INPUT'&&e.nodeName!='BUTTON')||e.type!='submit')){var i=DOM.scry(d,'.enter_submit_target')[0];var b=e;i&&(e=i);}var c=Form.serialize(d,e);Form.setDisabled(d,true);var a=Form.getAttribute(d,'ajaxify')||Form.getAttribute(d,'action');trackReferrer(d,a);var g=new AsyncRequest(a);g.setData(c).setNectarModuleDataSafe(d).setReadOnly(f=='GET').setMethod(f).setRelativeTo(d).setStatusElement(h).setInitialHandler(Form.setDisabled.curry(d,false)).send();},serialize:function(b,c){var a={};Form.getElements(b).forEach(function(d){if(d.name&&!d.disabled&&d.type!='submit')if(!d.type||((d.type=='radio'||d.type=='checkbox')&&d.checked)||d.type=='text'||d.type=='password'||d.type=='hidden'||d.tagName=='TEXTAREA'){var h;if(d.name=='post_form_id')h=Env.post_form_id;Form._serializeHelper(a,d.name,h||Input.getValue(d));}else if(d.tagName=='SELECT')for(var e=0,f=d.options.length;e<f;++e){var g=d.options[e];if(g.selected)Form._serializeHelper(a,d.name,g.value);}});if(c&&c.name&&'submit'==c.type&&DOM.contains(b,c)&&DOM.isNodeOfType(c,['input','button']))Form._serializeHelper(a,c.name,c.value);return Form._serializeFix(a);},_serializeHelper:function(a,d,e){var c=/([^\]]+)\[([^\]]*)\](.*)/.exec(d);if(c){a[c[1]]=a[c[1]]||{};if(c[2]==''){var b=0;while(a[c[1]][b]!=undefined)b++;}else b=c[2];if(c[3]==''){a[c[1]][b]=e;}else Form._serializeHelper(a[c[1]],b.concat(c[3]),e);}else a[d]=e;},_serializeFix:function(a){var e=[];for(var b in a){if(a[b] instanceof Object)a[b]=Form._serializeFix(a[b]);e.push(b);}if(e.length>0){var d=0,c=true;e.sort().each(function(g){if(g!=d++)c=false;});if(c){var f=[];e.each(function(g){f[g]=a[g];});return f;}}return a;},post:function(d,b,c){var a=document.createElement('form');a.action=d.toString();a.method='POST';a.style.display='none';if(c)a.target=c;if(ge('post_form_id'))b.post_form_id=$('post_form_id').value;b.fb_dtsg=Env.fb_dtsg;b.post_form_id_source='dynamic_post';Form.createHiddenInputs(b,a);DOM.getRootElement().appendChild(a);a.submit();return false;},createHiddenInputs:function(g,a,d,f){d=d||{};var c;var h=URI.implodeQuery(g,'',false);var i=h.split('&');for(var b=0;b<i.length;b++)if(i[b]){var j=i[b].split('=');var e=j[0];var k=j[1];if(e===undefined||k===undefined)continue;k=URI.decodeComponent(k);if(d[e]&&f){d[e].value=k;}else{c=$N('input',{type:'hidden',name:e,value:k});d[e]=c;a.appendChild(c);}}return d;},getFirstElement:function(b,g){g=g||['input[type="text"]','textarea','input[type="password"]','input[type="button"]','input[type="submit"]'];var f=[];for(var d=0;d<g.length;d++){f=DOM.scry(b,g[d]);for(var c=0;c<f.length;c++){var e=f[c];try{if(elementY(e)>0&&elementX(e)>0)return e;}catch(a){}}}return null;},focusFirst:function(b){var a=Form.getFirstElement(b);if(a){a.focus();return true;}return false;}});
function Dialog(a){this._show_loading=true;this._auto_focus=true;this._submit_on_enter=false;this._fade_enabled=true;this._onload_handlers=[];this._top=125;this._uniqueID='dialog_'+Dialog._globalCount++;this._content=null;this._obj=null;this._popup=null;this._overlay=null;this._shim=null;this._hidden_objects=[];this._causal_elem=null;this._previous_focus=null;this._buttons=[];this._buildDialog();if(a)this._setFromModel(a);Dialog._init();}Metaprototype.makeFinal(Dialog);copy_properties(Dialog,{OK:{name:'ok',label:_tx("\u0395\u03bd\u03c4\u03ac\u03be\u03b5\u03b9")},CANCEL:{name:'cancel',label:_tx("\u0391\u03ba\u03cd\u03c1\u03c9\u03c3\u03b7"),className:'inputaux'},CLOSE:{name:'close',label:_tx("\u039a\u03bb\u03b5\u03af\u03c3\u03b9\u03bc\u03bf")},NEXT:{name:'next',label:_tx("\u0395\u03c0\u03cc\u03bc\u03b5\u03bd\u03bf")},SAVE:{name:'save',label:_tx("\u0391\u03c0\u03bf\u03b8\u03ae\u03ba\u03b5\u03c5\u03c3\u03b7")},SUBMIT:{name:'submit',label:_tx("\u03a5\u03c0\u03bf\u03b2\u03bf\u03bb\u03ae")},CONFIRM:{name:'confirm',label:_tx("\u0395\u03c0\u03b9\u03b2\u03b5\u03b2\u03b1\u03af\u03c9\u03c3\u03b7")},DELETE:{name:'delete',label:_tx("\u0394\u03b9\u03b1\u03b3\u03c1\u03b1\u03c6\u03ae")},_globalCount:0,_bottoms:[0],max_bottom:0,_updateMaxBottom:function(){Dialog.max_bottom=Math.max.apply(Math,Dialog._bottoms);}});copy_properties(Dialog,{OK_AND_CANCEL:[Dialog.OK,Dialog.CANCEL],_STANDARD_BUTTONS:[Dialog.OK,Dialog.CANCEL,Dialog.CLOSE,Dialog.SAVE,Dialog.SUBMIT,Dialog.CONFIRM,Dialog.DELETE],SHOULD_HIDE_OBJECTS:!ua.windows(),_useCSSBorders:CSS.supportsBorderRadius()||ua.ie()<=6,SIZE:{WIDE:555,STANDARD:445},_HALO_WIDTH:10,_BORDER_WIDTH:1,_PADDING_WIDTH:10,_PAGE_MARGIN:40,_stack:[],newButton:function(e,d,b,c){var a={name:e,label:d};if(b)a.className=b;if(c)a.handler=c;return a;},getCurrent:function(){var a=Dialog._stack;return a.length?a[a.length-1]:null;},bootstrap:function(i,a,f,d,e,c){a=a||{};var j=c&&c.rel=='dialog-pipe';copy_properties(a,new URI(i).getQueryData());d=d||(f?'GET':'POST');var h=Parent.byClass(c,'stat_elem')||c;if(h&&CSS.hasClass(h,'async_saving'))return false;var g;if(j){g=new AjaxPipeRequest();}else g=new AsyncRequest().setReadOnly(!!f).setMethod(d).setRelativeTo(c).setStatusElement(h);g.setURI(i).setNectarModuleDataSafe(c).setData(a);var b=new Dialog(e).setCausalElement(c).setAsync(g,j);b.show();return false;},_init:function(){this._init=bagofholding;onleaveRegister(Dialog._tearDown.shield(null,false));Arbiter.subscribe('page_transition',Dialog._tearDown.shield(null,true));Event.listen(document.documentElement,'keydown',function(event){if(Event.getKeyCode(event)==KEYS.ESC&&!event.getModifiers().any){if(Dialog._escape())event.kill();}else if(Event.getKeyCode(event)==KEYS.RETURN&&!event.getModifiers().any)if(Dialog._enter())event.kill();});Event.listen(window,'resize',function(event){var a=Dialog.getCurrent();a&&a._resetDialogObj();});},_findButton:function(a,c){if(a)for(var b=0;b<a.length;++b)if(a[b].name==c)return a[b];return null;},_tearDown:function(b){var c=Dialog._stack.clone();for(var a=c.length-1;a>=0;a--)if(!(b&&c[a]._cross_transition))c[a].hide();},_escape:function(){var d=Dialog.getCurrent();if(!d)return false;var e=d._semi_modal;var b=d._buttons;if(!b&&!e)return false;if(e&&!b){d.hide();return true;}var a;var c=Dialog._findButton(b,'cancel');if(d._cancelHandler){d.cancel();return true;}else if(c){a=c;}else if(b.length==1){a=b[0];}else return false;d._handleButton(a);return true;},_enter:function(){var b=Dialog.getCurrent();if(!b||!b._submit_on_enter)return false;if(document.activeElement!=b._frame)return false;var a=b._buttons;if(!a)return false;b._handleButton(a[0]);return true;},call_or_eval:function(obj,func,args){if(!func)return undefined;args=args||{};if(typeof(func)=='string'){var params=keys(args).join(', ');func=eval('({f: function('+params+') { '+func+'}})').f;}return func.apply(obj,values(args));}});copy_properties(Dialog.prototype,{_cross_transition:false,_fixed:false,_loading:false,_showing:false,show:function(){if(this._async_request&&this._show_loading){this.showLoading();}else{this._showing=true;this._update();}return this;},showLoading:function(){this._loading=true;CSS.addClass(this._frame,'dialog_loading_shown');this._renderDialog();return this;},hide:function(){if(!this._showing&&!this._loading)return this;this._showing=false;if(this._autohide_timeout){clearTimeout(this._autohide_timeout);this._autohide_timeout=null;}if(this._fade_enabled&&Dialog._stack.length<=1){this._fadeOut();}else this._hide();return this;},cancel:function(){if(!this._cancelHandler||this._cancelHandler()!==false)this.hide();},getRoot:function(){return this._obj;},getBody:function(){return DOM.scry(this._obj,'div.dialog_body')[0];},getButtonElement:function(a){if(typeof a=='string')a=Dialog._findButton(this._buttons,a);if(!a||!a.name)return null;var b=DOM.scry(this._popup,'input');var c=function(d){return d.name==a.name;};return b.filter(c)[0]||null;},getContentNode:function(){return DOM.find(this._content,'div.dialog_content');},getFormData:function(){return Form.serialize(this.getContentNode());},setAllowCrossPageTransition:function(a){this._cross_transition=a;return this;},setShowing:function(){this.show();return this;},setHiding:function(){this.hide();return this;},setTitle:function(d){var c=this._nodes.title;var b=this._nodes.title_inner;var a=this._nodes.content;DOM.setContent(b,this._format(d||''));CSS.conditionShow(c,!!d);CSS.conditionClass(a,'dialog_content_titleless',!d);return this;},setBody:function(a){DOM.setContent(this._nodes.body,this._format(a));return this;},setExtraData:function(a){this._extra_data=a;return this;},setReturnData:function(a){this._return_data=a;return this;},setShowLoading:function(a){this._show_loading=a;return this;},setFullBleed:function(a){this._full_bleed=a;this._updateWidth();CSS.conditionClass(this._obj,'full_bleed',a);return this;},setCausalElement:function(a){this._causal_elem=a;return this;},setUserData:function(a){this._user_data=a;return this;},getUserData:function(){return this._user_data;},setAutohide:function(a){if(a){if(this._showing){this._autohide_timeout=setTimeout(this.hide.shield(this),a);}else this._autohide=a;}else{this._autohide=null;if(this._autohide_timeout){clearTimeout(this._autohide_timeout);this._autohide_timeout=null;}}return this;},setSummary:function(b){var a=this._nodes.summary;DOM.setContent(a,this._format(b||''));CSS.conditionShow(a,!!b);return this;},setButtons:function(b){var g,c;if(!(b instanceof Array)){g=$A(arguments);}else g=b;for(var h=0;h<g.length;++h)if(typeof g[h]=='string'){c=Dialog._findButton(Dialog._STANDARD_BUTTONS,g[h]);g[h]=c;}this._buttons=g;var d=[];if(g&&g.length>0)for(var i=0;i<g.length;i++){c=g[i];var e=$N('input',{type:'button',name:c.name||'',value:c.label});var f=$N('label',{className:'uiButton uiButtonLarge uiButtonConfirm'},e);if(c.className){c.className.split(/\s+/).each(function(j){CSS.addClass(f,j);});if(CSS.hasClass(f,'inputaux')){CSS.removeClass(f,'inputaux');CSS.removeClass(f,'uiButtonConfirm');}if(CSS.hasClass(f,'uiButtonSpecial'))CSS.removeClass(f,'uiButtonConfirm');}if(c.icon)DOM.prependContent(f,$N('img',{src:c.icon,className:'img mrs'}));if(c.disabled)Button.setEnabled(f,false);Event.listen(e,'click',this._handleButton.bind(this,c.name));for(var a in c)if(a.indexOf('data-')===0&&a.length>5)e.setAttribute(a,c[a]);d.push(f);}DOM.setContent(this._nodes.buttons,d);this._updateButtonVisibility();return this;},setButtonsMessage:function(a){DOM.setContent(this._nodes.button_message,this._format(a||''));this._has_button_message=!!a;this._updateButtonVisibility();return this;},_updateButtonVisibility:function(){var a=this._buttons.length>0||this._has_button_message;CSS.conditionShow(this._nodes.button_wrapper,a);CSS.conditionClass(this._obj,'omitDialogFooter',!a);},setClickButtonOnEnter:function(c,a){var b=ge(c);if(b)this._clickOnEnterListener=Event.listen(b,'keypress',function(event){if(Event.getKeyCode(event)==KEYS.RETURN){this._handleButton(a);event.kill();}return true;}.bind(this));return this;},setStackable:function(b,a){this._is_stackable=b;this._shown_while_stacked=b&&a;return this;},setHandler:function(a){this._handler=a;return this;},setCancelHandler:function(a){this._cancelHandler=Dialog.call_or_eval.bind(null,this,a);return this;},setCloseHandler:function(a){this._close_handler=Dialog.call_or_eval.bind(null,this,a);return this;},clearHandler:function(){return this.setHandler(null);},setPostURI:function(b,a){if(a===undefined)a=true;if(a){this.setHandler(this._submitForm.bind(this,'POST',b));}else this.setHandler(function(){Form.post(b,this.getFormData());this.hide();}.bind(this));return this;},setGetURI:function(a){this.setHandler(this._submitForm.bind(this,'GET',a));return this;},setModal:function(a){this._modal=a;return this;},setSemiModal:function(a){if(a)this.setModal(true);this._semi_modal=a;return this;},setWideDialog:function(a){this._wide_dialog=a;this._updateWidth();return this;},setContentWidth:function(a){this._content_width=a;this._updateWidth();return this;},setTitleLoading:function(b){if(b===undefined)b=true;var a=DOM.find(this._popup,'h2.dialog_title');if(a)CSS.conditionClass(a,'loading',b);return this;},setSecure:function(a){CSS.conditionClass(this._nodes.title,'secure',a);return this;},setClassName:function(a){CSS.addClass(this._obj,a);return this;},setFadeEnabled:function(a){this._fade_enabled=a;return this;},setFooter:function(a){var b=this._nodes.footer;DOM.setContent(b,this._format(a||''));CSS.conditionShow(b,!!a);return this;},setAutoFocus:function(a){this._auto_focus=a;return this;},setTop:function(a){this._top=a;this._resetDialogObj();return this;},setFixed:function(a){this._fixed=a;this._resetDialogObj();return this;},onloadRegister:function(a){$A(a).forEach(function(b){if(typeof b=='string')b=new Function(b);this._onload_handlers.push(b.bind(this));}.bind(this));return this;},setAsyncURL:function(a){return this.setAsync(new AsyncRequest(a));},setAsync:function(a,i){var d=function(m){if(this._async_request!=a)return;this._async_request=null;var l=m.getPayload();var j=l;var k=function(){if(this._loading)this._showing=true;if(typeof j=='string'){this.setBody(j);}else this._setFromModel(j);this._update();}.bind(this);if(i){j=l.dialog;Bootloader.setResourceMap(l.resource_map);Bootloader.loadResources(l.css,k);}else k();}.bind(this);var b=a.getData();b.__d=1;a.setData(b);var h;if(i){a.setFirstResponseHandler(d);h=a.getAsyncRequest();}else{var f=a.getHandler()||bagofholding;a.setHandler(function(j){f(j);d(j);});h=a;}var e=h.getErrorHandler()||bagofholding;var g=h.getTransportErrorHandler()||bagofholding;var c=function(){this._async_request=null;if(this._showing){this._update();}else this._hide();}.bind(this);h.setAllowCrossPageTransition(this._cross_transition).setErrorHandler(function(j){c();e(j);}).setTransportErrorHandler(function(j){c();g(j);});a.send();this._async_request=a;this._update();return this;},_format:function(a){if(typeof a=='string'){a=HTML(a);}else a=HTML.replaceJSONWrapper(a);if(a instanceof HTML)a.setDeferred(true);return a;},_update:function(){if(!this._showing)return;if(this._autohide&&!this._async_request&&!this._autohide_timeout)this._autohide_timeout=setTimeout(bind(this,'hide'),this._autohide);if(this._async_request&&this._show_loading){this.showLoading();}else{CSS.removeClass(this._frame,'dialog_loading_shown');this._loading=false;this._renderDialog();this._runOnloads();this._previous_focus=document.activeElement;Input.focus(this._frame);}},_runOnloads:function(){for(var b=0;b<this._onload_handlers.length;++b)try{this._onload_handlers[b]();}catch(a){}this._onload_handlers=[];},_updateWidth:function(){var a=2*Dialog._BORDER_WIDTH;if(Dialog._useCSSBorders)a+=2*Dialog._HALO_WIDTH;if(this._content_width){a+=this._content_width;if(!this._full_bleed)a+=2*Dialog._PADDING_WIDTH;}else if(this._wide_dialog){a+=Dialog.SIZE.WIDE;}else a+=Dialog.SIZE.STANDARD;this._popup.style.width=a+'px';},_renderDialog:function(){this._showDialog();this._submit_on_enter=false;if(this._auto_focus){var b=Form.getFirstElement(this._content,['input[type="text"]','textarea','input[type="password"]']);if(b){Form.focusFirst.bind(this,this._content).defer();}else this._submit_on_enter=true;}var a=Vector2.getElementDimensions(this._content).y+Vector2.getElementPosition(this._content).y;Dialog._bottoms.push(a);this._bottom=a;Dialog._updateMaxBottom();return this;},_buildDialog:function(){this._obj=$N('div',{className:'generic_dialog',id:this._uniqueID});this._obj.style.display='none';document.body.appendChild(this._obj);if(!this._popup)this._popup=$N('div',{className:'generic_dialog_popup'});this._popup.style.left=this._popup.style.top='';this._obj.appendChild(this._popup);if(ua.ie()<7&&!this._shim)Bootloader.loadComponents('iframe-shim',function(){this._shim=new IframeShim(this._popup);});this._buildDialogContainer();this._buildDialogContent();},_showDialog:function(){if(this._modal){this._buildOverlay();}else if(this._overlay){DOM.remove(this._overlay);this._overlay=null;}if(this._obj&&this._obj.style.display){this._obj.style.visibility='hidden';this._obj.style.display='';this.resetDialogPosition();this._obj.style.visibility='';this._obj.dialog=this;}else this.resetDialogPosition();clearInterval(this.active_hiding);this.active_hiding=setInterval(this._activeResize.bind(this),500);var c=Dialog._stack;if(!c.length)Arbiter.inform('layer_shown',{type:'Dialog'});c.remove(this);c.push(this);for(var a=c.length-2;a>=0;a--){var b=c[a];if(!b._is_stackable&&!b._async_request){b._hide();}else if(!b._shown_while_stacked)b._hide(true);}return this;},_updateShim:function(){return this._shim&&this._shim.show();},_activeResize:function(){if(this.last_offset_height!=this._content.offsetHeight){this.last_offset_height=this._content.offsetHeight;this._updateShim();}},_buildDialogContainer:function(){CSS.addClass(this._obj,'pop_dialog');if(intl_locale_is_rtl())CSS.addClass(this._obj,'pop_dialog_rtl');var b;if(Dialog._useCSSBorders){b='<div class="pop_container_advanced">'+'<div class="pop_content" id="pop_content"></div>'+'</div>';}else b='<div class="pop_container">'+'<div class="pop_verticalslab"></div>'+'<div class="pop_horizontalslab"></div>'+'<div class="pop_topleft"></div>'+'<div class="pop_topright"></div>'+'<div class="pop_bottomright"></div>'+'<div class="pop_bottomleft"></div>'+'<div class="pop_content pop_content_old" id="pop_content"></div>'+'</div>';DOM.setContent(this._popup,HTML(b));var a=DOM.find(this._popup,'div.pop_content');a.setAttribute('tabIndex','0');a.setAttribute('role','alertdialog');this._frame=this._content=a;},_buildDialogContent:function(){var g=$N('div',{className:'dialog_loading'},_tx("\u03a6\u03bf\u03c1\u03c4\u03ce\u03bd\u03b5\u03b9..."));var j=$N('span');var i=$N('h2',{className:'dialog_title hidden_elem',id:'title_'+this._uniqueID},j);var h=$N('div',{className:'dialog_summary hidden_elem'});var a=$N('div',{className:'dialog_body'});var d=$N('div');var b=$N('div',{className:'dialog_buttons_msg'});var c=$N('div',{className:'dialog_buttons clearfix hidden_elem'},[b,d]);var f=$N('div',{className:'dialog_footer hidden_elem'});var e=$N('div',{className:'dialog_content'},[h,a,c,f]);this._nodes={summary:h,body:a,buttons:d,button_message:b,button_wrapper:c,footer:f,content:e,title:i,title_inner:j};DOM.setContent(this._frame,[i,e,g]);},_buildOverlay:function(){if(this._overlay)return;this._overlay=$N('div',{className:'overlay'});if(this._semi_modal)Event.listen(this._obj,'click',function(a){if(!DOM.contains(this._popup,a.getTarget()))this.hide();}.bind(this));if(ua.ie()<7)this._overlay.style.height=Vector2.getDocumentDimensions().y+'px';this._obj.insertBefore(this._overlay,this._obj.firstChild);},resetDialogPosition:function(){if(!this._popup)return;this._resetDialogObj();this._updateShim();},_resetDialogObj:function(){var a=DOM.find(this._popup,'div.pop_content');var b=Vector2.getElementDimensions(a).y+(2*Dialog._HALO_WIDTH);var g=Vector2.getViewportDimensions().y-(2*Dialog._PAGE_MARGIN);var f=this._top;var e=Vector2.getScrollPosition().y;var c=g-b;if(c<0){f=Dialog._PAGE_MARGIN;}else if(f>c)f=Dialog._PAGE_MARGIN+(Math.max(c,0)/2);if(!this._fixed)f+=e;CSS.conditionClass(this._obj,'generic_dialog_fixed',this._fixed);var d=this._fixed&&c<0;CSS.conditionClass(this._obj,'generic_dialog_fixed_overflow',d);CSS.conditionClass(document.body,'generic_dialog_overflow_mode',d);CSS.setStyle(this._popup,'top',f+'px');if(this._fixed&&f-Vector2.getElementPosition(this._popup,'viewport').y>1){f+=e;CSS.setStyle(this._popup,'top',f+'px');}},_fadeOut:function(b){if(!this._popup)return;try{animation(this._obj).duration(0).checkpoint().to('opacity',0).hide().duration(250).ondone(this._hide.bind(this,b)).go();}catch(a){this._hide(b);}},_hide:function(d){if(this._obj)this._obj.style.display='none';this._updateShim();if(this.timeout){clearTimeout(this.timeout);this.timeout=null;}if(this._hidden_objects.length){for(var b=0,c=this._hidden_objects.length;b<c;b++)this._hidden_objects[b].style.visibility='';this._hidden_objects=[];}clearInterval(this.active_hiding);if(this._bottom){var a=Dialog._bottoms;a.splice(a.indexOf(this._bottom),1);Dialog._updateMaxBottom();}if(this._previous_focus&&document.activeElement&&DOM.contains(this._obj,document.activeElement))Input.focus(this._previous_focus);if(d)return;this.destroy();},destroy:function(){var a=Dialog._stack;var b=(a[a.length-1]===this);a.remove(this);if(a.length){if(b)a[a.length-1]._showDialog();}else Arbiter.inform('layer_hidden',{type:'Dialog'});if(this._obj){DOM.remove(this._obj);this._obj=null;this._shim&&this._shim.hide();this._shim=null;}this._clickOnEnterListener&&this._clickOnEnterListener.remove();if(this._close_handler)this._close_handler({return_data:this._return_data});},_handleButton:function(a){if(typeof a=='string')a=Dialog._findButton(this._buttons,a);var b=Dialog.call_or_eval(a,a.handler);if(b===false)return;if(a.name=='cancel'){this.cancel();}else if(Dialog.call_or_eval(this,this._handler,{button:a})!==false)this.hide();},_submitForm:function(d,e,b){var c=this.getFormData();if(b)c[b.name]=b.label;if(this._extra_data)copy_properties(c,this._extra_data);var a=new AsyncRequest().setURI(e).setData(c).setMethod(d).setNectarModuleDataSafe(this._causal_elem).setReadOnly(d=='GET');this.setAsync(a);return false;},_setFromModel:function(c){var a={};copy_properties(a,c);for(var d in a){if(d=='onloadRegister'){this.onloadRegister(a[d]);continue;}var b=this['set'+d.substr(0,1).toUpperCase()+d.substr(1)];b.apply(this,$A(a[d]));}},_updateBottom:function(){var a=Vector2.getElementDimensions(this._content).y+Vector2.getElementPosition(this._content).y;Dialog._bottoms[Dialog._bottoms.length-1]=a;Dialog._updateMaxBottom();}});
__d("async",[],function(global,module,require,exports){function AsyncRequest(uri){var dispatchResponse=bind(this,function(asyncResponse){try{this.clearStatusIndicator();if(!this.isRelevant()){invokeErrorHandler(1010);return;}if(this.initialHandler(asyncResponse)!==false){clearTimeout(this.timer);asyncResponse.jscc&&invoke_callbacks([asyncResponse.jscc]);if(this.handler)try{var suppress_onload=this.handler(asyncResponse);}catch(exception){asyncResponse.is_last&&this.finallyHandler(asyncResponse);throw exception;}if(suppress_onload!==AsyncRequest.suppressOnloadToken){var onload=asyncResponse.onload;if(onload)for(var ii=0;ii<onload.length;ii++)try{(new Function(onload[ii])).apply(this);}catch(exception){}if(this.lid)Arbiter.inform('tti_ajax',{s:this.lid,d:[this._sendTimeStamp||0,(this._sendTimeStamp&&this._responseTime)?(this._responseTime-this._sendTimeStamp):0]},Arbiter.BEHAVIOR_EVENT);var onafterload=asyncResponse.onafterload;if(onafterload)for(var ii=0;ii<onafterload.length;ii++)try{(new Function(onafterload[ii])).apply(this);}catch(exception){}}asyncResponse.is_last&&this.finallyHandler(asyncResponse);}}catch(exception){}});var dispatchErrorResponse=bind(this,function(asyncResponse,isTransport){try{this.clearStatusIndicator();var async_error=asyncResponse.getError();if(this._sendTimeStamp){var _duration=(+new Date())-this._sendTimeStamp;var xfb_ip=this._xFbServer||'-';asyncResponse.logError('async_error',{duration:_duration,xfb_ip:xfb_ip});}else asyncResponse.logError('async_error');if((!this.isRelevant())||async_error===1010)return;if(async_error==1357008||async_error==1357007||async_error==1442002||async_error==1357001){var is_confirmation=false;if(async_error==1357008||async_error==1357007)is_confirmation=true;var payload=asyncResponse.getPayload();this._displayServerDialog(payload.__dialog,is_confirmation);}else if(this.initialHandler(asyncResponse)!==false){clearTimeout(this.timer);try{if(isTransport){this.transportErrorHandler(asyncResponse);}else this.errorHandler(asyncResponse);}catch(exception){this.finallyHandler(asyncResponse);throw exception;}this.finallyHandler(asyncResponse);}}catch(exception){}});var _interpretTransportResponse=bind(this,function(){if(this.getOption('suppressEvaluation')){var r=new AsyncResponse(this,this.transport);return {asyncResponse:r};}var _sendError=function(p,error_code,str){if(!window.send_error_signal)return;if(this._xFbServer){error_code='1008_'+error_code;}else error_code='1012_'+error_code;send_error_signal('async_xport_resp',error_code+':'+(this._xFbServer||'-')+':'+p.getURI()+':'+str.length+':'+str.substr(0,1600));};var shield="for (;;);";var shieldlen=shield.length;var text=this.transport.responseText;if(text.length<=shieldlen){_sendError(this,'empty',text);return {transportError:'Response too short on async to '+this.getURI()};}var offset=0;while(text.charAt(offset)==" "||text.charAt(offset)=="\n")offset++;offset&&text.substring(offset,offset+shieldlen)==shield;var safeResponse=text.substring(offset+shieldlen);try{var response=eval('('+safeResponse+')');}catch(exception){_sendError(this,'excep',text);return {transportError:'eval() failed on async to '+this.getURI()};}return interpretResponse(response);});var interpretResponse=bind(this,function(response){if(response.redirect)return {redirect:response.redirect};var r=new AsyncResponse(this);if(response.__ar!=1){r.payload=response;}else{copy_properties(r,response);if(response.tplts)if(window.DynaTemplate)DynaTemplate.registerTemplates(response.tplts);}return {asyncResponse:r};});var invokeResponseHandler=bind(this,function(interp){if(typeof(interp.redirect)!='undefined'){(function(){this.setURI(interp.redirect).send();}).bind(this).defer();return;}if(this.handler||this.errorHandler||this.transportErrorHandler)if(typeof(interp.asyncResponse)!='undefined'){var r=interp.asyncResponse;if(!this.isRelevant()){invokeErrorHandler(1010);return;}if(r.inlinejs)eval_global(r.inlinejs);if(r.lid){this._responseTime=(+new Date());if(window.CavalryLogger)this.cavalry=CavalryLogger.getInstance(r.lid);this.lid=r.lid;}if(r.getError()&&!r.getErrorIsWarning()){var fn=dispatchErrorResponse;}else var fn=dispatchResponse;Bootloader.setResourceMap(r.resource_map);if(r.bootloadable)Bootloader.enableBootload(r.bootloadable);fn=fn.shield(null,r);fn=fn.defer.bind(fn);var is_transitional=false;if(this.preBootloadHandler)is_transitional=this.preBootloadHandler(r);r.css=r.css||[];r.js=r.js||[];Bootloader.loadResources(r.css.concat(r.js),fn,is_transitional,this.getURI());}else if(typeof(interp.transportError)!='undefined'){if(this._xFbServer){invokeErrorHandler(1008);}else invokeErrorHandler(1012);}else invokeErrorHandler(1007);});var invokeErrorHandler=bind(this,function(explicitError){try{if(!window.loaded&&!this.getOption('handleErrorAfterUnload'))return;}catch(ex){return;}var r=new AsyncResponse(this);var err;try{err=explicitError||this.transport.status||1004;}catch(ex){err=1005;}if(this._requestAborted)err=1011;try{if(this.responseText=='')err=1002;}catch(ignore){}if(this.transportErrorHandler){var desc,summary;var silent=true;if(false===navigator.onLine){summary=_tx("\u0394\u03b5\u03bd \u03c5\u03c0\u03ac\u03c1\u03c7\u03b5\u03b9 \u03c3\u03cd\u03bd\u03b4\u03b5\u03c3\u03b7 \u03c3\u03c4\u03bf \u03b4\u03af\u03ba\u03c4\u03c5\u03bf");desc=_tx("\u03a4\u03bf \u03c0\u03c1\u03cc\u03b3\u03c1\u03b1\u03bc\u03bc\u03b1 \u03c0\u03b5\u03c1\u03b9\u03ae\u03b3\u03b7\u03c3\u03b7\u03c2 \u03c6\u03b1\u03af\u03bd\u03b5\u03c4\u03b1\u03b9 \u03b5\u03ba\u03c4\u03cc\u03c2 \u03c3\u03cd\u03bd\u03b4\u03b5\u03c3\u03b7\u03c2. \u0395\u03bb\u03ad\u03b3\u03be\u03c4\u03b5 \u03c4\u03b7 \u03c3\u03cd\u03bd\u03b4\u03b5\u03c3\u03ae \u03c3\u03b1\u03c2 \u03c3\u03c4\u03bf \u0394\u03b9\u03b1\u03b4\u03af\u03ba\u03c4\u03c5\u03bf \u03ba\u03b1\u03b9 \u03b4\u03bf\u03ba\u03b9\u03bc\u03ac\u03c3\u03c4\u03b5 \u03be\u03b1\u03bd\u03ac.");err=1006;}else if(err>=300&&err<=399){summary=_tx("\u0391\u03bd\u03b1\u03ba\u03b1\u03c4\u03b5\u03cd\u03b8\u03c5\u03bd\u03c3\u03b7");desc=_tx("\u03a0\u03c1\u03bf\u03c2 \u03c4\u03bf \u03c0\u03b1\u03c1\u03cc\u03bd, \u03b7 \u03c0\u03c1\u03cc\u03c3\u03b2\u03b1\u03c3\u03ae \u03c3\u03b1\u03c2 \u03c3\u03c4\u03bf Facebook \u03ad\u03c7\u03b5\u03b9 \u03b1\u03bd\u03b1\u03ba\u03b1\u03c4\u03b5\u03c5\u03b8\u03c5\u03bd\u03b8\u03b5\u03af \u03ae \u03bc\u03c0\u03bb\u03bf\u03ba\u03b1\u03c1\u03b9\u03c3\u03c4\u03b5\u03af \u03b1\u03c0\u03cc \u03ba\u03ac\u03c0\u03bf\u03b9\u03bf\u03bd \u03c4\u03c1\u03af\u03c4\u03bf. \u0395\u03c0\u03b9\u03ba\u03bf\u03b9\u03bd\u03c9\u03bd\u03ae\u03c3\u03c4\u03b5 \u03bc\u03b5 \u03c4\u03bf\u03bd \u03c0\u03ac\u03c1\u03bf\u03c7\u03cc \u03c3\u03b1\u03c2 \u03ae \u03be\u03b1\u03bd\u03b1\u03c6\u03bf\u03c1\u03c4\u03ce\u03c3\u03c4\u03b5 \u03c4\u03b7 \u03c3\u03b5\u03bb\u03af\u03b4\u03b1.");redir_url=this.transport.getResponseHeader("Location");if(redir_url)goURI(redir_url,true);silent=true;}else{summary=_tx("\u03a9\u03c7!");desc=_tx("\u039a\u03ac\u03c4\u03b9 \u03c0\u03ae\u03b3\u03b5 \u03c3\u03c4\u03c1\u03b1\u03b2\u03ac. \u0395\u03c0\u03b5\u03be\u03b5\u03c1\u03b3\u03b1\u03b6\u03cc\u03bc\u03b1\u03c3\u03c4\u03b5 \u03c4\u03bf \u03c0\u03c1\u03cc\u03b2\u03bb\u03b7\u03bc\u03b1, \u03b3\u03b9\u03b1 \u03bd\u03b1 \u03c4\u03bf \u03b4\u03b9\u03bf\u03c1\u03b8\u03ce\u03c3\u03bf\u03c5\u03bc\u03b5 \u03cc\u03c3\u03bf \u03c0\u03b9\u03bf \u03c3\u03cd\u03bd\u03c4\u03bf\u03bc\u03b1 \u03b3\u03af\u03bd\u03b5\u03c4\u03b1\u03b9. \u03a3\u03b5 \u03bb\u03af\u03b3\u03bf \u03b8\u03b1 \u03bc\u03c0\u03bf\u03c1\u03b5\u03af\u03c4\u03b5 \u03bd\u03b1 \u03c0\u03c1\u03bf\u03c3\u03c0\u03b1\u03b8\u03ae\u03c3\u03b5\u03c4\u03b5 \u03c0\u03ac\u03bb\u03b9.\n");}!this.getOption('suppressErrorAlerts');copy_properties(r,{error:err,errorSummary:summary,errorDescription:desc,silentError:silent});dispatchErrorResponse(r,true);}});var handleResponse=function(response){var asyncResponse=this.interpretResponse(response);this.invokeResponseHandler(asyncResponse);};var onStateChange=function(){try{if(this.transport.readyState==4){AsyncRequest._inflightPurge();try{if(typeof(this.transport.getResponseHeader)!='undefined'&&this.transport.getResponseHeader('X-FB-Server'))this._xFbServer=this.transport.getResponseHeader('X-FB-Server');}catch(ex){}if(this.transport.status>=200&&this.transport.status<300){invokeResponseHandler(_interpretTransportResponse());}else if(ua.safari()&&(typeof(this.transport.status)=='undefined')){invokeErrorHandler(1002);}else if(window.Env&&window.Env.retry_ajax_on_network_error&&this.transport.status in {0:1,12029:1,12030:1,12031:1,12152:1}&&this.remainingRetries>0){--this.remainingRetries;delete this.transport;this.send(true);return;}else invokeErrorHandler();if(this.getOption('asynchronous')!==false)delete this.transport;}}catch(exception){try{if(!window.loaded)return;}catch(ex){return;}delete this.transport;if(this.remainingRetries>0){--this.remainingRetries;this.send(true);}else{!this.getOption('suppressErrorAlerts');if(window.send_error_signal)send_error_signal('async_xport_resp','1007:'+(this._xFbServer||'-')+':'+this.getURI()+':'+exception.message);invokeErrorHandler(1007);}}};var onJSONPResponse=function(data,more_chunked_response){var is_first=(this.is_first===undefined);this.is_first=is_first;if(this.transportIframe&&!more_chunked_response){if(this.cavalry)this.cavalry.collectBrowserTiming(this.transportIframe.contentWindow);(function(x){document.body.removeChild(x);}).bind(null,this.transportIframe).defer();}if(ua.ie()>=9&&window.JSON)data=window.JSON.parse(window.JSON.stringify(data));var r=this.interpretResponse(data);r.asyncResponse.is_first=is_first;r.asyncResponse.is_last=!more_chunked_response;this.invokeResponseHandler(r);return more_chunked_response;};copy_properties(this,{onstatechange:onStateChange,onjsonpresponse:onJSONPResponse,invokeResponseHandler:invokeResponseHandler,interpretResponse:interpretResponse,handleResponse:handleResponse,transport:null,method:'POST',uri:'',timeout:null,timer:null,initialHandler:bagofholding,handler:null,errorHandler:null,transportErrorHandler:null,timeoutHandler:null,finallyHandler:bagofholding,serverDialogCancelHandler:bagofholding,relativeTo:null,statusElement:null,statusClass:'',data:{},context:{},readOnly:false,writeRequiredParams:['post_form_id'],remainingRetries:0,option:{asynchronous:true,suppressErrorHandlerWarning:false,suppressEvaluation:false,suppressErrorAlerts:false,retries:0,jsonp:false,bundle:false,useIframeTransport:false,tfbEndpoint:true,handleErrorAfterUnload:false},userActionID:'-'});this.errorHandler=AsyncResponse.defaultErrorHandler;this.transportErrorHandler=bind(this,'errorHandler');if(uri!=undefined)this.setURI(uri);return this;}Arbiter.subscribe("page_transition",function(type,message){AsyncRequest._id_threshold=message.id;});copy_properties(AsyncRequest,{receiveJSONPResponse:function(id,data,more_chunked_response){if(this._JSONPReceivers[id]){if(!this._JSONPReceivers[id](data,more_chunked_response))delete this._JSONPReceivers[id];}else if(window.send_error_signal&&!more_chunked_response){var uri=(data.payload&&data.payload.uri)||'';send_error_signal('js_timeout_and_exception','00002:WrongSessionID:error:'+id+':'+uri);}},_bundleRequest:function(request){if(request.getOption('jsonp')||request.getOption('useIframeTransport')){request.setOption('bundle',false);return false;}else if(!request.uri.isFacebookURI()){request.setOption('bundle',false);return false;}else if(!request.getOption('asynchronous')){request.setOption('bundle',false);return false;}var path=request.uri.getPath();if(!AsyncRequest._bundleTimer)AsyncRequest._bundleTimer=setTimeout(function(){AsyncRequest._sendBundledRequests();},0);AsyncRequest._allBundledRequests.push([path,request]);return true;},_sendBundledRequests:function(){clearTimeout(AsyncRequest._bundleTimer);AsyncRequest._bundleTimer=null;var bundled_requests=AsyncRequest._allBundledRequests;AsyncRequest._allBundledRequests=[];if(bundled_requests.length==1){var request=bundled_requests[0][1];request.setOption('bundle',false).send();return request;}if(bundled_requests.length===0)return null;var data=[];for(var ii=0;ii<bundled_requests.length;ii++)data.push([bundled_requests[ii][0],URI.implodeQuery(bundled_requests[ii][1].data)]);var query_data={data:data};var request=new AsyncRequest();request.setURI('/ajax/proxy.php').setData(query_data).setMethod('POST').setInitialHandler(bagof(true)).setAllowCrossPageTransition(true).setHandler(function(r){var payload=r.getPayload();var responses=payload.responses;if(responses.length!=bundled_requests.length){return;}else for(var ii=0;ii<bundled_requests.length;ii++){var path=bundled_requests[ii][0];var request=bundled_requests[ii][1];request.id=this.id;if(responses[ii][0]!=path){request.invokeResponseHandler({transportError:'Wrong response order in bundled request to '+path});continue;}var asyncResponse=request.interpretResponse(responses[ii][1]);request.invokeResponseHandler(asyncResponse);}}).setTransportErrorHandler(function(response){var paths=[];var interp={transportError:response.errorDescription};for(var ii=0;ii<bundled_requests.length;ii++){var path=bundled_requests[ii][0];var request=bundled_requests[ii][1];paths.push(path);request.id=this.id;request.invokeResponseHandler(interp);}}).send();return request;},bootstrap:function(href,elem,is_post){var method='GET';var readonly=true;var data={};if(is_post||elem&&(elem.rel=='async-post'||elem.getAttribute&&elem.getAttribute('forcemethod')=='post')){method='POST';readonly=false;if(href){href=URI(href);data=href.getQueryData();href.setQueryData({});}}var status_elem=Parent.byClass(elem,'stat_elem')||elem;if(status_elem&&CSS.hasClass(status_elem,'async_saving'))return false;var async=new AsyncRequest(href).setReadOnly(readonly).setMethod(method).setData(data).setNectarModuleDataSafe(elem).setRelativeTo(elem);if(status_elem){async.setStatusElement(status_elem);var status_class=status_elem.getAttribute('data-status-class');status_class&&async.setStatusClass(status_class);}async.send();return false;},post:function(href,data){new AsyncRequest(href).setReadOnly(false).setMethod('POST').setData(data).send();return false;},getLastId:function(){return AsyncRequest._last_id;},_JSONPReceivers:{},_allBundledRequests:[],_bundleTimer:null,suppressOnloadToken:{},_last_id:2,_id_threshold:2,_inflight:[],_inflightAdd:bagofholding,_inflightPurge:bagofholding,_inflightEnable:function(){if(ua.ie()){copy_properties(AsyncRequest,{_inflightAdd:function(ar){this._inflight.push(ar);},_inflightPurge:function(){AsyncRequest._inflight=AsyncRequest._inflight.filter(function(ar){return ar.transport&&ar.transport.readyState<4;});}});onunloadRegister(function(){AsyncRequest._inflight.each(function(ar){if(ar.transport&&ar.transport.readyState<4){ar.transport.abort();delete ar.transport;}});});}}});copy_properties(AsyncRequest.prototype,{setMethod:function(m){this.method=m.toString().toUpperCase();return this;},getMethod:function(){return this.method;},setData:function(obj){this.data=obj;return this;},getData:function(){return this.data;},setContextData:function(key,value,enabled){enabled=enabled===undefined?true:enabled;if(enabled)this.context['_log_'+key]=value;return this;},_setUserActionID:function(){var ue=window.ArbiterMonitor&&ArbiterMonitor.getUE()||'-';this.userActionID=(window.EagleEye&&EagleEye.getSessionID()||'-')+'/'+ue;},setURI:function(uri){var uri_obj=URI(uri);if(this.getOption('useIframeTransport')&&!uri_obj.isFacebookURI())return this;if(!this.getOption('jsonp')&&!this.getOption('useIframeTransport')&&!uri_obj.isSameOrigin())return this;this._setUserActionID();if(!uri||uri_obj.isEmpty()){if(window.send_error_signal&&window.get_error_stack){var data={err_code:1013,vip:'-',duration:0,xfb_ip:'-',path:window.location.href,aid:this.userActionID};send_error_signal('async_error',JSON.stringify(data));send_error_signal('async_xport_stack','1013:'+window.location.href+'::'+get_error_stack());}return this;}this.uri=uri_obj;return this;},getURI:function(){return this.uri.toString();},setInitialHandler:function(fn){this.initialHandler=fn;return this;},setHandler:function(fn){if(!(typeof(fn)!='function'))this.handler=fn;return this;},getHandler:function(){return this.handler;},setErrorHandler:function(fn){if(!(typeof(fn)!='function'))this.errorHandler=fn;return this;},setTransportErrorHandler:function(fn){this.transportErrorHandler=fn;return this;},getErrorHandler:function(){return this.errorHandler;},getTransportErrorHandler:function(){return this.transportErrorHandler;},setTimeoutHandler:function(timeout,fn){if(!(typeof(fn)!='function')){this.timeout=timeout;this.timeoutHandler=fn;}return this;},resetTimeout:function(timeout){if(!(this.timeoutHandler===null))if(timeout===null){this.timeout=null;clearTimeout(this.timer);this.timer=null;}else{var clear_on_quickling_event=!this._allowCrossPageTransition;this.timeout=timeout;clearTimeout(this.timer);this.timer=this._handleTimeout.bind(this).defer(this.timeout,clear_on_quickling_event);}return this;},_handleTimeout:function(){this.abandon();this.timeoutHandler(this);},setNewSerial:function(){this.id=++AsyncRequest._last_id;return this;},setFinallyHandler:function(fn){this.finallyHandler=fn;return this;},setServerDialogCancelHandler:function(fn){this.serverDialogCancelHandler=fn;return this;},setPreBootloadHandler:function(fn){this.preBootloadHandler=fn;return this;},setReadOnly:function(readOnly){if(!(typeof(readOnly)!='boolean'))this.readOnly=readOnly;return this;},setFBMLForm:function(){this.writeRequiredParams=["fb_sig"];return this;},getReadOnly:function(){return this.readOnly;},setRelativeTo:function(element){this.relativeTo=element;return this;},getRelativeTo:function(){return this.relativeTo;},setStatusClass:function(c){this.statusClass=c;return this;},setStatusElement:function(element){this.statusElement=element;return this;},getStatusElement:function(){return ge(this.statusElement);},isRelevant:function(){if(this._allowCrossPageTransition)return true;if(!this.id)return true;return this.id>AsyncRequest._id_threshold;},clearStatusIndicator:function(){var statusElem=this.getStatusElement();if(statusElem){CSS.removeClass(statusElem,'async_saving');CSS.removeClass(statusElem,this.statusClass);}},addStatusIndicator:function(){var statusElem=this.getStatusElement();if(statusElem){CSS.addClass(statusElem,'async_saving');CSS.addClass(statusElem,this.statusClass);}},specifiesWriteRequiredParams:function(){return this.writeRequiredParams.every(function(param){this.data[param]=this.data[param]||Env[param]||(ge(param)||{}).value;if(this.data[param]!==undefined)return true;return false;},this);},setOption:function(opt,v){if(typeof(this.option[opt])!='undefined')this.option[opt]=v;return this;},getOption:function(opt){typeof(this.option[opt])=='undefined';return this.option[opt];},abort:function(){if(this.transport){var old_handler=this.getTransportErrorHandler();this.setOption('suppressErrorAlerts',true);this.setTransportErrorHandler(bagofholding);this._requestAborted=1;this.transport.abort();this.setTransportErrorHandler(old_handler);}},abandon:function(){clearTimeout(this.timer);this.setOption('suppressErrorAlerts',true).setHandler(bagofholding).setErrorHandler(bagofholding).setTransportErrorHandler(bagofholding);if(this.transport){this._requestAborted=1;this.transport.abort();}},setNectarData:function(nctrParams){if(nctrParams){if(this.data.nctr===undefined)this.data.nctr={};copy_properties(this.data.nctr,nctrParams);}return this;},setNectarModuleDataSafe:function(elem){if(this.setNectarModuleData)this.setNectarModuleData(elem);return this;},setNectarImpressionIdSafe:function(){if(this.setNectarImpressionId)this.setNectarImpressionId();return this;},setAllowCrossPageTransition:function(allow){this._allowCrossPageTransition=!!allow;if(this.timer)this.resetTimeout(this.timeout);return this;},send:function(isRetry){isRetry=isRetry||false;if(!this.uri)return false;!this.errorHandler&&!this.getOption('suppressErrorHandlerWarning');if(this.getOption('jsonp')&&this.method!='GET')this.setMethod('GET');if(this.getOption('useIframeTransport')&&this.method!='GET')this.setMethod('GET');this.timeoutHandler!==null&&(this.getOption('jsonp')||this.getOption('useIframeTransport'));if(!this.getReadOnly()){this.specifiesWriteRequiredParams();if(this.method!='POST')return false;}if(this.method=='POST'&&this.getOption('tfbEndpoint')){this.data.fb_dtsg=Env.fb_dtsg;this.data.lsd=getCookie('lsd');}if(!is_empty(this.context)&&this.getOption('tfbEndpoint')){copy_properties(this.data,this.context);this.data.ajax_log=1;}if(window.Env&&Env.force_param)copy_properties(this.data,Env.force_param);if(!this.getReadOnly()&&this.getOption('tfbEndpoint')&&this.method=='POST'&&this.data.post_form_id_source===undefined)this.data.post_form_id_source='AsyncRequest';if(window.Env)this.data.__user=Env.user;this._setUserActionID();if(this.getOption('bundle')&&AsyncRequest._bundleRequest(this))return true;this.setNewSerial();if(this.getOption('tfbEndpoint')){this.uri.addQueryData({__a:1});if(Env.fb_isb)this.uri.addQueryData({fb_isb:Env.fb_isb});}this.finallyHandler=async_callback(this.finallyHandler,'final');var uri_str,query;if(this.method=='GET'){uri_str=this.uri.addQueryData(this.data).toString();query='';}else{uri_str=this.uri.toString();query=URI.implodeQuery(this.data);}if(this.getOption('jsonp')||this.getOption('useIframeTransport')){uri_str=this.uri.addQueryData({__a:this.id}).toString();AsyncRequest._JSONPReceivers[this.id]=async_callback(bind(this,'onjsonpresponse'),'json');if(this.getOption('jsonp')){(function(){document.body.appendChild($N('script',{src:uri_str,type:"text/javascript"}));}).bind(this).defer();}else{var style={position:'absolute',top:'-9999999px',width:'80px',height:'80px'};this.transportIframe=$N('iframe',{src:"javascript:''",style:style});document.body.appendChild(this.transportIframe);this.transportIframe.src=uri_str;}return true;}if(this.transport)return false;var transport=null;try{transport=new XMLHttpRequest();}catch(ignored){}if(!transport)try{transport=new ActiveXObject("Msxml2.XMLHTTP");}catch(ignored){}if(!transport)try{transport=new ActiveXObject("Microsoft.XMLHTTP");}catch(ignored){}if(!transport)return false;transport.onreadystatechange=async_callback(bind(this,'onstatechange'),'xhr');if(!isRetry)this.remainingRetries=this.getOption('retries');if(window.send_error_signal||window.ArbiterMonitor)this._sendTimeStamp=this._sendTimeStamp||(+new Date());this.transport=transport;try{this.transport.open(this.method,uri_str,this.getOption('asynchronous'));}catch(ex){return false;}var svn_rev=env_get('svn_rev');if(svn_rev)this.transport.setRequestHeader('X-SVN-Rev',String(svn_rev));if(this.method=='POST')this.transport.setRequestHeader('Content-Type','application/x-www-form-urlencoded');this.addStatusIndicator();this.transport.send(query);if(this.timeout!==null)this.resetTimeout(this.timeout);AsyncRequest._inflightAdd(this);return true;},_displayServerDialog:function(model,is_confirmation){var dialog=new Dialog(model);if(is_confirmation)dialog.setHandler(this._displayConfirmationHandler.bind(this,dialog));dialog.setCancelHandler(function(){this.serverDialogCancelHandler.apply(this,arguments);this.finallyHandler.apply(this,arguments);}.bind(this)).setCloseHandler(this.finallyHandler.bind(this)).show();},_displayConfirmationHandler:function(dialog){this.data.confirmed=1;copy_properties(this.data,dialog.getFormData());this.send();}});function AsyncResponse(request,payload){copy_properties(this,{error:0,errorSummary:null,errorDescription:null,onload:null,replay:false,payload:payload||null,request:request||null,silentError:false,is_last:true});return this;}copy_properties(AsyncResponse,{defaultErrorHandler:function(response){try{if(!response.silentError){AsyncResponse.verboseErrorHandler(response);}else response.logErrorByGroup('silent',10);}catch(ex){alert(response);}},verboseErrorHandler:function(response){try{var summary=response.getErrorSummary();var desc=response.getErrorDescription();response.logErrorByGroup('popup',10);if(response.silentError&&desc=='')desc=_tx("\u039a\u03ac\u03c4\u03b9 \u03c0\u03ae\u03b3\u03b5 \u03c3\u03c4\u03c1\u03b1\u03b2\u03ac. \u0395\u03c0\u03b5\u03be\u03b5\u03c1\u03b3\u03b1\u03b6\u03cc\u03bc\u03b1\u03c3\u03c4\u03b5 \u03c4\u03bf \u03c0\u03c1\u03cc\u03b2\u03bb\u03b7\u03bc\u03b1, \u03b3\u03b9\u03b1 \u03bd\u03b1 \u03c4\u03bf \u03b4\u03b9\u03bf\u03c1\u03b8\u03ce\u03c3\u03bf\u03c5\u03bc\u03b5 \u03cc\u03c3\u03bf \u03c0\u03b9\u03bf \u03c3\u03cd\u03bd\u03c4\u03bf\u03bc\u03b1 \u03b3\u03af\u03bd\u03b5\u03c4\u03b1\u03b9. \u03a3\u03b5 \u03bb\u03af\u03b3\u03bf \u03b8\u03b1 \u03bc\u03c0\u03bf\u03c1\u03b5\u03af\u03c4\u03b5 \u03bd\u03b1 \u03c0\u03c1\u03bf\u03c3\u03c0\u03b1\u03b8\u03ae\u03c3\u03b5\u03c4\u03b5 \u03c0\u03ac\u03bb\u03b9.\n");ErrorDialog.show(summary,desc);}catch(ex){alert(response);}}});copy_properties(AsyncResponse.prototype,{getRequest:function(){return this.request;},getPayload:function(){return this.payload;},getError:function(){return this.error;},getErrorSummary:function(){return this.errorSummary;},setErrorSummary:function(summary){summary=(summary===undefined?null:summary);this.errorSummary=summary;return this;},getErrorDescription:function(){return this.errorDescription;},getErrorIsWarning:function(){return this.errorIsWarning;},logError:function(category,extra){if(window.send_error_signal){var data={err_code:this.error,vip:(env_get('vip')||'-')};if(extra!==undefined){data.duration=extra.duration;data.xfb_ip=extra.xfb_ip;}var path=this.request.getURI();data.path=path||'-';data.aid=this.request.userActionID;if(path&&path.indexOf('scribe_endpoint.php')!=-1)category='async_error_double';send_error_signal(category,JSON.stringify(data));}},logErrorByGroup:function(suffix,log_rate){if(Math.floor(Math.random()*log_rate)==0)if(this.error==1357010||this.error<15000){this.logError('async_error_oops_'+suffix);}else this.logError('async_error_logic_'+suffix);}});global.AsyncRequest=module.exports=AsyncRequest;global.AsyncResponse=AsyncResponse;},3);
function UntrustedLink(a,d,b,c){this.dom=a;this.url=a.href;this.hash=d;this.func_get_params=c||function(){return {};};Event.listen(this.dom,'click',this.onclick.bind(this));Event.listen(this.dom,'mousedown',this.onmousedown.bind(this));Event.listen(this.dom,'mouseup',this.onmouseup.bind(this));Event.listen(this.dom,'mouseout',this.onmouseout.bind(this));this.onmousedown($E(b));}UntrustedLink.bootstrap=function(a,d,b,c){if(a.__untrusted)return;a.__untrusted=true;new UntrustedLink(a,d,b,c);};UntrustedLink.prototype.getRewrittenURI=function(){var a=copy_properties({u:this.url,h:this.hash},this.func_get_params(this.dom));var b=new URI('/l.php');return b.setQueryData(a).setSubdomain('www').setProtocol('http');};UntrustedLink.prototype.onclick=function(){(function(){this.dom.href=this.url;}).bind(this).defer(100);this.dom.href=this.getRewrittenURI();};UntrustedLink.prototype.onmousedown=function(a){if(a.button==2)this.dom.href=this.getRewrittenURI();};UntrustedLink.prototype.onmouseup=function(){this.dom.href=this.getRewrittenURI();};UntrustedLink.prototype.onmouseout=function(){this.dom.href=this.url;};
function ElementController(){this.handlers=[[],[]];}copy_properties(ElementController,{ALL:1,TARGETS:2,MODIFIERS:4,BUTTONS:8});ElementController.prototype={initialize:function(){this.initialize=bagofholding;onloadRegister(this.register.bind(this));},handle:function(e,event,a){a=a||bagof(true);var b=this.handlers[0].concat(this.handlers[1]);for(var c=0,d=b.length;c<d;c++)if(a(b[c].filters,e,event)&&b[c].callback(e,event)===false)return event.kill();},_registerHandler:function(b,a,c,d){this.initialize();b[d?'unshift':'push']({callback:a,filters:c||0});},registerHandler:function(a,b,c){this._registerHandler(this.handlers[0],a,b,c);},registerFallbackHandler:function(a,b,c){this._registerHandler(this.handlers[1],a,b,c);}};var LinkController=new ElementController();copy_properties(LinkController,{key:'LinkControllerHandler',register:function(){Event.listen(document.documentElement,'mousedown',this.handler.bind(this));Event.listen(document.documentElement,'keydown',this.handler.bind(this));},handler:function(event){var b=Parent.byTag(event.getTarget(),'a');var a=b&&b.getAttribute('href',2);if(!a||b.rel||!this.usesWebProtocol(a)||DataStore.get(b,this.key))return;DataStore.set(b,this.key,Event.listen(b,'click',function(event){if(a.charAt(a.length-1)=='#'){event.prevent();return;}trackReferrer(b,a);this.handle(b,event,this.filter);}.bind(this)));},filter:function(a,b,event){if(a&ElementController.ALL)return true;if((!(a&ElementController.TARGETS)&&b.target)||(!(a&ElementController.MODIFIERS)&&event.getModifiers().any)||(!(a&ElementController.BUTTONS)&&ua.safari()>=525&&event.which!=1))return false;return true;},usesWebProtocol:function(a){var b=a.match(/^(\w+):/);return !b||b[1].match(/^http/i);}});var FormController=new ElementController();copy_properties(FormController,{register:function(){Event.listen(document.documentElement,'submit',this.handler.bind(this));},handler:function(event){var a=event.getTarget();if((a.getAttributeNode('rel')||{}).value)return;var b=user_action(a,'form',event);if(window.ArbiterMonitor)ArbiterMonitor.initUA(b,[a]);return this.handle(a,event);}});
__d("string-extensions",[],function(b,c,d,a){String.prototype.trim=function(){if(this==window)return null;return this.replace(/^\s*|\s*$/g,'');};a.trim=b.trim=function(f){try{return String(f.toString()).trim();}catch(e){return '';}};String.prototype.startsWith=function(e){if(this==window)return null;return this.substring(0,e.length)==e;};String.prototype.endsWith=function(e){if(this==window)return null;return this.length>=e.length&&this.substring(this.length-e.length)==e;};String.prototype.split=(function(e){return function(l,i){var f="";if(l===null||i===null){return [];}else if(typeof l=='string'){return e.call(this,l,i);}else if(l===undefined){return [this.toString()];}else if(l instanceof RegExp){if(!l._2||!l._1){f=l.toString().replace(/^[\S\s]+\//,"");if(!l._1)if(!l.global){l._1=new RegExp(l.source,"g"+f);}else l._1=1;}separator1=l._1===1?l:l._1;var m=(l._2?l._2:l._2=new RegExp("^"+separator1.source+"$",f));if(i===undefined||i<0){i=false;}else{i=Math.floor(i);if(!i)return [];}var j,k=[],h=0,g=0;while((i?g++<=i:true)&&(j=separator1.exec(this))){if((j[0].length===0)&&(separator1.lastIndex>j.index))separator1.lastIndex--;if(separator1.lastIndex>h){if(j.length>1)j[0].replace(m,function(){for(var n=1;n<arguments.length-2;n++)if(arguments[n]===undefined)j[n]=undefined;});k=k.concat(this.substring(h,j.index),(j.index===this.length?[]:j.slice(1)));h=separator1.lastIndex;}if(j[0].length===0)separator1.lastIndex++;}return (h===this.length)?(separator1.test("")?k:k.concat("")):(i?k:k.concat(this.substring(h)));}else return e.call(this,l,i);};})(String.prototype.split);},3);
onloadRegister(function(){copy_properties(AsyncRequest.prototype,{setNectarModuleData:function(c){if(this.method=='POST'){var d=Env.module;if(c&&d===undefined){var b={fbpage_fan_confirm:1};var e=null;for(var a=c;a&&a!=document.body;a=a.parentNode){if(!a.id||typeof a.id!=='string')continue;if(a.id.startsWith('pagelet_')){d=a.id;break;}if(!e&&b[a.id])e=a.id;}if(d===undefined&&e)d=e;}if(d!==undefined){if(this.data.nctr===undefined)this.data.nctr={};this.data.nctr._mod=d;}}},setNectarImpressionId:function(){if(this.method=='POST'){var a=env_get('impid');if(a!==undefined){if(this.data.nctr===undefined)this.data.nctr={};this.data.nctr._impid=a;}}}});});
if(window==window.top)!function(){var a=function(){var b=0;return function(){if(!b){b=1;setTimeout(function(){b=0;var c=Vector2.getViewportDimensions();setCookie('wd',c.x+'x'+c.y);if(window.AsyncSignal&&Math.random()<.01)new AsyncSignal('/ajax/dimension_context.php',{'x':c.x,'y':c.y}).send();},100);}};}();onloadRegister(a);onloadRegister(function(){Event.listen(window,'resize',a);});onloadRegister(function(){Event.listen(window,'focus',a);});}();
(function(){function a(e,g,c,b){var f;var d=function(){var h=arguments;var i=this;var j=function(){f=null;e.apply(i,h);};c&&d.reset();if(c||!f)f=setTimeout(j,g,b);};d.reset=function(){f&&clearTimeout(f);f=null;};return d;}window.debounce=function(c,d,b){return a(c,d,true,b);};window.throttle=function(c,d,b){return a(c,d,false,b);};})();function defer_until(c,b,g,a,h){var e=b();if(e){c(e);return null;}var f=new Date().getTime();var d=setInterval(function(){e=b();if(!e){if(!g||(g<new Date()-f))return;h&&h();}clearInterval(d);c(e);},20,a);return d;}
onloadRegister(function(){Event.listen(document.documentElement,'keyup',function(event){var c=event.getTarget();if(!DOM.isNodeOfType(c,['input','textarea']))return;if(DOM.isNodeOfType(c,'input')&&c.type=='password')return;if(c.getAttribute('data-prevent-auto-flip'))return;var f=Input.getValue(c);var b=(c.style&&c.style.direction);if(!b){for(var d=0;d<f.length;d++){var a=f.charCodeAt(d);if(a>=48){var e=(a>=1470&&a<=1920);CSS.setStyle(c,'direction',e?'rtl':'ltr');return;}}}else if(f.length===0)CSS.setStyle(c,'direction','');});});
onloadRegister(function(){Event.listen(document.documentElement,'submit',function(b){var a=b.getTarget().getElementsByTagName('*');for(var c=0;c<a.length;c++)if(a[c].getAttribute('placeholder')&&Input.isEmpty(a[c]))Input.setValue(a[c],'');});});
var LiveTimer={restart:function(a){this.serverTime=a;this.localStartTime=new Date().getTime()/1000;this.updateTimeStamps();},updateTimeStamps:function(){LiveTimer.timestamps=DOM.scry(document.body,'abbr.livetimestamp');LiveTimer.startLoop(20000);},addTimeStamps:function(a){if(!a||!LiveTimer.timestamps)return;if(DOM.isNodeOfType(a,'abbr')&&CSS.hasClass(a,'livetimestamp')){LiveTimer.timestamps.push(a);}else{var c=DOM.scry(a,'abbr.livetimestamp');for(var b=0;b<c.length;++b)LiveTimer.timestamps.push(c[b]);}LiveTimer.startLoop(0);},startLoop:function(a){this.stop();this.timeout=setTimeout(function(){LiveTimer.loop();},a);},stop:function(){clearTimeout(this.timeout);},updateNode:function(a,b){LiveTimer.updateNode=(ua.ie()<7)?function(c,d){c.nextSibling.nodeValue=d;}:function(c,d){c.firstChild.nodeValue=d;};LiveTimer.updateNode(a,b);},loop:function(d){if(d)LiveTimer.updateTimeStamps();var c=Math.floor(new Date().getTime()/1000-LiveTimer.localStartTime);var a=-1;LiveTimer.timestamps&&LiveTimer.timestamps.each(function(g){var f=+new Date(g.getAttribute('data-date'))/1000;var e=LiveTimer.renderRelativeTime(LiveTimer.serverTime+c,f);if(e.text)LiveTimer.updateNode(g,e.text);if(e.next!=-1&&(e.next<a||a==-1))a=e.next;});if(a!=-1){var b=Math.max(20000,a*1000);LiveTimer.timeout=setTimeout(function(){LiveTimer.loop();},b);}},renderRelativeTime:function(c,d){var e={text:"",next:-1};if(c-d>(12*3600)||(new Date(c*1000).getDay()!=new Date(d*1000).getDay()))return e;var f=c-d,b=Math.floor(f/60),a=Math.floor(b/60);if(b<1){e.text=_tx("\u03c0\u03c1\u03b9\u03bd \u03b1\u03c0\u03cc \u03bb\u03af\u03b3\u03b1 \u03b4\u03b5\u03c5\u03c4\u03b5\u03c1\u03cc\u03bb\u03b5\u03c0\u03c4\u03b1");e.next=60-f%60;return e;}if(a<1){if(b==1){e.text=_tx("\u03c0\u03c1\u03b9\u03bd \u03b1\u03c0\u03cc \u03ad\u03bd\u03b1 \u03c0\u03b5\u03c1\u03af\u03c0\u03bf\u03c5 \u03bb\u03b5\u03c0\u03c4\u03cc ");}else e.text=_tx("\u03a0\u03c1\u03b9\u03bd \u03b1\u03c0\u03cc {number} \u03bb\u03b5\u03c0\u03c4\u03ac",{number:b});e.next=60-f%60;return e;}if(a!=11)e.next=3600-f%3600;if(a==1){e.text=_tx("\u03c0\u03c1\u03b9\u03bd \u03b1\u03c0\u03cc \u03bc\u03af\u03b1 \u03ce\u03c1\u03b1 \u03c0\u03b5\u03c1\u03af\u03c0\u03bf\u03c5");return e;}e.text=_tx("{number} \u03ce\u03c1\u03b5\u03c2 \u03c0\u03c1\u03b9\u03bd",{number:a});return e;}};
onloadRegister(function(){add_properties('__behaviors',{});if(__behaviors.TinyViewport)return;__behaviors.TinyViewport=true;var a=document.documentElement;var b=debounce(function(){CSS.conditionClass(a,'tinyViewport',a.clientHeight<400||a.clientWidth<a.scrollWidth);});Event.listen(window,'resize',b);b();});
__d("ajaxpipe",["dom","arbiter","async","big-pipe"],function(g,h,i,f){var e=i('dom');var b=i('arbiter');var c=i('async');var d=i('big-pipe');function a(k,j){this._uri=k;this._query_data=j;this._request=new c();this._canvas_id=null;this._allow_cross_page_transition=true;}copy_properties(a.prototype,{setCanvasId:function(j){this._canvas_id=j;return this;},setURI:function(j){this._uri=j;return this;},setData:function(j){this._query_data=j;return this;},getData:function(j){return this._query_data;},setAllowCrossPageTransition:function(j){this._allow_cross_page_transition=j;return this;},setAppend:function(j){this._append=j;return this;},send:function(){this._request.setOption('useIframeTransport',true).setURI(this._uri).setData(copy_properties({ajaxpipe:1,ajaxpipe_token:Env.ajaxpipe_token},this._query_data)).setPreBootloadHandler(this._preBootloadHandler.bind(this)).setInitialHandler(this._onInitialResponse.bind(this)).setHandler(this._onResponse.bind(this)).setMethod('GET').setReadOnly(true).setAllowCrossPageTransition(this._allow_cross_page_transition);a._current_request=this._request;this._request.send();return this;},_preBootloadFirstResponse:function(j){return false;},_fireDomContentCallback:function(){this._arbiter.inform('ajaxpipe/domcontent_callback',true,b.BEHAVIOR_STATE);},_fireOnloadCallback:function(){this._arbiter.inform('ajaxpipe/onload_callback',true,b.BEHAVIOR_STATE);},_isRelevant:function(j){return this._request==a._current_request||this._jsNonBlock;},_preBootloadHandler:function(k){var j=k.getPayload();if(!j||j.redirect||!this._isRelevant(k))return false;var l=false;if(k.is_first){!this._append&&a.clearCanvas(this._canvas_id,this._constHeight);this._arbiter=new b();l=this._preBootloadFirstResponse(k);this.pipe=new d({arbiter:this._arbiter,rootNodeID:this._canvas_id,lid:this._request.lid,rrEnabled:k.payload.roadrunner_enabled,isAjax:true,domContentCallback:this._fireDomContentCallback.bind(this),onloadCallback:this._fireOnloadCallback.bind(this),domContentEvt:'ajaxpipe/domcontent_callback',onloadEvt:'ajaxpipe/onload_callback',jsNonBlock:this._jsNonBlock});}return l;},_redirect:function(j){return false;},_versionCheck:function(j){return true;},_onInitialResponse:function(k){var j=k.getPayload();if(!this._isRelevant(k))return false;if(!j)return true;if(this._redirect(j)||!this._versionCheck(j))return false;return true;},_processFirstResponse:function(k){var j=k.getPayload();if(ge(this._canvas_id)&&j.canvas_class!==null)CSS.setClass(this._canvas_id,j.canvas_class);},setFirstResponseCallback:function(j){this._firstResponseCallback=j;return this;},setFirstResponseHandler:function(j){this._processFirstResponse=j;return this;},_onResponse:function(k){var j=k.payload;if(!this._isRelevant(k))return c.suppressOnloadToken;if(k.is_first){this._processFirstResponse(k);this._firstResponseCallback&&this._firstResponseCallback();j.provides=j.provides||[];j.provides.push('uipage_onload');if(this._append)j.append=this._canvas_id;}if(j){if('content' in j.content&&this._canvas_id!==null&&this._canvas_id!='content'){j.content[this._canvas_id]=j.content.content;delete j.content.content;}d.pagelet_ids[j.id]=1;this.pipe.onPageletArrive(j);}if(k.is_last)a.restoreCanvas(this._canvas_id,this._constHeight);return c.suppressOnloadToken;},setNectarModuleDataSafe:function(j){this._request.setNectarModuleDataSafe(j);return this;},setFinallyHandler:function(j){this._request.setFinallyHandler(j);return this;},setErrorHandler:function(j){this._request.setErrorHandler(j);return this;},abort:function(){this._request.abort();if(a._current_request==this._request)a._current_request=null;this._request=null;return this;},setJSNonBlock:function(j){this._jsNonBlock=j;return this;},setConstHeight:function(j){this._constHeight=j;return this;},getAsyncRequest:function(){return this._request;}});copy_properties(a,{clearCanvas:function(j,k){var l=ge(j);if(l){if(!k)l.style.minHeight='600px';e.empty(l);}},restoreCanvas:function(j,k){var l=ge(j);if(l)if(!k)l.style.minHeight='100px';},getCurrentRequest:function(){return a._current_request;},setCurrentRequest:function(j){a._current_request=j;},isActiveOnPage:function(j){return env_get('ajaxpipe_enabled');}});g.AjaxPipeRequest=h.exports=a;},3);
__d("dom-scroll",["dom","vector","bootloader"],function(f,g,h,e){var a=h('dom').$N;var d=h('vector');var b=h('bootloader');var c={getScrollState:function(){var l=d.getViewportDimensions();var i=d.getDocumentDimensions();var j=(i.x>l.x);var k=(i.y>l.y);j+=0;k+=0;return new d(j,k);},_scrollbarSize:null,_initScrollbarSize:function(){var i=a('p');i.style.width='100%';i.style.height='200px';var j=a('div');j.style.position='absolute';j.style.top='0px';j.style.left='0px';j.style.visibility='hidden';j.style.width='200px';j.style.height='150px';j.style.overflow='hidden';j.appendChild(i);document.body.appendChild(j);var k=i.offsetWidth;j.style.overflow='scroll';var l=i.offsetWidth;if(k==l)l=j.clientWidth;document.body.removeChild(j);c._scrollbarSize=k-l;if(c._scrollbarSize<5)c._scrollbarSize=15;},getScrollbarSize:function(){if(c._scrollbarSize===null)c._initScrollbarSize();return c._scrollbarSize;},scrollTo:function(n,i,l,j,k){if(typeof i=='undefined'||i===true)i=750;if(!(n instanceof d)){var o=d.getScrollPosition().x;var p=d.getElementPosition($(n)).y;p=p-Math.min(0,Math.max(d.getViewportDimensions().y/3,100));var m=ge('blueBar');if(m&&CSS.isFixed(m)&&!l&&!j)p-=d.getElementDimensions(m).y;n=new d(o,p,'document');}if(l){n.y-=d.getViewportDimensions().y/2;}else if(j){n.y-=d.getViewportDimensions().y;n.y+=j;}n=n.convertTo('document');if(i){b.loadComponents('animation',function(){var q=document.body;animation(q).to('scrollTop',n.y).to('scrollLeft',n.x).ease(animation.ease.end).duration(i).ondone(k).go();});}else if(window.scrollTo){window.scrollTo(n.x,n.y);k&&k.call(this);}}};f.DOMScroll=g.exports=c;},3);
var HistoryManager=window.HistoryManager||{_IFRAME_BASE_URI:'http://static.ak.facebook.com/common/history_manager.php',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(!env_get('ALLOW_TRANSITION_IN_IFRAME')&&window!=window.top)return;if(HistoryManager._initialized)return HistoryManager;var b=URI();var a=b.getFragment()||'';if(a.charAt(0)==='!'){a=a.substr(1);b.setFragment(a);}if(URI.getRequestURI(false).getProtocol().toLowerCase()=='https')HistoryManager._IFRAME_BASE_URI='https://s-static.ak.facebook.com/common/history_manager.php';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(window.history&&history.pushState){this.lastURI=document.URL;window.history.replaceState(this.lastURI,null);Event.listen(window,'popstate',function(c){if(c&&c.state&&HistoryManager.lastURI!=c.state){HistoryManager.lastURI=c.state;HistoryManager.lastChanged=(+new Date());HistoryManager.notify(URI(c.state).getUnqualifiedURI().toString());}}.bind(HistoryManager));if(ua.safari()<534||ua.chrome()<=13){setInterval(HistoryManager.checkURI,42,false);HistoryManager._updateRefererURI(this.lastURI);}return HistoryManager;}HistoryManager._updateRefererURI(URI.getRequestURI(false));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 if('onhashchange' in window){Event.listen(window,'hashchange',function(){HistoryManager.checkURI.bind(HistoryManager).defer();});}else setInterval(HistoryManager.checkURI,42,false);return HistoryManager;},registerURIHandler:function(a){HistoryManager.callbacks.push(a);return HistoryManager;},setCanonicalLocation:function(a){HistoryManager.canonical=URI(a);return HistoryManager;},notify:function(c){if(c==HistoryManager.orig_fragment)c=HistoryManager.canonical.getFragment();for(var b=0;b<HistoryManager.callbacks.length;b++)try{if(HistoryManager.callbacks[b](c))return true;}catch(a){}return false;},checkURI:function(){if(new Date().getTime()-HistoryManager.lastChanged<400)return;if(window.history&&history.pushState){var d=URI(document.URL).removeQueryData('ref').toString();var c=URI(HistoryManager.lastURI).removeQueryData('ref').toString();if(d!=c){HistoryManager.lastChanged=(+new Date());HistoryManager.lastURI=d;if(ua.safari()<534)HistoryManager._updateRefererURI(d);HistoryManager.notify(URI(d).getUnqualifiedURI().toString());}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(a.charAt(0)=='!')a=a.substr(1);if(ua.ie()<8)a=HistoryManager.getIframeSrcFragment();a=a.replace(/%23/g,'#');if(a!=HistoryManager.fragment.replace(/%23/g,'#')){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().replace(/%23/g,'#')==a)break;++HistoryManager.user;if(b>=0){HistoryManager.go(b-HistoryManager.current);}else HistoryManager.go('#'+a);--HistoryManager.user;}},_updateRefererURI:function(e){e=e.toString();if(e.charAt(0)!='/'&&e.indexOf('//')==-1)return;var d=new URI(window.location);if(d.isFacebookURI()){var a=d.getPath()+window.location.search;}else var a='';var c=URI(e).getQualifiedURI().setFragment(a).toString();var b=2048;if(c.length>b)c=c.substring(0,b)+'...';setCookie('x-referer',c);},go:function(c,e,f){if(window.history&&history.pushState){e||typeof(c)=='number';var h=URI(c).removeQueryData('ref').toString();HistoryManager.lastChanged=(+new Date());this.lastURI=h;if(f){window.history.replaceState(c,null,h);}else window.history.pushState(c,null,h);if(ua.safari()<534)HistoryManager._updateRefererURI(c);return false;}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;b=URI(b).removeQueryData('ref').getUnqualifiedURI().toString();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 i=(HistoryManager.history.length-HistoryManager.current)-1;HistoryManager.history.splice(HistoryManager.current+1,i);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=window.PageTransitions||{_transition_handlers:[],_scroll_positions:{},_scroll_locked:false,isInitialized:function(){return !!PageTransitions._initialized;},_init:function(){if(!env_get('ALLOW_TRANSITION_IN_IFRAME')&&window!=window.top)return;if(PageTransitions._initialized)return PageTransitions;PageTransitions._initialized=true;var d=URI.getRequestURI(false);var a=d.getUnqualifiedURI();var e=URI(a).setFragment(null);var c=a.getFragment();if(c.charAt(0)==='!'&&e.toString()===c.substr(1))a=e;copy_properties(PageTransitions,{_current_uri:a,_most_recent_uri:a,_next_uri:a});var b;if(d.getFragment().startsWith('/')){b=d.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);Event.listen(window,'scroll',function(){if(!PageTransitions._scroll_locked)PageTransitions._scroll_positions[PageTransitions._current_uri]=Vector2.getScrollPosition();});return PageTransitions;},registerHandler:function(b,a){PageTransitions._init();a=a||5;if(!PageTransitions._transition_handlers[a])PageTransitions._transition_handlers[a]=[];PageTransitions._transition_handlers[a].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(Form.getAttribute(a,'action')||''),b=_computeRelativeURI(PageTransitions._most_recent_uri,c);a.setAttribute('action',b.toString());if((Form.getAttribute(a,'method')||'GET').toUpperCase()==='GET'){PageTransitions.go(b.addQueryData(Form.serialize(a)));return false;}},go:function(d,b){var a=new URI(d).removeQueryData('quickling').getQualifiedURI();var c=a.getUnqualifiedURI();delete PageTransitions._scroll_positions[c];!b&&user_action({href:a.toString()},'uri',null,'INDIRECT');_BusyUIManager.lookBusy();PageTransitions._loadPage(a,function(e){if(e){HistoryManager.go(a.toString(),false,b);}else go_or_replace(window.location,a,b);});},_historyManagerHandler:function(a){if(a.charAt(0)!='/')return false;user_action({href:a},'h',null);PageTransitions._loadPage(new URI(a),function(b){if(!b)go_or_replace(window.location,a,true);});return true;},_loadPage:function(e,c){if(URI(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(){PageTransitions._scroll_locked=true;var f=PageTransitions._handleTransition(e);c&&c(f);};var a=_runHooks('onbeforeleavehooks');if(a){_BusyUIManager.stopLookingBusy();PageTransitions._warnBeforeLeaving(a,b);}else b();},_handleTransition:function(g){window.onbeforeleavehooks=undefined;_BusyUIManager.lookBusy();if(!g.isSameOrigin())return false;var f=window.AsyncRequest&&AsyncRequest.getLastId();Arbiter.inform("pre_page_transition",{from:PageTransitions.getMostRecentURI(),to:g});for(var c=PageTransitions._transition_handlers.length-1;c>=0;--c){var b=PageTransitions._transition_handlers[c];if(!b)continue;for(var d=b.length-1;d>=0;--d)if(b[d](g)===true){var e={sender:this,uri:g,id:f};try{Arbiter.inform("page_transition",e);}catch(a){}return true;}else b.splice(d,1);}return false;},unifyURI:function(){PageTransitions._current_uri=PageTransitions._most_recent_uri=PageTransitions._next_uri;},transitionComplete:function(a){PageTransitions._executeCompletionCallback();_BusyUIManager.stopLookingBusy();PageTransitions.unifyURI();if(!a)PageTransitions.restoreScrollPosition();try{if(document.activeElement&&document.activeElement.nodeName==='A')document.activeElement.blur();}catch(b){}},_executeCompletionCallback:function(){if(PageTransitions._completionCallback)PageTransitions._completionCallback();PageTransitions._completionCallback=null;},setCompletionCallback:function(a){PageTransitions._completionCallback=a;},rewriteCurrentURI:function(b,a){PageTransitions.registerHandler(function(){if(b==PageTransitions.getMostRecentURI().getUnqualifiedURI().toString()){PageTransitions.transitionComplete();return true;}});PageTransitions.go(a,true);},_warnBeforeLeaving:function(b,a){new Dialog().setTitle(_tx("\u0398\u03ad\u03bb\u03b5\u03c4\u03b5 \u03c3\u03af\u03b3\u03bf\u03c5\u03c1\u03b1 \u03bd\u03b1 \u03c6\u03cd\u03b3\u03b5\u03c4\u03b5 \u03b1\u03c0\u03cc \u03b1\u03c5\u03c4\u03ae \u03c4\u03b7 \u03c3\u03b5\u03bb\u03af\u03b4\u03b1;")).setBody(htmlize(b)).setButtons([{name:'leave_page',label:_tx("\u039a\u03bb\u03b5\u03af\u03c3\u03b9\u03bc\u03bf \u03c4\u03b7\u03c2 \u03c3\u03b5\u03bb\u03af\u03b4\u03b1\u03c2"),handler:a},{name:'continue_editing',label:_tx("\u03a0\u03b1\u03c1\u03b1\u03bc\u03bf\u03bd\u03ae \u03c3\u03c4\u03b7 \u03c3\u03b5\u03bb\u03af\u03b4\u03b1"),className:'inputaux'}]).setModal(true).show();},restoreScrollPosition:function(){PageTransitions._scroll_locked=false;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.scry(document.body,"a[name='"+escape_js_quotes(f)+"']")[0]||ge(f));}var a=d(URI(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.getDomain()&&!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=window._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.documentElement);},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';}}};
var NavigationMessage={NAVIGATION_BEGIN:'NavigationMessage/navigationBegin',NAVIGATION_SELECT:'NavigationMessage/navigationSelect',NAVIGATION_FIRST_RESPONSE:'NavigationMessage/navigationFirstResponse',NAVIGATION_COMPLETED:'NavigationMessage/navigationCompleted',NAVIGATION_FAILED:'NavigationMessage/navigationFailed',NAVIGATION_COUNT_UPDATE:'NavigationMessage/navigationCount',NAVIGATION_FAVORITE_UPDATE:'NavigationMessage/navigationFavoriteUpdate',NAVIGATION_ITEM_REMOVED:'NavigationMessage/navigationItemRemoved',NAVIGATION_ITEM_HIDDEN:'NavigationMessage/navigationItemHidden',INTERNAL_LOADING_BEGIN:'NavigationMessage/internalLoadingBegin',INTERNAL_LOADING_COMPLETED:'NavigationMessage/internalLoadingCompleted'};
function AsyncLayout(){}AsyncLayout.prototype={init:function(a){this.canvas_id=a;if(ge('rightCol'))this.auxiliary_id='rightCol';if(ge('headerArea'))this.header_id='headerArea';if(ge('toolbarContainer'))this.toolbar_id='toolbarContainer';this.waitingForAux=false;PageTransitions.registerHandler(this.catchPageTransition.bind(this));this.subscription=Arbiter.subscribe(NavigationMessage.NAVIGATION_BEGIN,this.onNavigate.bind(this));return this;},catchPageTransition:function(a){Arbiter.unsubscribe(this.subscription);return false;},getCanvasID:function(a){return this.customCanvasID?this.customCanvasID:(a.sidecol?'contentCol':'contentArea');},onNavigate:function(c,a){var d=a.useAjaxPipe&&AjaxPipeRequest.isActiveOnPage(a.params.endpoint);a=a.params;if(a.endpoint){if(this.request){this.request.setFinallyHandler(bagofholding);this.request.abort();}if(this.sideRequest)this.sideRequest.abort();if(d){this.request=new AjaxPipeRequest().setURI(a.endpoint).setData(a).setCanvasId(this.getCanvasID(a)).setFinallyHandler(this.finallyHandler.bind(this)).setErrorHandler(this.errorHandler.bind(this)).setFirstResponseCallback(this.firstResponseCallback.bind(this)).send();}else{a.handled=true;this.waitingForAux=a.sidecol;var e=!!a.iframe;var b=new AsyncRequest().setOption('useIframeTransport',e).setURI(new URI(a.endpoint)).setReadOnly(true).setMethod('GET').setData(a).setHandler(this.onResponse.bind(this)).setErrorHandler(this.errorHandler.bind(this)).setFinallyHandler(this.finallyHandler.bind(this));this.request=b;b.send();}}},onSideResponse:function(b){var a=b.getPayload();if(a&&this.auxiliary_id)this.receivedAux(a);},receivedAux:function(a){!this.waitingForAux;this.waitingForAux=false;DOM.setContent($(this.auxiliary_id),HTML(a));},onResponse:function(e){var d=e.getPayload();if(d.redirect){goURI(d.redirect);}else{var c=d.html||d;DOM.setContent($(this.canvas_id),HTML(c));if(d.side_html&&this.auxiliary_id)this.receivedAux(d.side_html);if(this.header_id&&!d.keep_header){var b=$(this.header_id);DOM.setContent(b,HTML(d.header_html||''));CSS.conditionShow(b,d.header_html);}if(d.toolbar_html&&this.toolbar_id)DOM.setContent($(this.toolbar_id),HTML(d.toolbar_html));if(d.js)(new Function(d.js))();CSS.conditionClass('contentCol','hasRightCol',this.auxiliary_id&&!d.noRightSide);var f=ge('rightCol');if(f&&d.noRightSide)DOM.empty(f);}var a=e.getRequest().getData();Arbiter.inform(NavigationMessage.NAVIGATION_COMPLETED,a.key);},errorHandler:function(a){AsyncResponse.verboseErrorHandler(a);Arbiter.inform(NavigationMessage.NAVIGATION_FAILED);this.request=null;},firstResponseCallback:function(a){Arbiter.inform(NavigationMessage.NAVIGATION_FIRST_RESPONSE);},finallyHandler:function(a){this.request=null;PageTransitions.transitionComplete(true);Arbiter.inform(NavigationMessage.NAVIGATION_COMPLETED);}};
function FutureSideNav(){FutureSideNav.instance&&FutureSideNav.instance.uninstall();FutureSideNav.instance=this;}FutureSideNav.instance=null;FutureSideNav.getInstance=function(){return FutureSideNav.instance||new FutureSideNav();};FutureSideNav.prototype={init:function(c,b,a){this.root=c;this.items={};this.sections={};this.editor=null;this.editing=false;this.selected=null;this.loading=null;this.keyParam='sk';this.defaultKey=b;this.uri=URI.getRequestURI();this.ajaxPipe=a;this.ajaxPipeEndpoints={};this.sidecol=true;this._installed=true;this._handlePageTransitions=true;PageTransitions.registerHandler(function(d){return this._handlePageTransitions&&this.handlePageTransition(d);}.bind(this));this._eventHandlers=[];this._arbiterSubscriptions=[Arbiter.subscribe(NavigationMessage.NAVIGATION_COMPLETED,this.navigationComplete.bind(this)),Arbiter.subscribe(NavigationMessage.NAVIGATION_FAILED,this.navigationFailed.bind(this)),Arbiter.subscribe(NavigationMessage.NAVIGATION_COUNT_UPDATE,this.navigationCountUpdate.bind(this)),Arbiter.subscribe(NavigationMessage.NAVIGATION_SELECT,this.navigationSelect.bind(this)),Arbiter.subscribe(PresenceMessage.getArbiterMessageType('nav_count'),this.navigationCountUpdateFromPresence.bind(this))];this._explicitHover=[];this._ensureHover('sideNavItem');this._eventHandlers.push(Event.listen(window,'resize',this._handleResize.bind(this)));this._checkNarrow();window.Selector&&this._arbiterSubscriptions.push(Selector.subscribe(['open','close'],function(f,d){var e=Parent.byClass(d.selector,'sideNavItem');e&&CSS.conditionClass(e,'editMenuOpened',f==='open');}));onleaveRegister(this.uninstall.bind(this));},_handleResize:(function(){var a;return function(){a&&clearTimeout(a);a=this._checkNarrow.bind(this).defer(200);};})(),_checkNarrow:function(){CSS.conditionClass(this.root,'uiNarrowSideNav',Vector2.getElementPosition(this.root).x<20);},_ensureHover:function(a){if(ua.ie()<8)Bootloader.loadComponents('explicit-hover',function(){this._explicitHover.push(new ExplicitHover(this.root,a));}.bind(this));},uninstall:function(){if(this._installed){this._installed=false;this._handlePageTransitions=false;this._arbiterSubscriptions.forEach(Arbiter.unsubscribe);this._eventHandlers.forEach(function(a){a.remove();});this._explicitHover.forEach(function(a){a.uninstall();});}},initSection:function(b,a){this._initItems(a);this._initSection(b);},addItem:function(a,b){this._initItem(a,b);},_initItems:function(b){var a=function(c,e){var d=this._initItem(c,e);$(c.children).forEach(function(f){a(f,d);});}.bind(this);$A(b).forEach(function(c){a(c,null);});},_initItem:function(a,d){var b=this.items[a.id]=this._constructItem(a,d);if(b.equals(this.selected)||a.selected)this.setSelected(b);var c=b.getLinkNode();c&&this._eventHandlers.push(Event.listen(c,'click',function(event){return !this.editing;}.bind(this)));return b;},_initSection:function(a){var b=this.sections[a.id]=this._constructSection(a);this._eventHandlers.push(Event.listen(b.node,'click',this.handleSectionClick.bind(this,b)));DOM.scry(b.node,'div.bookmarksMenuButton').forEach(CSS.show);return b;},_constructItem:function(a,b){return new FutureSideNavItem(a,b);},_constructSection:function(a){return new FutureSideNavSection(a);},handleSectionClick:function(c,event){var b=this._getEventTarget(event,'a');var a=this._getItemForNode(b);if(!b){return;}else if(CSS.hasClass(b.parentNode,'uiMenuItem')){this._handleMenuClick(c,a,b.parentNode,event);}else this._handleLinkClick(c,b,event);},_getEventTarget:function(event,a){var b=event.getTarget();if(b.tagName!==a.toUpperCase()){return Parent.byTag(b,a);}else return b;},_handleMenuClick:function(c,a,b,event){if(CSS.hasClass(b,'rearrange'))this.beginEdit(c);},_handleLinkClick:function(b,a,event){if(CSS.hasClass(a,'navEditDone')){this.editing?this.endEdit():this.beginEdit(b);event.kill();}},getItem:function(a){if(this._isCurrentPath(a)){return this._getItemForKey(this._getKey(a.getQueryData())||this.defaultKey);}else return this._getItemForPath(a.getPath());},getNodeForKey:function(b){var a=this._getItemForKey(b);if(a)return a.node;},_isCurrentPath:function(a){return a.getDomain()===this.uri.getDomain()&&a.getPath()===this.uri.getPath();},_getKey:function(a){return a[this.keyParam];},_getItemForNode:function(a){a=Parent.byClass(a,'sideNavItem');return a&&this.items[a.id];},_getItemForKey:function(a){return this._findItem(function(b){return b.matchKey(a);});},_getItemForPath:function(a){return this._findItem(function(b){return b.matchPath(a);});},_findItem:function(a){for(var b in this.items)if(a(this.items[b]))return this.items[b];},removeItem:function(a){if(a&&this.items[a.id]){DOM.remove(a.node);delete this.items[a.id];if(a.getTop().equals(this.selected&&this.selected.getTop()))goURI(URI.getRequestURI(),true);}},removeItemByKey:function(a){this.removeItem(this._getItemForKey(a));},moveItem:function(d,b,c){var a=DOM.find(d.node,'ul.uiSideNav');(c?DOM.prependContent:DOM.appendContent)(a,b.node);},setLoading:function(a){this.loading&&this.loading.hideLoading();this.loading=a;this.loading&&this.loading.showLoading();},setSelected:function(a){this.setLoading(null);if(this.selected){this.selected.hideSelected();this.selected.getTop().hideChildren();}this.selected=a;if(this.selected){this.selected.showSelected();this.selected.getTop().showChildren();}},handlePageTransition:function(c){var a=this.getItem(c);var b=a&&a.endpoint&&this._doPageTransition(a,c);return b;},_doPageTransition:function(a,b){this.setLoading(a);this._sendPageTransition(a.endpoint,copy_properties(this._getTransitionData(a,b),b.getQueryData()));return true;},_sendPageTransition:function(b,a){a.endpoint=b;Arbiter.inform(NavigationMessage.NAVIGATION_BEGIN,{useAjaxPipe:this._useAjaxPipe(b),params:a});},_getTransitionData:function(b,c){var a={};a.sidecol=this.sidecol;a.path=c.getPath();a[this.keyParam]=b.textKey;a.key=b.textKey;return a;},_useAjaxPipe:function(a){return this.ajaxPipe||this.ajaxPipeEndpoints[a];},navigationComplete:function(){this.loading&&this.setSelected(this.loading);if(Arbiter.inform('sidenav/scrolltop')!==false)DOMScroll.scrollTo(document.documentElement,false);},navigationFailed:function(){this.setLoading(null);},navigationSelect:function(c,a){var b=this._getItemForKey(this._getKey(a));if(a.asLoading){this.setLoading(b);}else this.setSelected(b);},navigationCountUpdate:function(c,a){var b=this._getItemForKey(a&&a.key);if(b)if(typeof a.count!=="undefined"){b.setCount(a.count,a.hide);}else if(typeof a.increment!=="undefined")b.incrementCount(a.increment,a.hide);},navigationCountUpdateFromPresence:function(b,a){a=a.obj;if(a&&a.class_name&&CSS.hasClass(this.root,a.class_name))this.navigationCountUpdate(b,a);},beginEdit:function(a){if(!this.editing){this.editing=true;CSS.addClass(this.root,'editMode');this._updateTrackingData();Bootloader.loadComponents('sortable-side-nav-js',this._initEditor.bind(this,a));}},endEdit:function(){if(this.editing){CSS.removeClass(this.root,'editMode');this.editor.endEdit();this.editor=null;this.editing=false;this._updateTrackingData();}},_updateTrackingData:function(a){var c=this.root.getAttribute('data-gt')||"{}";try{c=JSON.parse(c);if(this.editing){c.editing=true;}else delete c.editing;this.root.setAttribute('data-gt',JSON.stringify(c));}catch(b){}},_initEditor:function(a){this.editor=a.getEditor();this.editor.beginEdit();}};function FutureSideNavSection(a){this.id=a.id;this.node=this.node||$(a.id);this.editEndpoint=a.editEndpoint;}FutureSideNavSection.prototype={equals:function(a){return a&&a.id===this.id;},getEditor:function(){return new SortableSideNav(DOM.find(this.node,'ul.uiSideNav'),this.editEndpoint);}};function FutureSideNavItem(a,c){this.id=a.id;this.up=c;this.endpoint=a.endpoint;this.type=a.type;this.node=a.node||$(a.id);this.paths=a.path?$A(a.path):[];this.keys=a.key?$A(a.key):[];var b=this._findKeys(this.keys);this.numericKey=b.numeric||this.keys[0];this.textKey=b.text||this.keys[0];this._pathPattern=this._buildRegex(this.paths);this._keyPattern=this._buildRegex(this.keys);this.hideLoading();this.hideSelected();}FutureSideNavItem.prototype={equals:function(a){return a&&a.id===this.id;},getLinkNode:function(){return (DOM.scry(this.node,'a.item')[0]||DOM.scry(this.node,'a.subitem')[0]);},matchPath:function(a){return this._matchInput(this._pathPattern,a);},matchKey:function(a){return this._matchInput(this._keyPattern,a);},_matchInput:function(c,a){var b=c&&c.exec(a);return b&&b.slice(1);},getTop:function(){return this.isTop()?this:this.up.getTop();},isTop:function(a){return !this.up;},setCount:function(a,b){return this._updateCount(a,true);},incrementCount:function(a,b){return this._updateCount(a,false);},_updateCount:function(a,h,e){var c=DOM.scry(this.node,'span.count')[0];var d=c&&DOM.scry(c,'span.countValue')[0];if(d){var b=h?0:parseInt(DOM.getText(d),10);var i=Math.max(0,b+a);var f=this.isTop()?'hidden':'hiddenSubitem';DOM.setContent(d,i);e&&CSS.conditionClass(this.node,f,!i);CSS.conditionClass(c,'hidden_elem',!i);if(this.isTop()){var g=DOM.scry(this.node,'div.linkWrap')[0];if(g){CSS.conditionClass(g,'noCount',!i);CSS.conditionClass(g,'hasCount',i);}}}},showLoading:function(){CSS.addClass(this.node,'loading');},hideLoading:function(){CSS.removeClass(this.node,'loading');},showSelected:function(){CSS.addClass(this.node,'selectedItem');CSS.hasClass(this.node,'hider')&&CSS.addClass(this._getExpanderParent(),'expandedMode');},hideSelected:function(){CSS.removeClass(this.node,'selectedItem');},showChildren:function(){CSS.addClass(this.node,'open');},hideChildren:function(){CSS.removeClass(this.node,'open');},_getExpanderParent:function(){return Parent.byClass(this.node,'expandableSideNav');},_buildRegex:function(a){if(a.length){var b=a.map(function(c){if(typeof c==="string"){return c.replace(/([^a-z0-9_])/ig,'\\$1');}else if(c.regex)return c.regex;});return new RegExp('^(?:'+b.join('|')+')$');}},_findKeys:function(c){var e=/^(app|group|fl)_/;var a={};for(var b=0;b<c.length;b++){var d=e.test(c[b]);if(d&&!a.numeric){a.numeric=c[b];}else if(!d&&!a.text)a.text=c[b];if(a.numeric&&a.text)break;}return a;}};
function FutureProfileSideNav(){this.parent.construct(this);}Class.extend(FutureProfileSideNav,'FutureSideNav');FutureProfileSideNav.prototype={init:function(){this.parent.init.apply(this,arguments);this.ajaxPipe=true;this.altKeyParam='v';this.sidecol=false;},_constructItem:function(a,b){return new FutureProfileSideNavItem(a,b);},_doPageTransition:function(a,b){if(!this._profileChanged(b)&&!this._scopeChanged(a))return this.parent._doPageTransition(a,b);},_profileChanged:function(c){var b=c.getQueryData();var a=this.uri.getQueryData();return (b.id!==a.id||b.viewas!==a.viewas||b.and!==a.and);},_scopeChanged:function(a){return (!this.selected||a.layoutType!==this.selected.layoutType);},_getKey:function(a){return this.parent._getKey(a)||a[this.altKeyParam];}};function FutureProfileSideNavItem(a,b){this.parent.construct(this,a,b);this.layoutType=a.layouttype;}Class.extend(FutureProfileSideNavItem,'FutureSideNavItem');
function adjustImage(e,g){if(!g){var a=e.parentNode;while(a.parentNode&&(CSS.getStyle(a,'display')!='block'||a.offsetWidth==0))a=a.parentNode;g=a.offsetWidth;}var c=e.offsetWidth;if(c==0){var d=e.nextSibling,f=e.parentNode;document.body.appendChild(e);c=e.offsetWidth;if(d){f.insertBefore(e,d);}else f.appendChild(e);}if(c>g)try{if(ua.ie()<8){var img_div=document.createElement('div');img_div.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+e.src.replace('"','%22')+'", sizingMethod="scale")';img_div.style.width=g+'px';img_div.style.height=Math.floor(((g/e.offsetWidth)*e.offsetHeight))+'px';if(e.parentNode.tagName=='A')img_div.style.cursor='pointer';e.parentNode.insertBefore(img_div,e);e.parentNode.removeChild(e);}else throw 1;}catch(b){e.style.width=g+'px';}CSS.removeClass(e,'img_loading');}function imageConstrainSize(e,b,c,d){var a=new Image();a.onload=function(){if(a.width>0&&a.height>0){var k=a.width;var h=a.height;if(k>b||h>c){var g=c/b;var f=h/k;if(f>g){k=k*(c/h);h=c;}else{h=h*(b/k);k=b;}}var j=ge(d);if(j){var i=document.createElement('img');i.src=e;i.width=k;i.height=h;j.parentNode.insertBefore(i,j);j.parentNode.removeChild(j);}}};a.src=e;}function image_has_loaded(a){if(a.naturalWidth!==undefined){return a.complete&&a.width!=0;}else if(a.height==20&&a.width==20&&a.complete){return false;}else if(a.complete===undefined&&ua.safari()<500){var b=new Image();b.src=a.src;return b.complete;}return a.complete;}function image_has_failed(a){if((a.complete==null&&a.width==20&&a.height==20)||(a.mimeType!=null&&a.complete&&a.mimeType=='')||(a.naturalHeight!=null&&a.complete&&a.naturalHeight==0))return true;}
add_properties('Input',{getSelection:function(b){if(!document.selection)return {start:b.selectionStart,end:b.selectionEnd};var d=document.selection.createRange();if(d.parentElement()!==b)return {start:0,end:0};var c=b.value.length;if(b.tagName=='INPUT'){return {start:-d.moveStart('character',-c),end:-d.moveEnd('character',-c)};}else{var e=d.duplicate();e.moveToElementText(b);e.setEndPoint('StartToEnd',d);var a=c-e.text.length;e.setEndPoint('StartToStart',d);return {start:c-e.text.length,end:a};}},setSelection:function(d,f,c){if(typeof c=='undefined')c=f;if(document.selection){if(d.tagName=='TEXTAREA'){var a=(d.value.slice(0,f).match(/\r/g)||[]).length;var b=(d.value.slice(f,c).match(/\r/g)||[]).length;f-=a;c-=a+b;}var e=d.createTextRange();e.collapse(true);e.moveStart('character',f);e.moveEnd('character',c-f);e.select();}else{d.selectionStart=f;d.selectionEnd=Math.min(c,d.value.length);Input.focus(d);}}});
add_properties('Input',{enforceMaxLength:function(c,e){var i=Input.getValue(c);var d=i.length;var f=d-e;if(f>0){var g;var a;try{g=Input.getSelection(c);a=g.end;}catch(b){g=null;a=0;}if(a>=f)d=a;var h=d-f;if(h&&(i.charCodeAt(h-1)&64512)===55296)h--;a=Math.min(a,h);Input.setValue(c,i.slice(0,h)+i.slice(d));if(g)Input.setSelection(c,Math.min(g.start,a),a);}}});onloadRegister(function(){function a(event){var b=event.getTarget();var c=parseInt(b.getAttribute('maxlength'),10);if(c>0&&DOM.isNodeOfType(b,['input','textarea']))Input.enforceMaxLength.bind(Input,b,c).defer();}Event.listen(document.documentElement,{keydown:a,paste:a});});
add_properties('Input',{setMaxLength:function(a,b){if(b>0){a.setAttribute('maxlength',b);Input.enforceMaxLength(a,b);}else a.removeAttribute('maxlength');}});
function TextInputControl(b){this.parent.construct(this,b);var a=this.getRoot();var c=function(){this.update.bind(this).defer();}.bind(this);Event.listen(a,{keydown:c,paste:c});}Class.extend(TextInputControl,'DOMControl');TextInputControl.prototype={setMaxLength:function(a){Input.setMaxLength(this.getRoot(),a);return this;},getValue:function(){return Input.getValue(this.getRoot());},isEmpty:function(){return Input.isEmpty(this.getRoot());},setValue:function(a){Input.setValue(this.getRoot(),a);this.update();return this;},clear:function(){return this.setValue('');},setPlaceholderText:function(a){Input.setPlaceholder(this.getRoot(),a);return this;}};
function TextMetrics(a){this._node=a;var b=this._shadow=$N('textarea',{className:'textMetrics'});var c=['fontSize','fontStyle','fontWeight','fontFamily','lineHeight','wordWrap'];c.each(function(d){CSS.setStyle(b,d,CSS.getStyle(a,d));});document.body.appendChild(b);}TextMetrics.prototype={measure:function(){var a=this._node;var b=this._shadow;var c=a.clientWidth-CSS.getStyleFloat(a,'paddingLeft')-CSS.getStyleFloat(a,'paddingRight');CSS.setStyle(b,'width',c+'px');b.value=a.value+'...';return {width:b.scrollWidth,height:b.scrollHeight};},destroy:function(){DOM.remove(this._shadow);}};
function TextAreaControl(a){this.autogrow=false;this.parent.construct(this,a);this.width=null;Event.listen(a,{focus:this._handleFocus.bind(this)});}Class.extend(TextAreaControl,'TextInputControl');Class.mixin(TextAreaControl,'Arbiter',{setAutogrow:function(a){this.autogrow=a;return this;},onupdate:function(){this.parent.onupdate();if(this.autogrow){var d=this.getRoot();if(!this.metrics)this.metrics=new TextMetrics(d);if(typeof this.minHeight==='undefined'){var c=CSS.getStyleFloat(d,'height');this.minHeight=c>0?c:d.offsetHeight-8;}if(typeof this.isBorderBox==='undefined')if(CSS.getStyle(d,'box-sizing')=='border-box'||CSS.getStyle(d,'-moz-box-sizing')=='border-box'||CSS.getStyle(d,'-webkit-box-sizing')=='border-box'){this.isBorderBox=true;this.borderBoxOffset=CSS.getStyleFloat(d,'padding-top')+CSS.getStyleFloat(d,'padding-bottom')+CSS.getStyleFloat(d,'border-top-width')+CSS.getStyleFloat(d,'border-bottom-width');}else this.isBorderBox=false;var b=this.metrics.measure();var a=Math.max(this.minHeight,b.height);if(this.isBorderBox)a+=this.borderBoxOffset;if(a!=this.height){CSS.setStyle(d,'height',a+'px');this.height=a;Arbiter.inform('reflow');this.inform('resize');}}else if(this.metrics){this.metrics.destroy();this.metrics=null;}},resetHeight:function(){this.height=-1;this.update();},_handleFocus:function(){this.width=null;}});
function KeyEventController(){this.handlers={};document.onkeyup=this.onkeyevent.bind(this,'onkeyup');document.onkeydown=this.onkeyevent.bind(this,'onkeydown');document.onkeypress=this.onkeyevent.bind(this,'onkeypress');}copy_properties(KeyEventController,{instance:null,getInstance:function(){return KeyEventController.instance||(KeyEventController.instance=new KeyEventController());},defaultFilter:function(event,a){event=$E(event);return KeyEventController.filterEventTypes(event,a)&&KeyEventController.filterEventTargets(event,a)&&KeyEventController.filterEventModifiers(event,a);},filterEventTypes:function(event,a){if(a==='onkeydown')return true;return false;},filterEventTargets:function(event,b){var a=event.getTarget();return !DOM.isNodeOfType(a,KeyEventController._interactiveElements)||(a.type in KeyEventController._uninterestingTypes)||(DOM.isNodeOfType(a,['input','textarea'])&&a.value.length===0&&event.keyCode in KeyEventController._controlKeys);},filterEventModifiers:function(event,a){if(event.ctrlKey||event.altKey||event.metaKey||event.repeat)return false;return true;},registerKey:function(f,a,d,g){if(d===undefined)d=KeyEventController.defaultFilter;var b=KeyEventController.getInstance();var c=b.mapKey(f);if(is_empty(b.handlers))onleaveRegister(b.resetHandlers.bind(b));for(var e=0;e<c.length;e++){f=c[e];if(!b.handlers[f]||g)b.handlers[f]=[];b.handlers[f].push({callback:a,filter:d});}},keyCodeMap:{BACKSPACE:[8],TAB:[9],RETURN:[13],ESCAPE:[27],LEFT:[37,63234],UP:[38,63232],RIGHT:[39,63235],DOWN:[40,63233],DELETE:[46],COMMA:[188],PERIOD:[190],'`':[192],'[':[219],']':[221]},_interactiveElements:['input','select','textarea','object','embed'],_uninterestingTypes:{checkbox:1,radio:1,submit:1},_controlKeys:{8:1,9:1,13:1,27:1,37:1,63234:1,38:1,63232:1,39:1,63235:1,40:1,63233:1,46:1}});copy_properties(KeyEventController.prototype,{mapKey:function(a){if(a>=0&&a<=9){if(typeof(a)!='number')a=a.charCodeAt(0)-48;return [48+a,96+a];}var b=KeyEventController.keyCodeMap[a.toUpperCase()];if(b)return b;return [a.toUpperCase().charCodeAt(0)];},onkeyevent:function(i,c){c=$E(c);var d=null;var g=this.handlers[c.keyCode];var b,f,a;if(g)for(var h=0;h<g.length;h++){b=g[h].callback;f=g[h].filter;try{if(!f||f(c,i)){a=b(c,i);if(a===false)return Event.kill(c);}}catch(e){}}return true;},resetHandlers:function(){this.handlers={};}});
function URLScraper(a){this.input=a;this.enable();}Class.mixin(URLScraper,'Arbiter',{reset:function(){this.lastMatch=null;},enable:function(){if(this.events)return;var a=function(b){setTimeout(this.check.bind(this,b),30);};this.events=Event.listen(this.input,{paste:a.bind(this,false),keydown:a.bind(this,true)});},disable:function(){if(!this.events)return;for(var event in this.events)this.events[event].remove();this.events=null;},check:function(b){var c=this.input.value;if(b&&URLScraper.trigger(c))return;var a=URLScraper.match(c);if(a&&a!=this.lastMatch){this.lastMatch=a;this.inform('match',{url:a});}}});(function(){var a='!"#%&\'()*,-./:;<>?@[\\]^_`{|}',r='\u2000-\u206F\u00ab\u00bb';var o='(?:(?:ht|f)tps?)://',g='(?:(?:\\d{1,3}[.]){3}\\d{1,3})',s='(?:\\b)www\\d{0,3}[.]',j='[^\\s'+a+r+']',h='(?:(?:[.:\\-_%@]|'+j+')*'+j+')',p='(?:[.][a-z]{2,4})',n='(?::\\d+){0,1}',d='(?=[\/?#])';var f='(?:'+'(?:'+o+h+n+')|'+'(?:'+g+n+')|'+'(?:'+s+h+p+n+')|'+'(?:'+h+p+n+d+')'+')';var e='[\/#?]',c='\\([^\\s()<>]+\\)',l='[^\\s()<>'+r+']+',k='[^\\s'+a+r+']';var m='(?:'+'(?:'+e+')'+'(?:'+'(?:'+c+'|'+l+')*'+'(?:'+c+'|'+k+')'+')*'+')*';var i=new RegExp('('+'(?:'+f+')'+'(?:'+m+')'+')','im');var b=new RegExp('('+'(?:'+o+h+n+')|'+'(?:'+s+h+p+n+')'+')');var q=/[\s'";]/;URLScraper.match=function(u){var t=(i.exec(u)||[])[1]||null;if(t&&t.indexOf('@')!=-1){return (b.exec(t))?t:null;}else return t;};URLScraper.trigger=function(t){return !q.test(t.charAt(t.length-1));};})();
function rand32(){return Math.floor(Math.random()*4294967295);}function verifyNumber(a){if(typeof a=='undefined'||isNaN(a)||a==Number.POSITIVE_INFINITY||a==Number.NEGATIVE_INFINITY)a=0;return a;}function mod(a,b){var c=a%b;if(c*b<0)c+=b;return c;}function clip(c,b,a){return Math.max(b,Math.min(c,a));}
__d("rect",["vector"],function(d,e,f,c){var b=f('vector');function a(k,j,g,i,h){if(this===window){if(k instanceof a)return k;if(k instanceof b)return new a(k.y,k.x,k.y,k.x,k.domain);return a.getElementBounds($(k));}copy_properties(this,{t:k,r:j,b:g,l:i,domain:h||'pure'});}copy_properties(a.prototype,{w:function(){return this.r-this.l;},h:function(){return this.b-this.t;},toString:function(){return '(('+this.l+', '+this.t+'), ('+this.r+', '+this.b+'))';},contains:function(h){h=a(h).convertTo(this.domain);var g=this;return (g.l<=h.l&&g.r>=h.r&&g.t<=h.t&&g.b>=h.b);},add:function(i,j){if(arguments.length==1){if(i.domain!='pure')i=i.convertTo(this.domain);return this.add(i.x,i.y);}var g=parseFloat(i);var h=parseFloat(j);return new a(this.t+h,this.r+g,this.b+h,this.l+g,this.domain);},sub:function(g,h){if(arguments.length==1){return this.add(g.mul(-1));}else return this.add(-g,-h);},boundWithin:function(g){var h=0,i=0;if(this.l<g.l){h=g.l-this.l;}else if(this.r>g.r)h=g.r-this.r;if(this.t<g.t){i=g.t-this.t;}else if(this.b>g.b)i=g.b-this.b;return this.add(h,i);},getCenter:function(){return new b(this.l+this.w()/2,this.t+this.h()/2,this.domain);},getPositionVector:function(){return new b(this.l,this.t,this.domain);},getDimensionVector:function(){return new b(this.w(),this.h(),'pure');},convertTo:function(g){if(this.domain==g)return this;if(g=='pure')return new a(this.t,this.r,this.b,this.l,'pure');if(this.domain=='pure')return new a(0,0,0,0);var h=new b(this.l,this.t,this.domain).convertTo(g);return new a(h.y,h.x+this.w(),h.y+this.h(),h.x,g);}});copy_properties(a,{deserialize:function(h){var g=h.split(':');return new a(g[1],g[2],g[3],g[0]);},newFromVectors:function(h,g){return new a(h.y,h.x+g.x,h.y+g.y,h.x,h.domain);},getElementBounds:function(g){return a.newFromVectors(b.getElementPosition(g),b.getElementDimensions(g));},getViewportBounds:function(){return a.newFromVectors(b.getScrollPosition(),b.getViewportDimensions());},minimumBoundingBox:function(j){var g=new a(Math.min(),Math.max(),Math.max(),Math.min());var i;for(var h=0;h<j.length;h++){i=j[h];g.t=Math.min(g.t,i.t);g.r=Math.max(g.r,i.r);g.b=Math.max(g.b,i.b);g.l=Math.min(g.l,i.l);}return g;}});d.Rect=e.exports=a;},3);
function htmlspecialchars(a){if(typeof(a)=='undefined'||a===null||!a.toString)return '';if(a===false){return '0';}else if(a===true)return '1';return a.toString().replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#039;').replace(/</g,'&lt;').replace(/>/g,'&gt;');}function htmlize(a){return htmlspecialchars(a).replace(/\n/g,'<br />');}function escape_js_quotes(a){if(typeof(a)=='undefined'||!a.toString)return '';return a.toString().replace(/\\/g,'\\\\').replace(/\n/g,'\\n').replace(/\r/g,'\\r').replace(/"/g,'\\x22').replace(/'/g,'\\\'').replace(/</g,'\\x3c').replace(/>/g,'\\x3e').replace(/&/g,'\\x26');}
function html_hyperlink(g,h,i,e){if(typeof g==='undefined'||!g.toString)return '';if(typeof h!=='function')h=htmlize;if(typeof i!=='function')i=htmlize;var g=g.toString();var f=[];var b;while((b=URLScraper.match(g))){var d=g.indexOf(b);if(d>=0)f.push(h(g.substring(0,d)));var a=i(b);var c=b.replace(/"/g,'%22');if(!(/^[a-z][a-z0-9\-+.]+:\/\//i.test(b)))c='http://'+c;f.push('<a target="_blank" rel="nofollow" href="'+c+'"');if(e)f.push(' onmousedown="UntrustedLink.bootstrap(this, \''+Env.lhsh+'\', event)"');f.push('>'+a+'</a>');g=g.substring(d+b.length);}g&&f.push(h(g));return f.join('');}function nl2br(a){if(typeof(a)=='undefined'||!a.toString)return '';return a.toString().replace(/\n/g,'<br />');}function is_email(a){return /^([\w!.%+\-])+@([\w\-])+(?:\.[\w\-]+)+$/.test(a);}
var OverlayZIndexHelper={getZIndex:function(c,e){e=e||document.body;var b=[];while(c&&c!==e){b.push(c);c=c.parentNode;}for(var d=b.length-1;d>=0;d--){var a=b[d];if(CSS.getStyle(a,'position')!='static'){var f=parseInt(CSS.getStyle(a,'z-index'),10);if(!isNaN(f))return f;}}return 0;}};
Hovercard=window.Hovercard||{RESERVED_WIDTH:297,RESERVED_HEIGHT:237,ARROW_LEFT_OFFSET:32,cache:{},active:{},contextElem:null,fetchDelay:150,showDelay:700,loadingDelay:1000,hideDelay:250,fetchTimer:null,showTimer:null,loadingTimer:null,hideTimer:null,init:function(){if(ua.ie()<7)return;Event.listen(document.documentElement,'mouseover',this.handle.bind(this));},handle:function(event){var a=Parent.byTag(event.getTarget(),'a');if(a&&this.setActive(a)){this.process(a);event.stop();}},setActive:function(b){if(!this.isActive(b)){var a;if(!b||!(a=this.getEndpoint(b))){this.active={};return false;}if(this.active.node!=b){this.active.moveToken&&this.active.moveToken.remove();this.active={node:b,endpoint:a,pos:null};}}return true;},isActive:function(a){return a&&this.contextElem&&this.active.node==a;},getEndpoint:function(a){return a.getAttribute('data-hovercard');},process:function(b){var d=Event.listen(b,'mouseout',function(){clearTimeout(this.fetchTimer);clearTimeout(this.showTimer);d.remove();this.hide();}.bind(this));if(!this.active.moveToken)this.active.moveToken=Event.listen(b,'mousemove',function(event){this.active.pos=Vector2.getEventPosition(event);}.bind(this));clearTimeout(this.fetchTimer);clearTimeout(this.showTimer);clearTimeout(this.hideTimer);var a=this.fetchDelay;var c=this.contextElem?this.hideDelay:this.showDelay;if(b.getAttribute('data-hovercard-instant'))a=c=50;this.fetchTimer=setTimeout(this.fetch.bind(this,b),a);this.showTimer=setTimeout(this.show.bind(this,b),c);},show:function(c,b){this.build();if(this.active.node!=c)return;var a;if(this.cache[this.getEndpoint(c)]){a=this.cache[this.getEndpoint(c)];}else if(b){a={content:'',node:this.loading};}else{var d=this.contextElem?this.hideDelay:this.showDelay;this.loadingTimer=setTimeout(this.show.bind(this,c,true),this.loadingDelay-d);}a&&this.update(a);},hide:function(a){if(!this.contextElem)return;if(a){Arbiter.inform('layer_hidden',{type:'Hovercard'});Arbiter.inform('Hovercard/hide',{node:this.contextElem});if(this.stage&&this.stage.firstChild)this.preload.appendChild(this.stage.firstChild);var b=this.container&&this.container.parentNode;b&&b.removeChild(this.container);this.contextElem=null;}else this.hideTimer=setTimeout(this.hide.bind(this,true),this.hideDelay);},build:function(){this.build=bagofholding;var c=$N('div',{className:'arrow'},$N('i'));this.loading=$N('div',{className:'loading'},_tx("\u03a6\u03bf\u03c1\u03c4\u03ce\u03bd\u03b5\u03b9..."));this.stage=$N('div',{className:'stage'});this.preload=$N('div',{id:'hovercardPreload'},this.loading);this.overlay=$N('div',{className:'HovercardOverlay'});this.container=$N('div',{className:'hovercard clearfix'},[this.stage,c]);Event.listen(window,'scroll',bind(this,'hide',true));Event.listen(this.container,{mouseleave:bind(this,'hide',false),mouseenter:function(){clearTimeout(this.hideTimer);}.bind(this)});var a=null;var b=[];Arbiter.subscribe('Overlay/show',function(d,e){var f=e.overlay;if(f.getContext)if(DOM.contains(this.container,f.getContext())){while(b.length)a.unsubscribe(b.pop());a=f;b=[f.subscribe('mouseenter',function(){clearTimeout(this.hideTimer);}.bind(this)),f.subscribe('mouseleave',bind(this,'hide',false))];}}.bind(this));Arbiter.subscribe('Overlay/hide',function(d,e){if(a===e.overlay){while(b.length)a.unsubscribe(b.pop());a=null;}}.bind(this));Arbiter.subscribe('page_transition',function(){this.abort();this.dirtyAll();}.bind(this),Arbiter.SUBSCRIBE_NEW);Arbiter.subscribe('layer_shown',function(d,e){e.type!='Hovercard'&&e.type!='Overlay'&&this.abort();}.bind(this),Arbiter.SUBSCRIBE_NEW);document.body.appendChild(this.preload);},abort:function(){this.hide(true);clearTimeout(this.showTimer);clearTimeout(this.loadingTimer);},update:function(a){var g=this.contextElem;var f=this.stage.firstChild;var h=(f===this.loading);if(f)this.preload.appendChild(f);var b=a.node;var c=b&&b.getAttribute('data-hovercard-layout');this.container.className='hovercard';c&&CSS.addClass(this.container,c);var d=this.active.node;var e=(d!=g&&!h);if(e)(function(){new AsyncSignal('/ajax/hovercard/shown.php').send();report_data('himp',{ft:{evt:39}});}).defer();var i=OverlayZIndexHelper.getZIndex(d);CSS.setStyle(this.overlay,'z-index',i>200?i:'');this.stage.appendChild(b);this.position(d,d.getAttribute('data-hovercard-fixed'));this.overlay.appendChild(this.container);document.body.appendChild(this.overlay);this.contextElem=d;if(e){if(g){Arbiter.inform('Hovercard/hide',{node:g});}else Arbiter.inform('layer_shown',{type:'Hovercard'});Arbiter.inform('Hovercard/show',{node:d});}},position:function(f,e){if(!this.wCheck&&e){this.wCheck=$N('div',{className:'HovercardWidthCheck'});document.body.appendChild(this.wCheck);}var h;var c=this.wCheck&&e?this.wCheck.offsetWidth:0;var b=this.getBounds(f);var i=b.getPositionVector().convertTo('viewport');var a=i.y<this.RESERVED_HEIGHT;var j=Vector2.getViewportDimensions();var g=(c||j.x)<this.RESERVED_WIDTH+b.l;var d=g?c-b.r:b.l;if(b.w()<2*this.ARROW_LEFT_OFFSET)d+=b.w()/2-this.ARROW_LEFT_OFFSET;if(a){h=e?i.y+b.h():b.b;}else h=e?j.y-i.y:-b.t;CSS.conditionClass(this.container,'HovercardFromRight',g);CSS.conditionClass(this.container,'HovercardBelow',a);CSS.conditionClass(this.container,'HovercardFixed',e);CSS.setStyle(this.container,(g?'right':'left'),d+'px');CSS.setStyle(this.container,(g?'left':'right'),'auto');CSS.setStyle(this.container,(a?'top':'bottom'),h+'px');CSS.setStyle(this.container,(a?'bottom':'top'),'auto');},getBounds:function(e){var a=this.active.pos;var h=e.getClientRects();if(!a||h.length===0)return Rect.getElementBounds(e);var b;var c=false;for(var d=0;d<h.length;d++){var g=new Rect(Math.round(h[d].top),Math.round(h[d].right),Math.round(h[d].bottom),Math.round(h[d].left),'viewport').convertTo('document');var f=g.getPositionVector();var i=f.add(g.getDimensionVector());if(!b||(f.x<=b.l&&f.y>b.t)){if(c)break;b=new Rect(f.y,i.x,i.y,f.x,'document');}else{b.t=Math.min(b.t,f.y);b.b=Math.max(b.b,i.y);b.r=i.x;}if(g.contains(a))c=true;}return b;},fetch:function(d,a){a=typeof a==='function'?a:bagofholding;if(d.id&&this.cache[d.id]!=null)return a();var b=this.getEndpoint(d);if(this.cache[b]!=null)return a();this.setFetchInProgress(b);var c=function(){this.dirty(b);this.abort();}.bind(this);new AsyncRequest(b).setMethod('GET').setReadOnly(true).setHandler(function(f){var e=f.getPayload();if(!e||!e.content){c();return;}e.node=HTML(e.content).getRootNode();delete e.content;this.setCache(b,e);}.bind(this)).setErrorHandler(c).setTransportErrorHandler(c).setFinallyHandler(a).send();},setFetchInProgress:function(a){this.cache[a]=false;},setCache:function(b,a){this.build();this.cache[b]=a;if(this.active.endpoint==b&&this.contextElem){this.update(a);}else DOM.appendContent(this.preload,a.node);},contains:function(a){return DOM.contains(this.stage,a);},dirty:function(b){var a=this.cache[b];var c=a.node;var d=c&&c.parentNode;d&&d.removeChild(c);delete this.cache[b];},dirtyAll:function(){for(var b in this.cache){var a=this.cache[b];a&&!a.cachepermanently&&this.dirty(b);}}};onloadRegister(Hovercard.init.bind(Hovercard));
__d("DocumentTitle",["arbiter"],function(j,k,l,i){var a=l('arbiter');var m=document.title;var b=1500;var h=[];var g=0;var e=null;var f=true;function d(){if(h.length>0){if(f){c.set(h[g].title,true);g=++g%h.length;f=false;}else c.reset();}else{clearInterval(e);e=null;c.reset();}}var c={get:function(){return m;},set:function(n,o){document.title=n;if(!o){m=n;a.inform('update_title',n);}},reset:function(){c.set(c.get(),true);f=true;},blink:function(o){var n={title:o};h.push(n);if(e===null)e=setInterval(d,b);return {stop:function(){var p=h.indexOf(n);if(p>=0){h.splice(p,1);if(g>p){g--;}else if(g==p&&g==h.length)g=0;}}};}};j.DocumentTitle=k.exports=c;},3);
function Poller(c,b,a){this._clearOnQuicklingEvent=!a;this._requestCallback=b;this.setTimePeriod(c);}Poller.MIN_TIME_PERIOD=2000;copy_properties(Poller.prototype,{stop:function(){clearTimeout(this._token);this._token=null;this._cancelRequest();},scheduleRequest:function(){this.stop();if(this._timePeriod)this._token=this._makeRequest.bind(this).defer(this._timePeriod,this._clearOnQuicklingEvent);},requestNow:function(){this.stop();this._makeRequest();},_timePeriod:null,setTimePeriod:function(a){a=a||null;if(a&&(isNaN(a)||a<Poller.MIN_TIME_PERIOD))return;if(a&&this._timePeriod==null)this._token=this._makeRequest.bind(this).defer(a,this._clearOnQuicklingEvents);this._timePeriod=a;},_makeRequest:function(){this._cancelRequest();if(!this._isLoadUser())return;var b=new AsyncRequest();var a=true;b.setInitialHandler(function(){return a;});this._cancelRequest=function(){a=false;};b.setFinallyHandler(this.scheduleRequest.bind(this));b.setInitialHandler=bagofholding;b.setFinallyHandler=bagofholding;this._requestCallback(b);if(a)b.send();},_isLoadUser:function(){return Env.user==getCookie('c_user');},_cancelRequest:bagofholding,getTimePeriod:function(){return this._timePeriod;}});
function XHPTemplate(a){this._model=a;}XHPTemplate.prototype={render:function(){if(HTML.isHTML(this._model))this._model=DOM.setContent(document.createDocumentFragment(),this._model)[0];return this._model.cloneNode(true);},build:function(){return new XHPTemplateInstance(this.render());}};copy_properties(XHPTemplate,{getNode:function(b,a){return XHPTemplate.getNodes(b)[a];},getNodes:function(d){var c=DataStore.get(d,'XHPTemplate:nodes');if(!c){c={};var e=DOM.scry(d,'[data-jsid]');e.push(d);var a=e.length;while(a--){var b=e[a];c[b.getAttribute('data-jsid')]=b;b.removeAttribute('data-jsid');}DataStore.set(d,'XHPTemplate:nodes',c);}return c;}});function XHPTemplateInstance(a){this._root=a;this._populateNodes();}XHPTemplateInstance.prototype={_populateNodes:function(){this._nodes={};this._leaves={};var e=this._root.getElementsByTagName('*');for(var a=0,c=e.length;a<c;a++){var d=e[a];var b=d.getAttribute('data-jsid');if(b){d.removeAttribute('data-jsid');this._nodes[b]=d;this._leaves[b]=!d.childNodes.length;}}},getRoot:function(){return this._root;},getNode:function(a){return this._nodes[a];},setNodeProperty:function(c,a,b){this.getNode(c)[a]=b;return this;},setNodeContent:function(b,a){if(!this._leaves[b])throw new Error("Can't setContent on non-leaf node: "+b);DOM.setContent(this.getNode(b),a);return this;}};
UserActivity=window.UserActivity||{DEFAULT_IDLE_MS:5000,EVENT_INTERVAL_MS:500,_listen:function(){UserActivity._listen=bagofholding;UserActivity._lastActive=+new Date();var a=throttle(function(event){UserActivity._lastActive=+new Date();Arbiter.inform('useractivity/activity',event);},UserActivity.EVENT_INTERVAL_MS,false);Event.listen(document.body,{mouseover:a,keydown:a,click:a});},subscribeOnce:function(a){var b=UserActivity.subscribe(function(){UserActivity.unsubscribe(b);a();});},subscribe:function(a){return Arbiter.subscribe('useractivity/activity',a);},unsubscribe:function(a){Arbiter.unsubscribe(a);},isActive:function(a){return (new Date()-UserActivity._lastActive<(a||UserActivity.DEFAULT_IDLE_MS));}};onloadRegister(UserActivity._listen);
var Live={logAll:false,startup:function(){Live.startup=bagofholding;Arbiter.subscribe(PresenceMessage.getArbiterMessageType('live'),Live.handleMessage.bind(Live));},lookupLiveNode:function(b,a){var c=DOM.scry(document.body,'.live_'+b+'_'+a);c.forEach(function(e){if(DataStore.get(e,'seqnum')===undefined){var d=JSON.parse(e.getAttribute('data-live'));DataStore.set(e,'seqnum',d.seq);}});return c;},handleMessage:function(f,b){var d=b.obj;var c=d.fbid;var a=d.assoc;var e=this.lookupLiveNode(c,a);if(!e)return false;e.forEach(function(l){var k={getRelativeTo:function(){return l;}};if(d.expseq){var i=DataStore.get(l,'seqnum');var g=DataStore.get(l,'message_buffer');if(g===undefined){g={};DataStore.set(l,'message_buffer',g);}var h={obj:d};g[d.expseq]=h;if(d.expseq!=i){Live.log('mismatch',d.fbid,d.expseq,i);return false;}while(true){i=DataStore.get(l,'seqnum');var j=g[i];if(j){Live._applyUpdates(j.obj.updates,k);Live.log('seqmatch',d.fbid,'exp',d.expseq,'cur',i);delete g[i];}else break;}}else Live._applyUpdates(d.updates,k);});},_applyUpdates:function(c,b){try{$A(c).each(function(d){new Function(d).apply(b);});}catch(a){}},log:function(){if(Live.logAll){var a=$A(arguments).join(":");new AsyncSignal('/common/scribe_endpoint.php',{c:'live_sequence',m:a}).send();}}};
function OnVisible(b,c,f,a,d){d=d||{};this.buffer=coalesce(a,300);this.lastY=Vector2.getScrollPosition().y;this.lastTime=(+new Date());var e=throttle(function(){this.targetY=Vector2.getElementPosition(b).y;var l=Vector2.getScrollPosition().y;var j=Vector2.getViewportDimensions().y;var k=l+j+this.buffer;if(k>this.targetY){var i=!f||(l-this.buffer<(this.targetY+Vector2.getElementDimensions(b).y));if(i){this.remove();if(d.detect_speed){var g=(l-this.lastY);var h=g/((+new Date())-this.lastTime+1);if((h>j/100)||(k>=Vector2.getDocumentDimensions().y&&g>1000))return true;}c();}}if(d.detect_speed){this.lastY=l;this.lastTime=(+new Date());}return true;}.bind(this),100);this.scrollListener=Event.listen(window,'scroll',e);this.resizeListener=Event.listen(window,'resize',e);e();onleaveRegister(this.remove.bind(this));}copy_properties(OnVisible.prototype,{remove:function(){if(this.scrollListener){this.scrollListener.remove();this.resizeListener.remove();this.scrollListener=this.resizeListener=null;}}});
var PhotosConst={VIEWER_PERMALINK:0,VIEWER_THEATER:1,VIEWER_SNOWBOX:2,BULK_EDITOR:3,inCenterStage:function(a){return a==PhotosConst.VIEWER_THEATER||a==PhotosConst.VIEWER_SNOWBOX;},SIZE_NORMAL:'n'};
var PhotoInlineCaptionEditor=function(a){this.instanceId=a;PhotoInlineCaptionEditor.instances[a]=this;};copy_properties(PhotoInlineCaptionEditor,{instances:{},getInstance:function(a){return this.instances[a];}});PhotoInlineCaptionEditor.prototype={init:function(a){this.element=a;Event.listen(a,'click',this.handleClick.bind(this));var b=DOM.scry(a,'input[name="caption_id"]');if(b.length)b[0].value=this.instanceId;this.inputStr='';var c=DOM.scry(this.element,'textarea.fbPhotoCaptionInput')[0];if(c)this.inputStr=Input.getValue(c);},handleClick:function(event){var a=event.getTarget();if(Parent.byClass(a,'editIcon')||Parent.byClass(a,'noCaption')){this.toggleEditDescription(true);}else if(Parent.byClass(a,'cancelEdit')){Input.setValue(DOM.find(this.element,'textarea.fbPhotoCaptionInput'),this.inputStr);this.toggleEditDescription(false);}},setCaption:function(a){DOM.setContent(DOM.find(this.element,'.fbPhotoCaptionText'),a);this.toggleEditDescription(false);this.inputStr=Input.getValue(DOM.find(this.element,'textarea.fbPhotoCaptionInput'));},getCaption:function(){return DOM.getText(DOM.find(this.element,'.fbPhotoCaptionText'));},toggleEditDescription:function(c){if(!c)DOM.find(this.element,'textarea.fbPhotoCaptionInput').blur();CSS.conditionClass(this.element,'fbPhotoInlineCaptionEditorEditMode',!!c);if(c){var b=DOM.find(this.element,'textarea.fbPhotoCaptionInput');var a=DOMControl.getInstance(b);a&&a.update();b.focus();}else CSS.conditionClass(DOM.find(this.element,'.noCaption'),'hidden_elem',this.getCaption().length);}};
function PhotosTaggingWaterfall(a){PhotosTaggingWaterfall._queueName=a||PhotosTaggingWaterfall._queueName;}copy_properties(PhotosTaggingWaterfall,{BEGIN:"begin",TAG_FACE:"tag_face",ADD_NAME:"add_name",TAG_CONFIRMED:"tag_confirmed",FINISH:"finish",TYPE_NAME:'type_name',SELECT_NAME:'select_name',_queueName:null,sendSignal:function(b,a){new AsyncSignal('/ajax/photos/tag_waterfall.php',{data:JSON.stringify(b)}).setHandler(a).send();}});
function Typeahead(b,d,a,c){this.args={data:b,view:d,core:a};DataStore.set(c,'Typeahead',this);this.element=c;}Typeahead.getInstance=function(a){var b=Parent.byClass(a,'uiTypeahead');return b?DataStore.get(b,'Typeahead'):null;};Class.mixin(Typeahead,'Arbiter',{init:function(a){this.init=bagofholding;this.getCore();this.proxyEvents();this.initBehaviors(a||[]);this.inform('init',this);this.data.bootstrap();this.core.focus();},getData:function(){if(!this.data){var a=this.args.data;this.data=a;this.data.init();}return this.data;},getView:function(){if(!this.view){var a=this.args.view;var b=ge(a.node_id);if(!b){b=$N('div',{className:'uiTypeaheadView'});DOM.appendContent(this.element,b);}this.view=new window[a.ctor](b,a.options||{});this.view.init();}return this.view;},getCore:function(){if(!this.core){var a=this.args.core;this.core=new window[a.ctor](a.options||{});this.core.init(this.getData(),this.getView(),this.getElement());}return this.core;},getElement:function(){return this.element;},swapData:function(b){var a=this.core;this.data=this.args.data=b;b.init();if(a){a.data=b;a.initData();a.reset();}b.bootstrap();return b;},proxyEvents:function(){[this.data,this.view,this.core].each(function(a){a.subscribe(a.events,this.inform.bind(this));},this);},initBehaviors:function(a){if(window.TypeaheadBehaviors)a.each(function(b){(TypeaheadBehaviors[b]||bagofholding)(this);},this);}});
var TypeaheadUtil=(function(){var b=/[ ]+/g;var c=/[^ ]+/g;var a=/[.,+*?$|#{}()\^\-\[\]\\\/!@%'"~=<>_:;\u2010\u2011\u2012\u2013\u2014\u2015\u30fb]/g;var d={};var r={a:"\u0430 \u00e0 \u00e1 \u00e2 \u00e3 \u00e4 \u00e5",b:"\u0431",c:"\u0446 \u00e7 \u010d",d:"\u0434 \u00f0 \u010f \u0111",e:"\u044d \u0435 \u00e8 \u00e9 \u00ea \u00eb \u011b",f:"\u0444",g:"\u0433 \u011f",h:"\u0445 \u0127",i:"\u0438 \u00ec \u00ed \u00ee \u00ef \u0131",j:"\u0439",k:"\u043a \u0138",l:"\u043b \u013e \u013a \u0140 \u0142",m:"\u043c",n:"\u043d \u00f1 \u0148 \u0149 \u014b",o:"\u043e \u00f8 \u00f6 \u00f5 \u00f4 \u00f3 \u00f2",p:"\u043f",r:"\u0440 \u0159 \u0155",s:"\u0441 \u015f \u0161 \u017f",t:"\u0442 \u0165 \u0167 \u00fe",u:"\u0443 \u044e \u00fc \u00fb \u00fa \u00f9 \u016f",v:"\u0432",y:"\u044b \u00ff \u00fd",z:"\u0437 \u017e",ae:"\u00e6",oe:"\u0153",ts:"\u0446",ch:"\u0447",ij:"\u0133",sh:"\u0448",ss:"\u00df",ya:"\u044f"};for(var m in r){var f=r[m].split(' ');for(var h=0;h<f.length;h++)d[f[h]]=m;}var p={};function e(s){return s?s.replace(a,' '):'';}function g(v){v=(''+v).toLowerCase();var u='';var s='';for(var t=v.length;t--;){s=v.charAt(t);u=(d[s]||s)+u;}return u.replace(b,' ');}function q(t){var u=[];var s=c.exec(t);while(s){s=s[0];u.push(s);s=c.exec(t);}return u;}function o(v,u){v=''+v;if(!p.hasOwnProperty(v)){var t=g(v);var s=e(t);p[v]={value:v,flatValue:t,tokens:q(s),isPrefixQuery:s&&s[s.length-1]!=' '};}if(u&&typeof p[v].sortedTokens=='undefined'){p[v].sortedTokens=copy_properties([],p[v].tokens);p[v].sortedTokens.sort(function(w,x){return x.length-w.length;});}return p[v];}function j(t,z,v){var y=o(z,t=='prefix');var za=t=='prefix'?y.sortedTokens:y.tokens;var w=o(v).tokens;var u={};var x=y.isPrefixQuery&&t=='query'?za.length-1:null;var s=function(zd,zc){for(var zb=0;zb<w.length;++zb){var ze=w[zb];if(!u[zb]&&(ze==zd||((t=='query'&&zc===x||t=='prefix')&&ze.indexOf(zd)===0)))return (u[zb]=true);}return false;};return za.length&&za.every(s);}var i=j.curry('exact');var l=j.curry('query');var k=j.curry('prefix');var n={parse:o,isExactMatch:i,isQueryMatch:l,isPrefixMatch:k};return n;})();
function DataSource(a){this._maxResults=a.maxResults||10;this.token=a.token;this.queryData=a.queryData||{};this.queryEndpoint=a.queryEndpoint||'';this.bootstrapData=a.bootstrapData||{};this.bootstrapEndpoint=a.bootstrapEndpoint||'';this._exclusions=a.exclusions||[];this._indexedFields=a.indexedFields||['text','tokens'];this._alwaysPrefixMatch=a.alwaysPrefixMatch||false;this._minExactMatchLength=4;}Class.mixin(DataSource,'Arbiter',{events:['activity','query','respond'],init:function(){this.init=bagofholding;this._fields=Object.from(this._indexedFields);this._activeQueries=0;this.dirty();},dirty:function(){this.value='';this._bootstrapped=false;this._data={};this.localCache={};this.queryCache={};},bootstrap:function(){if(this._bootstrapped)return;this.bootstrapWithoutToken();this._bootstrapped=true;},bootstrapWithoutToken:function(){this.fetch(this.bootstrapEndpoint,this.bootstrapData,{token:this.token});},bootstrapWithToken:function(){var a=copy_properties({},this.bootstrapData);a.token=this.token;this.fetch(this.bootstrapEndpoint,a,{replaceCache:true});},query:function(f,c,a){this.inform('beforeQuery',{value:f});var e=this.buildUids(f,[],a);var d=this.respond(f,e);this.value=f;this.inform('query',{value:f,results:d});var b=TypeaheadUtil.parse(f).flatValue;if(c||!b||!this.queryEndpoint||this.getQueryCache().hasOwnProperty(b)||!this.shouldFetchMoreResults(d))return false;this.inform('queryEndpoint',{value:f});this.fetch(this.queryEndpoint,this.getQueryData(f,e),{value:f,exclusions:a});return true;},shouldFetchMoreResults:function(a){return a.length<this._maxResults;},getQueryData:function(c,b){var a=copy_properties({value:c},this.queryData||{});b=b||[];if(b.length)a.existing_ids=b.join(',');return a;},setQueryData:function(a,b){if(b)this.queryData={};copy_properties(this.queryData,a);return this;},setBootstrapData:function(a,b){if(b)this.bootstrapData={};copy_properties(this.bootstrapData,a);return this;},getExclusions:function(){return $A(this._exclusions);},setExclusions:function(a){this._exclusions=a||[];},setFilter:function(a){this.filter=a;},respond:function(d,c,a){var b=this.buildData(c);this.inform('respond',{value:d,results:b,isAsync:!!a});return b;},asyncErrorHandler:bagofholding,fetch:function(c,b,d){if(!c)return;var a=new AsyncRequest().setURI(c).setData(b).setMethod('GET').setReadOnly(true).setHandler(function(e){this.fetchHandler(e,d||{});}.bind(this)).setFinallyHandler(function(){this._activeQueries--;if(!this._activeQueries)this.inform('activity',{activity:false});}.bind(this));a.setErrorHandler(this.asyncErrorHandler);this.inform('beforeFetch',{request:a});a.send();if(!this._activeQueries)this.inform('activity',{activity:true});this._activeQueries++;},fetchHandler:function(d,b){var e=b.value;var a=b.exclusions;if(!e&&b.replaceCache)this.localCache={};this.addEntries(d.getPayload().entries,e);this.inform('fetchComplete',{response:d,value:e});var c=(!e&&this.value)?this.value:e;this.respond(c,this.buildUids(c,[],a),true);if(!e&&b.token&&d.getPayload().token!==b.token)this.bootstrapWithToken();},addEntries:function(b,e){var c=this.processEntries($A(b||[]),e);var a=this.buildUids(e,c);if(e){var d=this.getQueryCache();d[TypeaheadUtil.parse(e).flatValue]=a;}else this.fillCache(a);},processEntries:function(a,b){return a.map(function(e,d){var f=(e.uid=e.uid+'');var c=this.getEntry(f);if(!c){c=e;c.query=b;this.setEntry(f,c);}else copy_properties(c,e);c.index===undefined&&(c.index=d);return f;},this);},getAllEntries:function(){return this._data||{};},getEntry:function(a){return this._data[a]||null;},setEntry:function(b,a){this._data[b]=a;},fillCache:function(b){var a=this.localCache;b.each(function(g){var d=this.getEntry(g);if(!d)return;d.bootstrapped=true;var f=TypeaheadUtil.parse(this.getTextToIndex(d)).tokens;for(var c=0,e=f.length;c<e;++c){var h=f[c];if(!a.hasOwnProperty(h))a[h]={};a[h][g]=true;}},this);},getTextToIndex:function(c){if(c.textToIndex)return c.textToIndex;var d=[];for(var b in this._fields){var a=c[b];if(a)d.push(a.join?a.join(' '):a);}return (c.textToIndex=d.join(' '));},mergeUids:function(a,c,b,e){var d=function(f,g){return this.getEntry(f).index-this.getEntry(g).index;}.bind(this);return a.sort(d).concat(c,b);},buildUids:function(h,d,a){if(!d)d=[];if(!h)return d;if(!a)a=[];var b=this.buildCacheResults(h,this.localCache);var f=this.buildQueryResults(h);var e=this.mergeUids(b,f,d,h);var g=Object.from(a.concat(this._exclusions));var c=e.filter(function(i){if(g.hasOwnProperty(i)||!this.getEntry(i))return false;if(this.filter&&!this.filter(this.getEntry(i)))return false;return (g[i]=true);},this);return this.uidsIncludingExact(h,c,g);},uidsIncludingExact:function(g,d,f){var e=d.length;if(g.length<this._minExactMatchLength||e<=this._maxResults)return d;for(var c=0;c<e;++c){var a=this.getEntry(d[c]);a.text_lower||(a.text_lower=a.text.toLowerCase());if(a.text_lower===TypeaheadUtil.parse(g).flatValue){if(c>=this._maxResults){var b=d.splice(c,1);d.splice(this._maxResults-1,0,b);}break;}}return d;},buildData:function(d){var c=[];var b=Math.min(d.length,this._maxResults);for(var a=0;a<b;++a)c.push(this.getEntry(d[a]));return c;},findQueryCache:function(e){var b=0;var a=null;var d=this.getQueryCache();for(var c in d)if(e.indexOf(c)==0&&c.length>b){b=c.length;a=c;}return d[a]||[];},buildQueryResults:function(c){var a=TypeaheadUtil.parse(c).flatValue;var b=this.findQueryCache(a);if(this.getQueryCache().hasOwnProperty(a))return b;return this.filterQueryResults(c,b);},filterQueryResults:function(c,b){var a=this._alwaysPrefixMatch?TypeaheadUtil.isPrefixMatch:TypeaheadUtil.isQueryMatch;return b.filter(function(d){return a(c,this.getTextToIndex(this.getEntry(d)));},this);},buildCacheResults:function(r,a){var k=TypeaheadUtil.parse(r,this._alwaysPrefixMatch);var l=this._alwaysPrefixMatch?k.sortedTokens:k.tokens;var h=l.length;var i=k.isPrefixQuery?h-1:null;var e={};var j={};var o={};var f=[];var c=false;var q={};var p=0;for(var d=0;d<h;++d){var m=l[d];if(!q.hasOwnProperty(m)){p++;q[m]=true;}else continue;for(var g in a)if((!e.hasOwnProperty(g)&&g===m)||((this._alwaysPrefixMatch||i===d)&&g.indexOf(m)===0)){if(g===m){if(j.hasOwnProperty(g))c=true;e[g]=true;}else{if(e.hasOwnProperty(g)||j.hasOwnProperty(g))c=true;j[g]=true;}for(var n in a[g])if(d===0||(o.hasOwnProperty(n)&&o[n]==p-1))o[n]=p;}}for(var b in o)if(o[b]==p)f.push(b);if(c||p<h)f=this.filterQueryResults(r,f);return f;},getQueryCache:function(){return this.queryCache;},setMaxResults:function(a){this._maxResults=a;this.value&&this.respond(this.value,this.buildUids(this.value));},updateToken:function(a){this.token=a;this.dirty();return this;}});
function photos_viewer_version(){if(CSS.hasClass(document.documentElement,'theaterMode')){return PhotosConst.VIEWER_SNOWBOX;}else return PhotosConst.VIEWER_PERMALINK;}
function PhotoTagger(a){this.version=a;PhotoTagger.instances[a]=this;}PhotoTagger.instances={};PhotoTagger.ACTIVATE_TAGGING='PhotoTagger.ACTIVATE_TAGGING';PhotoTagger.getInstance=function(a){return PhotoTagger.instances[a];};PhotoTagger.getCurrentInstance=function(){return PhotoTagger.getInstance(photos_viewer_version());};copy_properties(PhotoTagger.prototype,{TAG_BOX_SIZE:100,datasources:{},photoData:{},elemNames:{1:{tagger:'div.theaterTagger',addTagLink:'div.fbPhotosTheaterActions',overlayActions:'div.fbPhotoTheaterButtons',tagAction:'fbPhotosTheaterActionsTag',image:'div.stage img'},2:{tagger:'div.snowboxTagger',addTagLink:'div.fbPhotosPhotoActions',overlayActions:'div.fbPhotosPhotoButtons',tagAction:'fbPhotosPhotoActionsTag',image:'div.stage img'}},init:function(a,b){this.root=a;this.tokenizer=b;this._qn=null;this.typeahead=b.getTypeahead();this.clickState=DOM.find(this.root,'div.stageActions');this.tagger=DOM.find(this.clickState,this.elemNames[this.version].tagger);this.faceBox=DOM.find(this.tagger,'div.faceBox');this.newTagBox=DOM.find(this.clickState,'div.newTagBox');this.addTagLink=DOM.find(this.root,this.elemNames[this.version].addTagLink);this.overlayActions=DOM.find(this.root,this.elemNames[this.version].overlayActions);this.setupHandlers();this.hideNewTagTimer=null;this.fetchTaggingSuggestions({owner:this.photoData.owner});this.setDataSource(this.typeahead.getData());return this;},fetchTaggingSuggestions:function(b){new AsyncRequest().setURI('/ajax/photos/theater/tags_init.php').setData(b).setOption('retries',1).setHandler(function(c){this.typeahead.getView().setSuggestions(c.getPayload().taggees);}.bind(this)).send();var a=this.typeahead.subscribe('activity',function(c,d){if(d&&!d.activity){this.updateWithSuggestions();this.typeahead.unsubscribe(a);this.typeahead.subscribe('focus',this.updateWithSuggestions.bind(this));this.tokenizer.subscribe('removeToken',this.updateWithSuggestions.bind(this));this.tokenizer.subscribe('addToken',this.addSuggestion.bind(this));this.typeahead.subscribe('respond',function(e,f){if(f&&!f.results.length)this.updateWithSuggestions();}.bind(this));}}.bind(this));},setupHandlers:function(){this.handlers=[Event.listen(this.clickState,'click',this.addTag.bind(this)),Event.listen(window,'resize',this.hideTagger.bind(this)),Event.listen(this.addTagLink,'click',this.checkActions.bind(this)),Event.listen(this.overlayActions,'click',this.checkActions.bind(this))];if(this.version==PhotosConst.VIEWER_THEATER){this.subscriptions=[Arbiter.subscribe(PhotoTheater.PAGE,this.restartTagging.bind(this)),Arbiter.subscribe(PhotoTheater.DATA_CHANGE,this.setPhotoData.bind(this)),Arbiter.subscribe(PhotoTheater.CLOSE,this.deactivateTagging.bind(this))];}else if(this.version==PhotosConst.VIEWER_SNOWBOX)this.subscriptions=[Arbiter.subscribe(PhotoSnowbox.PAGE,this.restartTagging.bind(this)),Arbiter.subscribe(PhotoSnowbox.DATA_CHANGE,this.setPhotoData.bind(this)),Arbiter.subscribe(PhotoSnowbox.CLOSE,this.deactivateTagging.bind(this))];this.tokenizer.subscribe('addToken',this.saveTag.bind(this));this.tokenizer.subscribe('removeToken',this.removeTag.bind(this));this.tokenizer.subscribe('markTagAsSpam',this.markTagAsSpam.bind(this));},getTaggingSource:function(){if(this.version==PhotosConst.VIEWER_SNOWBOX){return 'snowbox';}else if(this.version==PhotosConst.VIEWER_THEATER){return 'center_stage';}else return null;},updateWithSuggestions:function(a,c){var e=this.typeahead.getData().buildUids(' ',this.typeahead.getView().getSuggestions(),this.typeahead.getCore().getExclusions());if(!e.length)return;var d=this.typeahead.getData().respond('',e);for(var b=0;b<d.length;b++)d[b].index=-1000+b;},addSuggestion:function(a,b){var c=b.info&&b.info.uid;if(c)this.typeahead.getView().addSuggestion(c);},setQueueName:function(a){this._qn=a;return this;},_sendWaterfallLogSignal:function(a){PhotosTaggingWaterfall.sendSignal({qn:this._qn,source:this.getTaggingSource(),step:a,pid:this.photoData.pid});},_bumpQueueName:function(){if(this._qn)this._qn+=1;},activateTagging:function(){Arbiter.inform(PhotoTagger.ACTIVATE_TAGGING);if(this.getDataSource()){this.dataSourceFetched(this.getDataSource());}else new AsyncRequest('/ajax/photos/theater/fetch_datasource.php').setData({fbid:this.photoData.fbid,version:this.version}).send();},restartTagging:function(){this.hideNewTag();this.hideTagger();if(this.taggingMode===true)this.activateTagging();},getDataSource:function(){return this.datasources[this.getDataSourceKey()];},getDataSourceKey:function(){if(this.photoData.ownertype=='user'&&!this.photoData.obj_id)return 'friends';return this.photoData.obj_id||this.photoData.owner;},setDataSource:function(a){if(this.typeahead.getData()!=a)this.typeahead.swapData(a);this.datasources[this.getDataSourceKey()]=a;},dataSourceFetched:function(a){this.taggingMode=true;CSS.addClass(this.root,'taggingMode');this._bumpQueueName();this._sendWaterfallLogSignal(PhotosTaggingWaterfall.BEGIN);this.setDataSource(a);},deactivateTagging:function(){if(this.taggingMode===true)this._sendWaterfallLogSignal(PhotosTaggingWaterfall.FINISH);this.taggingMode=false;this.hideNewTag();this.hideTagger();CSS.removeClass(this.root,'taggingMode');},checkActions:function(event){var a=event.getTarget();if(Parent.byClass(a,this.elemNames[this.version].tagAction))this.taggingMode?this.deactivateTagging():this.activateTagging();},hideTagger:function(){CSS.hide(this.tagger);},showTagger:function(){CSS.show(this.tagger);var a=DOM.find(this.tagger,'input.textInput');Input.reset(a);a.focus();this.updateWithSuggestions();this.hideNewTag();},showNewTag:function(a){if(!this.newTagBox)return;DOM.setContent(DOM.find(this.newTagBox,'div.tagName'),$N('span',null,a));CSS.show(this.newTagBox);this.hideNewTagTimer=setTimeout(this.hideNewTag.bind(this),3000);},hideNewTag:function(){if(!this.newTagBox)return;if(this.hideNewTagTimer!==null){clearTimeout(this.hideNewTagTimer);this.hideNewTagTimer=null;}CSS.hide(this.newTagBox);},getTaggerPositioningOrigin:function(){return Vector2.getElementPosition(this.clickState,'document');},addTag:function(event){var d=event.getTarget();if(!this.taggingMode||Parent.byClass(d,'fbPhotosPhotoButtons')||Parent.byClass(d,'photoTagTypeahead'))return;var b=this.getPhotoOnStage();var a=Vector2.getEventPosition(event);var c=this.calcTaggerPosition(b,a);this.calcClickPoint(b,a);if(!c){this.hideTagger();return;}c.setElementPosition(this.tagger);if(this.newTagBox)c.setElementPosition(this.newTagBox);this.showTagger();this._sendWaterfallLogSignal(PhotosTaggingWaterfall.TAG_FACE);},getPhotoOnStage:function(){return DOM.find(this.root,this.elemNames[this.version].image);},calcTaggerPosition:function(h,b){var e=Vector2.getElementPosition(h);var d=Vector2.getElementDimensions(h);var a=new Vector2(this.TAG_BOX_SIZE/2,this.TAG_BOX_SIZE/2);var g=b.sub(e);for(var c in g){if(b[c]<e[c]||b[c]>e[c]+d[c])return null;if(g[c]<(this.TAG_BOX_SIZE/2)){a[c]=g[c];}else if(d[c]<g[c]+(this.TAG_BOX_SIZE/2))a[c]=this.TAG_BOX_SIZE-(d[c]-g[c]);}var f=b.sub(this.getTaggerPositioningOrigin());return f.sub(a.x,a.y);},calcClickPoint:function(d,b){var c=Vector2.getElementDimensions(d);var a=Vector2.getElementPosition(d);var e=b.sub(a);this.clickPoint={x:e.x/c.x,y:e.y/c.y};},saveTag:function(a,c){var b=this.getTaggingData('add',c.isFreeform()?'':c.getValue(),c.getText());b.x=this.clickPoint.x*100;b.y=this.clickPoint.y*100;new AsyncRequest().setURI('/ajax/photo_tagging_ajax.php').setMethod('POST').setData(b).setAllowCrossPageTransition(true).setHandler(this.tagsChangeHandler.bind(this)).setErrorHandler(this.checkError.bind(this,c)).send();this.showNewTag(c.getText());this.hideTagger();},getTaggingData:function(a,c,b){return {cs_ver:this.version,pid:this.photoData.pid,id:this.photoData.owner,subject:c,name:b,action:a,source:this.getTaggingSource(),qn:this._qn,position:this.getPosition()};},getPosition:function(){var a=this.getPhotoViewerObj();return a&&a.position;},getPhotoViewerObj:function(){if(this.version==PhotosConst.VIEWER_THEATER){return window.PhotoTheater;}else if(this.version==PhotosConst.VIEWER_SNOWBOX)return window.PhotoSnowbox;return null;},tagsChangeHandler:function(b){var a=this.getPhotoViewerObj();if(a&&a.isOpen)a.saveTagComplete(b);},checkError:function(b,a){if(a.getPayload()&&a.getPayload().clear_tag){b.already_untagged=true;this.tokenizer.removeToken(b);}ErrorDialog.showAsyncError(a);},removeTag:function(a,c){if(c.already_untagged)return;var b='remove';if(DOM.scry(c.element,'a.pending')[0])b='retract';if(c.blockUser)b='remove_block';new AsyncRequest().setURI('/ajax/photo_tagging_ajax.php').setMethod('POST').setData(this.getTaggingData(b,c.isFreeform()?'':c.getInfo().uid,c.getInfo().text)).setHandler(this.tagsChangeHandler.bind(this)).setAllowCrossPageTransition(true).send();},removeTagByID:function(b){var c=this.tokenizer.tokens;for(var a=0;a<c.length;a++)if(c[a].info.uid==b)return this.removeTag(null,c[a]);},setPhotoData:function(a,b){this.photoData=b;return this;},markTagAsSpam:function(a,b){new AsyncRequest().setURI('/ajax/photo_tagging_ajax.php').setMethod('POST').setData(this.getTaggingData('mark_as_spam',b,null)).send();}});
function PhotoSnowboxLog(){}copy_properties(PhotoSnowboxLog,{UNKNOWN:0,ESC:1,X:2,OUTSIDE:3,UNLOAD:4,NAVIGATE:5,AGGREGATE:6,AGGREGATION_COUNT:20,set:null,time:null,views:0,fbidList:[],width:0,height:0,first:false,last:false,logIds:false,initLogging:function(){this.set=null;this.time=new Date();this.views=0;this.first=true;this.last=false;this.logIds=false;var a=Vector2.getViewportDimensions();this.width=a.x;this.height=a.y;},setLogFbids:function(a){this.logIds=a;},setPhotoSet:function(a){this.set=a;},addPhotoView:function(a){if(this.logIds&&this.views>=this.AGGREGATION_COUNT)this.logPhotoViews(this.AGGREGATE);this.views++;if(a)this.fbidList.push([a.fbid,a.owner,+new Date()]);},logPhotoViews:function(a){if(this.views){var c=Vector2.getViewportDimensions();if(a!=this.AGGREGATE)this.last=true;var b={set:this.set,time:new Date()-this.time,fbids:this.logIds?this.fbidList:[],width:c.x||this.width,height:c.y||this.height,first:this.first,last:this.last,close:a?a:this.UNKNOWN};new AsyncRequest().setURI('/ajax/photos/snowbox/session_logging.php').setAllowCrossPageTransition(true).setOption('asynchronous',(a!=PhotoSnowboxLog.UNLOAD)).setOption('suppressErrorHandlerWarning',true).setData(b).send();this.views=0;this.fbidList=[];this.first=false;if(this.last){this.set=null;this.logIds=false;}}}});onunloadRegister(function(){PhotoSnowboxLog.logPhotoViews(PhotoSnowboxLog.UNLOAD);});
function useFacebookReferer(b,a){var d=false;function e(){if(d)return;d=true;b.contentWindow.document.body.style.margin=0;a();}var c=(URI().isSecure()?'https://s-static.ak.facebook.com':'http://static.ak.facebook.com')+'/common/referer_frame.php';Event.listen(b,'load',e);b.src=c;}function useFacebookRefererHtml(b,a){useFacebookReferer(b,function(){b.contentWindow.document.body.innerHTML=a;});}
if(typeof deconcept=="undefined")var deconcept={};if(typeof deconcept.util=="undefined")deconcept.util={};if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil={};deconcept.SWFObject=function(h,d,j,c,i,a,f,l,g,b){if(!document.getElementById)return;this.DETECT_KEY=b?b:'detectflash';this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params={};this.variables={};this.attributes=[];this.fallback_html='';this.fallback_js_fcn=function(){};if(h)this.setAttribute('swf',h);if(d)this.setAttribute('id',d);if(j)this.setAttribute('width',j);if(c)this.setAttribute('height',c);this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(i){if(!(i instanceof Array))i=[i];var k;i.each(function(n){k=new deconcept.PlayerVersion(n.toString().split('.'));if(k.major==this.installedVer.major){this.setAttribute('version',k);return;}else if(!this.getAttribute('version')||k.major<this.getAttribute('version').major)this.setAttribute('version',k);}.bind(this));}if(!window.opera&&document.all&&this.installedVer.major>7)if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}if(a)this.addParam('bgcolor',a);var e=f?f:'high';this.addParam('quality',e);this.setAttribute('useExpressInstall',false);this.setAttribute('doExpressInstall',false);var m=(l)?l:window.location;this.setAttribute('xiRedirectUrl',m);this.setAttribute('redirectUrl','');if(g)this.setAttribute('redirectUrl',g);this.setAttribute('useIframe',false);};deconcept.SWFObject.ieWorkaroundApplied=false;deconcept.SWFObject.ensureIEWorkaroundAttached=function(){if(!deconcept.SWFObject.ieWorkaroundApplied&&document.attachEvent){deconcept.SWFObject.ieWorkaroundApplied=true;document.attachEvent('onpropertychange',deconcept.SWFObject.onDocumentPropertyChange);}};deconcept.SWFObject.onDocumentPropertyChange=function(event){if(event.propertyName=="title"){var a=document.title;if(a!=null&&a.indexOf('#!')!=-1){a=a.substring(0,a.indexOf('#!'));document.title=a;}}};deconcept.SWFObject.prototype={useExpressInstall:function(a){this.xiSWFPath=!a?"/swf/expressinstall.swf":a;this.setAttribute('useExpressInstall',true);},setAttribute:function(a,b){this.attributes[a]=b;},getAttribute:function(a){return this.attributes[a]||"";},addParam:function(a,b){this.params[a]=b;},getParams:function(){return this.params;},addVariable:function(a,b){this.variables[a]=b;},getVariable:function(a){return this.variables[a]||"";},getVariables:function(){return this.variables;},getVariablePairs:function(){var b=[];var a;var c=this.getVariables();for(a in c)b[b.length]=a+"="+c[a];return b;},getSWFHTML:function(){var d="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute('swf',this.xiSWFPath);}d='<embed type="application/x-shockwave-flash" src="'+htmlspecialchars(this.getAttribute('swf'))+'" width="'+htmlspecialchars(this.getAttribute('width'))+'" height="'+htmlspecialchars(this.getAttribute('height'))+'" style="'+htmlspecialchars(this.getAttribute('style')||"")+'"';d+=' id="'+htmlspecialchars(this.getAttribute('id'))+'" name="'+htmlspecialchars(this.getAttribute('id'))+'" ';var c=this.getParams();for(var a in c)d+=htmlspecialchars(a)+'="'+htmlspecialchars(c[a])+'" ';var b=this.getVariablePairs().join("&");if(b.length>0)d+='flashvars="'+b+'"';d+='/>';}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute('swf',this.xiSWFPath);}d='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+(this.getAttribute('style')||"")+'">';d+='<param name="movie" value="'+this.getAttribute('swf')+'" />';var c=this.getParams();for(var a in c)d+='<param name="'+a+'" value="'+c[a]+'" />';var b=this.getVariablePairs().join("&");if(b.length>0)d+='<param name="flashvars" value="'+b+'" />';d+="</object>";}return d;},write:function(a){if(this.getAttribute('useExpressInstall')){var b=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(b)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}var c=(typeof a=='string')?document.getElementById(a):a;if(!c)return false;CSS.addClass(c,'swfObject');c.setAttribute('data-swfid',this.getAttribute('id'));if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){if(!this.getAttribute('useIframe')){deconcept.SWFObject.ensureIEWorkaroundAttached();c.innerHTML=this.getSWFHTML();}else this._createIframe(c);return true;}else{if(this.getAttribute('redirectUrl')!="")document.location.replace(this.getAttribute('redirectUrl'));need_version=this.getAttribute('version').major+'.'+this.getAttribute('version').minor+'.'+this.getAttribute('version').rev;have_version=this.installedVer.major+'.'+this.installedVer.minor+'.'+this.installedVer.rev;this.fallback_js_fcn(have_version,need_version);c.innerHTML=this.fallback_html;}return false;},_createIframe:function(b){var a=$N('iframe',{width:this.getAttribute('width'),height:this.getAttribute('height'),frameBorder:0});DOM.empty(b);b.appendChild(a);useFacebookRefererHtml.bind(null,a,this.getSWFHTML()).defer();}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var a=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){for(var g=0;g<navigator.plugins.length;g++)try{var x=navigator.plugins[g];if(x.name=='Shockwave Flash'){PlayerVersion_tmp=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+(r|d)|\s+b[0-9]+)/,".").split("."));if(typeof a=='undefined'||PlayerVersion_tmp.major>a.major||(PlayerVersion_tmp.major==a.major&&(PlayerVersion_tmp.minor>a.minor||(PlayerVersion_tmp.minor==a.minor&&PlayerVersion_tmp.rev>a.rev))))a=PlayerVersion_tmp;}}catch(f){}}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var b=1;var c=3;while(b)try{c++;b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+c);a=new deconcept.PlayerVersion([c,0,0]);}catch(d){b=null;}}else{try{var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");a=new deconcept.PlayerVersion([6,0,21]);b.AllowScriptAccess="always";}catch(e2){if(a.major==6)return a;}try{b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e3){}}if(b!=null)a=new deconcept.PlayerVersion(b.GetVariable("$version").split(" ")[1].split(","));}return a;};deconcept.PlayerVersion=function(a){this.major=a[0]!=null?parseInt(a[0]):0;this.minor=a[1]!=null?parseInt(a[1]):0;this.rev=a[2]!=null?parseInt(a[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(a){if(this.major<a.major)return false;if(this.major>a.major)return true;if(this.minor<a.minor)return false;if(this.minor>a.minor)return true;if(this.rev<a.rev)return false;return true;};deconcept.util={getRequestParameter:function(c){var d=document.location.search||document.location.hash;if(c==null)return d;if(d){var b=d.substring(1).split("&");for(var a=0;a<b.length;a++)if(b[a].substring(0,b[a].indexOf("="))==c)return b[a].substring((b[a].indexOf("=")+1));}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var b=document.getElementsByTagName("OBJECT");for(var a=b.length-1;a>=0;a--){b[a].style.display='none';for(var c in b[a])if(typeof b[a][c]=='function')b[a][c]=function(){};}};if(!document.getElementById&&document.all)document.getElementById=function(a){return document.all[a];};var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;function spawn_flash_update_dialog(){new AsyncRequest().setURI('/ajax/flash_update_dialog.php').setMethod('GET').setReadOnly(true).send();}function setFlashFallback(d,g){var b=ge(d);var a=deconcept.SWFObjectUtil.getPlayerVersion();var e;g.each(function(h){h=new deconcept.PlayerVersion(h.toString().split('.'));if(h.major==a.major){e=h;return;}else if(typeof e=='undefined'||h.major<e.major)e=h;}.bind(this));if(b&&a.major>0){var c=a.major+'.'+a.minor+'.'+a.rev;var f=e.major+'.'+e.minor+'.'+e.rev;b.innerHTML=_tx("\u0393\u03b9\u03b1 \u03bd\u03b1 \u03b4\u03b5\u03af\u03c4\u03b5 \u03b1\u03c5\u03c4\u03cc \u03c4\u03bf \u03c0\u03b5\u03c1\u03b9\u03b5\u03c7\u03cc\u03bc\u03b5\u03bd\u03bf, \u03c7\u03c1\u03b5\u03b9\u03ac\u03b6\u03b5\u03c3\u03c4\u03b5 \u03c4\u03b7\u03bd \u03ad\u03ba\u03b4\u03bf\u03c3\u03b7 {required-version} \u03c4\u03bf\u03c5 Flash Player. \u03a4\u03ce\u03c1\u03b1 \u03ad\u03c7\u03b5\u03c4\u03b5 \u03c4\u03b7\u03bd \u03ad\u03ba\u03b4\u03bf\u03c3\u03b7 {current-version}. \u039a\u03b1\u03c4\u03b5\u03b2\u03ac\u03c3\u03c4\u03b5 \u03c3\u03c4\u03bf\u03bd \u03c5\u03c0\u03bf\u03bb\u03bf\u03b3\u03b9\u03c3\u03c4\u03ae \u03c3\u03b1\u03c2 \u03c4\u03b7\u03bd \u03c4\u03b5\u03bb\u03b5\u03c5\u03c4\u03b1\u03af\u03b1 \u03ad\u03ba\u03b4\u03bf\u03c3\u03b7 \u03c4\u03bf\u03c5 Flash Player.",{'required-version':f,'current-version':c});}}function getFlashPlayer(){goURI('http://get.adobe.com/flashplayer');return false;}function showFlashErrorDialog(b,a){Bootloader.loadComponents('error-dialog',function(){ErrorDialog.show(b,a);});}
function PhotosUtils(){}PhotosUtils.getNearestBox=function(e,l,k,j,c,a){var f=e.sub(l);var d=k.magnitude();var g=null;for(var b in a){var h=a[b];var i=new Rect(h.t/100*k.y*j,h.r/100*k.x*j,h.b/100*k.y*j,h.l/100*k.x*j);var m=i.getCenter().sub(f);if(Math.abs(m.x)<=c&&Math.abs(m.y)<=c&&m.magnitude()<=d){d=m.magnitude();g=b;if(0===d)break;}}return g;};
__d("UIPagelet",["dom","ajaxpipe","async"],function(e,f,g,d){var b=g('dom');var a=g('ajaxpipe');function c(j,k,h,i){this._id=j||null;this._element=ge(j||b.$N('div'));this._src=k||null;this._context_data=h||{};this._data=i||{};this._handler=bagofholding;this._request=null;this._use_ajaxpipe=false;this._is_bundle=true;this._allow_cross_page_transition=false;this._append=false;return this;}c.loadFromEndpoint=function(j,n,h,k){k=k||{};var i='/ajax/pagelet/generic.php/';if(k.intern)i='/intern'+i;var m=(i+j).replace(/\/+/g,'/');if(k.subdomain)m=URI(m).setSubdomain(k.subdomain);var l=new c(n,m,h).setUseAjaxPipe(k.usePipe).setBundleOption(j.substring(0,8)!='/intern/'&&k.bundle!==false).setAppend(k.append).setJSNonBlock(k.jsNonblock).setConstHeight(k.constHeight).setAllowCrossPageTransition(k.crossPage);k.handler&&l.setHandler(k.handler);l.go();return l;};copy_properties(c.prototype,{getElement:function(h){h=h||false;if(h)this._element=ge(this._id);return this._element;},setHandler:function(h){this._handler=h;return this;},go:function(i,h){if(arguments.length>=2||typeof i=='string'){this._src=i;this._data=h||{};}else if(arguments.length==1)this._data=i;this.refresh();return this;},setAllowCrossPageTransition:function(h){this._allow_cross_page_transition=h;return this;},setBundleOption:function(h){this._is_bundle=h;return this;},refresh:function(j){var i=function(l){this._request=null;if(j&&this._id)this._element=ge(this._id);var k=HTML(l.getPayload());if(this._append){b.appendContent(this._element,k);}else b.setContent(this._element,k);this._handler();}.bind(this);if(this._use_ajaxpipe){this._request=new a();this._request.setCanvasId(this._id).setAppend(this._append).setConstHeight(this._constHeight).setJSNonBlock(this._jsNonblock);}else{var h=g('async');this._request=new h().setMethod('GET').setReadOnly(true).setOption('bundle',this._is_bundle).setHandler(i);}this._request.setURI(this._src).setAllowCrossPageTransition(this._allow_cross_page_transition).setData({data:JSON.stringify(merge(this._context_data,this._data))}).send();return this;},cancel:function(){if(this._request)this._request.abort();},setUseAjaxPipe:function(h){this._use_ajaxpipe=!!h;return this;},setAppend:function(h){this._append=!!h;return this;},setJSNonBlock:function(h){this._jsNonblock=!!h;return this;},setConstHeight:function(h){this._constHeight=!!h;return this;}});e.UIPagelet=f.exports=c;},3);
function PhotoStreamCache(){}copy_properties(PhotoStreamCache,{ERROR:'error',HTML:'html',IMAGE_DATA:'image',EXTRA:'extra',BUFFER_SIZE:3,INIT_BUCKET_SIZE:4,FULL_BUCKET_SIZE:12,ERROR_ID:-1});copy_properties(PhotoStreamCache.prototype,{init:function(a){this.version=a;this.bufferSize=PhotoStreamCache.BUFFER_SIZE;this.initBucketSize=PhotoStreamCache.INIT_BUCKET_SIZE;this.fullBucketSize=PhotoStreamCache.FULL_BUCKET_SIZE;this.initError=false;this.isActive=true;this.leftLock=false;this.rightLock=false;this.reset();},reset:function(){this.cache={image:{},extra:{},html:{}};this.fbidList=[];this.loaded=false;this.allLoaded=false;this.permalinkMap={};this.position=0;this.totalCount=null;this.firstCursor=null;this.firstCursorIndex=null;},destroy:function(){this.reset();this.isActive=false;},isLoaded:function(){return this.loaded;},canPage:function(){if(this.totalCount!==null)return this.totalCount>1;return this.getLength()>1;},errorInCurrent:function(){if(this.initError){return true;}else if(!this.isLoaded())return false;return this.checkErrorAt(this.getCursor());},getLength:function(){return this.fbidList.length;},getPhotoSet:function(){return this.photoSetQuery.set;},getCurrentImageData:function(){return this.getImageData(this.getCursor());},getImageData:function(a){return this.getCacheContent(a,PhotoStreamCache.IMAGE_DATA);},getCurrentHtml:function(){return this.getCacheContent(this.getCursor(),PhotoStreamCache.HTML);},getCurrentExtraData:function(){return this.getCacheContent(this.getCursor(),PhotoStreamCache.EXTRA);},getCacheContent:function(a,b){if(!a||a===PhotoStreamCache.ERROR_ID)return null;return this.cache[b][a];},getCursorPos:function(){return this.position;},getCursor:function(){if(this.position>=0&&this.position<this.getLength())return this.fbidList[this.position];return null;},getCursorForURI:function(a){return this.permalinkMap[a];},calculatePositionForMovement:function(a){var b=this.position+a;if(this.allLoaded){var c=this.getLength();b=(c+b%c)%c;}return b;},isValidMovement:function(a){if(!this.isLoaded()||!this.canPage())return false;var b=this.calculatePositionForMovement(a);return this.getCursor()>0||(b>=0&&b<this.getLength());},moveCursor:function(a){if(!this.isValidMovement(a))return;this.position=this.calculatePositionForMovement(a);if(a!==0)this.loadMoreIfNeccessary(a>0);},checkErrorAt:function(a){if(!this.isLoaded())return false;if(a===PhotoStreamCache.ERROR_ID)return true;return false;},getRelativeMovement:function(a){for(var b=0;b<this.getLength();b++)if(this.fbidList[b]===a)return b-this.position;return null;},preloadImages:function(){var e,c;var f=this.getLength();var b=this.cache.image;var a=PhotoStreamCache.BUFFER_SIZE;if(f>a*2){e=(this.position+f-a%f)%f;c=(this.position+a)%f;}else{e=0;c=f-1;}while(e!=c){var d=this.fbidList[e];if(b[d]&&!b[d].resource&&b[d].url){b[d].resource=new Image();b[d].resource.src=b[d].url;}e=(e+1)%f;}},loadMoreIfNeccessary:function(c){if(this.allLoaded||(c&&this.rightLock)||(!c&&this.leftLock))return;var d=c?1:-1;var a=this.fullBucketSize*d;var b=this.position+this.bufferSize*d;if(b<0&&!this.checkErrorAt(this.getEndCursor(false))){this.leftLock=true;this.fetch(this.fullBucketSize,false);}else if(b>this.getLength()&&!this.checkErrorAt(this.getEndCursor(true))){this.rightLock=true;this.fetch(this.fullBucketSize,true);}},getEndCursor:function(a){return a?this.fbidList[this.getLength()-1]:this.fbidList[0];},calculateRelativeIndex:function(c,a,d){if(!this.totalCount)return null;var b=this.fbidList.indexOf(a);var e=this.fbidList.indexOf(d);if(b===-1||e===-1)return null;var f=e-b;return (c+f+this.totalCount)%this.totalCount;},fetch:function(a,d){var c=this.getEndCursor(d);var b=copy_properties({cursor:c,version:this.version,end:this.getEndCursor(!d),fetchSize:d?a:-1*a},this.photoSetQuery);if(this.totalCount&&this.firstCursorIndex!==null){b.total=this.totalCount;b.cursorIndex=this.calculateRelativeIndex(this.firstCursorIndex,this.firstCursor,c);}UIPagelet.loadFromEndpoint('PhotoViewerPagelet',null,b,{usePipe:true,jsNonblock:true,crossPage:true});},storeToCache:function(a){var b={};if(!this.isActive)return b;if('error' in a){this.processErrorResult(a.error);b.error=true;return b;}if('init' in a){this.processInitResult(a.init);b.init={logids:a.init.logids,fbid:a.init.fbid,loggedin:a.init.loggedin};}if('image' in a){this.processImageResult(a.image);b.image=true;}if('data' in a){this.processDataResult(a.data);b.data=true;}return b;},processInitResult:function(a){if(this.loaded)return;this.loaded=true;this.photoSetQuery=a.query;if(a.bufferSize)this.bufferSize=a.bufferSize;if(a.initBucketSize)this.initBucketSize=a.initBucketSize;if(a.fullBucketSize)this.fullBucketSize=a.fullBucketSize;this.fbidList.push(a.fbid);this.firstCursor=a.fbid;if('initIndex' in a&&'totalCount' in a){this.firstCursorIndex=a.initIndex;this.totalCount=a.totalCount;}this.rightLock=true;this.fetch(this.initBucketSize,true);},processImageResult:function(b){for(var a in b){this.cache.image[a]=b[a];if(b[a].dimensions)this.cache.image[a].dimensions=Vector2.deserialize(b[a].dimensions);this.permalinkMap[URI(b[a].info.permalink).getUnqualifiedURI().toString()]=a;}},attachToFbidsList:function(d,e,a){if(this.allLoaded)return;if(e===-1){for(var b=d.length-1;b>=0;b--){this.fbidList.unshift(d[b]);this.position++;}this.leftLock=false;}else{for(var c=0;c<d.length;c++)this.fbidList.push(d[c]);this.rightLock=false;}if(a)this.setAllLoaded();},setAllLoaded:function(){this.allLoaded=true;if(this.getCursor()===null)this.position=this.calculatePositionForMovement(0);},processDataResult:function(a){for(var b in a){if(!this.cache.html[b])this.cache.html[b]={};for(var d in a[b].html){var c=HTML(a[b].html[d]).getRootNode();this.cache.html[b][d]=$A(c.childNodes);}if(!('extra' in a[b])){this.cache.extra[b]=null;continue;}this.cache.extra[b]={tagRects:{}};if(a[b].extra.tagRects)for(var e in a[b].extra.tagRects)if(a[b].extra.tagRects[e])this.cache.extra[b].tagRects[e]=Rect.deserialize(a[b].extra.tagRects[e]);}},processErrorResult:function(b){if(!this.isLoaded()){this.initError=true;return;}var c=b.side;var a=[PhotoStreamCache.ERROR_ID];this.attachToFbidsList(a,c);},setTotalCount:function(a){this.totalCount=a;},setFirstCursorIndex:function(a){this.firstCursorIndex=a;}});
function PhotoInlineEditor(a){this.version=a;PhotoInlineEditor.instances[a]=this;}PhotoInlineEditor.CANCEL_INLINE_EDITING='CANCEL_INLINE_EDITING';PhotoInlineEditor.instances={};PhotoInlineEditor.getInstance=function(a){return PhotoInlineEditor.instances[a];};copy_properties(PhotoInlineEditor.prototype,{cancel:function(a){var b=Parent.byClass(a,'photoUfiContainer');if(!b)return;this.setVisible(b,'.fbPhotosPhotoCaption',true);this.setVisible(b,'.fbPhotoTagList',true);this.setVisible(b,'.fbPhotosPhotoEdit',true);this.setVisible(b,'.fbPhotosPhotoDisabledEdit',false);this.setVisible(b,'.fbPhotoInlineEditor',false);Arbiter.unsubscribe(this.arbiterToken);Arbiter.inform(PhotoInlineEditor.CANCEL_INLINE_EDITING);},setVisible:function(c,a,d){var b=DOM.scry(c,a)[0];b&&CSS[d?'show':'hide'](b);},subscribeCancel:function(a){var b=[PhotoSnowbox.PAGE,PhotoSnowbox.CLOSE,PhotoSnowbox.OPEN,PhotoTagger.ACTIVATE_TAGGING];this.arbiterToken=Arbiter.subscribe(b,this.cancel.bind(this,a),Arbiter.SUBSCRIBE_NEW);}});
var PhotoSnowbox=window.PhotoSnowbox||{STATE_ERROR:'error',STATE_HTML:'html',STATE_IMAGE_PIXELS:'image_pixels',STATE_IMAGE_DATA:'image',CLOSE:'PhotoSnowbox.CLOSE',DATA_CHANGE:'PhotoSnowbox.DATA_CHANGE',GO:'PhotoSnowbox.GO',OPEN:'PhotoSnowbox.OPEN',PAGE:'PhotoSnowbox.PAGE',RESET_HELP:'PhotoSnowbox.RESET_HELP',LOADING_TIMEOUT:2000,STAGE_MAX:{x:960,y:960},STAGE_MIN:{x:720,y:402},STAGE_CHROME:{x:225,y:117},WIDE_ADS:855,MIN_TAG_DISTANCE:83,ADS_REFRESH_RATE:30000,switchTimer:null,imageRefreshTimer:null,imageLoadingTimer:null,lastPage:0,currentMinSize:null,normalSize:null,thumbSrc:null,ua:new UserNoOp(),bootstrap:function(b,a){this.resetUriStack=true;if(this.isOpen)if(this.openExplicitly){this.closeCleanup();this.resetUriStack=false;}else return;this.ua=user_action(a,'snowbox',null).set_namespace('snowbox').set_ua_id('open');this.returningToStart=false;this.loading&&CSS.removeClass(this.loading,'loading');if(a){CSS.addClass((this.loading=a),'loading');this.getThumbAndSize(a);}else this.loading=null;Arbiter.inform(PhotoSnowbox.GO,b,Arbiter.BEHAVIOR_STATE);this.loadFrameIfUninitialized();},getThumbAndSize:function(b){this.normalSize=null;this.thumbSrc=null;var e=URI(b.getAttribute('ajaxify')).getQueryData();if(!e.size)return;var a=Vector2.deserialize(e.size);if(!a.x||!a.y)return;this.normalSize=a;if(!CSS.hasClass(b,'uiMediaThumb')&&!CSS.hasClass(b,'uiPhotoThumb')&&!CSS.hasClass(b,'uiScaledThumb'))return;var d=DOM.scry(b,'img')[0];var c=DOM.scry(b,'i')[0];if(d){thumbSrc=d.src;}else if(c){thumbSrc=CSS.getStyle(c,'backgroundImage').replace(/.*url\("?([^"]*)"?\).*/,'$1');}else return;this.thumbSrc=thumbSrc;},loadFrameIfUninitialized:function(){if(this.root)return;new AsyncRequest('/ajax/photos/snowbox/init.php').setAllowCrossPageTransition(true).setMethod('GET').setReadOnly(true).send();},init:function(a){var b=ge('fbPhotoSnowbox');if(!b){b=DOM.appendContent(document.body,a)[0];this.initialLoad=false;}if(this.root==b)return;this.initializeNodes(b);if(!this.subscription){LinkController.registerHandler(this.handleNavigateAway.bind(this),LinkController.TARGETS|LinkController.MODIFIERS);this.subscription=Arbiter.subscribe(PhotoSnowbox.GO,function(c,d){this.openExplicitly=true;this.loading&&CSS.removeClass(this.loading,'loading');this.open(d);}.bind(this));}this.transitionHandlerRegistered=false;this.returningToStart=false;PageTransitions.registerHandler(this.openHandler.bind(this));this.openHandlerRegistered=true;},initializeNodes:function(a){this.root=a;this.closeTheater=DOM.find(a,'a.closeTheater');this.container=DOM.find(a,'div.container');this.infoWrapper=DOM.find(a,'div.photoInfoWrapper');this.stageWrapper=DOM.find(a,'div.stageWrapper');this.errorBox=DOM.find(this.stageWrapper,'div.stageError');this.image=DOM.find(this.stageWrapper,'img.spotlight');this.pivotBar=DOM.find(this.stageWrapper,'div.pivotWrapper');this.stage=DOM.find(this.stageWrapper,'div.stage');this.videoStage=DOM.find(this.stageWrapper,'div.videoStage');this.stagePagers=DOM.find(a,'div.stagePagers');this.stageActions=DOM.find(a,'div.stageActions');this.buttonActions=DOM.find(this.stageActions,'div.fbPhotosPhotoButtons');this.actionList=$('fbPhotoSnowboxActions');this.sideAdUnit=$('fbPhotoSnowboxAdsSide');this.bottomAdUnit=$('fbPhotoSnowboxAdsBottom');},getRoot:function(){return this.root;},openHandler:function(a){if(this.isOpen||a.getPath()!='/photo.php'||this.returningToStart||a.getQueryData().closeTheater||a.getQueryData().permPage||a.getQueryData().makeprofile){this.openHandlerRegistered=false;return false;}this.open(a);this._uriStack.push(URI(a).getQualifiedURI().toString());PageTransitions.transitionComplete();return true;},open:function(c){var a=URI(c).getQueryData();var b=a.src;if(b)delete a.src;if(this.resetUriStack)this._uriStack=[];if(!this.initialLoad){a.firstLoad=true;this.initialLoad=true;}this.loadQuery=a;this.isOpen=true;this.refreshOnClose=false;this.hilitedTag=null;this.secondBatchArrived=false;this.lastAdsLoad=0;this.loadingStates={image:false,html:false};this.replaceUrl=false;this.stream=new PhotoStreamCache();this.stream.init(PhotosConst.VIEWER_SNOWBOX);this.fetchInitialData();this.setLoadingState(PhotoSnowbox.STATE_HTML,true);KeyEventController.registerKey('ESCAPE',this.closeListener.bind(this));Bootloader.loadComponents(['fb-photos-photo-css','fb-photos-snowbox-css'],function(){this._open(c,b);}.bind(this));},_open:function(d,c){this.createLoader(c);CSS.show(this.root);CSS.addClass.curry(document.documentElement,'theaterMode').defer();CSS.addClass.curry(document.body,'theaterMode').defer();this.ua.add_event('frame');Arbiter.inform('layer_shown',{type:'PhotoSnowbox'});Arbiter.inform(PhotoSnowbox.OPEN);Bootloader.loadComponents(['hovercard','live-js','photocrop2','PhotoTag','PhotoTagger','TagToken','TagTokenizer','ui-ufi-css']);this.stageHandlers=[Event.listen(window,'resize',this.adjustForResize.bind(this)),Event.listen(this.root,'click',this.closeListener.bind(this)),Event.listen(this.stageWrapper,'click',this.buttonListener.bind(this)),Event.listen(this.actionList,'click',this.rotateListener.bind(this))];var a=ge('fbPhotoSnowboxFeedback');if(a)this.stageHandlers.push(Event.listen(a,'click',function(event){if(Parent.byClass(event.getTarget(),'like_link'))CSS.toggleClass(DOM.find(this.buttonActions,'div.likeCommentGroup'),'viewerLikesThis');}.bind(this)));var b=ge('fbPhotoSnowboxOnProfile');if(b)this.stageHandlers.push(Event.listen(b,'click',function(event){if(Parent.byClass(event.getTarget(),'fbPhotoRemoveFromProfileLink'))this.refreshOnClose=true;}.bind(this)));if(this.resetUriStack)this.startingURI=URI.getMostRecentURI().addQueryData({closeTheater:1}).getUnqualifiedURI();if(!c)this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,true);if(!this.transitionHandlerRegistered){PageTransitions.registerHandler(this.transitionHandler.bind(this));this.transitionHandlerRegistered=true;}PhotoSnowboxLog.initLogging();ua.firefox()&&this.turnFlashAutoplayOff.defer();(function(){this.adjustForResize();if(ua.ie()){this.container.focus();}else this.root.focus();}).bind(this).defer();},getStream:function(){return this.stream;},fetchInitialData:function(){this.ua.add_event('init_data');new AsyncRequest('/ajax/photos/snowbox/load.php').setAllowCrossPageTransition(true).setData(this.loadQuery).setHandler(this.storeFromResponse.bind(this)).setMethod('GET').setReadOnly(true).send();},turnFlashAutoplayOff:function(){DOM.scry(document,'div.swfObject').each(function(d){var b=d.getAttribute('data-swfid');if(b&&window[b]){var c=window[b];c.addParam('autostart','false');c.addParam('autoplay','false');c.addParam('play','false');c.addVariable('video_autoplay','0');c.addVariable('autoplay','0');c.addVariable('play','0');var a=URI(c.getAttribute('swf'));a.addQueryData({autoplay:'0'});a.setPath(a.getPath().replace('autoplay=1','autoplay=0'));c.setAttribute('swf',a.toString());c.write(d);}});},closeHandler:function(){if(!this.isOpen)return;if(URI.getMostRecentURI().addQueryData({closeTheater:1}).getUnqualifiedURI().toString()==this.startingURI.toString()){this.close();return;}this.close();this.returnToStartingURI(this.refreshOnClose);},returnToStartingURI:function(c,a){if(!c)if(a){this.squashNextTransition(goURI.curry(a));}else this.squashNextTransition();this.returningToStart=true;var d=Arbiter.subscribe('page_transition',function(){this.returningToStart=false;Arbiter.unsubscribe(d);});var f=this._uriStack.length;if(f<window.history.length){window.history.go(-f);}else{var e=PhotoSnowbox.startingURI;var b=new URI(e).removeQueryData('closeTheater');if(e.getQueryData().sk=='approve'&&e.getPath()=='/profile.php'){b.removeQueryData('highlight');b.removeQueryData('notif_t');}goURI(b);}},squashNextTransition:function(a){PhotoSnowbox.squashNext=true;PageTransitions.registerHandler(function _squash(){if(PhotoSnowbox.squashNext){PhotoSnowbox.squashNext=false;if(a)a.defer();PageTransitions.transitionComplete();return true;}return false;});},handleNavigateAway:function(b){var a=_computeRelativeURI(window.PageTransitions._most_recent_uri.getQualifiedURI(),b.getAttribute('href'));if(this.isOpen&&(a instanceof URI)&&a.getUnqualifiedURI().toString()!=this.startingURI.toString()&&a.getPath()!='/photo.php'){if(!this.closingAction)this.closingAction=PhotoSnowboxLog.NAVIGATE;this.close();this.returnToStartingURI(false,a);return false;}return true;},closeListener:function(event){if(this.isOpen&&!(window.Dialog&&Dialog.getCurrent())){var c=event.getTarget();var a=Parent.byClass(c,'closeTheater');var b=(a||c==this.root||c==this.infoWrapper);if(b){if(a){this.closingAction=PhotoSnowboxLog.X;}else this.closingAction=PhotoSnowboxLog.OUTSIDE;Event.kill(event);this.closeHandler();}else if(Event.getKeyCode(event)==KEYS.ESC){this.closingAction=PhotoSnowboxLog.ESC;Event.kill(event);this.closeHandler();}}},close:function(){if(!this.isOpen)return;CSS.hide(this.root);this.openExplicitly=false;this.closeCleanup.bind(this).defer();},closeCleanup:function(){CSS.removeClass(document.documentElement,'theaterMode');CSS.removeClass(document.body,'theaterMode');CSS.removeClass(this.root,'dataLoaded');KeyEventController.getInstance().resetHandlers();PhotoSnowboxLog.logPhotoViews(this.closingAction);this.destroy();CSS.hide(this.errorBox);CSS.hide(this.image);this.normalSize=null;this.thumbSrc=null;CSS.removeClass(this.stageWrapper,'showVideo');DOM.empty(this.videoStage);this.currentMinSize=null;this.pinPagers=false;this.recacheData();DOM.empty(this.sideAdUnit);DOM.empty(this.bottomAdUnit);this.stream.destroy();var a=this.closingAction===PhotoSnowboxLog.NAVIGATE;this.closingAction=null;if(!this.openHandlerRegistered){PageTransitions.registerHandler(this.openHandler.bind(this));this.openHandlerRegistered=true;}Arbiter.inform('layer_hidden',{type:'PhotoSnowbox'});Arbiter.inform(PhotoSnowbox.CLOSE,a);this.root.setAttribute('aria-busy','true');this.isOpen=false;},createLoader:function(b){if(this.thumbSrc!==null&&this.normalSize!==null){var a=this.getMaxImageSize(this.normalSize);this.useImage($N('img',{className:'spotlight',alt:'',src:this.thumbSrc,style:{width:a.x+'px',height:a.y+'px'}}),a,false);}this.setLoadingState(this.STATE_IMAGE_PIXELS,true);if(b)(function(){var c=new Image();c.onload=async_callback(function(){if(!this.stream||!this.stream.errorInCurrent()){this.switchImage(b,this.normalSize);this.ua.add_event('image');}}.bind(this),'photo_theater');c.src=b;}).bind(this).defer();CSS.hide(this.stageActions);CSS.hide(this.stagePagers);},initDataFetched:function(a){PhotoSnowboxLog.setPhotoSet(this.stream.getPhotoSet());PhotoSnowboxLog.setLogFbids(a.logids);PhotoSnowboxLog.addPhotoView(this.stream.getCurrentImageData().info);this.position=this.stream.getCursor();var b={click:this.pageListener.bind(this),mouseleave:this.mouseLeaveListener.bind(this),mousemove:this.mouseMoveListener.bind(this)};if(!this.pageHandlers){this.pageHandlers=values(Event.listen(this.root,b));KeyEventController.registerKey('LEFT',this.pageListener.bind(this));KeyEventController.registerKey('RIGHT',this.pageListener.bind(this));}CSS.show(this.stageActions);this.root.setAttribute('aria-busy','false');this.isLoggedInViewer=a.loggedin;this.loadAds();},adjustForResize:function(){this.currentMinSize=null;this.pinPagers=false;this.adjustStageSize();this.adjustForNewData();},getMaxImageSize:function(c){var f=Vector2.getViewportDimensions();var e=f.sub(new Vector2(PhotoSnowbox.STAGE_CHROME.x,PhotoSnowbox.STAGE_CHROME.y));var a=new Vector2(Math.min(c.x,e.x,PhotoSnowbox.STAGE_MAX.x),Math.min(c.y,e.y,PhotoSnowbox.STAGE_MAX.y));if(a.x===0&&a.y===0)return new Vector2(0,0);var d=c.x/c.y;var b=a.x/a.y;if(b<d)return new Vector2(a.x,Math.round(a.x/d));return new Vector2(Math.round(a.y*d),a.y);},adjustStageSize:function(c){var a;var b=this.stream&&this.stream.getCurrentImageData();if(c){a=c;}else if(b&&b.dimensions){a=b.dimensions;}else if(this.image&&this.image.src&&image_has_loaded(this.image)){a=Vector2.getElementDimensions(this.image);}else return;var d=this.getMaxImageSize(a);if(!this.currentMinSize){this.currentMinSize=new Vector2(Math.max(d.x,PhotoSnowbox.STAGE_MIN.x),Math.max(d.y,PhotoSnowbox.STAGE_MIN.y));}else this.currentMinSize=new Vector2(Math.max(d.x,this.currentMinSize.x),Math.max(d.y,PhotoSnowbox.STAGE_MIN.y));CSS.setStyle(this.container,'width',this.currentMinSize.x+'px');CSS.setStyle(this.stageWrapper,'height',this.currentMinSize.y+'px');CSS.setStyle(this.stage,'lineHeight',this.currentMinSize.y+'px');CSS.setStyle(this.videoStage,'lineHeight',this.currentMinSize.y+'px');CSS.conditionClass(this.container,'adsOnSide',this.currentMinSize.x>=PhotoSnowbox.WIDE_ADS);this.adjustForAdUnit();if(!this.pinPagers)CSS.setStyle(this.stagePagers,'height',this.currentMinSize.y/2+'px');this.pinPagers=true;},adjustForNewData:function(){if(!this.image)return;var c=DOM.scry(this.stage,'div.tagsWrapper')[0];var a=Vector2.getElementDimensions(this.image);if(c){CSS.setStyle(c,'width',a.x+'px');CSS.setStyle(c,'height',a.y+'px');if(ua.ie()<=7){var b=DOM.scry(this.root,'div.tagContainer')[0];if(b)CSS.conditionClass(c,'ie7VerticalFix',Vector2.getElementDimensions(b).y>a.y);}}},setLoadingState:function(b,a){switch(b){case PhotoSnowbox.STATE_IMAGE_PIXELS:CSS.conditionClass(this.root,'imagePixelsLoading',a);break;case PhotoSnowbox.STATE_IMAGE_DATA:this.loadingStates[b]=a;CSS.conditionClass(this.root,'imageLoading',a);break;case PhotoSnowbox.STATE_HTML:this.loadingStates[b]=a;CSS.conditionClass(this.root,'dataLoading',a);CSS.conditionClass(this.root,'dataLoaded',!a);this.infoWrapper.setAttribute('aria-busy',a?'true':'false');break;}},destroy:function(){this.stageHandlers.each(function(a){a.remove();});if(this.pageHandlers){this.pageHandlers.each(function(a){a.remove();});this.pageHandlers=null;}},checkState:function(b){if(b!=PhotoSnowbox.STATE_ERROR&&!this.loadingStates[b])return;switch(b){case PhotoSnowbox.STATE_IMAGE_DATA:var a=this.stream.getCurrentImageData();if(a){if(a.url){this.switchImage(a.url,null,true);}else if(a.video)this.switchVideo(a.video,true);this.setLoadingState(b,false);}break;case PhotoSnowbox.STATE_HTML:if(this.stream.getCurrentHtml()){this.swapData();this.setLoadingState(b,false);}break;default:if(this.stream.errorInCurrent()){CSS.hide(this.image);CSS.show(this.errorBox);}break;}},buttonListener:function(event){var b=event.getTarget();var a=+new Date();if(a-this.lastPage<350){if(Parent.byClass(b,'tagApproveIgnore'))Event.kill(event);return;}if(Parent.byClass(b,'likeButton')){DOM.find($('fbPhotoSnowboxFeedback'),'button.like_link').click();}else if(Parent.byClass(b,'commentButton')){DOM.find(this.root,'div.commentBox textarea').focus();this.root.scrollTop=this.root.scrollHeight;}else if(Parent.byClass(b,'tagApproveIgnore'))this.updateTagBox(event,b);},rotateListener:function(event){var a=event.getTarget();if(Parent.byClass(a,'rotateRight')){this.rotate('right');}else if(Parent.byClass(a,'rotateLeft'))this.rotate('left');},updateTagBox:function(event,c){var a;if(Parent.byClass(c,'approveTag')){a=true;}else if(Parent.byClass(c,'ignoreTag')){a=false;}else return;this.unhiliteAllTags();var b=Parent.byClass(c,'tagBoxPending');CSS.addClass(b,'tagBox tagBoxPendingResponse');CSS.removeClass(b,'tagBoxPending');CSS.hide(DOM.find(b,'span.tagForm'));if(a){CSS.show(DOM.find(b,'span.tagApproved'));}else CSS.show(DOM.find(b,'span.tagIgnored'));},rotate:function(c){var d=this.stream.getCursor();if(this.getVideoOnStage()){var b=(c=='left')?270:90;Bootloader.loadComponents(['video-rotate-snowbox'],new VideoRotate(d,this.actionList).motionRotate(b));return;}var a={fbid:d,cs_ver:PhotosConst.VIEWER_SNOWBOX};a[c]=1;this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,true);this.setLoadingState(this.STATE_IMAGE_PIXELS,true);CSS.hide(this.image);new AsyncRequest('/ajax/photos/photo/rotate/').setAllowCrossPageTransition(true).setData(a).setErrorHandler(this.rotationError.bind(this,d)).setHandler(this.rotationComplete.bind(this,d)).setMethod('POST').setReadOnly(false).send();},rotationComplete:function(a,b){this.storeResponseForRotate(a,b);if(a==this.stream.getCursor()){this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,false);this.switchImage(this.stream.getCurrentImageData().url);this.swapData();}this.refreshOnClose=true;},storeResponseForRotate:function(a,c){this.storeFromResponse(c);var b=this.stream.getImageData(a);b.url=c.getPayload().new_urls[PhotosConst.SIZE_NORMAL];b.dimensions=Vector2.deserialize(c.getPayload().dimensions);},rotationError:function(a,b){if(a==this.stream.getCursor()){this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,false);this.switchImage(this.stream.getCurrentImageData().url);AsyncResponse.defaultErrorHandler(b);}},saveTagComplete:function(a){this.saveTagsFromPayload(a.getPayload());},saveTagsFromPayload:function(a){this.refreshOnClose=true;this.storeFromData(a);if('data' in a&&this.stream.getCursor() in a.data)this.swapData();},mouseLeaveListener:function(event){this.unhiliteAllTags();this.hiliteLeftmostPendingTag();},mouseMoveListener:function(event){var b=event.getTarget();var a=(Parent.byClass(b,'stageActions')||Parent.byClass(b,'stageWrapper'));if(!a)CSS.hide(this.pivotBar);if(this.hasPivotData()&&!this.loadingStates.html)CSS.show(this.pivotBar);this.hiliteTagsOnMouseMove(event);},hasPivotData:function(){var a=this.stream.getCurrentHtml();return a&&a.fbPhotoSnowboxPivots;},unhiliteAllTags:function(){DOM.scry(this.stage,'div.tagsWrapper div.hover').each(function(a){CSS.removeClass(a,'hover');});this.hilitedTag=null;},switchHilitedTags:function(b){if(this.switchTimer!==null){clearTimeout(this.switchTimer);this.switchTimer=null;}var a=ge(this.hilitedTag);a&&CSS.removeClass(a,'hover');this.unhiliteAllTags();if(b){this.hilitedTag=b;CSS.addClass($(this.hilitedTag),'hover');}},hiliteLeftmostPendingTag:function(){var a=ge(this.hilitedTag);if(a&&CSS.hasClass(a,'tagBoxPending'))return;var b=DOM.scry(this.stage,'div.tagsWrapper div.tagBoxPending')[0];if(b)this.switchHilitedTags(b.id);},hiliteTagsOnMouseMove:function(event){if(!this.stream.getCurrentExtraData()||this.getVideoOnStage())return;if(this.switchTimer!==null)return;var i=Parent.byClass(event.getTarget(),'tagBoxPending');var d=(this.hilitedTag&&CSS.hasClass($(this.hilitedTag),'tagBoxPending'));var l=((!this.hilitedTag&&i)||(!d&&i));if(l){this.switchHilitedTags(i.id);return;}if(i&&(i.id==this.hilitedTag))return;var a=250;var h=Vector2.getEventPosition(event);var f=Vector2.getElementPosition(this.image);var e=Vector2.getElementDimensions(this.image);var j=this.stream.getCurrentImageData().dimensions;var k=e.x/j.x;var g=PhotosUtils.getNearestBox(h,f,j,k,PhotoSnowbox.MIN_TAG_DISTANCE*k,this.stream.getCurrentExtraData().tagRects);if(!g){if(!d){this.unhiliteAllTags();this.hiliteLeftmostPendingTag();}return;}var b=null;if(d){var c={};c[this.hilitedTag]=this.stream.getCurrentExtraData().tagRects[this.hilitedTag];b=PhotosUtils.getNearestBox(h,f,j,k,PhotoSnowbox.MIN_TAG_DISTANCE*k,c);}if(b!==null&&d)return;if(this.hilitedTag!=g)if(d){this.switchTimer=this.switchHilitedTags.bind(this,g).defer(a);}else this.switchHilitedTags(g);},getVideoOnStage:function(){var a=this.stream&&this.stream.getCurrentImageData();return a&&a.video;},shouldGoForward:function(a,c){var d=(a==KEYS.RIGHT||Parent.byClass(c,'next'));if(d)return true;var b=(this.getVideoOnStage()||CSS.hasClass(this.root,'taggingMode')||Parent.byClass(c,'tagBoxPending')||Parent.byClass(c,'tagBoxPendingResponse'));if(b)return false;return DOM.isNode(c)&&Parent.byClass(c,'stage');},pageListener:function(event){var a=Event.getKeyCode(event);var b=event.getTarget();if(a==KEYS.LEFT||Parent.byClass(b,'prev')){this.page(-1);user_action(b,'a',event);return;}if(this.shouldGoForward(a,b)){this.page(1);user_action(b,'a',event);}},page:function(c,b){if(!this.stream.isValidMovement(c))return;this.lastPage=+new Date();this.unhiliteAllTags();var d=this.getVideoOnStage();if(d)this.switchVideo(d,false);Arbiter.inform(PhotoSnowbox.PAGE);this.recacheData();this.stream.moveCursor(c);CSS.hide(this.image);if(this.stream.errorInCurrent()){this.setLoadingState(PhotoSnowbox.STATE_HTML,true);CSS.show(this.errorBox);return;}var a=this.stream.getCurrentImageData();if(a){if(a.url){this.switchImage(a.url,null,true);}else if(a.video)this.switchVideo(a.video,true);if(!b){this.replaceUrl=true;goURI(a.info.permalink);}}else{this.setLoadingState(PhotoSnowbox.STATE_IMAGE_PIXELS,true);this.setLoadingState(PhotoSnowbox.STATE_IMAGE_DATA,true);}if(this.stream.getCurrentHtml()){this.swapData();}else this.setLoadingState(PhotoSnowbox.STATE_HTML,true);this.hiliteLeftmostPendingTag();this.loadAds();},loadAds:function(){if(!this.isLoggedInViewer)return;var a=+new Date();if(a-this.lastAdsLoad>PhotoSnowbox.ADS_REFRESH_RATE){UIPagelet.loadFromEndpoint('WebEgoPane','fbPhotoSnowboxAdsSide',{pid:34,data:[]},{crossPage:true});this.lastAdsLoad=a;}},adjustForAdUnit:function(){var b=this.sideAdUnit.childNodes;var a=this.bottomAdUnit.childNodes;if(CSS.hasClass(this.container,'adsOnSide')){if(a.length>0&&b.length===0)DOM.setContent(this.sideAdUnit,$A(a));DOM.empty(this.bottomAdUnit);}else if(b.length>0){DOM.setContent(this.bottomAdUnit,$A(b));DOM.empty(this.sideAdUnit);}},transitionHandler:function(c){if(c.getQueryData().closeTheater||c.getQueryData().permPage||c.getQueryData().makeprofile||this.returningToStart){if(this.isOpen)this.close();this.transitionHandlerRegistered=false;return false;}if(this.replaceUrl){this.replaceUrl=false;this._uriStack.push(c.getQualifiedURI().toString());PageTransitions.transitionComplete();return true;}var d=this._uriStack.length;if(d>=2&&this._uriStack[d-2]==c.getQualifiedURI().toString())this._uriStack.pop();var a=this.stream.getCursorForURI(c.getUnqualifiedURI().toString());if(a){var b=this.stream.getRelativeMovement(a);this.page(b,true);PageTransitions.transitionComplete();return true;}if(this.isOpen){this.close();PageTransitions.transitionComplete();return true;}this.transitionHandlerRegistered=false;return false;},recacheData:function(){if(!this.loadingStates.html){var a=this.stream.getCurrentHtml();for(var b in a){a[b]=$A($(b).childNodes);DOM.empty($(b));}}},reloadIfTimeout:function(){if(!image_has_loaded(this.image)){var a=this.makeNewImage(this.image.src,true);Event.listen(a,'load',this.useImage.bind(this,a,null,true));}},useImage:function(c,a,b){if(b&&image_has_loaded(this.image))return;DOM.replace(this.image,c);this.image=c;this.adjustStageSize(a);},makeNewImage:function(c,a){if(this.imageLoadingTimer){clearTimeout(this.imageLoadingTimer);this.imageLoadingTimer=null;}else if(!a)this.imageRefreshTimer=setTimeout(this.reloadIfTimeout.bind(this),PhotoSnowbox.LOADING_TIMEOUT);var b=$N('img',{className:'spotlight',alt:''});b.setAttribute('aria-describedby','fbPhotosSnowboxCaption');b.setAttribute('aria-busy','true');Event.listen(b,'load',async_callback(function(){clearTimeout(this.imageRefreshTimer);this.image.setAttribute('aria-busy','false');this.setLoadingState(this.STATE_IMAGE_PIXELS,false);(function(){this.adjustStageSize();this.adjustForNewData();}).bind(this).defer();}.bind(this),'photo_theater'));b.src=c;return b;},switchImage:function(d,b,c){CSS.hide(this.image);CSS.hide(this.errorBox);this.setLoadingState(this.STATE_IMAGE_PIXELS,true);var a=this.stream&&this.stream.getCurrentImageData();if(a)PhotoSnowboxLog.addPhotoView(a.info);this.useImage(this.makeNewImage(d,false),b,false);if(c)this.stream.preloadImages();},switchVideo:function(c,a){var b='swf_'+c;if(a){CSS.addClass(this.stageWrapper,'showVideo');this.videoStage.id=c;if(window[b]&&!ge(b))window[b].write(c);this.adjustStageSizeForVideo.bind(this,b).defer();}else{this.videoStage.id='fbVideoStage';window[b]&&window[b].addVariable('video_autoplay',0);this.videoLoadTimer&&clearTimeout(this.videoLoadTimer);DOM.empty(this.videoStage);CSS.removeClass(this.stageWrapper,'showVideo');}},checkVideoStatus:function(a){if(this.videoLoadTimer)clearTimeout(this.videoLoadTimer);video=this.getVideoOnStage();if(!video){return;}else{currentSwfID='swf_'+video;if(a!==currentSwfID)return;this.adjustStageSizeForVideo(a);}},adjustStageSizeForVideo:function(a){var b=ge(a);if(!b){this.videoLoadTimer=setTimeout(this.checkVideoStatus.bind(this,a),200);}else this.adjustStageSize(new Vector2(b.width,b.height));},setErrorBoxContent:function(a){DOM.setContent(this.errorBox,a);},swapData:function(){var b,c=this.stream.getCurrentHtml();if(c){this.setLoadingState(PhotoSnowbox.STATE_HTML,false);for(var d in c){b=ge(d);b&&DOM.setContent(b,c[d]);}var e=DOM.scry(this.root,'div.fbVideoTagApproval')[0];if(e&&e.children.length===0)CSS.hide(e);var a=DOM.scry($('fbPhotoSnowboxCaption'),'div.fbPhotoInlineCaptionEditor');if(a.length)new PhotoInlineCaptionEditor('snowbox').init(a[0]);Arbiter.inform(PhotoSnowbox.DATA_CHANGE,this.stream.getCurrentImageData().info,Arbiter.BEHAVIOR_STATE);this.position=this.stream.getCursor();if(ge(this.hilitedTag)){CSS.addClass($(this.hilitedTag),'hover');}else this.hiliteLeftmostPendingTag();}this.adjustForNewData();},updateTotalCount:function(c,b,a){element=ge('fbPhotoSnowboxPositionAndCount');element&&DOM.setContent(element,a);this.stream.setTotalCount(c);this.stream.setFirstCursorIndex(b);},addPhotoFbids:function(b,c,a){var d=this.stream.getCursor()===null;this.stream.attachToFbidsList(b,c,a);if(a&&d)this.page(0,true);},storeFromResponse:function(a){window.ArbiterMonitor&&ArbiterMonitor.stopTtiMeasurement();this.storeFromData(a.getPayload());},storeFromData:function(a){if(!this.isOpen)return;var b=this.stream.storeToCache(a);if('error' in b){this.checkState(PhotoSnowbox.STATE_ERROR);return;}if('init' in b){this.initDataFetched(b.init);if(this.openExplicitly){this.replaceUrl=true;goURI(this.stream.getCurrentImageData().info.permalink);}CSS.conditionShow(this.stagePagers,this.stream.canPage());this.ua.add_event('ufi');}else if(!this.secondBatchArrived){CSS.conditionShow(this.stagePagers,this.stream.canPage());this.secondBatchArrived=true;this.ua.add_event('arrows');}if('image' in b)this.checkState(PhotoSnowbox.STATE_IMAGE_DATA);if('data' in b)this.checkState(PhotoSnowbox.STATE_HTML);},deletePhoto:function(a){this.closeRefresh();},closeRefresh:function(){this.refreshOnClose=true;this.closeHandler();}};
var PrivacyBaseValue={FRIENDS_MINUS_ACQUAINTANCES:127,FACEBOOK_EMPLOYEES:112,CUSTOM:111,OPEN:100,EVERYONE:80,NETWORKS_FRIENDS_OF_FRIENDS:60,NETWORKS_FRIENDS:55,FRIENDS_OF_FRIENDS:50,ALL_FRIENDS:40,SELF:10,NOBODY:0};var PrivacyFriendsValue={EVERYONE:80,NETWORKS_FRIENDS:55,FRIENDS_OF_FRIENDS:50,ALL_FRIENDS:40,SOME_FRIENDS:30,SELF:10,NO_FRIENDS:0};var PrivacySpecialPreset={ONLY_CORP_NETWORK:200,COLLEGE_NETWORK_FRIENDS_OF_FRIENDS:201,COLLEGE_NETWORK_FRIENDS:202};var PrivacyNetworkTypes={TYPE_COLLEGE:1,TYPE_HS:2,TYPE_CORP:3,TYPE_GEO:4,TYPE_MANAGED:14,TYPE_TEST:50};var PrivacyNetworksAll=1;copy_properties(PrivacyBaseValue,PrivacySpecialPreset);function PrivacyModel(){this.value=PrivacyBaseValue.ALL_FRIENDS;this.friends=PrivacyFriendsValue.NO_FRIENDS;this.networks=[];this.objects=[];this.lists=[];this.lists_x=[];this.list_anon=0;this.ids_anon=[];this.list_x_anon=0;this.ids_x_anon=[];this.tdata={};return this;}copy_properties(PrivacyModel.prototype,{init:function(k,a,h,i,f,g,d,b,e,c,j){this.value=k;this.friends=a;this.networks=h.clone();this.objects=i.clone();this.lists=f.clone();this.lists_x=g.clone();this.list_anon=d;this.ids_anon=b.clone();this.list_x_anon=e;this.ids_x_anon=c.clone();j=j||{};copy_properties(this.tdata,j);},clone:function(){var a=new PrivacyModel();a.init(this.value,this.friends,this.networks,this.objects,this.lists,this.lists_x,this.list_anon,this.ids_anon,this.list_x_anon,this.ids_x_anon,this.tdata);return a;},getData:function(){var b=['value','friends','networks','objects','lists','lists_x','list_anon','ids_anon','list_x_anon','ids_x_anon'];var d={};for(var c=0;c<b.length;++c){var a=b[c];d[a]=this[a];}return d;}});
add_properties('TypeaheadBehaviors',{buildBestAvailableNames:function(a){var b=a.getView();b.subscribe('beforeRender',function(c,e){for(var d=0;d<e.results.length;++d){if(e.results[d].localized_text==null)continue;if(TypeaheadUtil.isQueryMatch(e.value,e.results[d].localized_text)){e.results[d].text=e.results[d].localized_text;}else e.results[d].text=e.results[d].additional_text;}});}});
var UFIOptimistic={COMMENT_SEND_EVENT:'ufi/comment',_commentSeqNo:0,init:function(a){this._commentTemplate=a;if(!this._loaded){Event.listen(document.documentElement,'click',this._clickHandler.bind(this),Event.Priority.URGENT);this._loaded=true;}},_clickHandler:function(event){var i=event.getTarget();var l=i.name=='comment'&&i.parentNode&&Parent.byClass(i,'optimistic_submit');if(!l)return true;var e=i.form;var k=DOM.find(e,'textarea');if(Input.isEmpty(k))return true;fc_uncollapse(e);var a=this._commentTemplate.render();var j=XHPTemplate.getNode(a,'text');DOM.setContent(j,HTML(htmlize(trim(k.value))));var c=DOM.scry(e,'ul.commentList')[0];if(!c)return true;CSS.show(c.parentNode);c.appendChild(a);var b=c.lastChild;var g=rand32();b.id='optimistic_comment_'+g+'_'+this._commentSeqNo++;var d=Form.serialize(e);d.comment_replace=b.id;d.comment=1;function h(){new AsyncRequest(Form.getAttribute(e,'action')).setData(d).setRelativeTo(e).setErrorHandler(function(m){CSS.addClass(b,'uiUfiCommentFailed');AsyncResponse.defaultErrorHandler(m);}).send();}Event.listen(XHPTemplate.getNode(a,'retry_link'),'click',h);h();k.value=k.style.height='';k.focus();var f=window.MentionsInput&&MentionsInput.getInstance(k);f&&f.reset();Arbiter.inform(UFIOptimistic.COMMENT_SEND_EVENT,{form:e});return false;}};
function ufi_add_ft_hidden_node(c){if(c.link_data)return;var a=collect_data_attrib(c,'ft');if(count(a)){var b=$N('input',{type:'hidden',name:'link_data',value:JSON.stringify(a)});c.appendChild(b);}}function ufi_add_all_link_data(){Bootloader.loadComponents('dom-collect',function(){DOM.scry(document.body,'form.commentable_item').forEach(ufi_add_ft_hidden_node);});}
var Menu=function(){var i='menu:mouseover';var a=null;function b(k){return Parent.byClass(k,'uiMenu');}function c(k){return Parent.byClass(k,'uiMenuItem');}function d(k){if(document.activeElement){var l=c(document.activeElement);return k.indexOf(l);}return -1;}function e(k){return DOM.find(k,'a.itemAnchor');}function f(k){return CSS.hasClass(k,'checked');}function g(k){return !CSS.hasClass(k,'disabled');}function h(event){var k=document.activeElement;if(!k||!Parent.byClass(k,'uiMenu')||!DOM.isNodeOfType(k,['input','textarea'])){var l=c(event.getTarget());l&&Menu.focusItem(l);}}function j(k){Menu.inform('select',{menu:b(k),item:k});}onloadRegister(function(){var k={};k.click=function(event){var n=c(event.getTarget());if(n&&g(n)){j(n);var l=e(n);var m=l.href;var o=l.getAttribute('rel');return (o&&o!=='ignore')||(m&&m.charAt(m.length-1)!=='#');}};k.keydown=function(event){var u=event.getTarget();if(event.getModifiers().any)return;if(!a||DOM.isNodeOfType(u,['input','textarea']))return;var q=Event.getKeyCode(event);switch(q){case KEYS.UP:case KEYS.DOWN:var m=Menu.getEnabledItems(a);var o=d(m);Menu.focusItem(m[o+(q===KEYS.UP?-1:1)]);return false;case KEYS.SPACE:var t=c(u);if(t){j(t);event.prevent();}break;default:var l=String.fromCharCode(q).toLowerCase();var p=Menu.getEnabledItems(a);var o=d(p);var n=o;var r=p.length;while((~o&&(n=++n%r)!==o)||(!~o&&++n<r)){var s=Menu.getItemLabel(p[n]);if(s&&s.charAt(0).toLowerCase()===l){Menu.focusItem(p[n]);return false;}}}};Event.listen(document.body,k);});return copy_properties(new Arbiter(),{focusItem:function(k){if(k&&g(k)){this._removeSelected(b(k));CSS.addClass(k,'selected');e(k).focus();}},getEnabledItems:function(k){return Menu.getItems(k).filter(g);},getCheckedItems:function(k){return Menu.getItems(k).filter(f);},getItems:function(k){return DOM.scry(k,'li.uiMenuItem');},getItemLabel:function(k){return k.getAttribute('data-label',2)||'';},isItemChecked:function(k){return CSS.hasClass(k,'checked');},register:function(k,l){k=b(k);if(!DataStore.get(k,i))DataStore.set(k,i,Event.listen(k,'mouseover',h));if(l!==false)a=k;},setItemEnabled:function(l,k){if(!k&&!DOM.scry(l,'span.disabledAnchor')[0])DOM.appendContent(l,$N('span',{className:DOM.find(l,'a').className+' disabledAnchor'},HTML(e(l).innerHTML)));CSS.conditionClass(l,'disabled',!k);},toggleItem:function(l){var k=!Menu.isItemChecked(l);CSS.conditionClass(l,'checked',k);e(l).setAttribute('aria-checked',k);},unregister:function(l){l=b(l);var k=DataStore.remove(l,i);k&&k.remove();a=null;this._removeSelected(l);},_removeSelected:function(k){Menu.getItems(k).filter(function(l){return CSS.hasClass(l,'selected');}).each(function(l){CSS.removeClass(l,'selected');});}});}();
function Overlay(){}!function(){var a=null;function b(d,e){var c;d.subscribe('show',function(){c=Event.listen(document.documentElement,'keydown',function(event){if(event.keyCode==KEYS.ESC&&(document.activeElement==document.body||DOM.contains(e,document.activeElement)))d.hide();});});d.subscribe('hide',function(){c.remove();c=null;});}copy_properties(Overlay,{getInstance:function(c){var d=Parent.byClass(c,'uiOverlay');return d?DataStore.get(d,'overlay'):null;}});Class.mixin(Overlay,'Arbiter',{_root:null,_transitionSubscription:null,_hideOnSubmit:false,_hideOnSuccess:true,_fadeOnShow:true,_fadeOnHide:true,destroyOnHide:true,init:function(c){this._transitionSubscription=Arbiter.subscribe('page_transition',this.hide.shield(this),Arbiter.SUBSCRIBE_NEW);this._root=HTML(c).getRootNode();this._arrow=DOM.scry(this._root,'.uiOverlayArrow')[0]||null;this._overlay=DOM.scry(this._root,'div.uiOverlay')[0]||this._root;CSS.hide(this._root);DOM.appendContent(document.body,this._root);DataStore.set(this._overlay,'overlay',this);var d=DataStore.get(this._overlay,'width');d&&this.setWidth(d);this.setHideOnSubmit(DataStore.get(this._overlay,'hideonsubmit')=='true');this.setHideOnSuccess(DataStore.get(this._overlay,'hideonsuccess')!='false');this.setFadeOnShow(DataStore.get(this._overlay,'fadeonshow')!='false');this.setFadeOnHide(DataStore.get(this._overlay,'fadeonhide')!='false');this.setHideOnBlur(DataStore.get(this._overlay,'hideonblur')=='true');this.setDestroyOnHide(DataStore.get(this._overlay,'destroyonhide')!='false');this.setFixed(DataStore.get(this._overlay,'fixed')=='true');Event.listen(this._overlay,{click:this.click.bind(this),submit:this.submit.bind(this),mouseenter:this._onMouseEnter.bind(this),mouseleave:this._onMouseLeave.bind(this)});Arbiter.subscribe('Hovercard/show',this._onHovercardShow.bind(this));Arbiter.subscribe('Hovercard/hide',this._onHovercardHide.bind(this));b(this,this._root);return this;},setHideOnBlur:function(c){if(!c&&this._hideOnBlurToken){this._removeHideOnBlurListener();this.unsubscribe(this._hideOnBlurToken);this._hideOnBlurToken=null;}else if(c&&!this._hideOnBlurToken){var d=this;var e=function(){(function(){d._hideOnBlurListener=Event.listen(document.documentElement,'click',function(event){if(!DOM.contains(d._overlay,event.getTarget()))d.setFadeOnHide(false).hide();});}).defer();};this.subscribe('hide',this._removeHideOnBlurListener.bind(this));this._hideOnBlurToken=this.subscribe('show',e);this._shown&&e.call(this);}return this;},_removeHideOnBlurListener:function(){this._hideOnBlurListener&&this._hideOnBlurListener.remove();this._hideOnBlurListener=null;},setDestroyOnHide:function(c){this.destroyOnHide=c;return this;},setHideOnSubmit:function(c){this._hideOnSubmit=c;return this;},setHideOnSuccess:function(c){this._hideOnSuccess=c;return this;},setFadeOnShow:function(c){this._fadeOnShow=c;return this;},setFadeOnHide:function(c){this._fadeOnHide=c;return this;},setWidth:function(c){this.width=parseInt(c,10);return this;},setFixed:function(c){this.fixed=c;return this;},show:function(){if(!this._shown){CSS.show(this._root);CSS.setStyle(this._overlay,'opacity',0);DOM.appendContent(document.body,this._root);this.updatePosition();if(this._fadeOnShow!==false){animation(this._overlay).from('opacity',0).to('opacity',1).duration(100).ondone(CSS.setStyle.curry(this._overlay,'opacity','')).go();}else CSS.setStyle(this._overlay,'opacity','');this._shown=true;Arbiter.inform('layer_shown',{type:'Overlay'});Arbiter.inform('Overlay/show',{overlay:this});this.inform('show');}return this;},updatePosition:function(){if(this.width)CSS.setStyle(this._overlay,'width',this.width+'px');},hide:function(){if(!this._shown||this.inform('beforehide')===false)return;this._shown=false;var c=function(){if(this._root){DOM.remove(this._root);CSS.setStyle(this._overlay,'opacity','');}Arbiter.inform('layer_hidden',{type:'Overlay'});Arbiter.inform('Overlay/hide',{overlay:this});this.inform('hide');this.destroyOnHide&&this.destroy();}.bind(this);if(this._fadeOnHide!==false){animation(this._overlay).from('opacity',1).to('opacity',0).duration(250).ondone(c).go();}else c();},destroy:function(){Arbiter.unsubscribe(this._transitionSubscription);DOM.remove(this._root);DataStore.remove(this._root,'overlay');this._root=null;},click:function(d){var e=d.getTarget();var c=Parent.byTag(e,'input')||Parent.byTag(e,'button')||Parent.byTag(e,'a');if(c){a=c;if(CSS.hasClass(c,'uiOverlayCancelButton')){if(this.inform('cancel')!==false)this.hide();d.prevent();}}},submit:function(e){var f=e.getTarget();if(this.inform('submit')===false){e.kill();return;}var g=function(){if(this.inform('success')!==false&&this._hideOnSuccess)this.hide();}.bind(this);if(Form.getAttribute(f,'rel')==='async'){var h=(Form.getAttribute(f,'method')||'GET').toUpperCase();var d=Form.serialize(f,a);Form.setDisabled(f,true);var i=Parent.byClass(a,'stat_elem')||f;var c=Form.getAttribute(f,'ajaxify')||Form.getAttribute(f,'action');if(this._hideOnSubmit){g();g=bagofholding;}new AsyncRequest(c).setData(d).setNectarModuleDataSafe(f).setReadOnly(h=='GET').setMethod(h).setStatusElement(i).setRelativeTo(f).setInitialHandler(Form.setDisabled.curry(f,false)).setHandler(g).setErrorHandler(function(j){if(this.inform('error',{response:j})!==false)AsyncResponse.defaultErrorHandler(j);}.bind(this)).send();e.kill();}else g();},_onMouseEnter:function(){this._fireMouseLeaveOnHovercardHide=false;if(!this._layerHovercardNode)this.inform('mouseenter');},_onMouseLeave:function(){if(!this._layerHovercardNode)this.inform('mouseleave');this._fireMouseLeaveOnHovercardHide=!!this._layerHovercardNode;},_onHovercardShow:function(c,d){var e=d.node;if(DOM.contains(this._root,e))this._layerHovercardNode=e;},_onHovercardHide:function(c,d){if(this._layerHovercardNode===d.node){this._layerHovercardNode=null;if(this._fireMouseLeaveOnHovercardHide)this._onMouseLeave();}}});}();
function ContextualDialogX(){this.parent.construct(this);return this;}Class.extend(ContextualDialogX,'Overlay');copy_properties(ContextualDialogX,{ARROW_INSET:22,VARROW_HEIGHT:16,TOP_MARGIN:8,BOTTOM_MARGIN:30,HALO_WIDTH:0,getInstance:function(b){var a=DataStore.get(b,'ContextualDialogX');return a||Overlay.getInstance(b);}});ContextualDialogX.prototype={_scrollListener:null,init:function(c){this.parent.init(c);var b=DataStore.get.curry(this._root);this.setAlignH(b('alignh','left'));this.setOffsetX(b('offsetx',0));this.setOffsetY(b('offsety',0));this.setPosition(b('position'));var a=b('context');if(a){this.setContext($(a));}else{a=b('contextselector');if(a)this.setContext(DOM.find(document,a));}this._content=DOM.scry(this._root,'.uiContextualDialogContent')[0];var e=null;var d=null;this.subscribe('show',function(){var f=this.updatePosition.shield(this);e=Event.listen(window,'resize',f);d=Arbiter.subscribe('reflow',f);this._setupScrollListener(this._scrollParent);}.bind(this));this.subscribe('hide',function(){e.remove();Arbiter.unsubscribe(d);this._teardownScrollListener();}.bind(this));Arbiter.subscribe('Hovercard/hide',function(f,g){if(Hovercard.contains(this.getContext()))this.hide();}.bind(this));},setAlignH:function(a){this.alignH=a;return this;},getContent:function(){return this._content;},getContext:function(){return this.context;},setContext:function(a){a=$(a);if(this.context&&this.context!=a)DataStore.remove(this.context,'ContextualDialogX');this.context=a;var b=Parent.byClass(a,'fbPhotoSnowbox');if(b)b.appendChild(this._root);if(this._scrollListener&&this._scrollParent!==b){this._teardownScrollListener();this._setupScrollListener(b);}this._scrollParent=b;var c=OverlayZIndexHelper.getZIndex(a,b);CSS.setStyle(this._root,'z-index',c>200?c:'');DataStore.set(this.context,'ContextualDialogX',this);return this;},listen:function(b,a){return Event.listen(this._root,b,a);},setFixed:function(a){CSS.conditionClass(this._root,'uiContextualDialogFixed',a);return this.parent.setFixed(a);},setOffsetX:function(a){this.offsetX=parseInt(a,10)||0;return this;},setOffsetY:function(a){this.offsetY=parseInt(a,10)||0;return this;},setPosition:function(a){this.position=a;return this;},updatePosition:function(){if(!this.context)return this;this.parent.updatePosition();var c=this.fixed?'viewport':'document';var g=Vector2.getElementPosition(this.context,c);var h=this._scrollParent;if(h)g=g.sub(Vector2.getElementPosition(h,'document')).add(h.scrollLeft,h.scrollTop);var a=Vector2.getElementDimensions(this.context);var k=this.position=='above'||this.position=='below';var d=intl_locale_is_rtl();if(d!=(this.position=='right'))g=g.add(a.x,0);if(this.position=='below')g=g.add(0,a.y);var f=new Vector2(0,0);var b=this.width+2*ContextualDialogX.HALO_WIDTH;if(k&&this.alignH=='center'){f=f.add((a.x-b)/2,0);}else{f=f.sub(k?ContextualDialogX.HALO_WIDTH:0,k?0:ContextualDialogX.HALO_WIDTH);var j=k?a.x:a.y;var e=2*(ContextualDialogX.ARROW_INSET+ContextualDialogX.HALO_WIDTH);if(j<e){var i=j/2-ContextualDialogX.ARROW_INSET;f=f.add(k?i:0,k?0:i);}}if(k&&this.alignH=='right')f=f.mul(-1,1).add(a.x-b,0);f=f.add(this.offsetX,this.offsetY);if(d)f=f.mul(-1,1);g=g.add(f);if(this.fixed)g=new Vector2(g.x,g.y,'document');g.setElementPosition(this._root);this._adjustVerticalPosition();return this;},scrollTo:function(){if(this.context)Bootloader.loadComponents('dom-scroll',function(){DOMScroll.scrollTo(this.context,true,true);}.bind(this));},destroy:function(){this.context&&DataStore.remove(this.context,'ContextualDialogX');this.parent.destroy();},_adjustVerticalPosition:function(){if(this.position!='left'&&this.position!='right')return;var c=Vector2.getElementPosition(this._root,'viewport').y;var a=Vector2.getElementDimensions(this._overlay).y;var e=Vector2.getViewportDimensions().y;var d=ContextualDialogX.TOP_MARGIN;var b=Math.min(Math.max(0,c+a+ContextualDialogX.BOTTOM_MARGIN-e),Math.max(-d,c-d),a-2*ContextualDialogX.ARROW_INSET-2*ContextualDialogX.HALO_WIDTH);CSS.setStyle(this._overlay,'top',(-1*b)+'px');CSS.setStyle(this._arrow,'marginTop',b+'px');},_setupScrollListener:function(a){this._scrollListener=Event.listen(a||window,'scroll',this._adjustVerticalPosition.shield(this));},_teardownScrollListener:function(){this._scrollListener.remove();this._scrollListener=null;}};
if(!window.Toggler){window.Toggler=function(){this.init();};(function(){var e=[];var c;function d(){d=bagofholding;Event.listen(document.documentElement,'click',function(event){var f=event.getTarget();e.each(function(g){g.active&&!g.sticky&&!DOM.contains(g.getActive(),f)&&!g.inTargetFlyout(f)&&!g.inTargetContextualDialog(f)&&g.inActiveDialog()&&g.hide();});},Event.Priority.URGENT);}function a(g,f){if(g instanceof Toggler)return g;return Toggler.getInstance(f);}function b(g){var f=DOM.scry(g,'a[rel="toggle"]');if(f.length>0&&f[0].getAttribute('data-target'))return ge(f[0].getAttribute('data-target'));}Class.mixin(Toggler,'Arbiter',{init:function(){this.active=null;this.togglers={};this.setSticky(false);e.push(this);this.subscribe(['show','hide'],Toggler.inform.bind(Toggler));d();},show:function(h){var f=a(this,h);var i=f.active;if(h!==i){i&&f.hide();f.active=h;CSS.addClass(h,'openToggler');var g=DOM.scry(h,'a[rel="toggle"]');if(g.length>0&&g[0].getAttribute('data-target'))CSS.removeClass(ge(g[0].getAttribute('data-target')),'toggleTargetClosed');DOM.appendContent(h,f.getToggler('next'));DOM.prependContent(h,f.getToggler('prev'));f.inform('show',f);}},hide:function(i){var g=a(this,i);var f=g.active;if(f&&(!i||i===f)){CSS.removeClass(f,'openToggler');var h=DOM.scry(f,'a[rel="toggle"]');if(h.length>0&&h[0].getAttribute('data-target'))CSS.addClass(ge(h[0].getAttribute('data-target')),'toggleTargetClosed');values(g.togglers).each(DOM.remove);g.inform('hide',g);g.active=null;}},toggle:function(g){var f=a(this,g);if(f.active===g){f.hide();}else f.show(g);},getActive:function(){return a(this).active;},inTargetFlyout:function(g){var f=b(this.getActive());return f&&DOM.contains(f,g);},inTargetContextualDialog:function(i){var h=b(this.getActive());var g=ContextualDialogX.getInstance(i);var f=g&&g.getContext();return h&&f&&DOM.contains(h,f);},inActiveDialog:function(){var f=Dialog.getCurrent();return !f||DOM.contains(f.getRoot(),this.getActive());},getToggler:function(g){var f=a(this);if(!f.togglers[g])f.togglers[g]=$N('button',{className:'hideToggler',onfocus:function(){var h=DOM.scry(f.active,'a[rel="toggle"]')[0];h&&h.focus();f.hide();}});return this.togglers[g];},setSticky:function(g){var f=a(this);g=g!==false;if(g!==f.sticky){f.sticky=g;if(g){f._pt&&Arbiter.unsubscribe(f._pt);}else f._pt=Arbiter.subscribe('page_transition',f.hide.bind(f,null));}return f;}});copy_properties(Toggler,Toggler.prototype);copy_properties(Toggler,{bootstrap:function(f){var g=f.parentNode;Toggler.getInstance(g).toggle(g);},createInstance:function(g){var f=new Toggler().setSticky(true);DataStore.set(g,'toggler',f);return f;},getInstance:function(g){while(g){var f=DataStore.get(g,'toggler');if(f)return f;if(CSS.hasClass(g,'uiToggleContext'))return Toggler.createInstance(g);g=g.parentNode;}return (c=c||new Toggler());},listen:function(h,g,f){return Toggler.subscribe($A(h),function(j,i){if(i.getActive()===g)return f(j,i);});},subscribe:(function(f){return function(h,g){h=$A(h);if(h.contains('show'))e.each(function(i){if(i.getActive())g.curry('show',i).defer();});return f(h,g);};})(Toggler.subscribe.bind(Toggler))});})();}
var TooltipLink={setTooltipText:function(a,b){TooltipLink.setTooltipEnabled(a,b!==null&&b!=='');a=Parent.byClass(a,'uiTooltip');if(a)DOM.setContent(DOM.find(a,'span.uiTooltipText'),b);},setTooltipEnabled:function(b,a){b=Parent.byClass(b,'uiTooltip');b&&CSS.conditionClass(b,'uiTooltipDisabled',!a);}};
var Selector=function(){var a;var i=false;function b(k){return Parent.byClass(k,'uiSelector');}function c(k){return Parent.byClass(k,'uiSelectorButton');}function e(k){return DOM.scry(k,'select')[0];}function d(k){return DOM.find(k,'div.uiSelectorMenuWrapper');}function f(){f=bagofholding;Menu.subscribe('select',function(k,m){if(!a||!m||m.menu!==Selector.getSelectorMenu(a))return;var n=g(a);var p=h(m.item);if(p){var l=a;var o=Selector.isOptionSelected(m.item);var q=Selector.inform('select',{selector:l,option:m.item});if(q===false)return;if(n||!o){Selector.setSelected(l,Selector.getOptionValue(m.item),!o);Selector.inform('toggle',{selector:l,option:m.item});Selector.inform('change',{selector:l});Arbiter.inform('Form/change',{node:l});if(j(l))DataStore.set(l,'dirty',true);}}if(!n||!p)a&&Selector.toggle(a);});}function g(k){return !!k.getAttribute('data-multiple');}function h(k){return CSS.hasClass(k,'uiSelectorOption');}function j(k){return !!k.getAttribute('data-autosubmit');}onloadRegister(function(){var k={};k.keydown=function(event){var m=event.getTarget();if(DOM.isNodeOfType(m,['input','textarea']))return;switch(Event.getKeyCode(event)){case KEYS.DOWN:case KEYS.SPACE:case KEYS.UP:i=true;if(c(m)){var l=b(m);Selector.toggle(l);return false;}break;case KEYS.ESC:i=true;if(a){Selector.toggle(a);return false;}break;case KEYS.RETURN:i=true;break;}};k.keyup=function(){!function(){i=false;}.defer();};Event.listen(document.body,k);Toggler.subscribe(['show','hide'],function(s,r){var o=b(r.getActive());if(o){f();var l=Selector.getSelectorButton(o);var m=Selector.getSelectorMenu(o);var p=s==='show';if(p){a=o;if(CSS.hasClass(l,'uiButtonDisabled')){Selector.setEnabled(o,false);return false;}m=m||Selector.loadMenu(o);if(m){Menu.register(m);if(i){var n=Menu.getCheckedItems(m);if(!n.length)n=Menu.getEnabledItems(m);Menu.focusItem(n[0]);}}}else{a=null;m&&Menu.unregister(m);i&&l.focus();if(j(o)&&DataStore.get(o,'dirty')){var q=DOM.scry(o,'input.submitButton')[0];q&&q.click();DataStore.remove(o,'dirty');}}CSS.conditionClass(Selector.getSelectorButton(o),'selected',p);Selector.inform(p?'open':'close',{selector:o});}});});return copy_properties(new Arbiter(),{attachMenu:function(o,k,m){o=b(o);if(o){a&&Menu.unregister(Selector.getSelectorMenu(a));DOM.setContent(d(o),k);a&&Menu.register(Selector.getSelectorMenu(o));if(m){var l=o.getAttribute('data-name');l&&m.setAttribute('name',l);if(!g(o))m.setAttribute('multiple',false);var n=e(o);if(n){DOM.replace(n,m);}else DOM.insertAfter(o.firstChild,m);}return true;}},getOption:function(m,n){var l=Selector.getOptions(m),k=l.length;while(k--)if(n===Selector.getOptionValue(l[k]))return l[k];return null;},getOptions:function(l){var k=Menu.getItems(Selector.getSelectorMenu(l));return k.filter(h);},getEnabledOptions:function(l){var k=Menu.getEnabledItems(Selector.getSelectorMenu(l));return k.filter(h);},getSelectedOptions:function(k){return Menu.getCheckedItems(Selector.getSelectorMenu(k));},getOptionText:function(k){return Menu.getItemLabel(k);},getOptionValue:function(l){var n=b(l);var m=e(n);var k=Selector.getOptions(n).indexOf(l);return k>=0?m.options[k+1].value:'';},getSelectorButton:function(k){return DOM.find(k,'a.uiSelectorButton');},getSelectorMenu:function(k){return DOM.scry(k,'div.uiSelectorMenu')[0];},getValue:function(o){var m=e(o);if(!m)return null;if(!g(o))return m.value;var p=[];var l=m.options;for(var k=1,n=l.length;k<n;k++)if(l[k].selected)p.push(l[k].value);return p;},isOptionSelected:function(k){return Menu.isItemChecked(k);},listen:function(l,m,k){return this.subscribe(m,function(o,n){if(n.selector===l)return k(n,o);});},loadMenu:function(n){var m=Selector.getSelectorMenu(n);if(!m){var l=Selector.getSelectorButton(n);var k=l.getAttribute('ajaxify');if(k){var o=HTML('<div class="uiSelectorMenuWrapper uiToggleFlyout">'+'<div class="uiMenu uiSelectorMenu loading">'+'<ul class="uiMenuInner">'+'<li><span></span></li>'+'</ul>'+'</div>'+'</div>');DOM.appendContent(l.parentNode,o);Bootloader.loadComponents('async',function(){AsyncRequest.bootstrap(k,l);});m=Selector.getSelectorMenu(n);l.removeAttribute('onmouseover');}}return m;},setButtonLabel:function(n,l){var k=Selector.getSelectorButton(n);var m=parseInt(k.getAttribute('data-length'),10);l=l||k.getAttribute('data-label')||'';Button.setLabel(k,l);if(typeof l==='string'){CSS.conditionClass(k,'uiSelectorBigButtonLabel',l.length>m);if(m&&l.length>m){k.setAttribute('title',l);}else k.removeAttribute('title');}},setButtonTooltip:function(m,l){var k=Selector.getSelectorButton(m);TooltipLink.setTooltipText(k,l||k.getAttribute('data-tooltip')||'');},setEnabled:function(l,k){if(!k&&a&&b(l)===a)Selector.toggle(l);Button.setEnabled(Selector.getSelectorButton(l),k);},setOptionEnabled:function(l,k){Menu.setItemEnabled(l,k);},setSelected:function(o,p,m){m=m!==false;var l=Selector.getOption(o,p);if(!l)return;var k=Selector.isOptionSelected(l);if(m!==k){if(!g(o)&&!k){var n=Selector.getSelectedOptions(o)[0];n&&Menu.toggleItem(n);}Menu.toggleItem(l);Selector.updateSelector(o);}},toggle:function(k){Toggler.toggle(DOM.scry(b(k),'div.wrap')[0]);},updateSelector:function(v){var s=Selector.getOptions(v);var u=Selector.getSelectedOptions(v);var p=e(v).options;var r=[];var x=[];for(var o=0,q=s.length;o<q;o++){var t=u.contains(s[o]);p[o+1].selected=t;if(t){var w=Selector.getOptionText(s[o]);r.push(w);x.push(s[o].getAttribute('data-tooltip')||w);}}p[0].selected=!u.length;var m=CSS.hasClass(v,'uiSelectorDynamicLabel');var n=CSS.hasClass(v,'uiSelectorDynamicTooltip');if(m||n){var l='';if(g(v)){var k=Selector.getSelectorButton(v);l=k.getAttribute('data-delimiter')||', ';}r=r.join(l);x=x.join(l);m&&Selector.setButtonLabel(v,r);n&&Selector.setButtonTooltip(v,x);}}});}();
onloadRegister(function(){Selector.subscribe('close',function(a,b){if(CSS.hasClass(b.selector,'commentHideSelector')){var c=Selector.getValue(b.selector);c&&Selector.setSelected.curry(b.selector,c,false).defer();}});});
function StreamProfileComposer(){}StreamProfileComposer.prototype={init:function(a){var b=$(a);Arbiter.subscribe('composer/publish',function(event,c){if(c.streamStory)animation.prependInsert(b,c.streamStory);});}};
(function(){var b=1,a=2;var g={};var f=function(){var j=DOM.scry(this.root,'span.linkAttachment')[0];if(!j&&this.isMetaComposer)j=DOM.scry(this.root,'span.attachmentAcceptsLink')[0];if(!j)return;var i=Parent.byTag(j,'form');this.scraper=new URLScraper(this.input);this.scraper.subscribe('match',function(k,l){if(this.isMetaComposer){var m=this.form.xhpc_targetid;var n=new URI('/ajax/metacomposer/attachment/link/scraper.php');n.addQueryData({scrape_url:encodeURIComponent(l.url),targetid:m.value});i.action=n.toString();}else{CSS.show(j);i.action='/ajax/composer/attachment/link/scraper.php?scrape_url='+encodeURIComponent(l.url);}i.xhpc.value=j.id;i.xhpc.disabled=false;i.xhpc.click();}.bind(this));this.isMetaComposer&&this.scraper.check();};var e=function(){var j=this.form.xhpc_targetid;var k=j.value;var i=Arbiter.subscribe('ComposerAudienceSelector/group',function(m,n){j.value=n.group;});var l=Arbiter.subscribe('ComposerAudienceSelector/nongroup',function(){j.value=k;});onunloadRegister(Arbiter.unsubscribe.curry(i));onunloadRegister(Arbiter.unsubscribe.curry(l));};var h=function(event,i){i=i||{};i.evt=event;i.flowID=this.flowID;i.context=this.form.xhpc_context.value;i.target=this.form.action.split('/').pop();i={data:JSON.stringify(i)};new AsyncSignal('/ajax/composer/logging.php',i).send();};var d=function(i){this.flowID=new Date().getTime().toString()+(rand32()+1);this._logged_short=this._logged_long=false;if(i)return;Event.listen(this.input,'keypress',function(){var j=Input.getValue(this.input).length;if(!this._logged_short&&j>=2){h.call(this,'typing',{extra:'short'});this._logged_short=true;return;}if(!this._logged_long&&j>=15){h.call(this,'typing',{extra:'long'});this._logged_long=true;}}.bind(this));};var c=function(i){if(this.inform('submit')===false){i.kill();return false;}h.call(this,'publish');if(this.submitHandler)return (new Function(this.submitHandler)).apply(this.form);};window.Composer=function(l,k,j,i){g[l.id]=this;this.root=l;this.resetCfg=k;this.dataSource=i;this.lazyEndpoint=this.resetCfg&&this.resetCfg.lazyEndpoint;Bootloader.loadComponents('dom',function(){this.focus=DOM.find(l,'div.focus_target');this.form=DOM.find(l,'form.attachmentForm');this.content=DOM.find(l,'div.attachmentContent');this.isMetaComposer=j;if(this.isMetaComposer){this.messageBox=DOM.find(l,'div.uiMetaComposerMessageBox');this.metaArea=DOM.find(l,'div.attachmentMetaArea');this.bottomArea=DOM.find(l,'div.attachmentBottomArea');this.barArea=DOM.find(l,'div.attachmentBarArea');this.blurb=DOM.find(l,'div.uiMetaComposerMessageBox div.textBlurb');this.input=DOM.find(l,'div.uiMetaComposerMessageBox textarea.input');this.button=DOM.find(l,'div.uiMetaComposerMessageBox label.submitBtn');this.privacy=DOM.find(l,'div.uiMetaComposerMessageBox li.privacyWidget');}else{this.blurb=DOM.find(l,'div.uiComposerMessageBox div.textBlurb');this.input=DOM.find(l,'div.uiComposerMessageBox textarea.input');this.button=DOM.find(l,'div.uiComposerMessageBox label.submitBtn');this.privacy=DOM.find(l,'div.uiComposerMessageBox li.privacyWidget');}Event.listen(this.form,'submit',c.bind(this));if(this.isMetaComposer){Event.listen(this.input,'focus',this.onFocus.bind(this));if(Parent.byClass(this.input,'child_was_focused'))this.onFocus.bind(this).defer();}Arbiter.inform('xhpc/construct/'+l.id,this,Arbiter.BEHAVIOR_STATE);}.bind(this));};Class.mixin(Composer,'Arbiter',{init:function(i){this.mentionsInput=i;if(this.mentionsInput){this.mentionsInput.subscribe('init',function(){var j=this.mentionsInput.getTypeahead().getView();j.subscribe(['reset','render'],function(k){CSS.conditionClass(this.root,'uiComposerMention',(k=='render'));}.bind(this));}.bind(this));this.mentionsInput.subscribe('update',function(k,j){Arbiter.inform('Composer/mentions',keys(j.mentioned));});}f.call(this);d.call(this);if(this.isMetaComposer)e.call(this);this.inform('init',null,Arbiter.BEHAVIOR_PERSISTENT);},setBlurb:function(i){DOM.setContent(this.blurb,i);},setEnabled:function(i){Button.setEnabled(this.button,i);},setLoading:function(i){CSS.conditionClass(this.root,'async_saving',!!i);},setContentVisible:function(i){CSS.conditionClass(this.root,'uiComposerHideContent',!i);},setMessageBoxVisible:function(i){CSS.conditionClass(this.root,'uiComposerHideMessageBox',!i);},setInputVisible:function(i){CSS.conditionClass(this.root,'uiComposerHideInput',!i);},setTopicTaggerVisible:function(i){CSS.conditionClass(this.root,'uiTagComposerHidden',!i);},mutate:function(k){var j=ge(k.xhpc);if(j){var l=DOM.scry(this.root,'.uiComposerAttachmentSelected')[0];if(k.confirmAugmentation&&l!==j)return;l&&CSS.removeClass(l,'uiComposerAttachmentSelected');CSS.addClass(j,'uiComposerAttachmentSelected');if(!k.disableCache)Event.listen(j,'click',function(m){$E(m).stop();k.disableCache=true;this.mutate(k);}.bind(this));}if(!k.keepContentAreas){this.setContentVisible(false);DOM.empty(this.content);if(this.isMetaComposer){this.mentionsInput&&this.mentionsInput.setAuxContent(null);DOM.empty(this.metaArea);DOM.empty(this.bottomArea);DOM.empty(this.barArea);}}if(k.content){DOM.setContent(this.content,HTML(k.content));this.setContentVisible(true);}if(this.isMetaComposer){k.metaContent&&DOM.setContent(this.metaArea,HTML(k.metaContent));k.bottomContent&&DOM.setContent(this.bottomArea,HTML(k.bottomContent));k.barContent&&DOM.setContent(this.barArea,HTML(k.barContent));}this.setMessageBoxVisible(!k.messageBoxHidden);CSS.conditionClass(this.root,'uiComposerWhiteMessageBox',!k.messageBoxHidden&&!k.inputHidden&&!k.content);this.setInputVisible(!k.inputHidden);CSS.conditionShow(this.privacy,!k.privacyWidgetHidden);Input.setPlaceholder(this.input,k.placeholder);Button.setLabel(this.button,k.buttonLabel);this.setBlurb(HTML(k.blurb));if(!this.isMetaComposer)CSS.conditionClass(DOM.scry(this.form,'.uiComposerMessageBox')[0],'uiCheckinComposer',k.placeVisible);if(k.autoscrape){this.scraper&&this.scraper.enable();}else this.scraper&&this.scraper.disable();this.setEnabled(!k.disabled);this.setTopicTaggerVisible(!k.hideTopicTagger);this.form.setAttribute('action',k.endpoint);if(k.formType==b){this.form.setAttribute('rel','async');}else this.form.removeAttribute('rel');if(k.formType==a){this.form.target=k.iframeName;this.form.enctype=this.form.encoding='multipart/form-data';}else{this.form.removeAttribute('target');this.form.removeAttribute('enctype');this.form.removeAttribute('encoding');}this.submitHandler=k.submitHandler;this.lazyEndpoint=k.lazyEndpoint;k.attachmentJS&&(new Function(k.attachmentJS)).apply(this);CSS.addClass(this.root,'uiComposerInteracted');CSS.addClass(this.root,'uiComposerOpen');if(k.messageBoxFocused){var i=document.activeElement;if(i===document.body||Parent.byClass(i,'attachmentLink'))this.focusInput.bind(this).defer();}Arbiter.inform('composer/mutate',this);},subscribeToMutate:function(i){return Arbiter.subscribe('composer/mutate',function(j,k){if(k===this)i();}.bind(this));},reset:function(j,i){if(!j){Input.reset(this.input);this.mentionsInput&&this.mentionsInput.reset();}if(this.isMetaComposer){DOM.empty(this.metaArea);DOM.empty(this.bottomArea);DOM.empty(this.barArea);}if(this.resetCfg){this.mutate(this.resetCfg);}else{var k=DOM.scry(this.root,'.uiComposerAttachmentSelected')[0];if(k)CSS.removeClass(k,'uiComposerAttachmentSelected');}CSS.removeClass(this.root,'uiComposerInteracted');CSS.setClass(this.focus,'focus_target');this.setLoading(false);d.call(this,true);if(i){var l=DOM.scry(this.root,'.widget')[0];l&&DOM.replace(l,i);}Arbiter.inform('composer/reset');},onFocus:function(){if(this.lazyEndpoint){var i=DOM.find(this.root,'form.attachmentSelectForm');var k=new URI(this.lazyEndpoint);k.setQueryData({isAugmentation:true});i.action=k.toString();var j=DOM.scry(this.root,'.uiComposerAttachmentSelected')[0];i.xhpc.value=j&&j.id;i.xhpc.click();CSS.removeClass.curry(this.root,'async_saving').defer();}this.inform('focus');},focusInput:function(){Input.focus(this.input);},getInput:function(){return this.input;},updateDataSourceToken:function(i){if(this.dataSource)this.dataSource.updateToken(i);}});copy_properties(Composer,{publish:function(j,i){i=i||{};i.composer=Composer.getInstance($(j));i.composer.reset(false,i.audienceMarkup);i.audienceMarkup=null;if(i.streamMarkup)i.streamStory=HTML(i.streamMarkup).getRootNode();Arbiter.inform('composer/publish',i);},getInstance:function(i){var j=Parent.byClass($(i),'uiComposer');return j?g[j.id]:null;}});})();
function MetaComposerMessageBox(){}MetaComposerMessageBox.prototype={init:function(b,a){this.inputContainer=DOM.scry(b,'div.inputContainer')[0];this.textInput=DOM.scry(b,'textarea.mentionsTextarea')[0];this.metaArea=DOM.scry(b,'div.attachmentMetaArea')[0];this.bottomArea=DOM.scry(b,'div.attachmentBottomArea')[0];this.barArea=DOM.scry(b,'div.attachmentBarArea')[0];Event.listen(this.inputContainer,'click',function(c){var d=c.getTarget();if(!DOM.contains(this.metaArea,d)&&d!==this.textInput)this.textInput.focus();}.bind(this));}};
function MentionsInput(a){DataStore.set(a,'MentionsInput',this);this._root=a;}MentionsInput.getInstance=function(a){var b=Parent.byClass(a,'uiMentionsInput');return b?DataStore.get(b,'MentionsInput'):null;};(function(){var a='@\\uff20';var e='.,+*?$|#{}()\\^\\-\\[\\]\\\\\/!@%&\'"~=<>_:;';var d='\\b[A-Z][^ A-Z'+e+']';var c='(?:['+a+']([^'+a+e+']{0,20}))';var b='(?:(?:'+d+'+)|'+c+')';var f='(?:'+d+'{4,})';MentionsInput.prototype={_matcher:new RegExp(c+'$'),_autoMatcher:new RegExp(b+'$'),_userMatcher:new RegExp(f+'$')};})();Class.mixin(MentionsInput,'Arbiter',{init:function(a,b){this.init=bagofholding;this._initialized=true;this._typeahead=Typeahead.getInstance(DOM.find(this._root,'.mentionsTypeahead'));this._highlighter=DOM.find(this._root,'.highlighter');this._highlighterInner=this._highlighter.firstChild;this._highlighterContent=DOM.find(this._root,'.highlighterContent');this._hiddenInput=DOM.find(this._root,'.mentionsHidden');this._input=this._typeahead.getCore().getElement();this._placeholder=this._input.getAttribute('placeholder');this._maxMentions=a.max||6;if(ua.firefox()<4){this._input.blur();setTimeout(function(){this._input.focus();}.bind(this));}if(!this._hiddenInput.name){var c=this._input.name;this._input.name=c+'_text';this._hiddenInput.name=c;}this._initEvents();this._initTypeahead();this.reset(b);this.inform('init',null,Arbiter.BEHAVIOR_STATE);},reset:function(b){if(!this._initialized)return;this._mentioned={};this._orderedUIDs=[];this._numMentioned=0;this._filterData=null;this._hiddenInput&&(this._hiddenInput.value='');this._highlighterContent&&DOM.empty(this._highlighterContent);this._highlighterAuxContent&&DOM.remove(this._highlighterAuxContent);this._highlighterAuxContent=null;Input.setPlaceholder(this._input,this._placeholder);CSS.setStyle(this._typeahead.getElement(),'height','auto');if(b){Input.setValue(this._input,b.flattened);for(var a in b.mention_data)this._addToken({uid:a,text:b.mention_data[a],type:'unknown'});}this._updateTypeahead();this._updateWidth();this._update();},getRawValue:function(){return Input.getValue(this._hiddenInput);},getTypeahead:function(){return this._typeahead;},_initEvents:function(){var a=this._update.bind(this);Event.listen(this._input,{input:a,keyup:a,change:a,focus:this._updateWidth.bind(this)});},_initTypeahead:function(){this._typeahead.subscribe('select',function(c,d){var e=d.selected;this._addToken({uid:e.uid,text:e.text,type:e.type});this.updateValue();}.bind(this));var a=this._input;var b=null;this._typeahead.subscribe('render',function(event){if(b===null){b=Input.getSubmitOnEnter(a);Input.setSubmitOnEnter(a,false);}});this._typeahead.subscribe('reset',function(event){if(b!==null){Input.setSubmitOnEnter(a,b);b=null;}});this._typeahead.subscribe('query',function(){this._filterData=null;}.bind(this));this._typeahead.getCore().suffix='';this._typeahead.getData().setFilter(this._filterResults.bind(this));},_filterResults:function(d){if(this._filterData===null){var a=Input.getSelection(this._input).start||0;for(var c=0;c<this._offsets.length;c++){var e=this._offsets[c];if(a>e[0]&&a<=e[1]){this._filterData={caretIsInsideMention:true};return false;}}var b=this._typeahead.getCore();this._filterData={value:b.getValue(),rawValue:b.getRawValue()};}if(this._filterData.caretIsInsideMention)return false;if(this._matcher.test(this._filterData.rawValue))return true;if(d.type!='user'&&!d.auto)return false;if(this._userMatcher.test(this._filterData.value))return true;return TypeaheadUtil.isExactMatch(this._filterData.value,this._typeahead.getData().getTextToIndex(d));},_addToken:function(a){var b=a.uid;if(!this._mentioned.hasOwnProperty(b)){this._mentioned[b]=a;this._orderedUIDs.push(b);this._numMentioned++;this._updateTypeahead();}},_removeToken:function(a){if(this._mentioned.hasOwnProperty(a)){delete this._mentioned[a];this._orderedUIDs.remove(a);this._numMentioned--;this._updateTypeahead();}},_reduceToken:function(f,d){var e=d.split(' ');var b=[];for(var a=0;a<e.length;a++)if(f.indexOf(e[a])!=-1)b.push(e[a]);e=b;for(a=1;a<e.length;a++)for(var c=1;c<e[a-1].length+1;c++)if(f.indexOf(e[a-1].substr(0,c)+e[a])!=-1)e.splice(a-1,1);while(f.indexOf(e.join(' '))==-1)e.splice(0,1);return e.join(' ');},_update:function(){var a=Input.getValue(this._input);if(a==this._value)return;this._value=a;this._updateTokens();this.updateValue();},_updateTokens:function(){var f=Input.getValue(this._input);for(var a=0;a<this._orderedUIDs.length;++a){var e=this._orderedUIDs[a];var b=this._mentioned[e];var d=b.text;var c;if(b.type=='user'&&(c=this._reduceToken(f,d))!==''){b.text=c;}else if(!d||f.indexOf(d)==-1||typeof d!=='string')this._removeToken(e);}},updateValue:function(){var g=Input.getValue(this._input);var f=this._orderedUIDs;var c=[];var a,d,e,b;for(b=0;b<f.length;++b){d=this._mentioned[f[b]].text;g=g.replace(d,function(h,i){c.push([i,i+d.length]);return d;});}for(b=0;b<f.length;++b){e=f[b];d=this._mentioned[e].text;g=g.replace(d,'@['+e+':]');}a=htmlize(g);for(b=0;b<f.length;++b){e=f[b];d=this._mentioned[e].text;a=a.replace('@['+e+':]','<b>'+htmlize(d)+'</b>');d=d.replace(/[\\\]:]/g,function(h){return '\\'+h;});g=g.replace('@['+e+':]','@['+e+':'+d+']');}if(ua.ie())a=a.replace(/ {2}/g,'&nbsp; ');this._offsets=c;this._hiddenInput.value=g;DOM.setContent(this._highlighterContent,HTML(a));this._updateHeight();},_updateWidth:function(){var a=CSS.getStyleFloat.curry(this._input);var b=this._input.offsetWidth-a('paddingLeft')-a('paddingRight')-a('borderLeftWidth')-a('borderRightWidth');if(ua.firefox())b-=2;if(ua.ie()<=7){b-=CSS.getStyleFloat(this._highlighterInner,'paddingLeft');this._highlighter.style.zoom=1;}this._highlighterInner.style.width=Math.max(b,0)+'px';},_updateHeight:function(){if(this._highlighterAuxContent){var a=this._highlighter.offsetHeight;var b=this._typeahead.getElement();if(a>b.offsetHeight){CSS.setStyle(b,'height',a+'px');Arbiter.inform('reflow');}}},_updateTypeahead:function(){var a=this._typeahead.getCore();var b=null;if(!this._maxMentions||this._numMentioned<this._maxMentions)b=this._autoMatcher;a.matcher=b;a.setExclusions(this._orderedUIDs);this.inform('update',{mentioned:this._mentioned});},setAuxContent:function(a){if(this._highlighterContent){if(!this._highlighterAuxContent){this._highlighterAuxContent=$N('span',{className:'highlighterAuxContent'});DOM.insertAfter(this._highlighterContent,this._highlighterAuxContent);}DOM.setContent(this._highlighterAuxContent,a);if(a){Input.setPlaceholder(this._input,'');}else Input.setPlaceholder(this._input,this._placeholder);this._updateHeight();}},getAuxContentRoot:function(){return this._highlighterAuxContent;},addMention:function(a){var b=Input.getValue(this._input);Input.setValue(this._input,b+" "+a.text);this._addToken(a);this._update();},getMentions:function(){return this._mentioned;}});
function MultiBootstrapDataSource(a){this._bootstrapEndpoints=a.bootstrapEndpoints;this.parent.construct(this,a);}Class.extend(MultiBootstrapDataSource,'DataSource');MultiBootstrapDataSource.prototype={bootstrapWithoutToken:function(){for(var a=0;a<this._bootstrapEndpoints.length;a++)this.fetch(this._bootstrapEndpoints[a].endpoint,this._bootstrapEndpoints[a].data||{},this._bootstrapEndpoints[a].token);},bootstrapWithToken:function(){for(var b=0;b<this._bootstrapEndpoints.length;b++){var a=copy_properties({},this._bootstrapEndpoints[b].data||{});a.token=this._bootstrapEndpoints[b].token;this.fetch(this._bootstrapEndpoints[b].endpoint,a,{replaceCache:true});}}};
function TypeaheadCore(a){copy_properties(this,a);}Class.mixin(TypeaheadCore,'Arbiter',{events:['blur','focus','unselect'],keepFocused:true,resetOnSelect:false,resetOnKeyup:true,setValueOnSelect:false,queryTimeout:250,preventFocusChangeOnTab:false,init:function(b,d,c){this.init=bagofholding;this.data=b;this.view=d;this.root=c;this.element=DOM.find(c,'.textInput');var a=DOM.scry(this.element,'input')[0];if(a)this.element=a;this.inputWrap=DOM.find(c,'div.wrap');this.hiddenInput=DOM.find(c,'input.hiddenInput');this.value='';this.selectedText=null;if(this.setValueOnSelect&&CSS.hasClass(this.inputWrap,'selected'))this.selectedText=this.getValue();this.initView();this.initData();this.initEvents();this.initToggle();this._exclusions=[];},initView:function(){this.view.subscribe('highlight',function(){this.element.focus();}.bind(this));this.view.subscribe('select',function(a,b){this.select(b.selected);}.bind(this));this.view.subscribe('afterSelect',function(){this.afterSelect();}.bind(this));},initData:function(){this.data.subscribe('respond',function(a,b){if(b.forceDisplay||b.value==this.getValue()&&!this.element.disabled)this.view.render(b.value,b.results,b.isAsync);}.bind(this));this.data.subscribe('activity',function(a,b){this.fetching=b.activity;if(!this.fetching)this.nextQuery&&this.performQuery();}.bind(this));},initEvents:function(){Event.listen(this.view.getElement(),{mouseup:this.viewMouseup.bind(this),mousedown:this.viewMousedown.bind(this)});var a={blur:bind(this,'blur'),focus:bind(this,'focus'),click:bind(this,'click'),keyup:bind(this,'keyup'),keydown:bind(this,'keydown')};if(ua.firefox())a.text=a.keyup;if(ua.firefox()<4){a.keypress=a.keydown;delete a.keydown;}Event.listen(this.element,a);Event.listen(this.element,'keypress',this.keypress.bind(this));},initToggle:function(){var b=this.root.parentNode;var d=CSS.getStyle(b,'position')!='static'?b:this.root;var c=this.view;var a='uiTypeaheadFocused';this.subscribe('focus',function(){c.show();CSS.addClass(d,a);});this.subscribe('blur',function(){c.hide();CSS.removeClass(d,a);});},viewMousedown:function(){this.selecting=true;},viewMouseup:function(){this.selecting=false;},blur:function(){if(this.selecting){this.selecting=false;return;}this.inform('blur');},click:function(){this.element.select();},focus:function(){this.checkValue();this.inform('focus');},keyup:function(){if(this.resetOnKeyup&&!this.getValue())this.view.reset();this.checkValue();},keydown:function(event){if(!this.view.isVisible()||this.view.isEmpty()){this.checkValue.bind(this).defer();return;}switch(Event.getKeyCode(event)){case KEYS.TAB:this.handleTab(event);return;case KEYS.UP:this.view.prev();break;case KEYS.DOWN:this.view.next();break;case KEYS.ESC:this.view.reset();break;default:this.checkValue.bind(this).defer();return;}event.kill();},keypress:function(event){if(this.view.getSelection()&&Event.getKeyCode(event)==KEYS.RETURN){this.view.select();event.kill();}},handleTab:function(event){this.view.select();this.preventFocusChangeOnTab&&event.kill();},select:function(a){if(a&&this.setValueOnSelect){this.setValue(a.text);this.setHiddenValue(a.uid);this.selectedText=a.text;CSS.addClass(this.inputWrap,'selected');}},afterSelect:function(){this.resetOnSelect?this.reset():this.view.reset();this.keepFocused?this.element.focus():this.element.blur();},unselect:function(){if(this.setValueOnSelect){this.selectedText=null;CSS.removeClass(this.inputWrap,'selected');}this.setHiddenValue();this.inform('unselect',this);},setEnabled:function(b){var a=b===false;this.element.disabled=a;CSS.conditionClass(this.root,'uiTypeaheadDisabled',a);},reset:function(){this.unselect();this.setValue();!this.keepFocused&&Input.reset(this.element);this.view.reset();this.inform('reset');},getElement:function(){return this.element;},setExclusions:function(a){this._exclusions=a;},getExclusions:function(){return this._exclusions;},setValue:function(a){this.value=this.nextQuery=a||'';Input.setValue(this.element,this.value);},setHiddenValue:function(a){this.hiddenInput.value=(a||a===0)?a:'';Arbiter.inform('Form/change',{node:this.hiddenInput});},getValue:function(){return Input.getValue(this.element);},getHiddenValue:function(){return this.hiddenInput.value||'';},checkValue:function(){var c=this.getValue();if(c==this.value)return;if(this.selectedText&&this.selectedText!=c)this.unselect();var b=+new Date();var a=b-this.time;this.time=b;this.value=this.nextQuery=c;this.performQuery(a);},performQuery:function(a){if(this.selectedText)return;a=a||0;if(this.fetching&&a<this.queryTimeout){this.data.query(this.nextQuery,true,this._exclusions);}else{this.data.query(this.nextQuery,false,this._exclusions);this.nextQuery=null;}}});
function TypeaheadAreaCore(a){this.parent.construct(this,a);this.matcher=new RegExp(this.matcher+'$');this.preventFocusChangeOnTab=true;}Class.extend(TypeaheadAreaCore,'TypeaheadCore');TypeaheadAreaCore.prototype={prefix:'',suffix:', ',matcher:"\\b[^,]*",click:bagofholding,select:function(a){this.parent.select(a);var e=this.element.value;var d=this.prefix+a.text+this.suffix;this.expandBounds(e,d);var b=e.substring(0,this.start);var c=e.substring(this.end);this.element.value=b+d+c;Input.setSelection(this.element,b.length+d.length);},expandBounds:function(g,f){g=g.toLowerCase().trim();f=f.toLowerCase();var b,e,c,d;var a=/\s/;e=g.substring(this.start,this.end);c=f.indexOf(e);b=this.start;while(b>=0&&c>=0){d=g.charAt(b-1);if(!d||a.test(d))this.start=b;e=d+e;c=f.indexOf(e);b--;}e=g.substring(this.start,this.end);c=f.indexOf(e);b=this.end;while(b<=g.length&&c>=0){d=g.charAt(b);if(!d||a.test(d))this.end=b;e=e+d;c=f.indexOf(e);b++;}},getRawValue:function(){var a=Input.getSelection(this.element).start||0;return this.parent.getValue().substring(0,a);},getValue:function(){var a=this.matcher&&this.matcher.exec(this.getRawValue());if(!a)return '';this.start=a.index;this.end=a.index+a[0].length;return a[1]||a[0];}};
function TypeaheadView(a,b){this.element=this.content=$(a);copy_properties(this,b);}Class.mixin(TypeaheadView,'Arbiter',{events:['highlight','render','reset','select'],renderer:'basic',autoSelect:false,init:function(){this.init=bagofholding;this.initializeEvents();this.reset();},initializeEvents:function(){Event.listen(this.element,{mouseup:this.mouseup.bind(this),mouseover:this.mouseover.bind(this)});},getElement:function(){return this.element;},mouseup:function(event){this.select(true);event.kill();},mouseover:function(event){if(this.visible)this.highlight(this.getIndex(event));},reset:function(a){if(!a)this.disableAutoSelect=false;this.index=-1;this.items=[];this.results=[];this.value='';this.content.innerHTML='';this.inform('reset');return this;},getIndex:function(event){return this.items.indexOf(Parent.byTag(event.getTarget(),'li'));},getSelection:function(){var a=this.results[this.index]||null;return this.visible?a:null;},isEmpty:function(){return !this.results.length;},isVisible:function(){return this.visible;},show:function(){CSS.show(this.element);this.visible=true;return this;},hide:function(){CSS.hide(this.element);this.visible=false;return this;},render:function(h,e,f){this.value=h;if(!e.length){this.reset(true);return;}var c={results:e,value:h};this.inform('beforeRender',c);e=c.results;var d=this.getDefaultIndex(e);if(this.index>0&&this.index!==this.getDefaultIndex(this.results)){var a=this.results[this.index];for(var b=0,g=e.length;b<g;++b)if(a.uid==e[b].uid){d=b;break;}}this.results=e;DOM.setContent(this.content,this.buildResults(e));this.items=this.getItems();this.highlight(d,false);this.inform('render',e);},getItems:function(){return DOM.scry(this.content,'li');},buildResults:function(d){var c;var a=null;if(typeof this.renderer=='function'){c=this.renderer;}else{c=TypeaheadRenderers[this.renderer];a=this.renderer;}c=c.bind(this);var b=d.map(function(e,f){return e.node||c(e,f);});return $N('ul',{className:a},b);},getDefaultIndex:function(b){var a=(this.autoSelect&&!this.disableAutoSelect);return this.index<0&&!a?-1:0;},next:function(){this.highlight(this.index+1);},prev:function(){this.highlight(this.index-1);},highlight:function(a,b){this.selected&&CSS.removeClass(this.selected,'selected');if(a>this.items.length-1){a=-1;}else if(a<-1)a=this.items.length-1;if(a>=0&&a<this.items.length){this.selected=this.items[a];CSS.addClass(this.selected,'selected');}this.index=a;this.disableAutoSelect=(a==-1);if(b!==false)this.inform('highlight',{index:a,selected:this.results[a]});},select:function(a){var b=this.index;var c=this.results[b];if(c){this.inform('select',{index:b,clicked:!!a,selected:c});this.inform('afterSelect');}}});
add_properties('TypeaheadBehaviors',{hoistFriends:function(a){var b=a.getView();b.subscribe('beforeRender',function(c,f){var g=[];var d=[];for(var e=0;e<f.results.length;++e){var h=f.results[e];if(h.type=='user'&&h.bootstrapped){d.push(h);}else g.push(h);}f.results=d.concat(g);});}});
add_properties('TypeaheadRenderers',{compact:function(c,d){var e=[];var f=c.photo;if(f){if(f instanceof Array){f=$N('span',{className:'splitpics clearfix'},[$N('span',{className:'splitpic leftpic'},[$N('img',{alt:'',src:f[0]})]),$N('span',{className:'splitpic'},[$N('img',{alt:'',src:f[1]})])]);}else f=$N('img',{alt:'',src:f});e.push(f);}if(c.text)e.push($N('span',{className:'text'},[c.text]));var g=c.subtext;var a=c.category;if(g||a){var b=[];g&&b.push(g);g&&a&&b.push(" \u00b7 ");a&&b.push(a);e.push($N('span',{className:'subtext'},b));}return $N('li',{className:c.type||''},e);}});
var Base64=(function(){var c='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';function d(e){e=(e.charCodeAt(0)<<16)|(e.charCodeAt(1)<<8)|e.charCodeAt(2);return String.fromCharCode(c.charCodeAt(e>>>18),c.charCodeAt((e>>>12)&63),c.charCodeAt((e>>>6)&63),c.charCodeAt(e&63));}var a='>___?456789:;<=_______'+'\0\1\2\3\4\5\6\7\b\t\n\13\f\r\16\17\20\21\22\23\24\25\26\27\30\31'+'______\32\33\34\35\36\37 !"#$%&\'()*+,-./0123';function b(e){e=(a.charCodeAt(e.charCodeAt(0)-43)<<18)|(a.charCodeAt(e.charCodeAt(1)-43)<<12)|(a.charCodeAt(e.charCodeAt(2)-43)<<6)|a.charCodeAt(e.charCodeAt(3)-43);return String.fromCharCode(e>>>16,(e>>>8)&255,e&255);}return {encode:function(f){f=unescape(encodeURI(f));var e=(f.length+2)%3;f=(f+'\0\0'.slice(e)).replace(/[\s\S]{3}/g,d);return f.slice(0,f.length+e-2)+'=='.slice(e);},decode:function(g){g=g.replace(/[^A-Za-z0-9+\/]/g,'');var f=(g.length+3)&3;g=(g+'AAA'.slice(f)).replace(/..../g,b);g=g.slice(0,g.length+f-3);try{return decodeURIComponent(escape(g));}catch(e){throw new Error('Not valid UTF-8');}},encodeObject:function(e){return Base64.encode(JSON.stringify(e));},decodeObject:function(e){return JSON.parse(Base64.decode(e));},encodeNums:function(e){return String.fromCharCode.apply(String,e.map(function(f){return c.charCodeAt((f|-(f>63))&-(f>0)&63);}));}};})();
window.__UIControllerRegistry=window.__UIControllerRegistry||{};
function Flash(){}copy_properties(Flash,{INIT:'flash/init',READY:'flash/ready',FAILED:'flash/failed'});
onloadRegister(function(){Event.listen(document.documentElement,'submit',function(b){var a=b.getTarget().getElementsByTagName('*');for(var c=0;c<a.length;c++)if(a[c].getAttribute('required')&&Input.isEmpty(a[c])){a[c].focus();return false;}},Event.Priority.URGENT);});
function AlbumScroller(){}AlbumScroller.prototype={init:function(d,e){this.photoGroups={};this.scrollListener={};if(d.length){var b=d.shift(),f=b,a=0,c=b.id;while(f){if(!this.photoGroups[c])this.photoGroups[c]=[];var g=DOM.scry(f,'a.uiScrollableThumb');if(g.length>0)this.photoGroups[c].push(g[0]);f=this.getNextPhotoCell(f);if(++a%e==0){this.scrollListener[c]=new OnVisible(b,this.showPage.bind(this,b));b=d.shift();if(b)c=b.id;}}if(b)this.scrollListener[c]=new OnVisible(b,this.showPage.bind(this,b));}},showPage:function(a){var b=this.photoGroups[a.id];if(b)for(var c=0,d=b.length;c<d;c++)DOM.find(b[c],'i').style.backgroundImage='url('+b[c].getAttribute('data-src')+')';},getNextPhotoCell:function(a){var b=null;if(a.nextSibling){b=a.nextSibling;}else if(a.parentNode.nextSibling)b=a.parentNode.nextSibling.firstChild;if(b&&b.childElementCount!==0)return b;return null;}};
function BulkTagLoader(){}copy_properties(BulkTagLoader,{_requested:false,loadForSet:function(a){if(!BulkTagLoader._requested){BulkTagLoader._requested=true;new AsyncRequest('/ajax/photos/sets/tags_fetch.php').setHandler(bagofholding).setData({set:a}).send();}},loadForAlbum:function(a){if(!BulkTagLoader._requested){BulkTagLoader._requested=true;new AsyncRequest('/ajax/photos/album/tags_fetch.php').setHandler(bagofholding).setData({fbid:a}).send();}},reset:function(){BulkTagLoader._requested=false;}});
var MediaSetLikeButtonController={submit:function(){$('mediaSetUfiLikeLink').firstChild.click();CSS.hide($('mediaSetLikeButton'));}};