/*
HTTP Host: b.static.ak.fbcdn.net
Generated: March 14th 2010 10:31:13 PM PDT
Machine: 10.16.139.102
Locale: nu_ll
Path: js/1m2b5fl84u4g8gc0.pkg.js
*/

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

function UIMutableFilterList(_L0,_L1,_L2,_L3){this.hiddenContainer=_L0.find('div.UIMutableFilterList_HiddenSection');this.showLink=DOM.scry(_L0,'a.UIMutableFilterList_Show')[0];this.hideLink=DOM.scry(_L0,'a.UIMutableFilterList_Hide')[0];if(this.showLink){this.showLink.listen('click',this.showBottom.bind(this));this.hideLink.listen('click',this.hideBottom.bind(this));}this.emptyBox=DOM.scry(_L0,'div.UIMutableFilterList_EmptyBox')[0];this.bottomShown=false;this.numVisible=_L2;this.orderChangedHandler=bagofholding;return this.parent.construct(this,_L0,_L1,_L3);}UIMutableFilterList.extend('UIFilterList');UIMutableFilterList.prototype.setOrderChangedHandler=function(_L0){this.orderChangedHandler=_L0;return this;};UIMutableFilterList.prototype.getOrderedItems=function(){var _L0={};_L0.shown=[];_L0.hidden=[];var _L1=this.getItems();var _L2=this.topGroup.getOrder();for(var i=0;i<_L2.length;i++)if(_L1[_L2[i]])_L0.shown.push(_L1[_L2[i]].data);var _L4=this.bottomGroup.getOrder();for(var i=0;i<_L4.length;i++)if(_L1[_L4[i]])_L0.hidden.push(_L1[_L4[i]].data);return _L0;};UIMutableFilterList.prototype.initializeItems=function(_L0){if(_L0[0])this.setDragHandlers();return this.parent.initializeItems(_L0);};UIMutableFilterList.prototype.setDragHandlers=function(){var _L0=this.ongrabcallback.bind(this);var _L1=this.ondropcallback.bind(this);this.topGroup=new SortableGroup();this.topGroup.setGrabCallback(_L0);this.topGroup.setDropCallback(_L1);this.topGroup.setOrderChangeHandler(this.orderChanged.bind(this));this.bottomGroup=new SortableGroup();this.bottomGroup.setGrabCallback(_L0);this.bottomGroup.setDropCallback(_L1);this.bottomGroup.setOrderChangeHandler(this.orderChanged.bind(this));this.topGroup.link(this.bottomGroup);var _L2=this.getDragContainers();var _L3=this.getItemLinks();for(var i=0,l=_L2.length;i<l;i++)if(i<this.numVisible){this.topGroup.addSortable(i,_L2[i]);this.topGroup.draggables[i].addHandle(_L2[i]);}else{this.bottomGroup.addSortable(i,_L2[i]);this.bottomGroup.draggables[i].addHandle(_L2[i]);}if(this.emptyBox){var _L6=this.hiddenContainer.find('div.UIFilterList_List');this.bottomGroup.addEmptyMessage(this.emptyBox,_L6);if(_L2.length==this.numVisible)CSS.removeClass(this.emptyBox,'hidden_elem');}this.bottomGroup.setLinkJumpHandler(function(){var _L7=this.root.find('div.UIFilterList_Footer');if(!this.emptyBox)return;if(_L6.childNodes.length>1){CSS.addClass(this.emptyBox,'hidden_elem');CSS.removeClass(_L7,'UIFilterList_NoBorder');}else{CSS.removeClass(this.emptyBox,'hidden_elem');CSS.addClass(_L7,'UIFilterList_NoBorder');}}.bind(this));this.topGroup.setNeverEmpty(true);this.setBoundingBox(this.getCurrentBoundingBox());};UIMutableFilterList.prototype.getDragContainers=function(){if(!this.dragContainers)this.dragContainers=this.getItemContainers();return this.dragContainers;};UIMutableFilterList.prototype.resetDragContainers=function(){this.dragContainers=null;};UIMutableFilterList.prototype.ongrabcallback=function(i){var _L1=this.getDragContainers()[i];CSS.setOpacity(_L1,.7);Vector2.getElementDimensions(_L1).setElementWidth(_L1);};UIMutableFilterList.prototype.ondropcallback=function(i){var _L1=this.getDragContainers()[i];CSS.setOpacity(_L1,1);_L1.setStyle('width','auto');this.setBoundingBox(this.getCurrentBoundingBox());};UIMutableFilterList.prototype.orderChanged=function(){this.orderChangedHandler(this.getOrderedItems());};UIMutableFilterList.prototype.setBoundingBox=function(_L0){this.bottomGroup.setBoundingBox(_L0);this.topGroup.setBoundingBox(_L0);};UIMutableFilterList.prototype.getCurrentBoundingBox=function(){var _L0=this.controller.scry('div.UIFilterList_Item');var _L1=Vector2.getElementCompassPoint(_L0[0],Vector2.compass.north);var _L2=_L1.y;var _L3=0;if(this.bottomShown){var _L4=_L0.length-1;}else var _L4=this.topGroup.getOrder().length-1;var _L5=Vector2.getElementCompassPoint(_L0[_L4],Vector2.compass.south);var _L6=0;var _L7=_L5.y;return new Rect(_L2,_L6,_L7,_L3,'document');};UIMutableFilterList.prototype.showAnimationEnded=function(){this.bottomShown=true;this.setBoundingBox(this.getCurrentBoundingBox());};UIMutableFilterList.prototype.hideAnimationEnded=function(){this.bottomShown=false;this.setBoundingBox(this.getCurrentBoundingBox());this.hiddenContainer.addClass('hidden_elem');};UIMutableFilterList.prototype.showBottom=function(){this.hiddenContainer.setStyle('height','0px');this.hiddenContainer.removeClass('hidden_elem');animation(this.hiddenContainer).to('height','auto').from('opacity',0).to('opacity',1).ease(animation.ease.both).duration(200).ondone(function(){this.showAnimationEnded();}.bind(this)).go();if(this.showLink){this.showLink.addClass('hidden_elem');this.hideLink.removeClass('hidden_elem');}return false;};UIMutableFilterList.prototype.hideBottom=function(){animation(this.hiddenContainer).to('height','0px').from('opacity',1).to('opacity',0).ease(animation.ease.both).duration(200).ondone(function(){this.hideAnimationEnded();}.bind(this)).go();if(this.showLink){this.showLink.removeClass('hidden_elem');this.hideLink.addClass('hidden_elem');}this.resetDragContainers();return false;};
function UIHomeFilter(_L0,_L1,_L2,_L3,_L4,_L5){this.is_wrapped=_L5;this.parent.construct(this,_L0,_L2,_L3,_L4);copy_properties(this,{root:_L0,assoc_id:_L1});this.finishedSetup=false;this.setOrderChangedHandler(UIHomeFilter.filterOrderChanged.bind(this));}UIHomeFilter.extend('UIMutableFilterList');UIHomeFilter.filterOrderChanged=function(_L0){this.resetItemContainers();this.resetItemLinks();var _L1=[];var _L2=[];for(var i=0;i<_L0.shown.length;i++)_L1.push(_L0.shown[i]['filter']);for(var i=0;i<_L0.hidden.length;i++)_L2.push(_L0.hidden[i]['filter']);this.numVisible=_L1.length;var _L4={};_L4.order=[];_L4.visible=_L1.length;_L4.id=this.assoc_id;_L4.order=_L1.concat(_L2);new AsyncRequest().setURI('/ajax/filterlist.php').setData(_L4).setHandler(bagofholding).send();};UIHomeFilter.prototype.beginEditMode=function(){this.showBottom();if(!this.finishedSetup){var _L0=document.createElement('a');var _L1=document.createElement('a');CSS.addClass(_L0,'UIFilterList_CreateLink');CSS.addClass(_L1,'UIFilterList_DoneLink');_L0.innerHTML=_tx("Create New List");var _L2=new URI().parse(DialogBootstrapEndpoints.LIST_EDITOR).addQueryData({'new_list':true}).toString();_L0.setAttribute('href',_L2);_L0.setAttribute('rel','dialog-post');var _L3=this.getItemLinks();if(this.numVisible==_L3.length){_L1.innerHTML=_tx("Done");}else _L1.innerHTML=_tx("Less");var _L4=this.root.find('div.UIFilterList_Footer');_L4.appendChild(_L0);_L4.appendChild(_L1);_L1=this.root.find('a.UIFilterList_DoneLink');_L1.listen('click',this.endEditMode.bind(this));for(var i=0;i<_L3.length;i++){var _L6=document.createElement('span');CSS.addClass(_L6,'UIFilterList_DragHandle');_L3[i].appendChild(_L6);}}if(this.finishedSetup)this.setDragHandlers();CSS.addClass(this.root,'UIFilterList_EditMode');this.finishedSetup=true;};UIHomeFilter.prototype.hideAnimationEnded=function(){this.parent.hideAnimationEnded();this.topGroup.destroy();this.bottomGroup.destroy();};UIHomeFilter.prototype.endEditMode=function(){this.hideBottom();var _L0=this.root.find('a.UIFilterList_DoneLink');var _L1=this.root.find('a.UIFilterList_EditLink');if(this.numVisible==this.getItemLinks().length){_L0.innerHTML=_tx("Done");_L1.innerHTML=_tx("Edit");}else{_L0.innerHTML=_tx("Less");_L1.innerHTML=_tx("More");}CSS.removeClass(this.root,'UIFilterList_EditMode');};

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