/*    HTTP Host:  b.static.ak.fbcdn.net                                        */
/*    Generated:  July 21st 2009 9:46:03 AM PDT                                */
/*      Machine:  10.16.140.104                                                */
/*       Source:  Global Cache                                                 */
/*     Location:  js/8ye5lviw1icko0cw.pkg.js h:6mxaar4r                        */
/*       Locale:  en_US                                                        */
/*         Path:  js/8ye5lviw1icko0cw.pkg.js                                   */


function UINav(controller,item_data,data){this.controller=controller;this.data=data;copy_properties(this,{controller:controller,data:data,items:[],selectedItem:null,selectedClass:this.selectedClass||''});this.initializeItems(item_data);UINav.instances[controller.id]=this;}
UINav.instances={};UINav.prototype.getItemContainers=abstractMethod;UINav.prototype.getItemLinks=abstractMethod;UINav.prototype.getItems=function(){return this.items;}
UINav.prototype.initializeItems=function(item_data){var containers=this.getItemContainers();var links=this.getItemLinks();for(var i=0;i<containers.length;i++){var item={};if(this.is_wrapped){item=(item_data[i]||{});}else{item={'container':containers[i],'link':links[i],'data':(item_data[i]||{})};}
this.items.push(item);if(CSS.hasClass(item.container,this.selectedClass)){this.selectedItem=item;}
item.addClickHandler=this.addClickHandler.bind(this,item);item.addClickHandler(this.selectItem.bind(this,item));}}
UINav.prototype.selectItem=function(item){if(item==this.selectedItem){return;}
if(this.selectedItem){CSS.removeClass(this.selectedItem.container,this.selectedClass);}
if(item){CSS.addClass(item.container,this.selectedClass);}
this.selectedItem=item;}
UINav.prototype.deselectAll=function(){if(this.selectedItem){CSS.removeClass(this.selectedItem.container,this.selectedClass);}
this.selectedItem=null;}
UINav.prototype.getSelectedItem=function(){return this.selectedItem;}
UINav.prototype.addClickHandler=function(item,handler){if(typeof item=='function'){handler=item;this.getItems().each(function(handler,item){this.addClickHandler(item,handler);}.bind(this,handler));return true;}else{return Event.listen(item.link,'click',handler);}}
function UINavGeneric(controller,item_data,data){this.selectedClass='UINavGeneric_ItemSelected';this.parent.construct(this,controller,item_data,data);}
UINavGeneric.extend('UINav');UINavGeneric.prototype.getItemContainers=function(){if(!this.containers){this.containers=DOM.scry(this.controller,'li');}
return this.containers;}
UINavGeneric.prototype.getItemLinks=function(){if(!this.containerLinks){this.containerLinks=DOM.scry(this.controller,'li a');}
return this.containerLinks;}
function UITabStructure(controller,item_data,data){this.selectedClass='UITabStructure_TabSelected';this.parent.construct(this,controller,item_data,data);}
UITabStructure.extend('UINavGeneric');UITabStructure.prototype.getItemContainers=function(){if(!this.tab_containers){this.tab_containers=[];var li_elements=DOM.scry(this.controller,'li');for(var i=0;i<li_elements.length;i++){this.tab_containers.push(li_elements[i].childNodes[0]);}}
return this.tab_containers;}
function UISourceList(controller,item_data,data){this.selectedClass='UISourceList_ItemSelected';this.parent.construct(this,controller,item_data,data);}
UISourceList.extend('UINavGeneric');

function UIFilterList(controller,item_data,data){this.selectedClass='UIObject_SelectedItem';this._itemsContainer=DOM.scry(controller,'div.UIFilterList_List')[0];this.parent.construct(this,controller,item_data,data);}
UIFilterList.extend('UINav');UIFilterList.prototype.getItemContainers=function(){if(!this.containers){this.containers=DOM.scry(this.controller,'div.UIFilterList_Item');}
return this.containers;}
UIFilterList.prototype.getItemLinks=function(){if(!this.containerLinks){this.containerLinks=DOM.scry(this.controller,'div.UIFilterList_Item a');}
return this.containerLinks;}
UIFilterList.prototype.resetItemContainers=function(){this.containers=null;}
UIFilterList.prototype.resetItemLinks=function(){this.containerLinks=null;}
UIFilterList.prototype.setEditIconHandler=function(handler){this._editIconHandler=handler;return this;}
UIFilterList.prototype.setLoading=function(loading){CSS.conditionClass(this.controller,'UIFilterList_Loading',loading);}
UIFilterList.prototype.setCreateLinkHandler=function(handler){var elem=DOM.find(this.controller,'a.UIFilterList_Create');elem.listen('click',handler);}
UIFilterList.prototype.addItem=function(title,href,pos,icon,data){if(!pos){pos=0;}
var items=this.getItems();data=data?data:{};var main_div=$N('div',{className:'UIFilterList_Item'});var link=$N('a',{className:'UIFilterList_ItemLink',href:href});if(icon){main_div.addClass('UIFilterList_HasIcon');var icon_span=$N('span',{className:'UIFilterList_Icon'});icon_span.setStyle('backgroundImage','url('+icon+')');link.appendContent(icon_span);}
link.appendContent($N('span',{className:'UIFilterList_Title'},title));var loading=$N('span',{className:'UIFilterList_LoadingIndicator'});var right=$N('span',{className:'UIFilterList_ItemRight'});main_div.setContent([link,loading,right]);var item={container:main_div,link:link,data:data};if(items.length>0){if(this.getItems()[pos]){DOM.insertBefore(main_div,items[pos].container);}else{pos=pos-1;DOM.insertAfter(items[pos].container,main_div);}}else{this._itemsContainer.appendContent(main_div);CSS.removeClass(this.controller,'UIFilterList_HasBlankState');}
this.getItems().splice(pos,0,item);this.getItemContainers().splice(pos,0,item.container);this.getItemLinks().splice(pos,0,item.link);return item;}
UIFilterList.prototype.setItemTitle=function(item,title){var title_span=DOM.find(item.link,'span.UIFilterList_Title');title_span.setContent(title);}
UIFilterList.prototype.removeItem=function(item){var items=this.getItems();var item_index=null;for(var i=0;i<items.length;i++){if(items[i]==item){item_index=i;break;}}
if(item_index!=null){if(this.selectedItem==item){this.selectItem(null);}
this.getItemContainers().splice(item_index,1);this.getItemLinks().splice(item_index,1);this.getItems().splice(item_index,1);DOM.remove(item.container);}
if(items.length==0){CSS.addClass(this.controller,'UIFilterList_HasBlankState');}}

function UIMutableFilterList(controller,item_data,num_visible,data){this.hiddenContainer=controller.find('div.UIMutableFilterList_HiddenSection');this.showLink=DOM.scry(controller,'a.UIMutableFilterList_Show')[0];this.hideLink=DOM.scry(controller,'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(controller,'div.UIMutableFilterList_EmptyBox')[0];this.bottomShown=false;this.numVisible=num_visible;this.orderChangedHandler=bagofholding;return this.parent.construct(this,controller,item_data,data);}
UIMutableFilterList.extend('UIFilterList');UIMutableFilterList.prototype.setOrderChangedHandler=function(handler){this.orderChangedHandler=handler;return this;}
UIMutableFilterList.prototype.getOrderedItems=function(){var ordered={};ordered.shown=[];ordered.hidden=[];var items=this.getItems();var top_order=this.topGroup.getOrder();for(var i=0;i<top_order.length;i++){if(items[top_order[i]]){ordered.shown.push(items[top_order[i]].data);}}
var bottom_order=this.bottomGroup.getOrder();for(var i=0;i<bottom_order.length;i++){if(items[bottom_order[i]]){ordered.hidden.push(items[bottom_order[i]].data);}}
return ordered;}
UIMutableFilterList.prototype.initializeItems=function(item_data){if(item_data[0]){this.setDragHandlers();}
return this.parent.initializeItems(item_data);}
UIMutableFilterList.prototype.setDragHandlers=function(){var ongrabcallback=this.ongrabcallback.bind(this);var ondropcallback=this.ondropcallback.bind(this);this.topGroup=new SortableGroup();this.topGroup.setGrabCallback(ongrabcallback);this.topGroup.setDropCallback(ondropcallback);this.topGroup.setOrderChangeHandler(this.orderChanged.bind(this));this.bottomGroup=new SortableGroup();this.bottomGroup.setGrabCallback(ongrabcallback);this.bottomGroup.setDropCallback(ondropcallback);this.bottomGroup.setOrderChangeHandler(this.orderChanged.bind(this));this.topGroup.link(this.bottomGroup);var items=this.getDragContainers();var link_items=this.getItemLinks();for(var i=0,l=items.length;i<l;i++){if(i<this.numVisible){this.topGroup.addSortable(i,items[i]);this.topGroup.draggables[i].addHandle(items[i]);}else{this.bottomGroup.addSortable(i,items[i]);this.bottomGroup.draggables[i].addHandle(items[i]);}}
if(this.emptyBox){var root=this.hiddenContainer.find('div.UIFilterList_List');this.bottomGroup.addEmptyMessage(this.emptyBox,root);if(items.length==this.numVisible){CSS.removeClass(this.emptyBox,'hidden_elem');}}
this.bottomGroup.setLinkJumpHandler(function(){var footer=this.root.find('div.UIFilterList_Footer');if(!this.emptyBox){return;}
if(root.childNodes.length>1){CSS.addClass(this.emptyBox,'hidden_elem');CSS.removeClass(footer,'UIFilterList_NoBorder');}else{CSS.removeClass(this.emptyBox,'hidden_elem');CSS.addClass(footer,'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 element=this.getDragContainers()[i];CSS.setOpacity(element,0.7);Vector2.getElementDimensions(element).setElementWidth(element);}
UIMutableFilterList.prototype.ondropcallback=function(i){var element=this.getDragContainers()[i];CSS.setOpacity(element,1);element.setStyle('width','auto');this.setBoundingBox(this.getCurrentBoundingBox());}
UIMutableFilterList.prototype.orderChanged=function(){this.orderChangedHandler(this.getOrderedItems());}
UIMutableFilterList.prototype.setBoundingBox=function(bounding_box){this.bottomGroup.setBoundingBox(bounding_box);this.topGroup.setBoundingBox(bounding_box);}
UIMutableFilterList.prototype.getCurrentBoundingBox=function(){var items=this.controller.scry('div.UIFilterList_Item');var top_item_pos=Vector2.getElementCompassPoint(items[0],Vector2.compass.north);var bounding_top=top_item_pos.y;var bounding_left=0;if(this.bottomShown){var last_item=items.length-1;}else{var last_item=this.topGroup.getOrder().length-1;}
var bottom_item_pos=Vector2.getElementCompassPoint(items[last_item],Vector2.compass.south);var bounding_right=0;var bounding_bottom=bottom_item_pos.y;return new Rect(bounding_top,bounding_right,bounding_bottom,bounding_left,'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(root,assoc_id,item_data,num_visible,data,stream,composer,hl_group,is_wrapped){this.is_wrapped=is_wrapped;this.parent.construct(this,root,item_data,num_visible,data);copy_properties(this,{root:root,stream:stream,composer:composer,assoc_id:assoc_id,hl_group:hl_group});this.finishedSetup=false;this.setOrderChangedHandler(UIHomeFilter.filterOrderChanged.bind(this));}
UIHomeFilter.extend('UIMutableFilterList');UIHomeFilter.filterOrderChanged=function(ordered){this.resetItemContainers();this.resetItemLinks();var shown=[];var hidden=[];for(var i=0;i<ordered.shown.length;i++){shown.push(ordered.shown[i]['filter']);}
for(var i=0;i<ordered.hidden.length;i++){hidden.push(ordered.hidden[i]['filter']);}
this.numVisible=shown.length;var postData={};postData.order=[];postData.visible=shown.length;postData.id=this.assoc_id;postData.order=shown.concat(hidden);new AsyncRequest().setURI('/ajax/filterlist.php').setData(postData).setHandler(bagofholding).send();};UIHomeFilter.prototype.setCreateLinkHandler=function(handler){var elem=DOM.find(this.controller,'a.UIFilterList_CreateLink');elem.listen('click',handler);}
UIHomeFilter.prototype.beginEditMode=function(){this.showBottom();if(!this.finishedSetup){var createLink=document.createElement('a');var doneLink=document.createElement('a');CSS.addClass(createLink,'UIFilterList_CreateLink');CSS.addClass(doneLink,'UIFilterList_DoneLink');createLink.innerHTML=_tx("Create New List");var itemLinks=this.getItemLinks();if(this.numVisible==itemLinks.length){doneLink.innerHTML=_tx("Done");}else{doneLink.innerHTML=_tx("Less");}
var footer=this.root.find('div.UIFilterList_Footer');footer.appendChild(createLink);footer.appendChild(doneLink);doneLink=this.root.find('a.UIFilterList_DoneLink');doneLink.listen('click',this.endEditMode.bind(this));for(var i=0;i<itemLinks.length;i++){var dragHandle=document.createElement('span');CSS.addClass(dragHandle,'UIFilterList_DragHandle');itemLinks[i].appendChild(dragHandle);}
var createHandler=Dialog.bootstrap.curry(DialogBootstrapEndpoints.LIST_EDITOR,{'new_list':true},false);this.setCreateLinkHandler(createHandler);}
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 doneLink=this.root.find('a.UIFilterList_DoneLink');var editLink=this.root.find('a.UIFilterList_EditLink');if(this.numVisible==this.getItemLinks().length){doneLink.innerHTML=_tx("Done");editLink.innerHTML=_tx("Edit");}else{doneLink.innerHTML=_tx("Less");editLink.innerHTML=_tx("More");}
CSS.removeClass(this.root,'UIFilterList_EditMode');}

function UIPagelet(element,src,context_data,data){this._element=ge(element||$N('div'));this._src=src||null;this._context_data=context_data||{};this._data=data||{};this._handler=bagofholding;return this;}
copy_properties(UIPagelet.prototype,{getElement:function(){return this._element;},setHandler:function(handler){this._handler=handler;return this;},go:function(src,data){if(arguments.length>=2||typeof src=='string'){this._src=src;this._data=data||{};}else if(arguments.length==1){this._data=src;}
this.refresh();return this;},refresh:function(){var handler=function(response){this._element.setContent(HTML(response.getPayload()));this._handler();}.bind(this);new AsyncRequest().setURI(this._src).setMethod('GET').setData({data:JSON.encode(merge(this._context_data,this._data))}).setReadOnly(true).setHandler(handler).setOption('bundle',true).send();return this;}});

function pymk_refresh(onResponse,onError){if(window.pymk_refreshing){return;}
var possible=['pymk_hp_box'];var locations=[];for(var i=0;i<possible.length;i++){if(ge(possible[i])){locations.push(possible[i]);}}
if(locations.length==0){return;}
var data={'locations':locations};var _onResponse=function(response){window.pymk_refreshing=false;var divs=response.getPayload();for(var id in divs){var location=ge(id);if(location){if(divs[id].length>0){location.replace(HTML(divs[id]));}else{hide(location);}}}
if(onResponse){onResponse(response);}}
var _onError=function(response){window.pymk_refreshing=false;if(onError){onError(response);}}
new AsyncRequest().setURI('/ajax/pymk_refresh.php').setData(data).setOption('bundle',true).setHandler(_onResponse).setErrorHandler(_onError).setReplayable(false).send();window.pymk_refreshing=true;}

function tz_calculate(timestamp){var d=new Date();var raw_offset=d.getTimezoneOffset()/30;var time_sec=d.getTime()/1000;var time_diff=Math.round((timestamp-time_sec)/1800);var rounded_offset=Math.round(raw_offset+time_diff)%48;if(rounded_offset==0){return 0;}else if(rounded_offset>24){rounded_offset-=Math.ceil(rounded_offset/48)*48;}else if(rounded_offset<-28){rounded_offset+=Math.ceil(rounded_offset/-48)*48;}
return rounded_offset*30;}
function ajax_tz_set(tzForm){var timestamp=tzForm.time.value;var gmt_off=-tz_calculate(timestamp);var cur_gmt_off=tzForm.tz_gmt_off.value;if(gmt_off!=cur_gmt_off){var ajaxUrl='/ajax/autoset_timezone_ajax.php';new AsyncSignal(ajaxUrl,{user:tzForm.user.value,gmt_off:gmt_off}).send();}}
function tz_autoset(){var tz_form=ge('tz_autoset_form');if(tz_form){ajax_tz_set(tz_form);}}

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