var AreaResizerController;(function(){var a={doPagination:true,leftMinWidth:null,rightMinWidth:null,resizeTarget:null,resizeForThumbs:true,maxThumbWidth:null,maxThumbHeight:null,thumbContainer:null,viewInfo:null,viewAll:false,isFindStuff:false,suppressResize:false,debug:false,hasLogged:false,PAGE_MARGINS:40,PANELRIGHT_OFFSET:78,PANELLEFT_MARGIN_PANELRIGHT:32,PANELLEFT_MARGIN_NOPANELRIGHT:42,mixIn:function(c){for(var d in c){this[d]=c[d]}},bindResizer:function(){var d=this;var c=jq(window);c.resize(function(){d.newResizeViewableArea()});var e=jq("#fullViewContainer");if(e.length>0){e.resize(jq.proxy(this.resizeOpacityBg,this))}},newResizeViewableArea:function(){if(this.suppressResize){return}var f=jq(window).width();var j=f-this.PAGE_MARGINS;var g;var h=(jq(this.rightChildren).children().length>0);if(h){g=j-this.PANELRIGHT_OFFSET}else{g=j}var e=this.getViewableCookie(AreaResizerController.RESIZECONTAINERALLCOOKIE);if(e==""||parseInt(e)!=g){this.setViewableCookie(AreaResizerController.RESIZECONTAINERALLCOOKIE,g)}var p=(h)?j-this.rightMinWidth-this.PANELLEFT_MARGIN_PANELRIGHT:j-this.PANELLEFT_MARGIN_NOPANELRIGHT;if(p<this.leftMinWidth){p=this.leftMinWidth}var r=this.getViewableCookie(AreaResizerController.RESIZERIGHTWIDTH);if(r==""||parseInt(r)!=p){this.setViewableCookie(AreaResizerController.RESIZERIGHTWIDTH,p)}var l;if(!this.isProfile){if(this.isFindStuff){var d=g-(this.rightMinWidth-this.PANELRIGHT_OFFSET);var o=Math.floor(d/220);var n=3;o=o<n?n:o;l=o*220}else{if(this.isTheme){l=p-20}else{if(this.resizeForThumbs){this.calculateMaxThumbDims();var c=(h)?g-(this.rightMinWidth-this.PANELRIGHT_OFFSET):g;if(this.isProfileUploads){c=c-40}var i=Math.floor(c/this.maxThumbWidth);l=i*this.maxThumbWidth}else{l=(h)?g-(this.rightMinWidth-this.PANELRIGHT_OFFSET):g}}}}jq(this.resizeTarget).css("width",j+"px");var k=jq(".containerAll");k.css("width",g+"px");jq(this.leftTarget).css("width",p+"px");if(l){jq(this.thumbContainer).css("width",l+"px")}var m=jq(this.rightTarget);if(this.isSearch){var q=m.find("#containerAd .pbad").first();if(q&&q.attr("width")==160){p=p+15}}else{if(this.isHome){var q=m.find(".panelAdv #skyAdIframe").first();if(q&&q.attr("width")==160){p=p+18}}}m.css("margin-left",p+"px");if(this.doPagination&&this.resizeForThumbs&&!this.isFindStuff&&!this.isProfile){this.calculateThumbThreshold()}else{if(this.isFindStuff){this.viewInfo={thumbCols:o,thumbRows:4};document.fire(AreaResizerController.EVENT.THUMBTHRESHOLDCALCULATED,this.viewInfo)}}this.resizeOpacityBg()},resizeOpacityBg:function(){var c=jq(".containerAll");jq(".transBkgrd").css({width:c.width()+"px",height:c.height()+"px"})},calculateThumbThreshold:function(){var f=jq(this.thumbContainer);var e=f.width();var c=f.height();var g=Math.floor(e/this.maxThumbWidth);var d;if(this.viewAll){d=Math.floor(c/this.maxThumbHeight);f.css("height",(c+200)+"px")}else{d=4;f.css("height",(d*this.maxThumbHeight)+"px")}this.viewInfo={thumbCols:g,thumbRows:d};document.fire(AreaResizerController.EVENT.THUMBTHRESHOLDCALCULATED,this.viewInfo)},calculateMaxThumbDims:function(){var e=jq(this.thumbContainer).children(".thumbnail").first();if(!this.maxThumbWidth&&!this.maxThumbHeight){if(e){var c=2;var d=e.width()+15+c;this.maxThumbWidth=(d<161)?161:d;this.maxThumbHeight=(photobucket.browser.isIE6)?225:e.height()+25}else{this.maxThumbWidth=161;this.maxThumbHeight=190}}},fireFindStuffDims:function(){this.viewInfo={thumbCols:3,thumbRows:4};document.fire(AreaResizerController.EVENT.THUMBTHRESHOLDCALCULATED,this.viewInfo)},getViewableCookie:function(c){return compoundCookieReader("session",c)},setViewableCookie:function(c,d){createCompoundCookie("session",c,d,0)}};var b={RESIZECOOKIE:"PB_AREARESIZE",RESIZECONTAINERALLCOOKIE:"PB_CONTAINERALL",RESIZERIGHTWIDTH:"PB_RESIZERIGHTWIDTH",EVENT:{THUMBTHRESHOLDCALCULATED:"AreaResizerController:thumbthresholdcalculated"}};Controller.create("AreaResizerController",a,b)})();var BulkActionsController;(function(){var staticMembers={EVENT:{TAGEDITMANY:"PB:BulkActionsController_TAGEDITMANY",DELETE:"PB:BulkActionsController_DELETE",MOVEOPTIONS:"PB:BulkActionsController_MOVEOPTIONS",CODEGEN:"PB:BulkActionsController_CODEGEN",SELECT:"PB:BulkActionsController_SELECT",REMOVE:"PB:BulkActionsController_REMOVE",UNSELECT:"PB:BulkActionsController_UNSELECT",ACTIVATE:"PB:BulkActionsController_ACTIVATE",APPROVE:"PB:BulkActionsController_APPROVE",ROTATE:"PB:BulkActionsController_ROTATE",RESIZE:"PB:BulkActionsController_RESIZE"}};var publicMembers={bulkCollection:new Hash(),albumUrl:"",chkSelectAll:null,chkSelectAll2:null,startOffset:0,endOffset:20,ajaxActions:false,warnings:"1",notify:"MessagePanel",isDynamic:true,initialize:function(){this.chkSelectAll=$("chkSelectAll");this.chkSelectAll2=$("chkSelectAll2");if(this.chkSelectAll){Event.observe(this.chkSelectAll,"click",this.onSelectAll.bindAsEventListener(this))}if(this.chkSelectAll2){Event.observe(this.chkSelectAll2,"click",this.onSelectAll.bindAsEventListener(this))}try{if(typeof(ThumbnailController)!=="undefined"){Event.observe(document,ThumbnailController.EVENT.SELECT,this.onSelect.bindAsEventListener(this))}}catch(e){}try{if(typeof(UploadThumbnailManager)!=="undefined"){Event.observe(document,UploadThumbnailManager.EVENT.SELECT,this.onSelect.bindAsEventListener(this))}}catch(e){}try{if(typeof(ThumbnailListManagerController)!="undefined"){Event.observe(document,ThumbnailListManagerController.EVENT.CONTENTREFRESHED,this.updateOffsets.bindAsEventListener(this))}}catch(e){}Event.observe(document,BulkActionsController.EVENT.ACTIVATE,this.onActivate.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.SELECT,this.onSelect.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.DELETE,this.onDelete.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.MOVEOPTIONS,this.onMove.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.TAGEDITMANY,this.onTag.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.CODEGEN,this.onCodegen.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.APPROVE,this.onApprove.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.REMOVE,this.onRemove.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.UNSELECT,this.onUnselect.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.ROTATE,this.onRotate.bindAsEventListener(this));Event.observe(document,BulkActionsController.EVENT.RESIZE,this.onResize.bindAsEventListener(this))},mixIn:function(cfg){for(var n in cfg){this[n]=cfg[n]}if(!this.isDynamic||this.viewAll){this.setStaticOffsets()}},onApprove:function(evnt){var selected=this.getSelected();var noApprove=true;selected.each(function(s){var panchor=jq("#thumbnail_"+s.index+" .pending a:first");if(panchor.length!=0){var url=this.albumUrl+s.mediaFilename;document.fire(ThumbnailController.EVENT.APPROVAL,{media:url,obj:panchor});this.markUnselected(s.index,$("thumbnail_"+s.index));noApprove=false}}.bind(this));if(noApprove){document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"No files selected to approve."})})}},onTag:function(evnt){if(typeof BulkTagActionController!="undefined"){document.fire(BulkTagActionController.EVENT.TAG,{selected:this.getSelected(),notify:this.notify,albumUrl:this.albumUrl,albumType:this.albumType})}},onCodegen:function(evnt){var selected=this.getSelected();var selectedStrs=new Array();if(selected.length>0){selected.each(function(s){selectedStrs.push(Object.toJSON(s))});var params={"selectedmedia[]":selectedStrs,albumUrl:this.albumUrl};document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/codegenaction",parameters:params,forceTall:true,cache:false})}else{this.showNoneSelectedMsg()}},onDelete:function(evnt){if(typeof DeleteActionController!="undefined"){document.fire(DeleteActionController.EVENT.DELETE,{selected:this.getSelected(),albumUrl:this.albumUrl,albumType:this.albumType,warnings:this.warnings,notify:this.notify,ajaxActions:this.ajaxActions})}},onMove:function(evnt){if(typeof MoveActionController!="undefined"){document.fire(MoveActionController.EVENT.MOVE,{selected:this.getSelected(),albumUrl:this.albumUrl,albumType:this.albumType,warnings:this.warnings,notify:this.notify,ajaxActions:this.ajaxActions})}},onRotate:function(evnt){if(typeof RotateActionController!="undefined"){document.fire(RotateActionController.EVENT.ROTATE,{selected:this.getSelected(),albumUrl:this.albumUrl,albumType:this.albumType,warnings:this.warnings,notify:this.notify,ajaxActions:this.ajaxActions})}},onResize:function(evnt){if(typeof ResizeActionController!="undefined"){document.fire(ResizeActionController.EVENT.RESIZE,{selected:this.getSelected(),albumUrl:this.albumUrl,albumType:this.albumType,warnings:this.warnings,notify:this.notify,ajaxActions:this.ajaxActions})}},onSelect:function(evnt){var target=evnt.memo.target;var idx=target.id.split("_")[1];if(target.checked){var t=$("thumbnail_"+idx);var info=eval("("+t.getAttribute("pbinfo")+")");if(t){this.bulkCollection.set(idx,{mediaFilename:info.mediaFilename,mediaThumbUrl:info.mediaThumbUrl,title:info.title,mediaType:info.mediaType})}}else{this.bulkCollection.unset(idx);if(this.chkSelectAll.checked){this.chkSelectAll.checked=false}if(this.chkSelectAll2){if(this.chkSelectAll2.checked){this.chkSelectAll2.checked=false}}}},onSelectAll:function(evnt){var elt=Event.element(evnt);var chk=elt.checked;for(var i=this.startOffset;i<this.endOffset;i++){var t=$("thumbnail_"+i);if(chk){this.markSelected(i,t);var chkbox=jq("#thumbchx_"+i);if(chkbox[0]){chkbox[0].checked=true}}else{this.markUnselected(i,t);var chkbox=jq("#thumbchx_"+i);if(chkbox[0]){chkbox[0].checked=false}}}this.chkSelectAll.checked=chk;if(this.chkSelectAll2!=null){this.chkSelectAll2.checked=chk}tr("album_bulk_action_select_deselect_all_click")},updateOffsets:function(evnt){for(var i=this.startOffset;i<this.endOffset;i++){var t=$("thumbnail_"+i);this.markUnselected(i,t);var chkbox=jq("#thumbchx_"+i);if(chkbox[0]){chkbox[0].checked=false}}this.startOffset=evnt.memo.start;this.endOffset=evnt.memo.end;this.bulkCollection=new Hash();if(this.chkSelectAll!=null){this.chkSelectAll.checked=false}},setStaticOffsets:function(){if(this.viewAll){var thumbNailCount=jq(".thumbnail");this.startOffset=0;this.endOffset=thumbNailCount.length}else{var _params=document.location.search;var start=null;if(_params.indexOf("&")!=-1){var params=_params.split("&");for(var i=0;i<params.length;i++){var pos=params[i].indexOf("start=");if(pos!=-1){start=parseInt(params[i].substring((pos+6)));break}}}else{var pos=_params.indexOf("start=");start=parseInt(_params.substring((pos+6)))}if(start){this.startOffset=start;this.endOffset=start+20}}},onActivate:function(evnt){this.albumUrl=evnt.memo.albumUrl;this.albumType=evnt.memo.albumType;this.startOffset=evnt.memo.start;this.endOffset=evnt.memo.end;this.warnings=evnt.memo.warnings;this.ajaxActions=evnt.memo.ajaxActions;this.notify=evnt.memo.notify;this.chkSelectAll.checked=false;if(this.chkSelectAll2){this.chkSelectAll2.checked=false}},markSelected:function(idx,th){if(th){th.setAttribute("pbselected","true");var info=eval("("+th.getAttribute("pbinfo")+")");this.bulkCollection.set(idx,{mediaFilename:info.mediaFilename,mediaThumbUrl:info.mediaThumbUrl,title:info.title,mediaType:info.mediaType});jq(th).find(".outline").each(function(){if(photobucket.browser.isIE6){jq(this).addClass("modClrHi")}else{jq(this).parent().addClass("selectedThumb")}})}},markUnselected:function(idx,th){if(th){th.setAttribute("pbselected","false");this.bulkCollection.unset(idx);jq(th).find(".outline").each(function(){if(photobucket.browser.isIE6){jq(this).removeClass("modClrHi")}else{jq(this).parent().removeClass("selectedThumb")}})}},getSelected:function(){var selected=new Array();for(var i=this.startOffset;i<this.endOffset;i++){var blob=this.bulkCollection.get(i);if(blob){blob.index=i;selected.push(blob)}}return selected},showNoneSelectedMsg:function(){document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"No items selected."})})},onRemove:function(evnt){evnt.memo.selected.each(function(s){this.markUnselected(s.index,$("thumbnail_"+s.index));jq("#thumbnail_"+s.index).fadeOut("normal",function(){jq(this).remove()})}.bind(this))},onUnselect:function(evnt){evnt.memo.selected.each(function(s){this.markUnselected(s.index,$("thumbnail_"+s.index))}.bind(this));if(evnt.memo.selected.length>0){if(this.chkSelectAll!=null){this.chkSelectAll.checked=false}if(this.chkSelectAll2!=null){this.chkSelectAll2.checked=false}}}};Controller.create("BulkActionsController",publicMembers,staticMembers)})();var DeleteActionController;(function(){var b={EVENT:{DELETE:"PB:DeleteActionController_DELETE",DODELETE:"PB:DeleteActionController_DODELETE"}};var a={ajaxAction:false,actionType:"album",selected:[],notify:"MessagePanel",initialize:function(){Event.observe(document,DeleteActionController.EVENT.DELETE,this.onDelete.bindAsEventListener(this));Event.observe(document,DeleteActionController.EVENT.DODELETE,this.doDelete.bindAsEventListener(this))},onDelete:function(e){this.selected=e.memo.selected;this.ajaxAction=e.memo.ajaxActions;if(e.memo.notify){this.notify=e.memo.notify}if(e.memo.albumType){this.albumType=e.memo.albumType}var c=new Array();if(this.selected.length>0){this.selected.each(function(f){c.push(Object.toJSON(f))});var d={"selectedmedia[]":c,albumUrl:e.memo.albumUrl};if(e.memo.warnings){d.warnings=e.memo.warnings}if(e.memo.returnUrl){d.returnUrl=e.memo.returnUrl}if(e.memo.displayThumbnailBar){d.displayThumbnailBar=e.memo.displayThumbnailBar}if(e.memo.actionType){d.actionType=e.memo.actionType;this.actionType=e.memo.actionType}document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/deleteaction",parameters:d,initialHeight:240,cache:false});this.bindKeyHandlers()}else{document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"No files selected."})})}},doDelete:function(e){document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);if(this.actionType=="fullview"){tr("fullview_click_delete")}else{if(this.albumType){tr(this.albumType+"_album_bulk_action_delete_submit")}else{if(this.selected.length==1){tr("album_thumb_delete_submit")}}}if(this.ajaxAction){var d=$("deleteActionForm").serialize(true);d.action="ajaxdelete";new Ajax.Request($("deleteActionForm").getAttribute("action"),{method:"POST",parameters:d,evalJSON:"force",onSuccess:this.deleteHandler.bind(this)})}else{var c=jq("#deleteActionForm");c.find('input[name="positionHash"]').val(document.location.hash);jq("#deleteActionForm").submit()}},deleteHandler:function(f){var d=f.responseJSON;var c=d.response.message;var e=d.response.redir;if(d&&d.response.stat=="ok"){c.type=PBMessage.MESSAGE_TYPE.SUCCESS;if(typeof BulkActionsController!="undefined"){document.fire(BulkActionsController.EVENT.REMOVE,{selected:this.selected})}this.selected=[]}else{c.type=PBMessage.MESSAGE_TYPE.ERROR}document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE);this.unbindKeyHandlers();document.fire(PBLightbox.EVENT.DEACTIVATE);document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage(c)});if(e!==undefined){window.location.href=e}},keyHandler:function(c){if(c.keyCode==13){document.fire(DeleteActionController.EVENT.DODELETE)}},bindKeyHandlers:function(){this.windowObj=(photobucket.browser.isIE)?jq(document):jq(window);this.windowObj.keyup(this.keyHandler)},unbindKeyHandlers:function(){this.windowObj.unbind("keyup",this.keyHandler)}};Controller.create("DeleteActionController",a,b)})();var MoveAcionController;(function(){var b={EVENT:{MOVE:"PB:MoveActionController_MOVE",DOMOVE:"PB:MoveActionController_DOMOVE"}};var a={ajaxAction:false,actionType:"album",selected:[],albumUrl:null,notify:"MessagePanel",initialize:function(){Event.observe(document,MoveActionController.EVENT.MOVE,this.onMove.bindAsEventListener(this));Event.observe(document,MoveActionController.EVENT.DOMOVE,this.doMove.bindAsEventListener(this))},onMove:function(e){this.selected=e.memo.selected;this.ajaxAction=e.memo.ajaxActions;if(e.memo.notify){this.notify=e.memo.notify}if(e.memo.albumType){this.albumType=e.memo.albumType}var c=new Array();if(this.selected.length>0){this.selected.each(function(f){c.push(Object.toJSON(f))});this.albumUrl=e.memo.albumUrl;var d={"selectedmedia[]":c,albumUrl:this.albumUrl};if(e.memo.warnings){d.warnings=e.memo.warnings}if(e.memo.returnUrl){d.returnUrl=e.memo.returnUrl}if(e.memo.displayThumbnailBar){d.displayThumbnailBar=e.memo.displayThumbnailBar}if(e.memo.actionType){d.actionType=e.memo.actionType;this.actionType=e.memo.actionType}document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/moveaction",parameters:d,initialHeight:320,cache:false});this.bindKeyHandlers()}else{document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"No items selected."})})}},doMove:function(g){var c=jq("#moveActionForm input[name='origLoc']").val();var d=jq("#moveActionForm input[name='destination_album']").val();if(d==c){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"Cannot move file(s) to the same album.",details:"Try <a href='"+this.albumUrl+"?action=organize'>organize</a>, if you would like to re-order your files."})})}else{document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);if(this.actionType=="fullview"){tr("fullview_click_move")}else{if(this.albumType){tr(this.albumType+"_album_bulk_action_move_submit")}else{if(this.selected.length==1){tr("album_thumb_move_submit")}}}if(this.ajaxAction){var f=$("moveActionForm").serialize(true);f.action="ajaxmove";new Ajax.Request(jq("#moveActionForm").attr("action"),{method:"POST",parameters:f,evalJSON:"force",onSuccess:this.moveHandler.bind(this)})}else{var e=jq("#moveActionForm");e.find('input[name="positionHash"]').val(document.location.hash);jq("#moveActionForm").submit()}}},moveHandler:function(e){var d=e.responseJSON;var c=d.response.message;if(d&&d.response.stat=="ok"){c.type=PBMessage.MESSAGE_TYPE.SUCCESS;if(typeof BulkActionsController!="undefined"){document.fire(BulkActionsController.EVENT.REMOVE,{selected:this.selected})}this.selected=[]}else{c.type=PBMessage.MESSAGE_TYPE.ERROR}document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE);this.unbindKeyHandlers();document.fire(PBLightbox.EVENT.DEACTIVATE);document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage(c)})},keyHandler:function(c){if(c.keyCode==13){document.fire(MoveActionController.EVENT.DOMOVE)}},bindKeyHandlers:function(){this.windowObj=(photobucket.browser.isIE)?jq(document):jq(window);this.windowObj.keyup(this.keyHandler)},unbindKeyHandlers:function(){this.windowObj.unbind("keyup",this.keyHandler)}};Controller.create("MoveActionController",a,b)})();var AlbumChooserController;(function(){if(window.AlbumChooserController){return}var a={initialize:function(){var c=this;this.choosers={};this.chooserCount=0;try{$$(".album_chooser").each(function(e){c.register(e)})}catch(d){}},register:function(c){if(!c.id){c.id="albumChooser"+this.chooserCount;this.chooserCount++}if(!(c.id in this.choosers)){this.choosers[c.id]=new b(c)}return this.choosers[c.id]},get:function(c){if(c in this.choosers){return this.choosers[c]}return null}};Controller.create("AlbumChooserController",a,{});var b=Class.create({cn:"hover",initialize:function(c){this.chooser=c;this.selector=c.down(".selector");this.panel=c.down(".album_chooser_panel");this.input=c.down("input");this.tabPanel=c.down(".album_chooser_tab_panel");this.newAlbumPanel=c.down(".album_chooser_add_album");this.trackingPrefix=c.readAttribute("tracking");this.rootPath=c.readAttribute("rootpath");this.progressPanel=null;this.maxWidth=this.chooser.readAttribute("maxwidth")||100;jq(this.chooser).hoverIntent({over:this.onChooser.bind(this),out:this.offChooser.bind(this),timeout:300});var d=$("albumChooserCreate");if(d){d.observe("click",this.onCreateAlbum.bindAsEventListener(this))}this.selector.observe("click",this.onSelector.bindAsEventListener(this));this.panel.observe("click",this.onClick.bindAsEventListener(this));document.observe("PBAlbumCreate::new",this.onNewAlbum.bindAsEventListener(this));if(this.newAlbumPanel){this.newAlbumName=this.newAlbumPanel.down(".album_chooser_add_album_name");this.newAlbumName.observe("keyup",this.checkAlbumName.bindAsEventListener(this))}},onSelector:function(e){var d=Event.element(e);if(this.chooser.hasClassName(this.cn)){this.chooser.removeClassName(this.cn)}else{var c=this.panel.down(".album_chooser_album");if(c){this.chooser.addClassName(this.cn)}}},onChooser:function(c){},offChooser:function(c){this.chooser.removeClassName(this.cn)},onCreateAlbum:function(c){this.showNewAlbumPanel()},onClick:function(d){var c=Event.element(d);if(c.hasClassName("button")){return}if(c.hasClassName("album_chooser_album")){this.select({name:c.readAttribute("title"),location:c.readAttribute("location"),privacy:c.readAttribute("data-privacy")})}else{if(c.hasClassName("album_chooser_new")){this.showNewAlbumPanel()}else{if(c.hasClassName("album_chooser_new_cancel")){this.hideNewAlbumPanel()}else{if(c.hasClassName("album_chooser_add_button")){this.addNewAlbum()}}}}},select:function(c){this.selector.down("b").update(this.truncateName(c.name));this.input.value=c.location;jq(this.tabPanel).find(".selected").removeClass("selected");jq(this.tabPanel).find("a[location='"+c.location+"']").parent().addClass("selected");this.offChooser();this.track("album select");c.path=this.rootPath+"/"+c.location;this.chooser.fire("chooser:selected",c)},getValue:function(){var d=jq(this.tabPanel).find(".tabBody .selected a"),c={name:d.attr("title"),location:d.attr("location"),privacy:d.data("privacy")};return c},showNewAlbumPanel:function(){this.track("album create");document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/createalbum?p=redirect",cache:false,parameters:{p:"albumchooser"}})},hideNewAlbumPanel:function(){this.newAlbumPanel.hide();this.tabPanel.show()},truncateName:function(c){if(c.length>this.maxWidth){c=c.substring(0,this.maxWidth-2)+"..."}return c},track:function(c){if(this.trackingPrefix){tr(this.trackingPrefix+" "+c)}},addNewAlbum:function(){var e=this.newAlbumPanel.down("select");var h=(e)?$(e.options[e.selectedIndex]):false;var c=(h)?h.value:"";var g=(h)?h.readAttribute("depth"):1;var j=this.newAlbumPanel.down("input").value.strip().stripTags().stripScripts();var f={createnew:1,postaction:"update",newAlbum:j,parenttarget:c,parentdepth:g};if(f.newAlbum){if(f.parenttarget.length>0){f.addAsSub=true}var i=this.newAlbumPanel.readAttribute("create");new Ajax.Request(i,{method:"POST",parameters:f,onSuccess:this.onAddNewAlbumResp.bind(this)});if(!this.progressPanel){this.progressPanel=new PBProgress({parentId:this.newAlbumPanel.identify(),message:"Creating new album..."})}document.fire(PBProgress.EVENT.ACTIVATE,this.progressPanel)}},onAddNewAlbumResp:function(e){document.fire(PBProgress.EVENT.DEACTIVATE,this.progressPanel);track("create_album");var f=e.responseJSON.response;if(f.stat=="ok"){var d={name:f.optionLabel,location:f.optionValue,parentDepth:e.request.parameters.parentdepth,parentLocation:e.request.parameters.parenttarget};this.insert(d);this.select(d);this.track("album create")}else{var c={type:PBMessage.MESSAGE_TYPE.ERROR,title:"Failed To Create Album",details:f.message.details};document.fire(PBMessage.EVENT.NOTIFY,{message:new PBMessage(c)});this.offChooser()}},onNewAlbum:function(j){var i=j.memo.response;var e=j.memo.response.optionLabel;var d=j.memo.response.optionValue;var g=d.split("/");g.pop();var h=g.length+1;var f=g.join("/");var c={name:e,location:d,parentDepth:h,parentLocation:f};this.insert(c);this.select(c)},insert:function(e){var j=this.tabPanel.down(".recentalbumslist");var i=new Element("li");i.appendChild(this.getAlbumLinkElement(e));j.insert({top:i});var f=this.tabPanel.down(".allalbumslist");var d=(e.parentDepth)?((new Number(e.parentDepth)+1)*15):0;i=new Element("li",{style:"margin-left:"+d+"px;"});i.appendChild(this.getAlbumLinkElement(e));var h=false;if(e.parentLocation){f.select("a").each(function(l){if(l.readAttribute("location")==e.parentLocation){h=l.up("li")}})}if(h){h.insert({after:i})}else{f.insert({bottom:i})}if(this.newAlbumPanel&&e.parentDepth<4){var k=this.newAlbumPanel.down("select");if(k){var g="&nbsp;".times(e.parentDepth*2)+e.name;var c=new Element("option",{depth:e.parentDepth+1,value:e.location}).update(g);var h=false;if(e.parentLocation){k.select("option").each(function(l){if(l.value==e.parentLocation){h=l}})}if(h){h.insert({after:c})}else{k.insert({bottom:c})}}}},getAlbumLinkElement:function(c){return new Element("a",{href:"javascript:void(1)",title:c.name,location:c.location,"class":"album_chooser_album"}).update(c.name)},checkAlbumName:function(e){var c=this.newAlbumPanel.down(".album_chooser_add_button");var d="disabled";if(this.newAlbumName.value.strip()==""){c.addClassName(d)}else{c.removeClassName(d)}}})})();var BulkTagActionController;(function(){var b={EVENT:{TAG:"PB:BulkTagActionController_TAG",DOTAG:"PB:BulkTagActionController_DOTAG"}};var a={selected:[],taglist:"",notify:"MessagePanel",initialize:function(){Event.observe(document,BulkTagActionController.EVENT.TAG,this.onTag.bindAsEventListener(this));Event.observe(document,BulkTagActionController.EVENT.DOTAG,this.doTag.bindAsEventListener(this))},onTag:function(e){this.selected=e.memo.selected;if(e.memo.notify){this.notify=e.memo.notify}if(e.memo.albumType){this.albumType=e.memo.albumType}var c=new Array();if(this.selected.length>0){this.selected.each(function(f){c.push(Object.toJSON(f))})}if(c.length>0){var d={"selectedmedia[]":c,albumUrl:e.memo.albumUrl};if(e.memo.displayThumbnailBar){d.displayThumbnailBar=e.memo.displayThumbnailBar}document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/tagaction",parameters:d,initialHeight:250,cache:false});this.bindKeyHandlers()}else{document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"No files selected."})})}},doTag:function(d){this.taglist=jq("#taglist").val();if(this.taglist!=""){var c=$("tagActionForm").serialize(true);new Ajax.Request(jq("#tagActionForm").attr("action"),{method:"post",parameters:c,evalJSON:"force",onSuccess:this.tagHandler.bind(this)});document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);if(this.albumType){tr(this.albumType+"_album_bulk_action_tag_submit")}}else{document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"Tags missing."})});jq("#taglist").select()}},tagHandler:function(d){var c=d.responseJSON;this.unbindKeyHandlers();document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE);if(c&&c.response.stat=="ok"){document.fire(PBLightbox.EVENT.DEACTIVATE);document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage(c.response.message)});if(typeof BulkActionsController!="undefined"){document.fire(BulkActionsController.EVENT.UNSELECT,{selected:this.selected})}this.selected.each(function(e){jq("#thumbnail_"+e.index+" #thumbchx_"+e.index).attr("checked",false);jq("#thumbnail_"+e.index+" #tags_"+e.index).val(this.taglist);jq("#thumbnail_"+e.index+" #tags_"+e.index).addClass("isChanged")}.bind(this));this.selected=[]}else{document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"There was an error tagging your photos.",id:this.notify,details:c.response.message,type:PBMessage.MESSAGE_TYPE.ERROR})});jq("#taglist").select()}},keyHandler:function(c){if(c.keyCode==13){document.fire(BulkTagActionController.EVENT.DOTAG)}},bindKeyHandlers:function(){this.windowObj=(photobucket.browser.isIE)?jq(document):jq(window);this.windowObj.keyup(this.keyHandler)},unbindKeyHandlers:function(){this.windowObj.unbind("keyup",this.keyHandler)}};Controller.create("BulkTagActionController",a,b)})();var RotateActionController;(function(){var b={EVENT:{ROTATE:"PB:RotateActionController_ROTATE",DOROTATE:"PB:RotateActionController_DOROTATE"},removeThumbnailRotations:function(){RotateActionController.refreshThumbnails();jq("DIV.tb_thumb IMG").removeClass("thumbRotate0 thumbRotate90 thumbRotate180 thumbRotate270")},setThumbnailRotation:function(c){RotateActionController.removeThumbnailRotations();jq("DIV.tb_thumb IMG").addClass("thumbRotate"+c)},refreshThumbnails:function(){jq("DIV.thumbnail IMG").each(function(c,d){this.src=this.src+"?"+(new Date()).getTime()});jq("DIV.rb_thumb IMG").each(function(c,d){this.src=this.src+"?"+(new Date()).getTime()})}};var a={ajaxAction:false,actionType:"album",selected:[],albumUrl:null,notify:"MessagePanel",initialize:function(){Event.observe(document,RotateActionController.EVENT.ROTATE,this.onRotate.bindAsEventListener(this));Event.observe(document,RotateActionController.EVENT.DOROTATE,this.doRotate.bindAsEventListener(this))},onRotate:function(c){this.selected=c.memo.selected;this.ajaxAction=c.memo.ajaxActions;if(c.memo.notify){this.notify=c.memo.notify}if(c.memo.albumType){this.albumType=c.memo.albumType}var d=new Array();if(this.selected.length>0){this.selected.each(function(f){d.push(Object.toJSON(f))});this.albumUrl=c.memo.albumUrl;var e={"selectedmedia[]":d,albumUrl:this.albumUrl};if(c.memo.warnings){e.warnings=c.memo.warnings}if(c.memo.returnUrl){e.returnUrl=c.memo.returnUrl}if(c.memo.displayThumbnailBar){e.displayThumbnailBar=c.memo.displayThumbnailBar}if(c.memo.degrees){e.degrees=c.memo.degrees}if(c.memo.ajaxActions){e.ajaxAction=c.memo.ajaxActions;this.ajaxAction=c.memo.ajaxActions}if(c.memo.actionType){e.actionType=c.memo.actionType;this.actionType=c.memo.actionType}document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/rotateaction",parameters:e,initialHeight:320,cache:false});this.bindKeyHandlers()}else{document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"No items selected."})})}},doRotate:function(d){document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);if(this.actionType=="fullview"){tr("fullview_click_rotate")}else{if(this.albumType){tr(this.albumType+"_album_bulk_action_rotate_submit")}else{if(this.selected.length==1){tr("album_thumb_rotate_submit")}}}if(true){var e=$("rotateActionForm").serialize(true);e.action="ajaxrotate";new Ajax.Request(jq("#rotateActionForm").attr("action"),{method:"POST",parameters:e,evalJSON:"force",onSuccess:this.rotateHandler.bind(this)})}else{var c=jq("#rotateActionForm");c.find('input[name="positionHash"]').val(document.location.hash);jq("#rotateActionForm").submit()}},rotateHandler:function(c){var e=c.responseJSON;var d=e.response.message;if(e&&e.response.stat=="ok"){d.type=PBMessage.MESSAGE_TYPE.SUCCESS;this.selected=[]}else{d.type=PBMessage.MESSAGE_TYPE.ERROR}document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE);this.unbindKeyHandlers();document.fire(PBLightbox.EVENT.DEACTIVATE);document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage(d)});RotateActionController.refreshThumbnails()},keyHandler:function(c){if(c.keyCode==13){document.fire(RotateActionController.EVENT.DOROTATE)}},bindKeyHandlers:function(){this.windowObj=(photobucket.browser.isIE)?jq(document):jq(window);this.windowObj.keyup(this.keyHandler)},unbindKeyHandlers:function(){this.windowObj.unbind("keyup",this.keyHandler)}};Controller.create("RotateActionController",a,b)})();var AlbumChooserController;(function(){if(window.AlbumChooserController){return}var a={initialize:function(){var c=this;this.choosers={};this.chooserCount=0;try{$$(".album_chooser").each(function(e){c.register(e)})}catch(d){}},register:function(c){if(!c.id){c.id="albumChooser"+this.chooserCount;this.chooserCount++}if(!(c.id in this.choosers)){this.choosers[c.id]=new b(c)}return this.choosers[c.id]},get:function(c){if(c in this.choosers){return this.choosers[c]}return null}};Controller.create("AlbumChooserController",a,{});var b=Class.create({cn:"hover",initialize:function(c){this.chooser=c;this.selector=c.down(".selector");this.panel=c.down(".album_chooser_panel");this.input=c.down("input");this.tabPanel=c.down(".album_chooser_tab_panel");this.newAlbumPanel=c.down(".album_chooser_add_album");this.trackingPrefix=c.readAttribute("tracking");this.rootPath=c.readAttribute("rootpath");this.progressPanel=null;this.maxWidth=this.chooser.readAttribute("maxwidth")||100;jq(this.chooser).hoverIntent({over:this.onChooser.bind(this),out:this.offChooser.bind(this),timeout:300});var d=$("albumChooserCreate");if(d){d.observe("click",this.onCreateAlbum.bindAsEventListener(this))}this.selector.observe("click",this.onSelector.bindAsEventListener(this));this.panel.observe("click",this.onClick.bindAsEventListener(this));document.observe("PBAlbumCreate::new",this.onNewAlbum.bindAsEventListener(this));if(this.newAlbumPanel){this.newAlbumName=this.newAlbumPanel.down(".album_chooser_add_album_name");this.newAlbumName.observe("keyup",this.checkAlbumName.bindAsEventListener(this))}},onSelector:function(e){var d=Event.element(e);if(this.chooser.hasClassName(this.cn)){this.chooser.removeClassName(this.cn)}else{var c=this.panel.down(".album_chooser_album");if(c){this.chooser.addClassName(this.cn)}}},onChooser:function(c){},offChooser:function(c){this.chooser.removeClassName(this.cn)},onCreateAlbum:function(c){this.showNewAlbumPanel()},onClick:function(d){var c=Event.element(d);if(c.hasClassName("button")){return}if(c.hasClassName("album_chooser_album")){this.select({name:c.readAttribute("title"),location:c.readAttribute("location"),privacy:c.readAttribute("data-privacy")})}else{if(c.hasClassName("album_chooser_new")){this.showNewAlbumPanel()}else{if(c.hasClassName("album_chooser_new_cancel")){this.hideNewAlbumPanel()}else{if(c.hasClassName("album_chooser_add_button")){this.addNewAlbum()}}}}},select:function(c){this.selector.down("b").update(this.truncateName(c.name));this.input.value=c.location;jq(this.tabPanel).find(".selected").removeClass("selected");jq(this.tabPanel).find("a[location='"+c.location+"']").parent().addClass("selected");this.offChooser();this.track("album select");c.path=this.rootPath+"/"+c.location;this.chooser.fire("chooser:selected",c)},getValue:function(){var d=jq(this.tabPanel).find(".tabBody .selected a"),c={name:d.attr("title"),location:d.attr("location"),privacy:d.data("privacy")};return c},showNewAlbumPanel:function(){this.track("album create");document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/createalbum?p=redirect",cache:false,parameters:{p:"albumchooser"}})},hideNewAlbumPanel:function(){this.newAlbumPanel.hide();this.tabPanel.show()},truncateName:function(c){if(c.length>this.maxWidth){c=c.substring(0,this.maxWidth-2)+"..."}return c},track:function(c){if(this.trackingPrefix){tr(this.trackingPrefix+" "+c)}},addNewAlbum:function(){var e=this.newAlbumPanel.down("select");var h=(e)?$(e.options[e.selectedIndex]):false;var c=(h)?h.value:"";var g=(h)?h.readAttribute("depth"):1;var j=this.newAlbumPanel.down("input").value.strip().stripTags().stripScripts();var f={createnew:1,postaction:"update",newAlbum:j,parenttarget:c,parentdepth:g};if(f.newAlbum){if(f.parenttarget.length>0){f.addAsSub=true}var i=this.newAlbumPanel.readAttribute("create");new Ajax.Request(i,{method:"POST",parameters:f,onSuccess:this.onAddNewAlbumResp.bind(this)});if(!this.progressPanel){this.progressPanel=new PBProgress({parentId:this.newAlbumPanel.identify(),message:"Creating new album..."})}document.fire(PBProgress.EVENT.ACTIVATE,this.progressPanel)}},onAddNewAlbumResp:function(e){document.fire(PBProgress.EVENT.DEACTIVATE,this.progressPanel);track("create_album");var f=e.responseJSON.response;if(f.stat=="ok"){var d={name:f.optionLabel,location:f.optionValue,parentDepth:e.request.parameters.parentdepth,parentLocation:e.request.parameters.parenttarget};this.insert(d);this.select(d);this.track("album create")}else{var c={type:PBMessage.MESSAGE_TYPE.ERROR,title:"Failed To Create Album",details:f.message.details};document.fire(PBMessage.EVENT.NOTIFY,{message:new PBMessage(c)});this.offChooser()}},onNewAlbum:function(j){var i=j.memo.response;var e=j.memo.response.optionLabel;var d=j.memo.response.optionValue;var g=d.split("/");g.pop();var h=g.length+1;var f=g.join("/");var c={name:e,location:d,parentDepth:h,parentLocation:f};this.insert(c);this.select(c)},insert:function(e){var j=this.tabPanel.down(".recentalbumslist");var i=new Element("li");i.appendChild(this.getAlbumLinkElement(e));j.insert({top:i});var f=this.tabPanel.down(".allalbumslist");var d=(e.parentDepth)?((new Number(e.parentDepth)+1)*15):0;i=new Element("li",{style:"margin-left:"+d+"px;"});i.appendChild(this.getAlbumLinkElement(e));var h=false;if(e.parentLocation){f.select("a").each(function(l){if(l.readAttribute("location")==e.parentLocation){h=l.up("li")}})}if(h){h.insert({after:i})}else{f.insert({bottom:i})}if(this.newAlbumPanel&&e.parentDepth<4){var k=this.newAlbumPanel.down("select");if(k){var g="&nbsp;".times(e.parentDepth*2)+e.name;var c=new Element("option",{depth:e.parentDepth+1,value:e.location}).update(g);var h=false;if(e.parentLocation){k.select("option").each(function(l){if(l.value==e.parentLocation){h=l}})}if(h){h.insert({after:c})}else{k.insert({bottom:c})}}}},getAlbumLinkElement:function(c){return new Element("a",{href:"javascript:void(1)",title:c.name,location:c.location,"class":"album_chooser_album"}).update(c.name)},checkAlbumName:function(e){var c=this.newAlbumPanel.down(".album_chooser_add_button");var d="disabled";if(this.newAlbumName.value.strip()==""){c.addClassName(d)}else{c.removeClassName(d)}}})})();var ResizeActionController;(function(){var b={EVENT:{RESIZE:"PB:ResizeActionController_RESIZE",DORESIZE:"PB:ResizeActionController_DORESIZE"}};var a={ajaxAction:false,actionType:"album",selected:[],albumUrl:null,notify:"MessagePanel",initialize:function(){Event.observe(document,ResizeActionController.EVENT.RESIZE,this.onResize.bindAsEventListener(this));Event.observe(document,ResizeActionController.EVENT.DORESIZE,this.doResize.bindAsEventListener(this))},onResize:function(c){this.selected=c.memo.selected;this.ajaxAction=c.memo.ajaxActions;if(c.memo.notify){this.notify=c.memo.notify}if(c.memo.albumType){this.albumType=c.memo.albumType}var d=new Array();if(this.selected.length>0){this.selected.each(function(f){d.push(Object.toJSON(f))});this.albumUrl=c.memo.albumUrl;var e={"selectedmedia[]":d,albumUrl:this.albumUrl};if(c.memo.warnings){e.warnings=c.memo.warnings}if(c.memo.returnUrl){e.returnUrl=c.memo.returnUrl}if(c.memo.displayThumbnailBar){e.displayThumbnailBar=c.memo.displayThumbnailBar}if(c.memo.size){e.size=c.memo.size}else{e.size=640}if(c.memo.ajaxActions){e.ajaxAction=c.memo.ajaxActions;this.ajaxAction=c.memo.ajaxActions}if(c.memo.actionType){e.actionType=c.memo.actionType;this.actionType=c.memo.actionType}document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/resizeaction",parameters:e,initialHeight:320,cache:false});this.bindKeyHandlers()}else{document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"No items selected."})})}},doResize:function(d){document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);if(this.actionType=="fullview"){tr("fullview_click_resize")}else{if(this.albumType){tr(this.albumType+"_album_bulk_action_resize_submit")}else{if(this.selected.length==1){tr("album_thumb_resize_submit")}}}if(true){var e=$("resizeActionForm").serialize(true);e.action="ajaxresize";new Ajax.Request(jq("#resizeActionForm").attr("action"),{method:"POST",parameters:e,evalJSON:"force",onSuccess:this.resizeHandler.bind(this)})}else{var c=jq("#resizeActionForm");c.find('input[name="positionHash"]').val(document.location.hash);jq("#resizeActionForm").submit()}},resizeHandler:function(c){var e=c.responseJSON;var d=e.response.message;if(e&&e.response.stat=="ok"){d.type=PBMessage.MESSAGE_TYPE.SUCCESS;this.selected=[]}else{d.type=PBMessage.MESSAGE_TYPE.ERROR}document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE);this.unbindKeyHandlers();document.fire(PBLightbox.EVENT.DEACTIVATE);document.fire(PBMessage.EVENT.NOTIFY,{gotoHash:true,id:this.notify,message:new PBMessage(d)})},keyHandler:function(c){if(c.keyCode==13){document.fire(ResizeActionController.EVENT.DORESIZE)}},bindKeyHandlers:function(){this.windowObj=(photobucket.browser.isIE)?jq(document):jq(window);this.windowObj.keyup(this.keyHandler)},unbindKeyHandlers:function(){this.windowObj.unbind("keyup",this.keyHandler)}};Controller.create("ResizeActionController",a,b)})();var AlbumChooserController;(function(){if(window.AlbumChooserController){return}var a={initialize:function(){var c=this;this.choosers={};this.chooserCount=0;try{$$(".album_chooser").each(function(e){c.register(e)})}catch(d){}},register:function(c){if(!c.id){c.id="albumChooser"+this.chooserCount;this.chooserCount++}if(!(c.id in this.choosers)){this.choosers[c.id]=new b(c)}return this.choosers[c.id]},get:function(c){if(c in this.choosers){return this.choosers[c]}return null}};Controller.create("AlbumChooserController",a,{});var b=Class.create({cn:"hover",initialize:function(c){this.chooser=c;this.selector=c.down(".selector");this.panel=c.down(".album_chooser_panel");this.input=c.down("input");this.tabPanel=c.down(".album_chooser_tab_panel");this.newAlbumPanel=c.down(".album_chooser_add_album");this.trackingPrefix=c.readAttribute("tracking");this.rootPath=c.readAttribute("rootpath");this.progressPanel=null;this.maxWidth=this.chooser.readAttribute("maxwidth")||100;jq(this.chooser).hoverIntent({over:this.onChooser.bind(this),out:this.offChooser.bind(this),timeout:300});var d=$("albumChooserCreate");if(d){d.observe("click",this.onCreateAlbum.bindAsEventListener(this))}this.selector.observe("click",this.onSelector.bindAsEventListener(this));this.panel.observe("click",this.onClick.bindAsEventListener(this));document.observe("PBAlbumCreate::new",this.onNewAlbum.bindAsEventListener(this));if(this.newAlbumPanel){this.newAlbumName=this.newAlbumPanel.down(".album_chooser_add_album_name");this.newAlbumName.observe("keyup",this.checkAlbumName.bindAsEventListener(this))}},onSelector:function(e){var d=Event.element(e);if(this.chooser.hasClassName(this.cn)){this.chooser.removeClassName(this.cn)}else{var c=this.panel.down(".album_chooser_album");if(c){this.chooser.addClassName(this.cn)}}},onChooser:function(c){},offChooser:function(c){this.chooser.removeClassName(this.cn)},onCreateAlbum:function(c){this.showNewAlbumPanel()},onClick:function(d){var c=Event.element(d);if(c.hasClassName("button")){return}if(c.hasClassName("album_chooser_album")){this.select({name:c.readAttribute("title"),location:c.readAttribute("location"),privacy:c.readAttribute("data-privacy")})}else{if(c.hasClassName("album_chooser_new")){this.showNewAlbumPanel()}else{if(c.hasClassName("album_chooser_new_cancel")){this.hideNewAlbumPanel()}else{if(c.hasClassName("album_chooser_add_button")){this.addNewAlbum()}}}}},select:function(c){this.selector.down("b").update(this.truncateName(c.name));this.input.value=c.location;jq(this.tabPanel).find(".selected").removeClass("selected");jq(this.tabPanel).find("a[location='"+c.location+"']").parent().addClass("selected");this.offChooser();this.track("album select");c.path=this.rootPath+"/"+c.location;this.chooser.fire("chooser:selected",c)},getValue:function(){var d=jq(this.tabPanel).find(".tabBody .selected a"),c={name:d.attr("title"),location:d.attr("location"),privacy:d.data("privacy")};return c},showNewAlbumPanel:function(){this.track("album create");document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/createalbum?p=redirect",cache:false,parameters:{p:"albumchooser"}})},hideNewAlbumPanel:function(){this.newAlbumPanel.hide();this.tabPanel.show()},truncateName:function(c){if(c.length>this.maxWidth){c=c.substring(0,this.maxWidth-2)+"..."}return c},track:function(c){if(this.trackingPrefix){tr(this.trackingPrefix+" "+c)}},addNewAlbum:function(){var e=this.newAlbumPanel.down("select");var h=(e)?$(e.options[e.selectedIndex]):false;var c=(h)?h.value:"";var g=(h)?h.readAttribute("depth"):1;var j=this.newAlbumPanel.down("input").value.strip().stripTags().stripScripts();var f={createnew:1,postaction:"update",newAlbum:j,parenttarget:c,parentdepth:g};if(f.newAlbum){if(f.parenttarget.length>0){f.addAsSub=true}var i=this.newAlbumPanel.readAttribute("create");new Ajax.Request(i,{method:"POST",parameters:f,onSuccess:this.onAddNewAlbumResp.bind(this)});if(!this.progressPanel){this.progressPanel=new PBProgress({parentId:this.newAlbumPanel.identify(),message:"Creating new album..."})}document.fire(PBProgress.EVENT.ACTIVATE,this.progressPanel)}},onAddNewAlbumResp:function(e){document.fire(PBProgress.EVENT.DEACTIVATE,this.progressPanel);track("create_album");var f=e.responseJSON.response;if(f.stat=="ok"){var d={name:f.optionLabel,location:f.optionValue,parentDepth:e.request.parameters.parentdepth,parentLocation:e.request.parameters.parenttarget};this.insert(d);this.select(d);this.track("album create")}else{var c={type:PBMessage.MESSAGE_TYPE.ERROR,title:"Failed To Create Album",details:f.message.details};document.fire(PBMessage.EVENT.NOTIFY,{message:new PBMessage(c)});this.offChooser()}},onNewAlbum:function(j){var i=j.memo.response;var e=j.memo.response.optionLabel;var d=j.memo.response.optionValue;var g=d.split("/");g.pop();var h=g.length+1;var f=g.join("/");var c={name:e,location:d,parentDepth:h,parentLocation:f};this.insert(c);this.select(c)},insert:function(e){var j=this.tabPanel.down(".recentalbumslist");var i=new Element("li");i.appendChild(this.getAlbumLinkElement(e));j.insert({top:i});var f=this.tabPanel.down(".allalbumslist");var d=(e.parentDepth)?((new Number(e.parentDepth)+1)*15):0;i=new Element("li",{style:"margin-left:"+d+"px;"});i.appendChild(this.getAlbumLinkElement(e));var h=false;if(e.parentLocation){f.select("a").each(function(l){if(l.readAttribute("location")==e.parentLocation){h=l.up("li")}})}if(h){h.insert({after:i})}else{f.insert({bottom:i})}if(this.newAlbumPanel&&e.parentDepth<4){var k=this.newAlbumPanel.down("select");if(k){var g="&nbsp;".times(e.parentDepth*2)+e.name;var c=new Element("option",{depth:e.parentDepth+1,value:e.location}).update(g);var h=false;if(e.parentLocation){k.select("option").each(function(l){if(l.value==e.parentLocation){h=l}})}if(h){h.insert({after:c})}else{k.insert({bottom:c})}}}},getAlbumLinkElement:function(c){return new Element("a",{href:"javascript:void(1)",title:c.name,location:c.location,"class":"album_chooser_album"}).update(c.name)},checkAlbumName:function(e){var c=this.newAlbumPanel.down(".album_chooser_add_button");var d="disabled";if(this.newAlbumName.value.strip()==""){c.addClassName(d)}else{c.removeClassName(d)}}})})();var AjaxWrapper=Class.create();AjaxWrapper.prototype={url:null,jsonOptions:null,initialize:function(a,b){this.url=a;this.jsonOptions=b},execute:function(d){var c=new Date();var b=c.getTime();var a={date:b};this.appendParameters(a);new Ajax.Request(this.url,this.jsonOptions)},appendParameters:function(a){Object.extend(this.jsonOptions.parameters,a)},appendOptions:function(a){Object.extend(this.jsonOptions,a)}};(function(){var a={initialize:function(b){if(!b.max){return}this.maxLength=$(b.max);var c=$(b.elem);if(c){switch(c.tagName.toLowerCase()){case"textarea":Event.observe(c,"keypress",this.handleKeyPress.bindAsEventListener(this));break;case"input":Element.writeAttribute(c,"maxLength",this.maxLength);break}}},handleKeyPress:function(d){switch(d.keyCode){case Event.KEY_RETURN:case Event.KEY_BACKSPACE:case Event.KEY_DELETE:case Event.KEY_LEFT:case Event.KEY_RIGHT:case Event.KEY_HOME:case Event.KEY_END:return;default:break}var b=Event.element(d);var c=b.value;if(c.length>=this.maxLength){Event.stop(d)}}};Object.extend(PB.Util,{MaxLength:Class.create(a)})})();(function(a){a.fn.fixClick=function(){return this.each(function(){a(this).css({cursor:"pointer"}).click(function(){window.location.href=a(this).attr("href")})})}})(jQuery);(function(){var a=jq.event.special,c="D"+(+new Date()),b="D"+(+new Date()+1);a.scrollstart={setup:function(){var e,d=function(h){var f=this,g=arguments;if(e){clearTimeout(e)}else{h.type="scrollstart";jq.event.handle.apply(f,g)}e=setTimeout(function(){e=null},a.scrollstop.latency)};jq(this).bind("scroll",d).data(c,d)},teardown:function(){jq(this).unbind("scroll",jq(this).data(c))}};a.scrollstop={latency:300,setup:function(){var e,d=function(h){var f=this,g=arguments;if(e){clearTimeout(e)}e=setTimeout(function(){e=null;h.type="scrollstop";jq.event.handle.apply(f,g)},a.scrollstop.latency)};jq(this).bind("scroll",d).data(b,d)},teardown:function(){jq(this).unbind("scroll",jq(this).data(b))}}})();var ThumbnailController;(function(){var staticMembers={EVENT:{TITLE:"PB:ThumbnailController_title",SELECT:"PB:ThumbnailController_SELECT",SELECTALL:"PB:ThumbnailController_SELECTALL",MOVE:"PB:ThumbnailController_MOVE",UPDATED:"PB:ThumbnailController_UPDATED",APPROVAL:"PB:ThumbnailController_APPROVAL",UPDATEACTIVEFLYOUT:"PB:ThumbnailController_UPDATEACTIVEFLYOUT"}};function preventClick(){return false}var publicMembers={thumbHash:new Array(),lastActiveFlyoutId:-1,isActivity:false,initialize:function(){Event.observe(document,ThumbnailController.EVENT.SELECT,this.onSelect.bindAsEventListener(this));Event.observe(document,ThumbnailController.EVENT.MOVE,this.onMove.bindAsEventListener(this));Event.observe(document,ThumbnailController.EVENT.APPROVAL,this.onApproval.bindAsEventListener(this));Event.observe(document,ThumbnailController.EVENT.UPDATEACTIVEFLYOUT,this.updateActiveFlyout.bindAsEventListener(this));if(typeof(ThumbnailListManagerController)!="undefined"){Event.observe(document,ThumbnailListManagerController.EVENT.CONTENTREFRESHED,this.bindThumbsByOffset.bindAsEventListener(this))}var self=this;jq.find("div.thumbnail").each(function(t){var doPreload=t.getAttribute("pbdopreload");if(doPreload=="1"){self.preloadImage(t)}else{new Thumb(t)}})},bindThumbsByOffset:function(evt){var memo=evt.memo;for(var i=memo.start;i<memo.end;i++){var newThumb=jq("#thumbnail_"+i)[0];if(newThumb){var doPreload=newThumb.getAttribute("pbdopreload");if(doPreload=="1"){this.preloadImage(newThumb)}else{new Thumb(newThumb)}}}},preloadImage:function(thumb){var id=thumb.id;jq(thumb).find("a.ninepoint").click(preventClick);var thumbUrl=thumb.getAttribute("pbthumburl");this.isActivity=(thumb.getAttribute("pbactivity")=="1");var preload=jq("#preload");if(preload.length==0){jq("body").append('<div id="preload" style="overflow:hidden; position:absolute: width: 1px; height: 0px; top: -10px; left: -10px;"></div>');var preload=jq("#preload")}preload.append('<img id="preload_'+id+'" src="'+thumbUrl+'" galleryimg="no" />');var cacheImage=jq("#preload_"+id)[0];if(cacheImage){var self=this;cacheImage.onload=function(){self.handlePreLoadedThumb(this.id)}}},handlePreLoadedThumb:function(id){var img=jq("#"+id);var thumbId=id.replace("preload_","");var width=img.width();var height=img.height();if(width!=0&&height!=0){var dims=this.rescale(width,height);var thumbnail=jq("#"+thumbId);thumbnail.find("a.ninepoint").unbind("click",preventClick);var underImg=thumbnail.find("img.under");if(underImg.length!=0){underImg.css({width:dims.width,height:dims.height});if(!this.isActivity){var imgMargin=this.calculateHSpace(dims.width);underImg.css("margin-left",imgMargin+"px");underImg.css("margin-right",imgMargin+"px")}underImg.attr("src",img.attr("src"))}new Thumb(thumbnail[0]);thumbnail.attr("pbdopreload","0")}},rescale:function(w,h){var max=(this.isActivity)?100:140;if(w>=h&&w>max){h=max*h/w;w=max}else{if(h>=w&&h>max){w=w/h*max;h=max}}return{width:w,height:h}},calculateHSpace:function(w){var hspace=0;if(w<140){hspace=(140-w)/2}return hspace},onMove:function(evnt){var memo=evnt.memo;tr(memo.track);var cfg=memo.cfg;document.fire(SaveToAlbumController.EVENT.ACTIVATE,cfg)},onSelect:function(evnt){var target=evnt.memo.target;var thumbnail=jq(target).parents(".thumbnail");var outlines=jq(thumbnail).find(".outline");if(outlines.length>0){if(photobucket.browser.isIE6){if(target.checked){outlines.each(function(){jq(this).addClass("modClrHi")})}else{outlines.each(function(){jq(this).removeClass("modClrHi")})}}else{if(target.checked){outlines.each(function(){jq(this).parent().addClass("selectedThumb")})}else{outlines.each(function(){jq(this).parent().removeClass("selectedThumb")})}}}},onApproval:function(evnt){var memo=evnt.memo;var media=memo.media;var link=jq(memo.obj);var thumbnail=link.parents(".thumbnail");var pendings=thumbnail.find(".pending");var url=location.pathname;var data={action:"approvemedia",mediaUrl:media};link[0].style.cursor="wait";jq.getJSON(url,data,function(resp){if(resp.response.stat=="ok"){link[0].style.cursor="pointer";if(pendings.length>0){pendings.each(function(i){jq(this).remove()})}thumbnail.attr("pbpending","0")}})},updateActiveFlyout:function(evt){var id=evt.memo.activeId;if(this.lastActiveFlyoutId!=-1&&id!=this.lastActiveFlyoutId){jq("#flyout_"+this.lastActiveFlyoutId).hide()}this.lastActiveFlyoutId=id}};Controller.create("ThumbnailController",publicMembers,staticMembers);var Thumb=Class.create({maxThumbWidth:null,maxThumbWidthIncludingMargin:null,maxFlyoutWidth:182,thumbId:null,thumbType:null,hasSetThumbs:false,jqThumb:null,hasSetFlyouts:false,jqFlyout:null,thumbStyle:null,isScrolling:false,initialize:function(elem){if(!this.hasSetThumbs){this.jqThumb=jq(elem);this.thumbId=this.jqThumb.attr("id").split("_").pop();this.hasSetThumbs=true}jq(window).bind("scrollstart",jq.proxy(this.setIsScrollingOn,this));jq(window).bind("scrollstop",jq.proxy(this.setIsScrollingOff,this));var self=this;var uThumb=this.jqThumb.find(".outline");uThumb.hoverIntent(function(){self.onThumb()},function(){})},setIsScrollingOn:function(){this.isScrolling=true},setIsScrollingOff:function(){this.isScrolling=false},onThumb:function(){if(this.jqThumb.attr("pbshowflyout")!="1"){return}if(this.isScrolling){return}this.thumbType=this.jqThumb.attr("pbthumbtype");if(this.thumbType=="custom"){return}this.adjustPreviousZIndex();document.fire(ThumbnailController.EVENT.UPDATEACTIVEFLYOUT,{activeId:this.thumbId});if(this.hasSetFlyouts){this.adjustFlyoutPosition();this.verifyThumbStyle();this.jqFlyout.show();return}var isPending=this.jqThumb.attr("pbpending");var info=this.jqThumb.attr("pbinfo");var info=eval("("+info+")");if(!info.isOwner&&isPending=="1"){return}if(info.mediaType!="slideshow"){var _image=this.jqThumb.find("img.under");var image=jq(_image);if(typeof(image)=="undefined"){return false}var origStyle="width:"+image.width()+"px;height:"+image.height()+"px;";this.thumbStyle=origStyle;var src=image.attr("src")}else{var origStyle="";var src=info.mediaThumbUrl}var fContent=this.buildContent(src,info,origStyle,isPending);this.jqFlyout=jq("#flyout_"+this.thumbId);this.hasSetFlyouts=true;this.jqFlyout[0].innerHTML=fContent;this.bindFlyoutActions(info);if(photobucket.browser.isIE6||photobucket.browser.isIE7){if(info.mediaType=="video"){jq(".thumbnail a.video").fixClick()}else{if(info.mediaType=="slideshow"){jq(".thumbnail a.slideshow").fixClick()}}}this.adjustFlyoutPosition();this.jqFlyout.hover(function(){},function(){jq(this).fadeOut("fast")});this.jqFlyout.show();setTimeout(this.bindCopyCode.bind(this),0)},adjustFlyoutPosition:function(){var thumbnail=this.jqFlyout.parent();var box=thumbnail.parent();var fH=this.jqFlyout.height();var fW=this.jqFlyout.width();if(!this.maxThumbWidth){this.maxThumbWidth=thumbnail.width();this.maxThumbWidthIncludingMargin=this.maxThumbWidth+15}var _nLeft=((this.maxFlyoutWidth-this.maxThumbWidth)/2)*-1;var _nTop=-4;var bw=box.width();var bh=box.height();var thumbsperrow=Math.floor(bw/this.maxThumbWidthIncludingMargin);var thumbOff=thumbnail.position();var xLeft=thumbOff.left+fW;if(thumbOff.left==0){_nLeft=0}var xTop=thumbOff.top+fH;if(thumbOff.top==0){_nTop=0}else{if(xTop>bh&&this.isOnLastRow(thumbsperrow)){_nTop=((xTop-bh)*-1)-10;var topthumb=jq("#thumbnail_"+(this.thumbId-thumbsperrow));if(topthumb){this.saveAndSetZIndex(topthumb)}if(thumbOff.left==0){var topnextthumb=jq("#thumbnail_"+((this.thumbId-thumbsperrow)+1));if(topnextthumb){this.saveAndSetZIndex(topnextthumb)}}var shareLinks=this.jqFlyout.find("table.shareLinks");shareLinks.css("margin-bottom","3px");this.jqFlyout.prepend(shareLinks);this.jqFlyout.addClass("flipped")}else{if(this.jqFlyout.hasClass("flipped")){var shareLinks=this.jqFlyout.find("table.shareLinks");shareLinks.css("margin-bottom","0px");this.jqFlyout.append(shareLinks);this.jqFlyout.removeClass("flipped")}}}this.jqFlyout.css({top:_nTop,left:_nLeft})},saveAndSetZIndex:function(thumb){var dataOldZIndex=thumb.data("oldZIndex");if(!dataOldZIndex){var oldZIndex=thumb.css("z-index");thumb.data("oldZIndex",oldZIndex)}thumb.css("z-index","1")},adjustPreviousZIndex:function(){if(this.jqThumb){var oldZIndex=this.jqThumb.data("oldZIndex");if(oldZIndex){this.jqThumb.css("z-index",oldZIndex)}}},isOnLastRow:function(tpr){var x=parseInt(this.thumbId)/(tpr*4);var floor=Math.floor(x);return((x-floor)>=0.75)},verifyThumbStyle:function(){this.jqFlyout.find("img.over").attr("style",this.thumbStyle)},buildContent:function(src,info,style,isPending){var isOwner=info.isOwner;var title=(info.title)?info.title.replace(/~!#/i,"'"):"";var html="";if(isOwner){html+='<div class="editable mediaTitle"><div><div class="edit">';if(title==""){html+='<a class="linkClr pbaddtitle" id="editTitle_'+this.thumbId+'" style="background-color: transparent;" onclick="tr(\'thumb_click_to_add_title\');">Click to add title</a>'}else{html+='<a class="linkClr pbaddtitle" id="editTitle_'+this.thumbId+'" style="background-color: transparent;" onclick="tr(\'thumb_click_to_add_title\');">'+title+"</a>"}html+="</div></div>";html+="</div>"}else{if(this.thumbType=="search"){html+='<p class="title"><label class="txtClrDef">&nbsp;</label></p>'}else{html+='<p class="title"><label class="txtClrDef">'+title+"&nbsp;</label></p>"}}switch(info.mediaType){case"video":html+=this.buildVideoIMGHTML(info.mediaBrowseUrl,src,style);break;case"slideshow":html+=this.buildSlideshowIMGHTML(info.mediaBrowseUrl,src);break;default:html+=this.buildImgHTML(info.mediaBrowseUrl,src,style);break}if(isPending=="1"){html+='<div class="pending modClrHdr"><b>New:</b>&nbsp;<a href="javascript:void(0);" id="approve_'+this.thumbId+'">approve</a>&nbsp;|&nbsp;<a href="javascript:void(0);" id="groupdelete_'+this.thumbId+'">delete</a></div>'}var isGroupContributor=(this.thumbType=="group"&&info.isContributor);if(isOwner||isGroupContributor){if(this.thumbType=="group"){html+='<p>By <a href="/home/'+info.location+'/index" title="See '+info.location+"'s profile\">"+info.location+"</a></p>"}else{if(this.thumbType=="home"){var albumName=info.location.replace(/~!#/i,"'").replace("Album","default");var showAlbumName=(albumName.length>20)?albumName.substring(0,20)+"...":albumName;html+='<p>In <a href="'+info.albumUrl+'" title="Visit '+albumName+' album">'+showAlbumName+"</a></p>"}}if(info.mediaFilename.length>20){var fname=info.mediaFilename.substring(0,17)+"...";var addToolTip=true}else{var fname=info.mediaFilename;var addToolTip=false}if(this.thumbType!="home"){html+='<div class="meta txtClrDef">';var isSelected=(this.jqThumb.attr("pbselected"))=="true"?true:false;if(isSelected){html+='<input class="selectedMedia" type="checkbox" id="thumbchx_'+this.thumbId+'" checked="checked" onclick="document.fire(ThumbnailController.EVENT.SELECT,{target:this});tr(\'thumb_checkbox_click\');" iscontributor="'+info.isContributor+'" />'}else{html+='<input class="selectedMedia" type="checkbox" id="thumbchx_'+this.thumbId+'" onclick="document.fire(ThumbnailController.EVENT.SELECT,{target:this});tr(\'thumb_checkbox_click\');" iscontributor="'+info.isContributor+'" />'}html+='<label for="thumbchx_'+this.thumbId+'">';if(addToolTip){html+='<span title="'+info.mediaFilename+'">'+fname+"</span>"}else{html+=fname}html+="</label>";html+="</div>"}html+='<span class="button buttons blue sharemultiaction">';html+='<a href="javascript:void(0);" id="share_'+this.thumbId+'">Share</a><span class="sep">|</span>';if((info.mediaType=="image"&&!info.isAnimatedGif)||info.mediaType=="slideshow"){html+='<a href="javascript:void(0);" id="edit_'+this.thumbId+'">Edit</a><span class="sep">|</span>'}html+='<a href="javascript:void(0);" id="delete_'+this.thumbId+'">Delete</a><span class="sep">|</span>';if(this.thumbType=="group"){html+='<a href="javascript:void(0);" id="copy_'+this.thumbId+'">Copy</a>'}else{html+='<a href="javascript:void(0);" id="move_'+this.thumbId+'">Move</a>'}html+="</span>"}else{if(this.thumbType=="group"){html+='<p>By <a href="/home/'+info.location+'/index" title="See '+info.location+"'s profile\">"+info.location+"</a></p>";html+='<span class="button buttons blue sharemultiaction">';html+='<a href="javascript:void(0);" id="share_'+this.thumbId+'">Share</a><span class="sep">|</span>';html+='<a href="javascript:void(0);" id="copy_'+this.thumbId+'">Copy</a>';html+="</span>"}else{if(this.thumbType=="search"&&!info.isLatestActivity){var _url="/profile/"+info.location+"/index";var _title="See "+info.location+"'s profile";var _by="By";html+="<p>"+_by+' <a href="'+_url+'" title="'+_title+'">'+info.location+"</a></p>"}else{if(this.thumbType=="home"){var albumName=info.location.replace(/~!#/i,"'").replace("Album","default");var showAlbumName=(albumName.length>20)?albumName.substring(0,20)+"...":albumName;html+='<p>In <a href="'+info.albumUrl+'" title="Visit '+albumName+' album">'+showAlbumName+"</a></p>"}}if(info.isDownloadable){html+='<span class="button buttons blue sharemultiaction">';html+='<a href="javascript:void(0);" id="share_'+this.thumbId+'">Share</a><span class="sep">|</span>';html+='<a href="javascript:void(0);" id="copy_'+this.thumbId+'">Copy</a>';html+="</span>"}else{html+='<a href="javascript:void(0);" class="button buttons blue sharebutton" id="share_'+this.thumbId+'">Share</a>'}}}var links=info.links;var isEmptyLinks=(jq.isArray(links)&&links.length==0);if(!isEmptyLinks){html+='<table class="txtClrDef shareLinks" cellspacing="0">';for(var n in links){var trackname=n;trackname=trackname.toLowerCase().substring(0,128).replace(/[ -]/g,"_");trackname=trackname.replace(/['"\/|\\!\?\.]/g,"");trackname=trackname.replace("&amp;","and");trackname=trackname.replace(/[&]/g,"and");var id=trackname+"_"+this.thumbId;html+="<tr><td>";html+='<div id="zeroclipboard_'+id+'" class="zeroclipboard"><div id="copycode_'+id+'" class="copycode">';html+='<span class="lbl">'+n+"</span>";html+='<input id="'+id+'" type="text" value="'+links[n]+'" class="txtCode" onclick="tr(\'thumb_'+trackname+"_link_click');\"/>";html+='<div class="ccplaceholder" style="left:0px;top:0px;z-index:1000;width:160px;height:23px;position:absolute;"></div>';html+="</div></div></div>";html+="</td></tr>"}html+="</table>"}return html},buildImgHTML:function(url,src,style){var html="";html='<a href="'+url+'"><img class="over off" src="'+src+'" style="'+style+'" galleryimg="no" /></a>';return html},buildVideoIMGHTML:function(url,src,style){var html="";html+='<a class="video ninepoint" href="'+url+'"><span style="width: 140px; height: 140px; margin: 0 auto 5px;" class="wrapper"><span class="play icon"></span>';html+='<img class="under off" style="'+style+'" src="'+src+'" galleryimg="no" /></span></a>';return html},buildSlideshowIMGHTML:function(url,src){var html="";html+='<a class="slideshow ninepoint" href="'+url+'"><span style="width: 140px; height: 140px; margin: 0 auto 5px;" class="wrapper"><span class="ssborder"></span>';html+='<span class="ssborder left"></span><span class="curl"></span><span class="sslabel">slideshow</span>';html+="<span style=\"background-image: url('"+src+'\');" class="image"></span></span></a>';return html},bindFlyoutActions:function(info){var share=jq("#share_"+this.thumbId)[0];if(share){var offset=this.thumbId;share.onclick=function(){var type=info.mediaType;if(type=="image"){var type="photo"}tr("thumb_share_click");var memo={tabType:"SharePanelController:easy",mediaUrl:info.mediaUrl,mediaType:type};if(info.searchTerm){memo.searchType=info.mediaType;memo.searchOffset=offset;memo.searchTerm=info.searchTerm}pb_share_manager.getSharePanel(memo)}}if(info.isDownloadable){var copy=jq("#copy_"+this.thumbId)[0];if(copy){copy.onclick=function(){tr("thumb_copy_click");document.fire(ThumbnailController.EVENT.MOVE,{cfg:info.saveToAlbumConfig})}}}var isGroupContributor=(this.thumbType=="group"&&info.isContributor);var isOwner=(info.isOwner||isGroupContributor);if(!isOwner){return}var _albumUrl=info.albumUrl;var source=info.albumUrl;var path=info.mediaUrl;var rand=Math.floor(Math.random()*10001);InlineEditorController.getInstance().addEditor("editTitle_"+this.thumbId,source,"action=mediasettitle&media="+path+"&date="+rand+"&title=","","thumb");var edit=jq("#edit_"+this.thumbId)[0];if(edit){if(info.mediaType=="slideshow"){var url=_albumUrl+"?action=slideshow&current="+info.mediaFilename}else{var url=_albumUrl+"?action=edit&current="+info.mediaFilename}edit.onclick=function(){tr("thumb_edit_click");if(cookieReader("pixlr")=="B"){var params={image:info.directUrl,exit:"javascript:window.parent.postMessage('close', '"+info.originUrl+"');",target:info.targetUrl};pixlr.overlay.show(params)}else{document.location.href=url}}}dupDelete=function(){tr("thumb_delete_click");document.fire(DeleteActionController.EVENT.DELETE,{selected:[{mediaFilename:info.mediaFilename,mediaThumbUrl:info.mediaThumbUrl,title:info.title}],albumUrl:_albumUrl})};var del=jq("#delete_"+this.thumbId)[0];if(del){del.onclick=dupDelete}var groupdel=jq("#groupdelete_"+this.thumbId)[0];if(groupdel){tr("group_thumb_delete");groupdel.onclick=dupDelete}var move=jq("#move_"+this.thumbId)[0];if(move){move.onclick=function(){tr("thumb_move_click");document.fire(MoveActionController.EVENT.MOVE,{selected:[{mediaFilename:info.mediaFilename,mediaThumbUrl:info.mediaThumbUrl,title:info.title}],albumUrl:_albumUrl})}}var approve=jq("#approve_"+this.thumbId)[0];if(approve){approve.onclick=function(){tr("group_album_thumb_approve_click");document.fire(ThumbnailController.EVENT.APPROVAL,{media:info.mediaUrl,obj:this})}}},bindCopyCode:function(){var version=deconcept.SWFObjectUtil.getPlayerVersion();if(version.major>=9){var codes=this.jqFlyout.find(".shareLinks .txtCode");codes.each(function(i){var obj=jq(this);var clip=obj.parent();var ccclip=new ZeroClipboard.Client();ccclip.setIsThumb();ccclip.glue(obj[0],clip[0],obj.val());ccclip.addEventListener("onComplete",function(c,t){tr("album_thumb_link_code_click");obj.val("Copied");obj.css("backgroundColor","#FFFF66");obj.fadeTo("normal",0.4,function(){jq(this).fadeTo("normal",1,function(){jq(this).css("backgroundColor","#FFFFFF").val(t)})})})})}else{var codes=this.jqFlyout.find(".shareLinks .txtCode");codes.click(function(){jq(this).select()})}}})})();var ThumbnailListManagerController;(function(){var a={source:null,startOffset:null,endOffset:null,totalObjects:null,thumbsPerPage:null,currentPage:null,cacheHash:null,cacheFull:false,cacheMin:null,cacheMax:null,secondaryContainer:null,secondaryCacheHash:null,secondaryCacheMax:null,fetchStart:null,isFetchingMore:null,currentReq:null,mediaFilter:"",collection:[],collectionSelectorClass:null,collectionStartTotal:null,parentContainer:null,isParentContainerSet:false,resizeContainerHeightOnNextEvent:false,isSearch:false,initialize:function(){jq(document).bind(PaginationController.EVENT.PAGEUPDATE,{ctrl:this},function(c){c.data.ctrl.handlePageUpdate(c)})},mixIn:function(c){for(var d in c){this[d]=c[d]}this.prepCache();this.populateCache();this.testThresholds()},prepCache:function(){var c=new Hash();for(var e=0;e<this.totalObjects;e++){c.set(e,false)}this.cacheHash=c;if(this.hasSecondary){this.secondaryContainer=jq(".secondaryResults").first();var d=new Hash();for(var e=0;e<this.secondaryDetails.total;e++){d.set(e,false)}this.secondaryCacheHash=d}},populateCache:function(){var d=jq(this.collectionSelectorClass);var c=this;d.each(function(f){var g=jq(this);var e=parseInt(g.attr("id").split("_").pop());c.cacheHash.set(e,g);if(!c.isParentContainerSet){c.parentContainer=g.parent();c.isParentContainerSet=true}});if(d.length==this.totalObjects){this.cacheFull=true}if(this.hasSecondary){var d=jq(this.secondaryDetails.collectionSelectorClass);var c=this;d.each(function(f){var g=jq(this);var e=parseInt(g.attr("id").split("_").pop());c.secondaryCacheHash.set(e,g)})}},handlePageUpdate:function(c){var d=c.memo;if(d.resizeContainerHeightOnNextEvent){this.resizeContainerHeightOnNextEvent=true}this.thumbsPerPage=d.thumbsPerPage;this.currentPage=d.currentPage;if(this.startOffset==d.offset){this.setEndOffset();this.toggleObjects();return}else{this.startOffset=d.offset;if(this.startOffset>this.totalObjects){this.startOffset=(this.totalObjects-this.thumbsPerPage)-1}this.setEndOffset()}this.testThresholds();if(this.cacheFull){this.toggleObjects()}else{var e=this.testCacheForAction();if(e.fetch=="now"){this.fetchMore(e)}else{if(e.fetch=="more"){this.isFetchingMore=true;this.fetchMore(e);this.toggleObjects()}else{this.toggleObjects()}}}if(this.hasSecondary){this.toggleSecondaryObjects()}},setEndOffset:function(){this.endOffset=this.startOffset+this.thumbsPerPage;if(this.endOffset>this.totalObjects){this.endOffset=this.totalObjects}},testCacheForAction:function(){if(this.isSearch){var c=this.startOffset-this.thumbsPerPage}else{var c=this.startOffset-(this.thumbsPerPage*2)}c=(c<0)?0:c;var g=this.endOffset+(this.thumbsPerPage*2);g=(g>this.totalObjects)?this.totalObjects:g;var k=(this.startOffset>=this.cacheMin&&(this.startOffset-1)<=this.cacheMax);var j=(this.endOffset>=this.cacheMin&&(this.endOffset-1)<=this.cacheMax);var h=(!k||!j);if(h){if(this.isFetchingMore){this.currentReq.abort();this.isFetchingMore=false}if(typeof(PaginationController)!="undefined"){document.fire(PaginationController.EVENT.UNBINDKEYS)}if(!k&&!j){if(this.startOffset<this.cacheMin){var n=this.scanCacheForGaps("start");var i=(n>c)?n:c;var o=this.cacheMin}else{if(this.endOffset>this.cacheMax){var f=this.scanCacheForGaps("end")+1;var o=(f<g)?f:g;var i=(c<this.cacheMax)?this.cacheMax+1:c}}}else{if(!k){var n=this.scanCacheForGaps("start");var i=(n>c)?n:c;var o=this.cacheMin}else{if(!j){var f=this.scanCacheForGaps("end");var m=this.cacheMax+1;var i=(f<m)?f:m;var o=g}}}if(i==o){if(typeof(PaginationController)!="undefined"){document.fire(PaginationController.EVENT.REBINDKEYS)}return"toggle"}else{var l={fetch:"now",fetchStart:i,fetchEnd:o};return l}}if(this.isFetchingMore){return{fetch:"none"}}if(c<this.cacheMin){var e="more";var d=this.scanCacheForGaps("start");var m=(c<0)?0:c;var i=(d>m)?d:m;var o=this.cacheMin}else{if((g-1)>this.cacheMax){var e="more";var m=this.cacheMax+1;var f=this.scanCacheForGaps("end");var i=(f<m)?f:m;var o=g}else{return{fetch:"none"}}}var l={fetch:e,fetchStart:i,fetchEnd:o};return l},scanCacheForGaps:function(c){if(c=="start"){for(var d=0;d<this.totalObjects;d++){var e=this.cacheHash.get(d);if(!e){return d;break}}}else{for(var d=this.totalObjects-1;d>=0;d--){var e=this.cacheHash.get(d);if(!e){return d;break}}}return false},testThresholds:function(){for(var d=this.startOffset;d>=0;d--){var e=this.cacheHash.get(d);if(e){this.cacheMin=d}else{break}}var c=(this.endOffset)?this.endOffset:this.startOffset;for(var d=c;d<this.totalObjects;d++){var e=this.cacheHash.get(d);if(e){this.cacheMax=d}else{break}}if(this.hasSecondary){for(var d=this.secondaryDetails.total-1;d>=0;d--){var e=this.secondaryCacheHash.get(d);if(!e){continue}else{this.secondaryCacheMax=d;break}}}},fetchMore:function(f){var e="/pbassets/thumbs";var g={source:this.source,start:f.fetchStart,end:f.fetchEnd,thumbsperpage:this.thumbsPerPage,filter:this.mediaFilter,ts:this.fpk.ts,sig:this.fpk.sig};if(this.currentTag){g.currentTag=this.currentTag}if(this.setId){g.setId=this.setId}if(this.searchFilter){g.searchFilter=this.searchFilter}if(this.searchSortBy){g.searchSortBy=this.searchSortBy}if(this.hasSecondary&&(this.secondaryDetails.endoffset<this.secondaryDetails.total)){g.searchSecondary=1;g.searchStartOffset=this.secondaryDetails.endoffset}var d=this;if(f.fetch=="now"){this.showProgress();this.currentReq=jq.getJSON(e,g,function(h){if(h.response.stat=="ok"){d.fpk=h.response.fpk;d.loadNewObjects(h.response.results);d.toggleObjects();d.removeProgress();if(typeof(PaginationController)!="undefined"){document.fire(PaginationController.EVENT.REBINDKEYS)}}else{document.location.reload(true)}},"json")}else{this.fetchStart=f.fetchStart;this.currentReq=jq.getJSON(e,g,function(h){if(h.response.stat=="ok"){d.fpk=h.response.fpk;d.loadNewObjects(h.response.results);d.isFetchingMore=false}else{document.location.reload(true)}},"json");var c={start:g.start,end:g.end};document.fire(ThumbnailListManagerController.EVENT.CONTENTREFRESHED,c)}},loadNewObjects:function(f){var c=this.parentContainer.find(".clearBoth");c.before(f.primary);if(this.hasSecondary&&f.secondary){var d=this.secondaryContainer.find(".vresults");var e=jq(d[0]).find(".clearBoth");e.before(f.secondary);this.secondaryDetails.endoffset+=f.secondaryTotal}this.populateCache();this.testThresholds();if(this.resizeContainerHeightOnNextEvent&&!this.hasSecondary){this.parentContainer.css("height","800px");this.resizeContainerHeightOnNextEvent=false}},toggleObjects:function(){var g=this.totalObjects;if(this.viewAll){this.startOffset=0;this.endOffset=this.totalObjects}for(var d=0;d<this.totalObjects;d++){var f=this.cacheHash.get(d);if(!f){continue}var e=g-d;if(d>=this.startOffset&&d<this.endOffset){f.css("z-index",e);f.show()}else{f.hide()}}var c={start:this.startOffset,end:this.endOffset};this.resizeLastPage();document.fire(ThumbnailListManagerController.EVENT.CONTENTREFRESHED,c)},toggleSecondaryObjects:function(){var e=Math.floor(this.thumbsPerPage/4);var c=(this.currentPage-1)*e;var d=c+e;if(c>this.secondaryCacheMax){this.secondaryContainer.toggle(false);return}for(var f=0;f<this.secondaryDetails.total;f++){var g=this.secondaryCacheHash.get(f);if(!g){continue}if(f>=c&&f<d){g.show()}else{g.hide()}}if(c>this.secondaryDetails.total){this.secondaryContainer.toggle(false)}else{if(this.secondaryContainer.css("display")=="none"&&c<this.secondaryDetails.total){this.secondaryContainer.toggle(true)}}},resizeLastPage:function(){var f=Math.ceil(this.totalObjects/this.thumbsPerPage);if(this.currentPage==f){var g=Math.floor(this.thumbsPerPage/4);var c=this.thumbsPerPage*(f-1);var e=this.totalObjects-this.startOffset;var d=Math.ceil(e/g);if(d<4){this.parentContainer.css("height",(d*190+200)+"px")}}else{var h=this.parentContainer.data("oldHeight");if(h&&this.parentContainer.height()!=h){this.parentContainer.css("height",h+"px");this.parentContainer.removeData("oldHeight")}else{this.parentContainer.data("oldHeight",this.parentContainer.height())}}},showProgress:function(){var c=(this.parentContainer.width()-25);var d=this.parentContainer.height();this.parentContainer.prepend('<div class="progress modClrBg" style="width:'+c+"px;height:"+d+'px;z-index:5001;"><div class="message">Loading...</div></div>')},removeProgress:function(){var c=this.parentContainer.find(".progress");if(c){c.remove()}}};var b={EVENT:{CONTENTREFRESHED:"ThumbnailListManagerController:contentrefreshed"}};Controller.create("ThumbnailListManagerController",a,b)})();
/*!
 * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010
 * http://benalman.com/projects/jquery-bbq-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M<N?O[P]||(R[M+1]&&isNaN(R[M+1])?{}:[]):J}}else{if($.isArray(H[P])){H[P].push(J)}else{if(H[P]!==i){H[P]=[H[P],J]}else{H[P]=J}}}}else{if(P){H[P]=F?i:""}}});return H};function z(H,F,G){if(F===i||typeof F==="boolean"){G=F;F=a[H?D:A]()}else{F=E(F)?F.replace(H?w:x,""):F}return l(F,G)}l[A]=B(z,0);l[D]=v=B(z,1);$[y]||($[y]=function(F){return $.extend(C,F)})({a:k,base:k,iframe:t,img:t,input:t,form:"action",link:k,script:t});j=$[y];function s(I,G,H,F){if(!E(H)&&typeof H!=="object"){F=H;H=G;G=i}return this.each(function(){var L=$(this),J=G||j()[(this.nodeName||"").toLowerCase()]||"",K=J&&L.attr(J)||"";L.attr(J,a[I](K,H,F))})}$.fn[A]=B(s,A);$.fn[D]=B(s,D);b.pushState=q=function(I,F){if(E(I)&&/^#/.test(I)&&F===i){F=2}var H=I!==i,G=c(p[g][k],H?I:{},H?F:2);p[g][k]=G+(/#/.test(G)?"":"#")};b.getState=u=function(F,G){return F===i||typeof F==="boolean"?v(F):v(G)[F]};b.removeState=function(F){var G={};if(F!==i){G=u();$.each($.isArray(F)?F:arguments,function(I,H){delete G[H]})}q(G,2)};e[d]=$.extend(e[d],{add:function(F){var H;function G(J){var I=J[D]=c();J.getState=function(K,L){return K===i||typeof K==="boolean"?l(I,K):l(I,L)[K]};H.apply(this,arguments)}if($.isFunction(F)){H=F;return G}else{H=F.handler;F.handler=G}}})})(jQuery,this);
/*!
 * jQuery hashchange event - v1.2 - 2/11/2010
 * http://benalman.com/projects/jquery-hashchange-plugin/
 * 
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,i,b){var j,k=$.event.special,c="location",d="hashchange",l="href",f=$.browser,g=document.documentMode,h=f.msie&&(g===b||g<8),e="on"+d in i&&!h;function a(m){m=m||i[c][l];return m.replace(/^[^#]*#?(.*)$/,"$1")}$[d+"Delay"]=100;k[d]=$.extend(k[d],{setup:function(){if(e){return false}$(j.start)},teardown:function(){if(e){return false}$(j.stop)}});j=(function(){var m={},r,n,o,q;function p(){o=q=function(s){return s};if(h){n=$('<iframe src="javascript:0"/>').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this);var Pagination=function(b,a){this.elt=b;this.controller=a;this.goToIndex=function(c){if(this.totalPages<this.showPages){this.showPages=this.totalPages;this.startPage=1;this.endPage=this.showPages+1}else{if(c<this.centerIndex){this.startPage=1;this.endPage=this.showPages+1}else{if(c>(this.totalPages-this.centerIndex)){this.startPage=this.totalPages-this.showPages+1;this.endPage=this.totalPages+1}else{this.startPage=c-this.centerIndex+1;this.endPage=c+this.centerIndex}}}this.currentPage=c;var d=this.startPage;this.elt.find(".page").each(function(e){var f=jq(this);f.text(e+d);if((e+d)==c){f.addClass("current")}else{if(f.hasClass("current")){f.removeClass("current")}}});if(this.currentPage==1){this.elt.find(".previous").hide()}else{this.elt.find(".previous").show()}if(this.currentPage==this.totalPages){this.elt.find(".next").hide()}else{this.elt.find(".next").show()}}};Pagination.prototype={elt:null,controller:null,currentPage:null,totalPages:null,showPages:null,centerIndex:null,bindToKeys:null,target:null,setConstants:function(){this.currentPage=parseInt(this.elt.attr("currentpage"));this.totalPages=parseInt(this.elt.attr("totalpages"));this.centerIndex=parseInt(this.elt.attr("centerindex"));this.bindToKeys=parseInt(this.elt.attr("bindtokeys"));this.target=this.elt.attr("target")},bindControls:function(){this.setConstants();var a=this;this.elt.find(".page").each(function(b){jq(this).bind("click",function(c){var d=parseInt(c.target.innerHTML);if(!a.controller.keyHandlersBinded){return false}a.controller.goTo(d);tr("pagination_number_click");c.preventDefault();return false})});this.elt.find(".previous").each(function(b){jq(this).bind("click",function(c){if(!a.controller.keyHandlersBinded){return false}a.controller.goTo(a.currentPage-1);tr("pagination_previous_click");c.preventDefault();return false})});this.elt.find(".next").each(function(b){jq(this).bind("click",function(c){if(!a.controller.keyHandlersBinded){return false}a.controller.goTo(a.currentPage+1);tr("pagination_next_click");c.preventDefault();return false})})}};var PaginationController;(function(){var publicMembers={currentOffset:null,currentPage:null,totalPages:null,thumbsperpage:null,resizeContainerHeightOnNextEvent:false,totalObjects:null,baseURL:null,paginatorList:[],showPages:5,isSearch:"0",isDynamic:"1",bindToKeys:null,keyHandlersBinded:false,windowObj:null,showOffsetHref:false,isLoggedIn:0,isPro:0,metrics:null,findStuffTracking:null,adRefresh:"",adRefreshBinded:false,adRefreshTimerExpired:false,adTimeMax:null,adTimer:null,adCountMax:null,adCount:0,initialize:function(){var targets=new Array();var paginators=jq(".pagination");var controller=this;paginators.each(function(i){var obj=jq(this);controller.currentOffset=parseInt(obj.attr("currentOffset"));controller.totalObjects=parseInt(obj.attr("totalobjects"));controller.isSearch=obj.attr("isSearch");controller.isDynamic=parseInt(obj.attr("dynamic"));controller.bindToKeys=parseInt(obj.attr("bindtokeys"));controller.baseURL=decodeURIComponent(obj.attr("baseUrl"));controller.isLoggedIn=parseInt(obj.attr("isloggedin"));controller.isPro=parseInt(obj.attr("ispro"));controller.adRefresh=obj.attr("adrefresh");controller.metrics=obj.attr("metrics");controller.findStuffTracking=obj.attr("findStuffTracking");var paginator=new Pagination(obj,controller);if(controller.isDynamic==1){paginator.bindControls()}controller.paginatorList.push(paginator)});if(this.isDynamic==1&&paginators.length>0){Event.observe(document,PaginationController.EVENT.UNBINDKEYS,this.unbindKeyHandlers.bindAsEventListener(this));Event.observe(document,PaginationController.EVENT.REBINDKEYS,this.bindKeyHandlers.bindAsEventListener(this));if(typeof(AreaResizerController)!="undefined"){Event.observe(document,AreaResizerController.EVENT.THUMBTHRESHOLDCALCULATED,this.setAreaConstants.bindAsEventListener(this))}if(this.bindToKeys==1&&!this.keyHandlersBinded){this.bindKeyHandlers();Event.observe(document,PBLightbox.EVENT.ACTIVATE,this.unbindKeyHandlers.bindAsEventListener(this));Event.observe(document,PBLightbox.EVENT.DEACTIVATED,this.bindKeyHandlers.bindAsEventListener(this))}if(this.adRefresh!=""&&!this.adRefreshBinded){jq(document).bind(PaginationController.EVENT.USERACTIONUPDATE,{ctrl:this},function(evt){evt.data.ctrl.checkAdRefresh(evt)});this.adRefreshBinded=true;var adInfo=eval("("+this.adRefresh+")");this.bindAdRefresh(adInfo)}}},keyHandler:function(event){var isInput=(event.target.tagName=="INPUT"||event.target.tagName=="TEXTAREA"||event.target.tagName=="SELECT");var key=event.keyCode;if((key==37||key==188)&&!isInput){if(this.currentPage!=1){this.goTo(this.currentPage-1);tr("pagination_left_carot_key_press")}}else{if((key==39||key==190)&&!isInput){if(this.currentPage!=this.totalPages){this.goTo(this.currentPage+1);tr("pagination_right_carot_key_press")}}}},bindKeyHandlers:function(){this.keyHandlersBinded=true;this.windowObj=(photobucket.browser.isIE)?jq(document):jq(window);this.windowObj.keyup(jq.proxy(this.keyHandler,this))},unbindKeyHandlers:function(){this.windowObj.unbind("keyup",this.keyHandler);this.keyHandlersBinded=false},goTo:function(index){for(var i=0;i<this.paginatorList.length;i++){this.paginatorList[i].goToIndex(index)}this.currentPage=index;this.currentOffset=(this.thumbsperpage*index)-this.thumbsperpage;this.redraw();if(_pb.history){var history={cp:this.currentPage,tpp:this.thumbsperpage};_pb.history.add(history)}var event=jq.Event(PaginationController.EVENT.USERACTIONUPDATE);jq(document).trigger(event);this.fireRedrawEvent();this.updateTracking()},setAreaConstants:function(evt){var memo=evt.memo;var tpp=memo.thumbRows*memo.thumbCols;if(this.thumbsperpage==tpp){return}this.thumbsperpage=tpp;if(this.thumbsperpage<20){this.resizeContainerHeightOnNextEvent=true}this.totalPages=Math.ceil(this.totalObjects/this.thumbsperpage);this.currentPage=Math.floor(this.currentOffset/this.thumbsperpage)+1;var hashSet=false;if(_pb.history){var hash=_pb.history.getHash();if(hash){hashSet=true}}if(hashSet){var params=_pb.history.getParams(hash);var goToPage=parseInt(params.cp);var tpp=parseInt(params.tpp);var start=(goToPage-1)*tpp;if(this.thumbsperpage!=tpp){var goToPage=Math.floor(start/this.thumbsperpage)+1}if(goToPage>this.totalPages){goToPage=this.totalPages}this.currentPage=goToPage;this.redraw();this.goTo(goToPage)}else{this.redraw();this.fireRedrawEvent()}},redraw:function(evt){var self=this;if(this.totalPages==1){jq(".pagination").each(function(i){var obj=jq(this);var container=obj.parents(".pbcontainer");var hasBulkActions=(container.find(".bulkActions").length>0);if(container.hasClass("lower")&&!hasBulkActions){container.hide()}obj.hide()})}else{jq(".pagination").each(function(i){var obj=jq(this);obj.children().each(function(){jq(this).remove()});obj.attr("totalpages",self.totalPages);obj.attr("currentpage",self.currentPage);obj.html(self.buildLinks());obj.show();var container=obj.parents(".pbcontainer");if(container){container.show()}});if(this.isDynamic==1){for(var i=0;i<this.paginatorList.length;i++){this.paginatorList[i].bindControls()}}}},buildLinks:function(){var showPages=this.showPages;var start,end;var center=Math.floor(showPages/2)+1;if(this.totalPages<=showPages){showPages=this.totalPages;start=1;end=showPages+1}else{if(this.currentPage<center){start=1;end=showPages+1}else{if(this.currentPage>(this.totalPages-center)){start=this.totalPages-showPages+1;end=this.totalPages+1}else{start=this.currentPage-center+1;end=this.currentPage+center}}}center=Math.floor(showPages/2)+1;var showPrev=(this.currentPage!=1);var showFirst=(this.totalPages>5&&start>=2);var showNext=(this.currentPage!=this.totalPages);var showLast=(this.isSearch!="1"&&(this.totalPages>5&&end<=this.totalPages));var html="";var poffset=(this.thumbsperpage*(this.currentPage-1))-this.thumbsperpage;var previous='<span class="arrowprevious linkClr"></span><a href="'+this.getPaginationHref(poffset)+'" class="previous">Previous</a>';var noffset=(this.thumbsperpage*(this.currentPage+1))-this.thumbsperpage;var next='<a href="'+this.getPaginationHref(noffset)+'" class="next">Next</a><span class="arrownext linkClr"></span>';if(showPrev){html+=previous}if(showFirst){html+='<a class="page" href="'+this.getPaginationHref(0)+'">1</a>';if(start>2){html+="..."}}for(var i=start;i<end;i++){var currentstyle=(i==this.currentPage)?" current":"";var offset=(this.thumbsperpage*i)-this.thumbsperpage;html+='<a class="page'+currentstyle+'" href="'+this.getPaginationHref(offset)+'">'+i+"</a>"}if(showLast){if(this.totalPages-this.currentPage!=3){html+="..."}html+='<a class="page" href="'+this.getPaginationHref(((this.totalPages*this.thumbsperpage)-this.thumbsperpage))+'">'+this.totalPages+"</a>"}else{if(this.isSearch&&showNext&&this.totalPages>5){html+="..."}}if(showNext){html+=next}return html},getPaginationHref:function(offset){var href=(this.showOffsetHref)?this.baseURL+offset:document.location;return href},updatePaginationFromHistory:function(memo){var cp=memo.cp;if(isNaN(cp)){cp=1}var tpp=memo.tpp;if(isNaN(tpp)){tpp=this.thumbsperpage}if(cp>this.totalPages){cp=this.totalPages}if(this.thumbsperpage!=tpp){var oldOffset=(cp-1)*tpp;var newPage=Math.floor(oldOffset/this.thumbsperpage)+1}else{var newPage=cp}if(newPage!=this.currentPage){this.goTo(newPage)}},fireRedrawEvent:function(){var memo={offset:this.currentOffset,currentPage:this.currentPage,totalPages:this.totalPages,thumbsPerPage:this.thumbsperpage};if(this.resizeContainerHeightOnNextEvent){memo.resizeContainerHeightOnNextEvent=true;this.resizeContainerHeightOnNextEvent=false}var event=jq.Event(PaginationController.EVENT.PAGEUPDATE);event.memo=memo;jq(document).trigger(event)},bindAdRefresh:function(adInfo){this.adCountMax=adInfo.count;this.adTimeMax=adInfo.time;this.configureAdRefreshTimer()},checkAdRefresh:function(){if(this.adRefreshTimerExpired||this.adCount==this.adCountMax){this.refreshAds()}else{this.adCount+=1}},configureAdRefreshTimer:function(){var self=this;var callback=function(){self.adRefreshTimerExpired=true};this.adTimer=window.setInterval(callback,this.adTimeMax)},refreshAds:function(){var self=this;var ads=jq(".pbad");var pageid=Math.floor(Math.random()*9999999999)+111111;ads.each(function(i){var ad=jq(this);var parent=ad.parent();var newAd=ad.clone();ad.remove();var src=newAd.attr("src");var newsrc=self.regenAdUrl(src,pageid);newAd.attr("src",newsrc);parent.append(newAd)});var gadsense=jq("#gadsense_adcontainer1");if(gadsense.length>0){if(gadsense_pageOptions&&gadsense_adblock1){try{gadsense.html("");new google.ads.search.Ads(gadsense_pageOptions,gadsense_adblock1)}catch(e){}}}document.fire(PaginationController.EVENT.ADREFRESH);this.adCount=0;this.adRefreshTimerExpired=false;window.clearInterval(this.adTimer);this.configureAdRefreshTimer()},regenAdUrl:function(url,pageid){var src=url.split("?");if(src.length==2){var adUrl=src[0];var adParams=src[1].toQueryParams();var rdm=Math.floor(Math.random()*899999)+100000;adParams.redir=adParams.redir.replace(/random=\d+\//,"random="+rdm+"/");adParams.redir=adParams.redir.replace(/viewid=\d+\//,"viewid="+pageid+"/");url=adUrl+"?"+$H(adParams).toQueryString()}else{if(src.length==1){var adUrl=src[0];var rdm=Math.floor(Math.random()*899999)+100000;url=adUrl.replace(/random=\d+\//,"random="+rdm+"/");url=adUrl.replace(/viewid=\d+\//,"viewid="+pageid+"/")}}return url},updateTracking:function(){if(typeof(_gaq)!="undefined"){_gaq.push(["_trackPageview"])}if(typeof(APIRequest)!="undefined"){if(this.isSearch){APIRequest.track("search_thumbnail_paginate_view")}else{APIRequest.track("album_thumbnail_paginate_view")}if(this.metrics){var metrics=eval("("+this.metrics+")");if(metrics.length>0){for(var i=0;i<metrics.length;i++){APIRequest.track(metrics[i])}}}if(this.isLoggedIn==1){APIRequest.track("page_view_logged_in")}else{APIRequest.track("page_view_logged_out")}APIRequest.track("page_view")}if(typeof(gomez)!="undefined"){if(this.isSearch){gomez.nameEvent("s_th_page")}else{gomez.nameEvent("a_th_page")}}var url=document.location.protocol+"//"+document.location.hostname+document.location.pathname;var d=new Image(1,1);d.onerror=d.onload=function(){d.onerror=d.onload=null};d.src=["//secure-us.imrworldwide.com/cgi-bin/m?ci=us-904896h&cg=0&cc=1&si=",escape(window.location.href),"&rp=",escape(document.referrer),"&ts=compact&c0=usergen,1&rnd=",(new Date()).getTime()].join("");if(typeof(COMSCORE)!="undefined"){var truncatedURL=url.split("?",1);COMSCORE.beacon({c1:2,c2:6034695,c3:"",c4:truncatedURL[0],c5:"",c6:"",c15:""})}if(typeof(this.findStuffTracking)!="undefined"){tr(this.findStuffTracking)}}};var staticMembers={EVENT:{PAGEUPDATE:"PaginationController:pageupdate",USERACTIONUPDATE:"PaginationController:useractionupdate",REBINDKEYS:"PaginationController:rebindkeys",UNBINDKEYS:"PaginationController:unbindkeys",ADREFRESH:"PaginationController:adrefresh"}};Controller.create("PaginationController",publicMembers,staticMembers)})();jq(document).ready(function(){function a(){this.currentOffset=null;this.loggingOn=false;this.amper="QQ";this.eq="ZZ";this.googleHashingEnabled=true}jq.extend(a.prototype,{onChange:function(d){var b=_pb.history;var c=b.getHash();var f=b.getParams(c);if(f){f.cp=parseInt(f.cp);f.tpp=parseInt(f.tpp);b.updatePage(f)}},getHash:function(){var c=jq.param.fragment();var b=_pb.history;if(b.googleHashingEnabled){c=c.substring(1);return c}},getParams:function(g){try{g=g.split(this.amper);var f=new Array();for(var b=0;b<g.length;b++){var c=g[b].split(this.eq);if(c.length==2){f[c[0]]=decodeURIComponent(c[1])}}return f}catch(d){this.log("ERROR: failed to get params: "+d)}},add:function(d){var c=(this.googleHashingEnabled)?"#!":"#";for(var b in d){c+=b+this.eq+encodeURIComponent(d[b])+this.amper}if(d.o){this.currentOffset=d.o}c=c.substring(0,c.length-this.amper.length);document.location.hash=c},updatePage:function(c){var b=PaginationController.getInstance();if(b){b.updatePaginationFromHistory(c)}else{this.log("ERROR: no access to PaginationController!")}},resetPage:function(){var b=PaginationController.getInstance();if(b){b.resetPage();this.currentOffset=null}else{this.log("ERROR: no access to PaginationController!")}},log:function(c){if(this.loggingOn){try{console.log(c)}catch(b){alert(c)}}}});_pb.history=new a();jq(window).bind("hashchange",_pb.history.onChange)});(function(){jq(document).ready(function(){if(typeof PaginationController!="undefined"){Event.observe(document,PaginationController.EVENT.ADREFRESH,function(){var b=jq("#whatsnew_area");if(b.length>0){var a="/whatsnewrefresh?area="+b.val()}else{var a="/whatsnewrefresh"}jq.get(a,function(c){jq(".whatsnewRefresh").html(c)})})}})})();(function(e){e.fn.editInPlace=function(f){var g=e.extend({},e.fn.editInPlace.defaults,f);b(g);c(g.saving_image);return this.each(function(){var h=e(this);if(h.data("editInPlace")){return}h.data("editInPlace",true);new d(g,h).init()})};e.fn.editInPlace.defaults={url:"",bg_over:"#ffc",bg_out:"transparent",hover_class:"",show_buttons:false,save_button:'<button class="inplace_save">Save</button>',cancel_button:'<button class="inplace_cancel">Cancel</button>',params:"",field_type:"text",default_text:"(Click here to add text)",textarea_rows:10,textarea_cols:25,select_text:"Choose new value",select_options:"",saving_text:"Saving...",saving_image:"",saving_animation_color:"transparent",value_required:false,element_id:"element_id",update_value:"update_value",original_html:"original_html",save_if_nothing_changed:false,on_blur:"save",cancel:"",callback:null,success:null,error:null,error_sink:function(f,g){alert(g)},preinit:null,postclose:null};function d(f,g){this.settings=f;this.dom=g;this.originalHTML=null;this.originalText=null;this.didInsertDefaultText=false;this.shouldDelayReinit=false}e.extend(d.prototype,{init:function(){this.setDefaultTextIfNeccessary();this.connectEvents()},reinit:function(){if(this.shouldDelayReinit){return}if(this.settings.postclose){this.triggerCallback(this.settings.postclose,this.dom)}this.markEditorAsInactive();this.connectEvents()},setDefaultTextIfNeccessary:function(){if(""!==this.dom.html()){return}this.dom.html(this.settings.default_text);this.didInsertDefaultText=true},connectEvents:function(){var f=this;this.dom.bind("mouseenter.editInPlace",function(){f.addHoverEffect()}).bind("mouseleave.editInPlace",function(){f.removeHoverEffect()}).bind("click.editInPlace",function(g){f.openEditor(g)})},addHoverEffect:function(){if(this.settings.hover_class){this.dom.addClass(this.settings.hover_class)}else{this.dom.css("background-color",this.settings.bg_over)}},removeHoverEffect:function(){if(this.settings.hover_class){this.dom.removeClass(this.settings.hover_class)}else{this.dom.css("background-color",this.settings.bg_out)}},openEditor:function(f){if(!this.shouldOpenEditor(f.target)){return}this.dom.unbind(".editInPlace");this.removeHoverEffect();this.removeInsertedDefaultTextIfNeccessary();this.originalHTML=this.dom.html();var g=this.dom.text();if(g=="Click to add title"||g=="Click to add"){g=""}this.originalText=a(g);this.workaroundFirefoxBlurBug();this.markEditorAsActive();this.replaceContentWithEditor();this.connectEventsToEditor()},shouldOpenEditor:function(f){if(this.isClickedObjectCancelled(f)){return false}if(this.settings.preinit){return false!==this.triggerCallback(this.settings.preinit,this.dom)}return true},removeInsertedDefaultTextIfNeccessary:function(){if(!this.didInsertDefaultText||this.dom.html()!==this.settings.default_text){return}this.dom.html("");this.didInsertDefaultText=false},isClickedObjectCancelled:function(h){if(!this.settings.cancel){return false}var f=e(h).parents().andSelf();var g=f.filter(this.settings.cancel);return 0!==g.length},workaroundFirefoxBlurBug:function(){if(!e.browser.mozilla){return}this.dom.parents(":last").find(".editInPlace-active :input").blur()},replaceContentWithEditor:function(){var g=(this.settings.show_buttons)?this.settings.save_button+" "+this.settings.cancel_button:"";var f=this.createEditorElement();this.dom.html('<form class="inplace_form" style="display: inline; margin: 0; padding: 0;"></form>').find("form").append(f).append(g)},createEditorElement:function(){if(-1===e.inArray(this.settings.field_type,["text","textarea","select"])){throw"Unknown field_type <fnord>, supported are 'text', 'textarea' and 'select'"}if("select"===this.settings.field_type){return this.createSelectEditor()}var f=null;if("text"===this.settings.field_type){f=e('<input type="text"'+this.inputNameAndClass()+"/>")}else{if("textarea"===this.settings.field_type){f=e("<textarea"+this.inputNameAndClass()+'rows="'+this.settings.textarea_rows+'" cols="'+this.settings.textarea_cols+'"></textarea>')}}f.val(this.originalText);return f},inputNameAndClass:function(){return' name="inplace_value" class="inplace_field" '},createSelectEditor:function(){var l=e("<select"+this.inputNameAndClass()+'><option disabled="true" value="">'+this.settings.select_text+"</option></select>");var g=this.settings.select_options;if(!e.isArray(g)){g=g.split(",")}for(var h=0;h<g.length;h++){var f=g[h];if(!e.isArray(f)){f=f.split(":")}var m=a(f[1]||f[0]);var n=a(f[0]);var k=(m==this.originalText)?'selected="selected" ':"";var j=e("<option "+k+" ></option>").val(m).text(n);l.append(j)}return l},connectEventsToEditor:function(){var i=this;function h(){i.handleCancelEditor();return false}function f(){i.handleSaveEditor();return false}var g=this.dom.find("form");g.find(".inplace_field").focus().select();g.find(".inplace_cancel").click(h);g.find(".inplace_save").click(f);if(!this.settings.show_buttons){if("save"===this.settings.on_blur){g.find(".inplace_field").blur(f)}else{g.find(".inplace_field").blur(h)}if(e.browser.mozilla){g.keyup(function(j){if(13===j.which){f()}})}}g.keyup(function(j){if(27===j.which){return h()}else{if(13===j.which){return f()}}});g.submit(f)},handleCancelEditor:function(){this.dom.html(this.originalHTML);this.reinit()},handleSaveEditor:function(){var g=a(this.dom.find(":input").val());var f=/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi;g=g.replace(f,"");if(this.isDisabledDefaultSelectChoice()||this.isUnchangedInput(g)){this.handleCancelEditor();return}if(this.didForgetRequiredText(g)){this.handleCancelEditor();this.reportError("Error: You must enter a value to save this field");return}this.showSaving();if(this.settings.callback){this.handleSubmitToCallback(g)}else{this.handleSubmitToServer(g)}},didForgetRequiredText:function(f){return this.settings.value_required&&(""===f||undefined===f)},isDisabledDefaultSelectChoice:function(){return this.dom.find("option").eq(0).is(":selected:disabled")},isUnchangedInput:function(f){return !this.settings.save_if_nothing_changed&&this.originalText===f},showSaving:function(){var f=this.settings.saving_text;if(""!==this.settings.saving_image){f='<img src="'+this.settings.saving_image+'" alt="Saving..." />'}this.dom.html(f)},handleSubmitToCallback:function(f){this.enableOrDisableAnimationCallbacks(true,false);var g=this.triggerCallback(this.settings.callback,this.id(),f,this.originalHTML,this.settings.params,this.savingAnimationCallbacks());if(undefined===g){this.reportError("Error: Failed to save value: "+f);this.dom.html(this.originalHTML)}else{this.dom.html(g)}if(this.didCallNoCallbacks()){this.enableOrDisableAnimationCallbacks(false,false);this.reinit()}},handleSubmitToServer:function(f){var h=this.settings.update_value+"="+encodeURIComponent(f)+"&"+this.settings.element_id+"="+this.dom.attr("id")+((this.settings.params)?"&"+this.settings.params:"")+"&"+this.settings.original_html+"="+encodeURIComponent(this.originalHTML);this.enableOrDisableAnimationCallbacks(true,false);this.didStartSaving();var g=this;e.ajax({url:g.settings.url,type:"POST",data:h,dataType:"html",complete:function(i){g.didEndSaving()},success:function(j){var i=j||g.settings.default_text;g.dom.html(i);g.triggerCallback(g.settings.success,j)},error:function(i){g.dom.html(g.originalHTML);if(g.settings.error){g.triggerCallback(g.settings.error,i)}else{g.reportError("Failed to save value: "+i.responseText||"Unspecified Error")}}})},triggerCallback:function(g){if(!g){return}var f=Array.prototype.splice.call(arguments,1,arguments.length-1);return g.apply(this.dom[0],f)},reportError:function(f){this.triggerCallback(this.settings.error_sink,this.id(),f)},id:function(){return this.dom.attr("id")},markEditorAsActive:function(){this.dom.addClass("editInPlace-active")},markEditorAsInactive:function(){this.dom.removeClass("editInPlace-active")},savingAnimationCallbacks:function(){var f=this;return{didStartSaving:function(){f.didStartSaving()},didEndSaving:function(){f.didEndSaving()}}},enableOrDisableAnimationCallbacks:function(g,f){this.didStartSaving.enabled=g;this.didEndSaving.enabled=f},didCallNoCallbacks:function(){return this.didStartSaving.enabled&&!this.didEndSaving.enabled},assertCanCall:function(f){if(!this[f].enabled){throw new Error("Cannot call "+f+" now. See documentation for details.")}},didStartSaving:function(){this.assertCanCall("didStartSaving");this.shouldDelayReinit=true;this.enableOrDisableAnimationCallbacks(false,true);this.startSavingAnimation()},didEndSaving:function(){this.assertCanCall("didEndSaving");this.shouldDelayReinit=false;this.enableOrDisableAnimationCallbacks(false,false);this.reinit();this.stopSavingAnimation()},startSavingAnimation:function(){var f=this;this.dom.animate({backgroundColor:this.settings.saving_animation_color},400).animate({backgroundColor:"transparent"},400,"swing",function(){setTimeout(function(){f.startSavingAnimation()},10)})},stopSavingAnimation:function(){this.dom.stop(true).css({backgroundColor:""})},missingCommaErrorPreventer:""});function b(f){if(f.url||f.callback){return}throw new Error("Need to set either url: or callback: option for the inline editor to work.")}function c(g){if(""===g){return}var f=new Image();f.src=g}function a(f){return f.replace(/^\s+/,"").replace(/\s+$/,"")}})(jQuery);var InlineEditorController;(function(){var a={editors:new Hash(),initialize:function(){},onFullviewDynamicPagination:function(){this.editors.keys().each(function(c){this.destroyEditor(c)}.bind(this))},destroyEditor:function(c){jq("#"+c).unbind(".editInPlace");this.editors.unset(c)},addEditor:function(d,c,e,k,i,j,h){var l=this.onClose.curry(k,h);if(i=="thumb"){l=this.onCloseThumb.curry(d,k)}else{if(i=="thumb_nohover"){l=this.onCloseThumbNoHover.curry(d,k)}}var g={save_button:InlineEditorController.SaveButton,cancel_button:InlineEditorController.CancelButton,show_buttons:true,bg_over:"transparent",callback:this.onEdit.curry({url:c,params:e,defaultText:k}),postclose:l};if(j=="true"){g.value_required="true"}if(i=="textarea"){g.field_type=i;g.textarea_cols=80;g.textarea_rows=4;g.save_button="<br/>"+InlineEditorController.SaveButton}var f=jq("#"+d).editInPlace(g);this.editors.set(d,f)},onEdit:function(d,e,f,g,c){jq.post(d.url,d.params+encodeURIComponent(f),function(h){if(h.response.stat!="ok"){jq("#"+idOdEditor).innerHTML=g}else{document.fire("editor:changed")}},"json");return(f.length==0)?d.defaultText:f},onClose:function(d,c){var f=$(this);var e=this.innerHTML;if((e==d||jq.trim(e)=="")&&!c){f.addClassName("linkClr");f.removeClassName("userValue")}else{f.removeClassName("linkClr");f.addClassName("userValue");var g=f.up(".editable").down(".triggerEdit");g.show()}},onCloseThumb:function(i,c){var h=$(this);var g=this.innerHTML;var f=$(i).up(".thumbnail").down(".title").down();if(g=="Click to add title"||g==""){f.update("&nbsp;");var e=jq(h);e.removeClass("editInPlace-active");e.html("Click to add title")}else{var d=(g.length>17)?g.substring(0,17)+"...":g;f.update(d)}},onCloseThumbNoHover:function(i,c){var h=$(this);var g=this.innerHTML;var f=$(i).up(".thumbnail").down(".pbaddtitle");if(g=="Click to add title"||g==""){f.update("&nbsp;");var e=jq(h);e.removeClass("editInPlace-active");e.html("Click to add title")}else{var d=(g.length>17)?g.substring(0,17)+"...":g;f.update(d)}}};var b={SaveButton:'<button type="button" class="inplace_save button xsmall blue tight">Ok</button>',CancelButton:'<button type="button" class="inplace_cancel button xsmall tight">Cancel</button>'};Controller.create("InlineEditorController",a,b)})();var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"ZeroClipboard.swf",nextId:1,setMoviePath:function(a){this.moviePath=a},dispatch:function(d,b,c){var a=this.clients[d];if(a){a.receiveEvent(b,c)}},register:function(b,a){this.clients[b]=a},Client:function(a){this.handlers={};this.id=ZeroClipboard.nextId++;this.movieId="ZeroClipboardMovie_"+this.id;ZeroClipboard.register(this.id,this);if(a){this.glue(a)}}};ZeroClipboard.Client.prototype={id:0,ready:false,movie:null,clipText:"",handCursorEnabled:true,cssEffects:false,handlers:null,appendElem:null,isThumb:false,div:null,glue:function(f,d,g){if(this.div){this.div.innerHTML=""}if(typeof(f)=="string"){this.domElement=document.getElementById(f);if(!this.domElement){return}}else{this.domElement=f}var h=99;if(this.domElement.style.zIndex){h=parseInt(this.domElement.style.zIndex,10)+1}if(typeof(d)=="string"){this.appendElem=document.getElementById(d)}else{this.appendElem=d}this.clipText=g;var c="";if(this.isThumb){var b=160;var a=23}else{var b="100%";var a="100%"}var e=jq(this.appendElem).find(".ccplaceholder");this.div=e[0];this.div.innerHTML=this.getHTML(b,a,g)},getHTML:function(d,a,e){var c="";var b="id="+this.id+"&text="+escape(escape(e));if(photobucket.browser.isIE){var f="http://";c+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+f+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+d+'" height="'+a+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+b+'"/><param name="wmode" value="transparent"/></object>'}else{c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+d+'" height="'+a+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+b+'" wmode="transparent" />'}return c},setText:function(a){},setHandCursor:function(a){this.handCursorEnabled=a;if(this.ready){this.movie.setHandCursor(a)}},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,"");if(!this.handlers[a]){this.handlers[a]=[]}this.handlers[a].push(b)},receiveEvent:function(d,e){d=d.toString().toLowerCase().replace(/^on/,"");switch(d){case"load":this.movie=document.getElementById(this.movieId);if(!this.movie){var c=this;setTimeout(function(){c.receiveEvent("load",null)},1);return}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var c=this;setTimeout(function(){c.receiveEvent("load",null)},100);this.ready=true;return}this.ready=true;break}if(this.handlers[d]){for(var b=0,a=this.handlers[d].length;b<a;b++){var f=this.handlers[d][b];if(typeof(f)=="function"){f(this,e)}else{if((typeof(f)=="object")&&(f.length==2)){f[0][f[1]](this,e)}else{if(typeof(f)=="string"){window[f](this,e)}}}}}},setIsThumb:function(){this.isThumb=true}};ZeroClipboard.setMoviePath("http://pic.pbsrc.com/flash/ZeroClipboardFV2.swf");var CopyCodeController;(function(){var a={clients:{},createZeroClipboard:function(h,g){var c=deconcept.SWFObjectUtil.getPlayerVersion();if(g){jq("#"+h).click(function(){jq(this).select()})}else{if(c.major>=9){var f="clip"+h;var d;if(this.clients[h]){d=this.clients[h]}else{d=new ZeroClipboard.Client();this.clients[h]=d}var e=jq("#"+h).val();d.glue("copycode_"+h,"zeroclipboard_"+h,e);d.addEventListener("onComplete",function(j,i){jq("#"+h).val("Copied").css("backgroundColor","#FFFF66").fadeTo("normal",0.4,function(){jq(this).fadeTo("normal",1,function(){jq(this).css("backgroundColor","#FFFFFF").val(e)})})})}else{jq("#"+h).click(function(){jq(this).select()})}}},hasClient:function(c){if(this.clients[c]){return true}return false}};var b={};Controller.create("CopyCodeController",a,b)})();var LoginLBBaseController={doFriendFinder:false,messageTimer:null,messageInterval:10000,messageIndex:0,connectMessages:["Busy finding friends...","Sled dogs at full speed!","Wow, some of your friends found good hiding places!  Still seeking..."],mixIn:function(a){for(var b in a){this[b]=a[b]}},skipToPrompt:function(a){this.handleIsPbUserPrompt()},skipToNewUser:function(b){this.setFormProtectKeys();var c=jq(".loginlb .welcome");if(this.extProfileUrl){c.before('<span class="share '+this.serviceName+'"></span>');c.before('<img src="'+this.extProfileUrl+'" />')}var a=(this.extUserName)?"Welcome to Photobucket "+this.extUserName+"!":"Register with "+this.displayName+"!";c.html(a);jq(".loginmain").hide();jq(".PBPrompt").show();this.handleToggleChoosePW(this.showExtras)},skipToFriendFinder:function(a){var b=jq(".loginlb .welcome");b.html("Make it easy to share...");jq(".friendresults").hide();jq(".autoshareprompt").show()},handleIsPbUserPrompt:function(){var b=jq(".loginlb .welcome");if(this.extProfileUrl){b.before('<span class="share '+this.serviceName+'"></span>');b.before('<img src="'+this.extProfileUrl+'" />')}var a=(this.extUserName)?"Welcome to Photobucket "+this.extUserName+"!":"Login with "+this.displayName+"!";b.html(a);jq(".loginmain").hide();jq(".PBPrompt").show();jq(".hasaccount").show()},handleExistingUser:function(){document.fire(PBLightbox.PBMessage.EVENT.CLOSE);jq(".hasaccount").hide();jq(".choosepw").hide();jq(".pblogin").show();this.activeForm=jq("#pbloginform")},handlePBUserLogin:function(){var b=this;var c=this.activeForm.serialize();var a=jq.param(this.extUserInfo);var d=c+"&"+a+"&mode=connect";d+="&ts="+this.fpTs+"&sig="+this.fpSig;this.showProgress("Connecting your account...");if(this.doFriendFinder){this.startMessageTimer()}jq.post(this.serviceLoginUrl,d,function(e){if(e.response.stat=="ok"){if(e.response.status=="loggedin"){if(b.isTwitterLanding){tr("twitter_landing_connect")}document.location.href=e.response.redir}else{if(e.response.status=="loggedout"){b.extractFormProtectKeys(e);b.hideProgress();b.fireMessage("error",e.response.message)}}}},"json")},handleToggleChoosePW:function(d){jq(".hasaccount").hide();if(this.extUserInfo.name){var b=(this.extUserInfo.screen_name)?this.extUserInfo.screen_name:this.extUserInfo.name;b=b.replace(" ","_");this.handleVerifyUserName(b);jq("#choosepwform #username")[0].value=b}if(d){jq("#choosepwform .choose").html("Please provide some additional information:");jq("#choosepwform .extra").each(function(e){jq(this).show()});if(typeof(this.extUserInfo.gender)=="string"){var c=this.extUserInfo.gender;var a=(c=="male")?"M":"F";jq("#choosepwform #gender"+a)[0].checked=true}}else{jq("#choosepwform .choose").html("Please choose a Photobucket username and password:")}jq(".choosepw").show();this.activeForm=jq("#choosepwform")},handleVerifyUserName:function(a){this.bubbleCtrl.hide("bubbleUsername");if(!this.isVerifyingUname){this.isVerifyingUname=true;new APIRequest("isusernameavailable",true,{username:a},this.handleUsernameOnSuccess.bind(this))}},handleUsernameOnSuccess:function(resp){if(resp.available!=1){var event=this.ctrlName+".EVENT.SUGGESTCLOSE";var bubble=new Bubble({elemId:"bubbleUsername",targetId:"username",eventOff:eval(event),posOffset:true,offsetX:435,offsetY:-10,useWindow:document});this.bubbleCtrl.addBubble(bubble);var suggestions="";for(var n in resp.suggestions){if(resp.suggestions[n].suggestion){suggestions+='<li><a href="javascript:void(0);" onclick="'+this.ctrlName+'.getInstance().handleSuggestion(this);">'+resp.suggestions[n].suggestion+"</a>"}}var bubContent=jq("#bubbleUsername #suggestions").html(suggestions);this.bubbleCtrl.show("bubbleUsername")}this.isVerifyingUname=false},handleNormalPBLogin:function(b){var d="#loginform ";var e=jq("#loginform");var a=jq("#loginform #usernameemail").val();var c=jq("#loginform #password").val();if(a==""){this.fireInputErrorMessage(d+"#usernameemail","A username or email is required.");return false}if(c==""){this.fireInputErrorMessage(d+"#password","A password required.");return false}if(!this.isHP){jq("#returnUrl").val(document.location.href)}this.showProgress();e.submit()},validateNewUserSubmit:function(c){var b="#choosepwform #";for(var e in c){if(e=="username"){if(this.isEmptyField(c[e])){this.fireInputErrorMessage(b+e,"Please enter a username");return false}var d="Usernames must be at least 3 characters long. ";d+="They can only contain the characters a-z, A-Z, 0-9, -, _, ";d+="and must begin with either a letter, a number, or an underscore. ";d+="Spaces are not allowed.";if(c[e].length<3||c[e].length>50){this.fireInputErrorMessage(b+e,d);return false}var a=/^[a-zA-Z0-9_][-a-zA-Z0-9_]+$/;if(!a.test(c[e])){this.fireInputErrorMessage(b+e,d);return false}}else{if(e=="password"){if(this.isEmptyField(c[e])){this.fireInputErrorMessage(b+e,"Please enter a password");return false}var d="Passwords must be at least 6 characters long. ";d+="They can only contain the characters a-z, A-Z, 0-9, -, _, ";d+="contain no spaces, and cannot start with a zero.";if(c[e].length<6||c[e].length>50){this.fireInputErrorMessage(b+e,d);return false}var a=/^[a-zA-Z1-9_-][a-zA-Z0-9_-]+$/;if(!a.test(c[e])){this.fireInputErrorMessage(b+e,d)}}else{if(e=="email"){var d="Please enter a valid email address";if(this.isEmptyField(c[e])){this.fireInputErrorMessage(b+e,d);return false}var a=/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;if(!a.test(c[e])){this.fireInputErrorMessage(b+e,d);return false}}else{if(e=="gender"){var d="Please select a gender";if(this.isEmptyField(c[e])){this.fireInputErrorMessage(b+e,d);return false}}else{if(e=="birthMonth"||e=="birthDay"||e=="birthYear"){if(!this.isNumber(c[e])){this.fireInputErrorMessage(b+e,"Please enter your birth date.");return false}}}}}}}return true},isEmptyField:function(a){return(a=="")},isNumber:function(a){return !isNaN(parseFloat(a))&&isFinite(a)},watchUname:function(a){var b=this;jq("#choosepwform #username").bind("blur",function(){b.handleVerifyUserName(jq(this).val())})},handleSuggestion:function(obj){var uname=obj.innerHTML;var formFields=jq("#choosepwform :input");formFields[0].value=uname;formFields[0].focus();formFields[1].focus();var event=this.ctrlName+".EVENT.SUGGESTCLOSE";document.fire(eval(event))},setFriendstoFollow:function(a){this.hasFriendsToFollow=true;this.friendsToFollow=a},startMessageTimer:function(){this.messageTimer=window.setInterval(this.updateMessage.bind(this),this.messageInterval)},updateMessage:function(){var a=jq(".loginlb .progress .message");if(a.length&&this.messageIndex<this.connectMessages.length){a.html(this.connectMessages[this.messageIndex]);this.messageIndex++}},resetChoosePWForm:function(){var a=jq("#choosepwform #email").val("");jq("#choosepwform .extra.emailext").each(function(b){jq(this).removeClass("hilightError");jq(this).hide()});jq("#choosepwform .extra.genderext").each(function(b){jq(this).removeClass("hilightError");jq(this).hide()})},extractFormProtectKeys:function(a){if(a.response.sig){this.fpSig=a.response.sig}if(a.response.ts){this.fpTs=a.response.ts}},setFormProtectKeys:function(){this.fpSig=jq('#extLoginkeys input[name="sig"]').val();this.fpTs=jq('#extLoginkeys input[name="ts"]').val()},fireInputErrorMessage:function(a,b){this.fireMessage("error",b);jq(a)[0].focus()},fireMessage:function(d,c){var a=(d=="success")?"success":"error";var b=(a=="success")?"Success":"Attention";document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:b,details:c,type:a})})},showProgress:function(b){var a=(typeof(b)!="undefined")?{message:b}:{};document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE,a)},hideProgress:function(){window.clearInterval(this.messageTimer);document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE)}};LoginLBBaseController=Class.create(LoginLBBaseController);var LoginLBFacebookController;(function(){var a={ctrlName:"LoginLBFacebookController",displayName:"Facebook",serviceName:"facebook",serviceLoginUrl:"/lblogin/facebooklogin/",bttnPBLogIn:null,isHP:false,isUpload:false,isBanner:false,extUserAuth:null,extUserInfo:null,extUserName:null,extProfileUrl:null,createUserFromExtData:false,bubbleCtrl:null,isVerifyingUname:false,fromReg:false,showExtras:false,hasBasicPerms:true,activeForm:null,fpTs:null,fpSig:null,newUserMap:{username:null,password:null,email:null,gender:null,birthMonth:null,birthDay:null,birthYear:null},hasFriendsToFollow:false,friendsToFollow:null,initialize:function(){Event.observe(document,LoginLBFacebookController.EVENT.LOADED,this.bindHandlers.bindAsEventListener(this));Event.observe(document,LoginLBFacebookController.EVENT.PROMPT,this.skipToPrompt.bindAsEventListener(this));Event.observe(document,LoginLBFacebookController.EVENT.NEWUSER,this.skipToNewUser.bindAsEventListener(this));Event.observe(document,LoginLBFacebookController.EVENT.NEWUSERFB,this.handleFBNewUser.bindAsEventListener(this));Event.observe(document,LoginLBFacebookController.EVENT.AUTOSHAREPROMPT,this.skipToAutoSharePrompt.bindAsEventListener(this));Event.observe(document,LoginLBFacebookController.EVENT.SKIPFRIENDFINDER,this.skipToFriendFinder.bindAsEventListener(this));Event.observe(document,LoginLBFacebookController.EVENT.CHECKLOGINSTATUS,this.checkLoginStatus.bindAsEventListener(this));Event.observe(document,LoginLBFacebookController.EVENT.LOGOUT,this.handleLogout.bindAsEventListener(this));Event.observe(document,LoginLBFacebookController.EVENT.WATCHUNAME,this.watchUname.bindAsEventListener(this));this.bubbleCtrl=new BubbleController()},bindHandlers:function(c){this.setFormProtectKeys();if(typeof(FB)!="undefined"){FB.XFBML.parse()}this.bttnPBLogIn=jq("#loginform #bttnPBLogIn")[0];if(this.bttnPBLogIn){Event.observe(this.bttnPBLogIn,"click",this.handleNormalPBLogin.bindAsEventListener(this))}jq(".loginmain").show()},skipToAutoSharePrompt:function(c){var d=this;FB.getLoginStatus(function(e){if(e.authResponse){d.extUserAuth=e.authResponse;d.extProfileUrl="http://graph.facebook.com/"+e.authResponse.userID+"/picture";FB.api("/me",function(g){d.extUserInfo=g;d.extUserName=g.name;var h=jq(".loginlb .welcome");if(d.extProfileUrl){h.before('<span class="share facebook"></span>');h.before('<img src="'+d.extProfileUrl+'" />')}if(d.hasFriendsToFollow&&this.doFriendFinder){jq(".autoshareprompt").before(d.friendsToFollow.html);var f="Welcome to Photobucket";f+=(d.extUserName)?" "+d.extUserName+"!":"!";h.html(f)}else{var f="Make it easy to share...";h.html(f);jq(".autoshareprompt").show()}jq(".loginmain").hide();jq(".PBPrompt").show()})}},true)},checkLoginStatus:function(c){this.isHP=c.memo.isHP;this.isUpload=c.memo.isUpload;if(c.memo.isBanner){this.isBanner=c.memo.isBanner}var d=this;FB.getLoginStatus(function(e){if(e.authResponse){FB.api({method:"users.hasAppPermission",ext_perm:"publish_stream"},function(f){if(f!="1"){d.hasBasicPerms=false}});FB.api({method:"users.hasAppPermission",ext_perm:"offline_access"},function(f){if(f!="1"){d.hasBasicPerms=false}});if(!d.hasBasicPerms){tr("facebook_login_initial_permission_impression")}d.extUserAuth=e.authResponse;d.extProfileUrl="http://graph.facebook.com/"+e.authResponse.userID+"/picture";FB.api("/me",function(f){d.extUserInfo=f;d.extUserName=f.name;if(d.isHP||d.isUpload){d.handleFacebookHP(f)}else{d.handleFacebook(f)}})}},true)},handleFBNewUser:function(c){this.showFBProgress(true);this.setFormProtectKeys();var d=this;var e={mode:"lookup",sig:this.fpSig,ts:this.fpTs};jq.post(this.serviceLoginUrl,e,function(f){if(f.response.stat=="ok"){if(f.response.status=="loggedin"){document.location.href=f.response.redir}else{d.showFBProgress(false);FB.getLoginStatus(function(g){if(g.authResponse){d.extUserAuth=g.authResponse;d.extProfileUrl="http://graph.facebook.com/"+g.authResponse.userID+"/picture";FB.api("/me",function(h){d.extUserInfo=h;d.extUserName=h.name;if(h.birthday){d.createUserFromExtData=true}else{d.showExtras=true}d.fromReg=true;document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/lblogin/?service=facebook&newuser=1",cache:false});tr("facebook_registration_allow_permissions")})}else{jq(".regright h3").addClass("hilightError");document.fire(PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"There was an error with your submission",details:"You must allow Photobucket permission to access your Facebook information to sign up for a new account.",type:"error"})});tr("facebook_registration_deny_permissions")}},true)}}},"json")},handleFacebookHP:function(){this.showFBProgress(true);this.setFormProtectKeys();var c=this;var d={mode:"lookup",sig:this.fpSig,ts:this.fpTs};jq.post(this.serviceLoginUrl,d,function(e){if(e.response.stat=="ok"){if(e.response.status=="loggedin"){if(c.isUpload){tr("uploadsignup_login_total");document.location.reload(true)}else{if(!this.isBanner){tr("homepage_login_total")}document.location.href=e.response.redir}}else{if(e.response.status=="loggedout"){c.showFBProgress(false);if(c.hasBasicPerms){if(jq("#hpLoginbox").length>0){jq("#hpLoginbox").hide()}document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/lblogin/?service=facebook&prompt=1",cache:false})}}}}},"json")},handleFacebook:function(){this.setFormProtectKeys();this.showProgress();var c=this;var d={mode:"lookup",sig:this.fpSig,ts:this.fpTs};jq.post(this.serviceLoginUrl,d,function(e){if(e.response.stat=="ok"){if(e.response.status=="loggedin"){document.location.href=e.response.redir}else{if(e.response.status=="loggedout"){c.extractFormProtectKeys(e);c.hideProgress();if(c.hasBasicPerms){c.handleIsPbUserPrompt()}else{c.fireMessage("error","You must allow Photobucket permission to access your Facebook account to connect")}}}}},"json")},handleNewUser:function(){document.fire(PBLightbox.PBMessage.EVENT.CLOSE);this.resetChoosePWForm();var c=this;FB.login(function(d){if(d.authResponse){c.showProgress();FB.api("/me",function(e){c.extUserInfo=e;c.extUserName=e.name;if(e.birthday){c.createUserFromExtData=true}else{c.showExtras=true}c.hideProgress();jq(".pblogin").hide();c.handleToggleChoosePW(c.showExtras)});tr("facebook_login_allow_second_set_of_permissions");tr("facebook_login_second_set_of_permission_impression")}else{c.fireMessage("error","You must be logged into Facebook.")}},{scope:"email,user_birthday,user_location"})},handleNewUserSubmit:function(){var o=this;var e=jq("#choosepwform #email");if(this.createUserFromExtData){var d=this.newUserMap;var h=this.extUserInfo;d.username=jq("#choosepwform #username").val();d.password=jq("#choosepwform #password1").val();var l=e.val();d.email=(l!="")?l:h.email;var c=jq("#choosepwform #genderM")[0];var i=jq("#choosepwform #genderF")[0];if(c.checked||i.checked){d.gender=(c.checked)?c.value:i.value}else{d.gender=h.gender}var j=h.birthday.split("/");d.birthMonth=j[0];d.birthDay=j[1];d.birthYear=j[2]}else{var m=this.activeForm.serializeArray();m.each(function(p){var q=p.name;var r=p.value;o.newUserMap[q]=r})}var g={zip:jq("#zip")[0].value,country:jq("#country")[0].value,createdFromExt:this.createUserFromExtData};this.newUserMap=jq.extend(this.newUserMap,g);var f=this.validateNewUserSubmit(this.newUserMap);if(f){document.fire(LoginLBFacebookController.EVENT.SUGGESTCLOSE);this.showProgress("Creating your account...");if(this.doFriendFinder){this.startMessageTimer()}var n={ts:this.fpTs,sig:this.fpSig};var k=jq.extend(this.extUserAuth.session,this.extUserInfo,this.newUserMap,n);jq.post(this.serviceLoginUrl+"?mode=create",k,function(q){o.extractFormProtectKeys(q);if(q.response.stat=="ok"){if(q.response.status=="loggedin"){if(!o.fromReg){tr("facebook_login_new_account_created_total")}document.location.href=q.response.redir}else{if(q.response.status=="loggedout"){o.hideProgress();o.fireMessage("error",q.response.message)}}}else{jq("#choosepwform .hilightError").each(function(r){jq(this).removeClass("hilightError")});var p=q.response.message;if(p.search(/Account already exists/i)!=-1){p="An account already exists with the same email address.<br/><br/>";p+='Please <a href="javascript:void(0);" onclick="LoginLBFacebookController.getInstance().handleExistingUser();return false;">login</a> or register with a different email address.';e.val(k.email);jq("#choosepwform .extra.emailext").each(function(r){jq(this).addClass("hilightError");jq(this).show()})}else{if(p.search(/gender/)!=-1){jq("#choosepwform .extra.genderext").each(function(r){jq(this).addClass("hilightError");jq(this).show()})}else{if(p.search(/birth/)!=-1){jq("#choosepwform .extra.birthdayext").each(function(r){jq(this).addClass("hilightError");jq(this).show()})}}}o.hideProgress();o.fireMessage("error",p)}},"json")}},handleLogout:function(){if(typeof(FB)=="undefined"){document.location.href="/logout"}FB.getLoginStatus(function(c){if(c.authResponse){document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/lblogin/fblogout/",cache:false})}else{document.location.href="/logout"}},true)},doFacebookLogout:function(){document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);if(typeof(FB)=="undefined"){document.location.href="/logout"}FB.logout(function(c){document.location.href="/logout"})},handleAutoShareSetting:function(){var c={siteId:2,active:true,fromPromo:true,isLB:true};document.fire(AutoShareController.EVENT.SAVESHARESETTING,c)},showFBProgress:function(c){if(c){jq(".fbload").show()}else{jq(".fbload").hide()}}};var b={EVENT:{LOADED:"LoginLBFacebookController:loaded",PROMPT:"LoginLBFacebookController:prompt",NEWUSER:"LoginLBFacebookController:newuser",NEWUSERFB:"LoginLBFacebookController:newuserfb",AUTOSHAREPROMPT:"LoginLBFacebookController:autoshareprompt",SKIPFRIENDFINDER:"LoginLBFacebookController:skipfriendfinder",CHECKLOGINSTATUS:"LoginLBFacebookController:checkloginstatus",LOGOUT:"LoginLBFacebookController:logout",SUGGESTCLOSE:"LoginLBFacebookController:suggestclose",WATCHUNAME:"LoginLBFacebookController:watchuname"}};Controller.create("LoginLBFacebookController",a,b,LoginLBBaseController)})();var LoginLBTwitterController;(function(){var a={ctrlName:"LoginLBTwitterController",displayName:"Twitter",serviceName:"twitter",serviceLoginUrl:"/lblogin/twitterlogin/",bttnPBLogIn:null,isHP:false,isUpload:false,isBanner:false,extUserAuth:null,extUserInfo:null,extUserName:null,extProfileUrl:null,createUserFromExtData:false,bubbleCtrl:null,isVerifyingUname:false,fromReg:false,showExtras:false,hasBasicPerms:true,activeForm:null,fpTs:null,fpSig:null,newUserMap:{username:null,password:null,email:null,gender:null,birthMonth:null,birthDay:null,birthYear:null},hasFriendsToFollow:false,friendsToFollow:null,isTwitterLanding:false,authWin:null,authTimer:null,initialize:function(){Event.observe(document,LoginLBTwitterController.EVENT.LOADED,this.bindHandlers.bindAsEventListener(this));Event.observe(document,LoginLBTwitterController.EVENT.PROMPT,this.skipToPrompt.bindAsEventListener(this));Event.observe(document,LoginLBTwitterController.EVENT.HANDLETWITTERAUTH,this.handleTwitterAuth.bindAsEventListener(this));Event.observe(document,LoginLBTwitterController.EVENT.NEWUSER,this.skipToNewUser.bindAsEventListener(this));Event.observe(document,LoginLBTwitterController.EVENT.AUTOSHAREPROMPT,this.skipToAutoSharePrompt.bindAsEventListener(this));Event.observe(document,LoginLBTwitterController.EVENT.SKIPFRIENDFINDER,this.skipToFriendFinder.bindAsEventListener(this));Event.observe(document,LoginLBTwitterController.EVENT.LOGOUT,this.handleLogout.bindAsEventListener(this));Event.observe(document,LoginLBTwitterController.EVENT.WATCHUNAME,this.watchUname.bindAsEventListener(this));this.bubbleCtrl=new BubbleController()},bindHandlers:function(c){this.setFormProtectKeys();this.bttnPBLogIn=jq("#loginform #bttnPBLogIn")[0];if(this.bttnPBLogIn){Event.observe(this.bttnPBLogIn,"click",this.handleNormalPBLogin.bindAsEventListener(this))}jq(".loginmain").show()},authenticate:function(c){if(c){this.isTwitterLanding=true}this.authWin=window.open("/lblogin/twitterauthstart","Twitter_Auth","width=800,height=800,modal=yes,alwaysRaised=yes");this.authTimer=window.setInterval(this.checkIsAuthWindowClosed.bind(this),300)},checkIsAuthWindowClosed:function(){if(!this.authWin||this.authWin.closed){window.clearInterval(this.authTimer);document.fire(LoginLBTwitterController.EVENT.HANDLETWITTERAUTH)}},setTwitterParams:function(c){this.extUserInfo=c;this.extUserName=c.screen_name;this.extProfileUrl=c.profile_image_url},skipToAutoSharePrompt:function(d){var e=jq(".loginlb .welcome");if(this.extProfileUrl){e.before('<span class="share twitter"></span>');e.before('<img src="'+this.extProfileUrl+'" />')}if(this.hasFriendsToFollow&&this.doFriendFinder){var c="Welcome to Photobucket";c+=(this.extUserName)?", "+this.extUserName+"!":"!";jq(".autoshareprompt").before(this.friendsToFollow.html);e.html(c)}else{var c="Make it easy to share...";e.html(c);jq(".autoshareprompt").show()}jq(".loginmain").hide();jq(".PBPrompt").show()},handleTwitterAuth:function(c){this.showTWProgress(true);this.setFormProtectKeys();var d=this;var e={mode:"lookup",sig:this.fpSig,ts:this.fpTs,isTwitterLanding:this.isTwitterLanding};jq.post(this.serviceLoginUrl,e,function(f){if(f.response.stat=="ok"){if(f.response.status=="loggedin"){if(d.isUpload){tr("uploadsignup_login_total");document.location.reload(true)}else{if(!d.isBanner){tr("homepage_login_total")}if(d.isTwitterLanding){tr("twitter_landing_connect")}document.location.href=f.response.redir}}else{if(f.response.status=="loggedout"){d.showTWProgress(false);if(f.response.extParams){d.setTwitterParams(f.response.extParams);if(jq("#hpLoginbox").length>0){jq("#hpLoginbox").hide()}document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/lblogin/?service=twitter&prompt=1",cache:false})}}}}},"json")},handleNewUser:function(){document.fire(PBLightbox.PBMessage.EVENT.CLOSE);this.resetChoosePWForm();if(!this.extUserInfo){this.fireMessage("error","You must be logged into Twitter.");return}jq(".pblogin").hide();this.showExtras=true;this.handleToggleChoosePW(this.showExtras)},handleNewUserSubmit:function(){var j=this;var c=jq("#choosepwform #email");var h=this.activeForm.serializeArray();h.each(function(l){var m=l.name;var n=l.value;j.newUserMap[m]=n});var f={zip:jq("#zip")[0].value,country:jq("#country")[0].value,createdFromExt:this.createUserFromExtData};var k;if(this.extUserInfo.name){var d=this.extUserInfo.name.split(" ");k={first_name:d[0],last_name:d[1]}}this.newUserMap=jq.extend(this.newUserMap,f,k);var e=this.validateNewUserSubmit(this.newUserMap);if(e){document.fire(LoginLBTwitterController.EVENT.SUGGESTCLOSE);this.showProgress("Creating your account...");if(this.doFriendFinder){this.startMessageTimer()}var i={ts:this.fpTs,sig:this.fpSig};var g=jq.extend(this.extUserInfo,this.newUserMap,i);jq.post(this.serviceLoginUrl+"?mode=create",g,function(m){j.extractFormProtectKeys(m);if(m.response.stat=="ok"){if(m.response.status=="loggedin"){if(!j.fromReg){tr(j.serviceName+"_login_new_account_created_total")}if(j.isTwitterLanding){tr("twitter_landing_registration")}document.location.href=m.response.redir}else{if(m.response.status=="loggedout"){j.hideProgress();j.fireMessage("error",m.response.message)}}}else{jq("#choosepwform .hilightError").each(function(n){jq(this).removeClass("hilightError")});var l=m.response.message;if(l.search(/Account already exists/i)!=-1){l="An account already exists with the same email address.<br/><br/>";l+='Please <a href="javascript:void(0);" onclick="LoginLBTwitterController.getInstance().handleExistingUser();return false;">login</a> or register with a different email address.';c.val(g.email);jq("#choosepwform .extra.emailext").each(function(n){jq(this).addClass("hilightError");jq(this).show()})}else{if(l.search(/gender/)!=-1){jq("#choosepwform .extra.genderext").each(function(n){jq(this).addClass("hilightError");jq(this).show()})}else{if(l.search(/birth/)!=-1){jq("#choosepwform .extra.birthdayext").each(function(n){jq(this).addClass("hilightError");jq(this).show()})}}}j.hideProgress();j.fireMessage("error",l)}},"json")}},handleLogout:function(){document.location.href="/logout"},handleAutoShareSetting:function(){var c={siteId:3,active:true,fromPromo:true,isLB:true};document.fire(AutoShareController.EVENT.SAVESHARESETTING,c)},showTWProgress:function(c){if(c){jq(".twload").show()}else{jq(".twload").hide()}}};var b={EVENT:{HANDLETWITTERAUTH:"LoginLBTwitterController:handletwitterauth",LOADED:"LoginLBTwitterController:loaded",PROMPT:"LoginLBTwitterController:prompt",NEWUSER:"LoginLBTwitterController:newuser",AUTOSHAREPROMPT:"LoginLBTwitterController:autoshareprompt",SKIPFRIENDFINDER:"LoginLBTwitterController:skipfriendfinder",CHECKLOGINSTATUS:"LoginLBTwitterController:checkloginstatus",LOGOUT:"LoginLBTwitterController:logout",SUGGESTCLOSE:"LoginLBTwitterController:suggestclose",WATCHUNAME:"LoginLBTwitterController:watchuname"}};Controller.create("LoginLBTwitterController",a,b,LoginLBBaseController)})();var FriendFinder=(function(){var e="/friendfinder/showfriends",r="/friendfinder/showfriends",J="/friendfinder/updatefacebookauth",z="/friendfinder/followfriends",f="/friendfinder/completeFollow/",q="/friendfinder/processInvite",M,y,v,j=false,b=null,n=6000,c=0,Y=["Busy finding friends...","Sled dogs at full speed!","Wow, some of your friends found good hiding places!  Still seeking..."],s=[],l=PBMessage.MESSAGE_TYPE,C=l.ALERT,S=l.SUCCESS,t=l.ERROR,k=0,x=0,U=[],E,X=0;function H(){M=(j)?jq("#lightbox .container"):jq(".friendFinderContent")}function O(){if(!M){H()}M.find(".progress").remove();if(b){window.clearInterval(b);b=null}}function D(){var Z=M.find(".progress .message");if(Z&&c!==s.length){Z.html(s[c]);c++}else{c=0}}function g(ac,aa){O();var ab,Z;if(j){ab=M.prop("offsetWidth")-2;Z=M.prop("offsetHeight")-2}else{ab=M.parent().prop("offsetWidth")-2;Z=M.parent().prop("offsetHeight")-2}if(!ac){ac="We're searching for your friends who are using Photobucket."}M.prepend('<div class="progress modClrBg" style="width:'+ab+"px;height:"+Z+'px;z-index:5001;"><div class="message">'+ac+"</div></div>");if(aa){c=0;b=window.setInterval(D.bind(this),n)}}function R(ab,ac,aa){O();if(ac){var ad={type:ab,title:ac},Z=PBMessage.EVENT.NOTIFY;if(j){Z=PBLightbox.PBMessage.EVENT.NOTIFY}if(aa){ad.details=aa}document.fire(Z,{id:(j)?"":"friendFinderMessagePanel",message:new PBMessage(ad)})}else{document.fire(PBMessage.EVENT.CLOSE,{id:(j)?"":"friendFinderMessagePanel"})}}function P(Z){if(Z.response.stat!=="ok"){if(Z.response.hasOwnProperty("loggedOut")&&Z.response.loggedOut){R(t,"You must be logged in to perform this action");O();return false}}return true}function V(Z){if(Z){jq("#friendSearch").show();jq("#inviteFriends").show();jq("#recentFollowsContainer").show()}else{jq("#friendSearch").hide();jq("#inviteFriends").hide();jq("#recentFollowsContainer").hide()}}function i(){var Z=jq("#invitation");if(Z&&Z.length>0){if(typeof"PBInvite"!=="undefined"){PBInvite.init()}}}function N(Z,aa,ab){document.fire(PBMessage.EVENT.CLOSE);jq.ajax({url:Z,dataType:"json",data:aa,success:ab,type:"post"})}function d(ad){if(!P(ad)){return}AutoShareController.getInstance().unsetFindingFriends();var Z,aa=ad.response,ac,ab;if(aa.stat==="ok"){if(aa.hasOwnProperty("reconnect")&&aa.reconnect){O();AutoShareController.getInstance().setFindingFriends();V(true);R(C,aa.message.title,aa.message.details);return}if(aa.hasOwnProperty("redirect")&&aa.redirect){ab="http://"+location.host;if(v){ab+=v}else{ab+="/friendfinder"}if(aa.params){ab+=(ab.indexOf("?")===-1?"?":"&")+aa.params}location.href=ab;return}M.html(aa.innerHTML);ac=M.find("div.friendresults");if(!ac||ac.length===0){V(true)}Z=S}else{Z=t}R(Z,aa.message,aa.messageDetails)}function W(ab,aa){var Z="";if(aa){Z=aa+" "}Z+=(ab==="auth"?"friends":"contacts");s.splice(0,0,"When we're done, you'll be able to choose specific "+Z+" to follow on Photobucket");return"We're searching for your "+Z+" who are using Photobucket."}function p(ab,aa,Z){FB.login(function(ac){if(ac.authResponse){g(W("auth",Z),true);N(J,{},function(){L(ab,aa,Z)})}else{V(true);R(t,"You must allow Photobucket to access your Facebook account.")}},{scope:"publish_stream,offline_access"})}function L(ad,ac,aa){k=0;x=0;s=Y.slice(0);document.fire(PBMessage.EVENT.CLOSE);var ab,Z;H();ab={findingId:ad,findingType:"auth"};if(aa==="Facebook"){FB.getLoginStatus(function(ae){if(ae.authResponse){if(ae.authResponse.userID===ac){FB.api("/me/permissions",function(ag){var af=ag.data[0];if(af.offline_access!==1||af.publish_stream!==1){p(ad,ac,aa)}else{V(false);Z=M.find(".progress");if(!Z||Z.length===0){g(W("auth","Facebook"),true)}N(e,ab,d)}})}else{FB.logout(function(){p(ad,ac,aa)})}}else{p(ad,ac,aa)}},true)}else{V(false);g(W("auth",aa),true);N(e,ab,d)}}function h(Z,aa){k=0;x=0;s=Y.slice(0);document.fire(PBMessage.EVENT.CLOSE);H();var ab={findingId:Z,findingType:"contact"};V(false);g(W("contact",aa),true);N(r,ab,d)}function B(ab){var ac,Z,aa=ab.response;if(!P(ab)){return}if(j){if(aa.stat!=="ok"){ac="There was a problem following your friends.  Please try again.";R(t,ac);return}else{document.fire(y.EVENT.SKIPFRIENDFINDER);R(S,aa.message,aa.messageDetails)}}else{if(aa.stat!=="ok"){ac="There was a problem following your friends.  Please try again.";R(t,ac)}else{M.html(aa.innerHTML);V(true);if(aa.hasOwnProperty("noAction")&&aa.noAction){Z=l.ALERT}else{Z=S}R(Z,aa.message,aa.messageDetails);if(aa.recentFollows){jq("#recentFollowsContainer").remove();jq("div.panelRight").append(aa.recentFollows)}}}O()}function K(){H();var Z=jq("#followFriendsForm"),ah=Z.find("input[name=findingId]").val(),aj=Z.find("input[name=findingType]").val(),ag=Z.find("div.friend input[type=checkbox]"),ad={},ak=[],ab,af,ai,ac,aa={},ae={};ag.each(function(){ai=this.id.replace(/^follow_/,"");ac=jq(this).next("input[type=hidden][name^=findingId_]").val();if(this.checked){if(!ad.hasOwnProperty(ac)){ad[ac]=[]}ad[ac].push(ai)}else{ak.push(ai)}});af=jq(ad)[0];if(jq.isEmptyObject(af)){ab="Please select at least one friend to follow";R(t,ab)}else{jq.each(ad,function(am,al){aa[am]=al.join(",")});ae.userIds=aa;if(ak){ae.unfollowedUserIds=ak.join(",")}if(ah){ae.findingId=ah}if(aj){ae.findingType=aj}if(v){ae.returnUrl=v}ab="Following your "+(aj==="auth"?"friends":"contacts")+"...";g(ab);N(z,ae,B)}}function I(){X--;if(X===0){jq("#followAll").prop("disabled",false);jq("div.friend a.followButton").unbind("followComplete unfollowComplete",I)}}function o(){var ab,aa=0,Z;jq("#followAll").prop("disabled",true);if(jq("#followAll").prop("checked")){ab=jq("div.friend a.followButton[data-followee]:not(.isFollowing)");Z="friend_finder_follow_all_click";ab.bind("followComplete",I)}else{ab=jq("div.friend a.followButton.isFollowing");Z="friend_finder_unfollow_all_click";ab.bind("unfollowComplete",I)}X=ab.length;ab.click();tr(Z)}function A(){var aa=jq("#followFriendsForm"),Z=aa.find("input[name=findingId]").val(),ac=aa.find("input[name=findingType]").val(),ab={findingId:Z,findingType:ac,followedCount:x,invitedCount:k};if(v){ab.returnUrl=v}N(f,ab,B)}function w(ab,aa){if(!P(ab)){return}var Z=ab.response;if(Z.stat==="ok"){jq("#invite_"+aa).closest("div.friend").fadeOut(2000,function(){jq(this).remove()});k+=1}else{R(t,Z.message);jq("#invite_"+aa).text("Invite").removeClass("invited").attr("onclick",'FriendFinder.sendInviteTo("'+aa+'");')}}function a(Z){H();var ac=jq("#followFriendsForm"),aa=ac.find("input[name=findingId]").val(),ae=ac.find("input[name=findingType]").val(),ab=jq("#invite_"+Z),ad={toAddresses:ab.data("email"),findingId:aa,findingType:ae};ab.attr("onclick","").addClass("invited").text("Sending...");N(q,ad,function(af){w(af,Z)})}function G(ab){if(!P(ab)){return}var Z=ab.response,aa;if(Z.stat==="ok"){aa="http://"+location.host;if(v){aa+=v}else{aa+="/friendfinder"}if(Z.params){aa+=(aa.indexOf("?")===-1?"?":"&")+Z.params}location.href=aa}else{R(t,Z.message)}}function Q(){H();var aa=jq("#followFriendsForm"),ac=aa.find("input[name=toAddresses]"),Z="",ab={};if(!ac.hasClass("hint")){Z=ac.val()}ab.toAddresses=Z;g("Inviting your friends...");N(q,ab,G)}function u(aa){var Z="div.friend input[type=checkbox]";if(aa){Z+=":not(:checked)"}else{Z+=":checked"}jq("div.friend input[type=checkbox]").each(function(){this.checked=aa})}function m(aa,Z){j=aa;y=Z}function F(Z){v=Z}function T(){document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/friendfinder/invite?isLightbox=true",cache:false})}jq(document).ready(function(){jq("a.followButton").live("followComplete",function(){x+=1;if(jq("div.friendresults").data("site")==="Facebook"){U.push(jq(this).closest("div.friend").find("label").text());if(!E){E=jq("#followFriendsForm").find("input[name=findingId]").val()}}}).live("unfollowComplete",function(){x-=1;if(jq("div.friendresults").data("site")==="Facebook"){var Z=jq(this).closest("div.friend").find("label").text(),aa;for(aa=0;aa<U.length;aa++){if(U[aa]===Z){U.splice(aa,1);break}}}})});jq(window).unload(function(){if(U.length>0){var Z={findingId:E,findingType:"auth",friends:U};N("/friendfinder/postFollows",Z,function(){})}});return{getFriends:L,getFriendsFromContacts:h,followFriends:K,sendInvite:Q,setIsLightBox:m,setPage:F,removeProgress:O,toggleSelected:u,completeFollow:A,followAllFriends:o,sendInviteTo:a,showInvitePreview:T}}());var FoundFriendsPromo=(function(){function f(){}function c(g){jq.ajax({url:"/friendfinder/followuser",dataType:"json",data:{userId:g,simpleMessage:true},success:d,type:"post"})}function a(g){jq.ajax({url:"/friendfinder/rejectusers",dataType:"json",data:{rejectIds:g},success:d,type:"post"})}function d(g){msg={title:g.response.message};if(g.response.stat=="ok"){jq("#friendSuggestion").hide();msg.type=PBMessage.MESSAGE_TYPE.SUCCESS}else{msg.type=PBMessage.MESSAGE_TYPE.ERROR}document.fire(PBMessage.EVENT.NOTIFY,{id:"MessagePanel",message:new PBMessage(msg)})}function b(g){jq.ajax({url:"/friendfinder/setShowPromo",dataType:"json",data:{showPromo:g},success:e,type:"post"})}function e(g){if(g.response.stat=="ok"){jq("#friendSuggestion").hide()}else{msg={type:PBMessage.MESSAGE_TYPE.ERROR,title:g.response.message};document.fire(PBMessage.EVENT.NOTIFY,{id:"MessagePanel",message:new PBMessage(msg)})}}jq(document).ready(function(){f()});return{followFriend:c,rejectFriends:a,setShowPromo:b}}());var Roadblock=(function(){function b(){document.location.reload(true)}function a(){document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE);document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"An error occurred.  Please try again."})})}function c(){document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);jq.ajax({url:"/agree",data:{agree:true},dataType:"json",success:b,error:a})}return{submit:c}}());var FollowController=(function(){var e="user",h="group",o="search";function g(r,p){var q,s;if(r&&r.response){q=r.response;if(q.stat==="ok"){if(p){p.trigger({type:"followComplete",success:true,unsubscribeLink:q.unsubscribeLink,btn:p});i(p.data("tracking"),true)}if(typeof CorePaginationController!=="undefined"){CorePaginationController.getInstance().setHash()}return}else{s=q.message}}if(p){if(!s){s={title:"There was a problem with following.  Please try again."}}p.trigger({type:"followComplete",success:false,message:s})}}function f(p){return function(q){g(q,p)}}function l(p,r,w,s,v){w+="";s+="";var u={"notify[uploads]":true,"notify[subname]":w.replace(/['"]/g,"")},t=f(p);if(r===o){u["notify[term]"]=w.replace(/['"]/g,"")}else{u["notify[ownername]"]=s.replace(/['"]/g,"")}if(v){u.addToRecentFollows=true}if(p){p.trigger({type:"followStart",btn:p})}var q=(PB_isMobile)?jq("#PB_viewerSiloDomain").val()+"/subscribe/"+r:"/subscribe/"+r;jq.ajax({url:q,type:"post",data:u,dataType:"jsonp",jsonp:"jsoncallback",success:t,error:t})}function d(p){var q=p.data("type"),t=p.data("followee"),r=p.data("ownername"),s=p.data("addtorecentfollows");l(p,q,t,r,s)}function c(q,t,r,s){var p=jq("a.followButton[data-followee="+t+"][data-type="+q+"][data-ownername="+r+"]").bind("followComplete",function(){tr(s)});FollowButton.toggle(p,true)}function k(r,p){var q=r.response;p.trigger({type:"unfollowComplete",success:(q.stat==="ok"),btn:p});i(p.data("tracking"),false)}function a(p){return function(q){k(q,p)}}function n(p,t){t=(PB_isMobile)?t.replace(/http:\/\/photobucket.com/i,jq("#PB_viewerSiloDomain").val()):t.replace(/http:\/\/photobucket.com/i,"");var s=Math.floor(Math.random()*10001),q={type:"edit",cb:s},r=a(p);p.trigger({type:"unfollowStart",btn:p});jq.ajax({url:t,type:"get",data:q,dataType:"jsonp",jsonp:"jsoncallback",success:r,error:r})}function m(p){var q=p.data("unsubscribelink");if(q){n(p,q)}}function j(q){var p=jq("#email_subscribe_"+q.response.subName.replace(/\ /g,"_"));p.siblings(".smallload").hide();p.show()}function b(s,v,t,r){var p=jq("#email_subscribe_"+v.replace(/\ /g,"_")),u;p.hide();p.siblings(".smallload").show();u={"notify[editSubscriptions]":1,"notify[subname]":v};if(s===o){u["notify[term]"]=v}else{u["notify[ownername]"]=t}if(r){u["notify[uploads]"]=1}var q=(PB_isMobile)?jq("#PB_viewerSiloDomain").val()+"/subscribe/"+s:"/subscribe/"+s;jq.ajax({url:q,method:"post",data:u,dataType:"jsonp",jsonp:"jsoncallback",success:j})}function i(r,p){if(!PB_isMobile||(typeof r==="undefined")){return}var q;if(p){q="followed"}else{q="unfollowed"}tr("mobile_"+r+"_to_"+q)}return{follow:d,unfollow:m,editFollowEmail:b,autoFollow:c}}());var FollowButton=(function(){function h(p,r,n,o){var q;if(jq("#fullviewMessagePanel").length>0){q="fullviewMessagePanel"}else{q="MessagePanel"}document.fire(PBMessage.EVENT.NOTIFY,{id:q,message:new PBMessage({type:p,title:r,details:n,goToHash:o})})}function d(n){n.find(".followLabel").text("Unfollow");n.addClass("hover")}function b(){d(jq(this))}function g(n){n.find(".followLabel").text("Following");n.removeClass("hover")}function a(){g(jq(this))}function m(o){var n=jq(this);n.data("loading",true);if(o.type==="unfollowStart"){if(n.data("unfollow_refresh")||n.data("remove_id")){n.find(".followLabel").text("Loading...")}else{n.removeClass("green").removeClass("isFollowing").addClass("blue");n.find(".followLabel").text("Follow")}n.unbind("mouseenter").unbind("mouseleave")}else{if(n.data("follow_refresh")){n.find(".followLabel").text("Loading...")}else{n.removeClass("blue").addClass("isFollowing").addClass("green");n.find(".followLabel").text("Following")}}if(typeof FullViewPaginatorController!=="undefined"){document.fire(FullViewPaginatorController.EVENT.CLEAR_CACHE)}}function c(q){var o=jq(this),n,s,r=o.data("tracking"),p=o.data("type");if(q.success){if(q.type==="unfollowComplete"){if(r){tr("unfollow_"+p+"_"+r)}tr("unfollow_"+p);if(o.data("unfollow_refresh")){location.href=location.href.replace(location.hash,"");return}n=o.data("remove_id");if(n){if(jq("a.followButton[data-remove_id]").length===1){location.href=location.href.replace(location.hash,"")}else{jq("#"+n).remove()}return}}else{if(r){tr("follow_"+p+"_"+r)}tr("follow_"+p);if(o.data("follow_refresh")){location.href=location.href.replace(location.hash,"");return}s=q.unsubscribeLink;if(s){o.data("unsubscribelink",s);o.hover(b,a)}}}else{if(q.type==="unfollowComplete"){o.addClass("green").addClass("isFollowing").removeClass("blue");o.find(".followLabel").text("Following");o.hover(b,a);h(PBMessage.MESSAGE_TYPE.ERROR,"There was a problem unfollowing.  Please try again.",null,true)}else{o.addClass("blue").removeClass("isFollowing").removeClass("green");o.find(".followLabel").text("Follow");o.unbind("mouseenter").unbind("mouseleave");h(PBMessage.MESSAGE_TYPE.ERROR,q.message.title,q.message.details,true)}}o.data("loading",false)}function f(o){var n=jq(this);n.data("loading",true);n.addClass("loading")}function l(o){var n=jq(this),p;if(o.success){if(o.type==="followComplete"){n.addClass("btngrey").addClass("isFollowing").removeClass("blue");n.find(".followLabel").text("Unfollow");p=o.unsubscribeLink;if(p){n.data("unsubscribelink",p)}}else{n.addClass("blue").removeClass("isFollowing").removeClass("btngrey");n.find(".followLabel").text("Follow")}jq(document).trigger(jq.Event("followButtonChanged",{ftype:o.type}))}n.removeClass("loading");n.data("loading",false)}function e(o,p){var n=jq(o);if(!n.data("loading")){if(n.hasClass("isFollowing")){if(!p){FollowController.unfollow(n)}}else{FollowController.follow(n)}}}function k(){var q=jq(this),n=q.data("loginurl"),o=q.data("registerurl"),p=q.data("followee"),s,r;s="<p><a href='"+n+"' class='linkClr'>Sign in</a> to follow "+p+"</p>";r="<p>Don't have an account? <a href='"+o+"' class='linkClr'>Sign up now</a></p>";q.qtip({content:{text:r,title:{text:s}},show:{solo:true},hide:{fixed:true,inactive:3000,delay:200},position:{my:"top left",at:"bottom center"}})}function j(){jq("a.followButton").live("followStart",m).live("followComplete",c).live("unfollowStart",m).live("unfollowComplete",c);jq("a.followButton.isFollowing").live("mouseover mouseout",function(n){if(n.type==="mouseover"){d(jq(this))}else{g(jq(this))}});jq("a.followButton.loggedOut").each(k)}function i(){jq("a.followButton").live("followStart",f).live("followComplete",l).live("unfollowStart",f).live("unfollowComplete",l)}if(!PB_isMobile){Event.observe(document,PB.EVENT.PAGE_LOADED,j)}else{jq(document).ready(i)}return{toggle:e}}());(function(f,j,g){var i=true,r=false,y=null,q,p,b,x={},k="ui-tooltip",d="ui-widget",e="ui-state-disabled",s="div.qtip."+k,l=k+"-default",z=k+"-focus",c=k+"-hover",u=k+"-fluid",o="-31000px",w="_replacedByqTip",n="oldtitle",m;function h(){h.history=h.history||[];h.history.push(arguments);if("object"===typeof console){var C=console[console.warn?"warn":"log"],B=Array.prototype.slice.call(arguments),A;if(typeof arguments[0]==="string"){B[0]="qTip2: "+B[0]}A=C.apply?C.apply(console,B):C(B)}}function a(B){var A;if(!B||"object"!==typeof B){return r}if("object"!==typeof B.metadata){B.metadata={type:B.metadata}}if("content" in B){if("object"!==typeof B.content||B.content.jquery){B.content={text:B.content}}A=B.content.text||r;if(!f.isFunction(A)&&((!A&&!A.attr)||A.length<1||("object"===typeof A&&!A.jquery))){B.content.text=r}if("title" in B.content){if("object"!==typeof B.content.title){B.content.title={text:B.content.title}}A=B.content.title.text||r;if(!f.isFunction(A)&&((!A&&!A.attr)||A.length<1||("object"===typeof A&&!A.jquery))){B.content.title.text=r}}}if("position" in B){if("object"!==typeof B.position){B.position={my:B.position,at:B.position}}}if("show" in B){if("object"!==typeof B.show){if(B.show.jquery){B.show={target:B.show}}else{B.show={event:B.show}}}}if("hide" in B){if("object"!==typeof B.hide){if(B.hide.jquery){B.hide={target:B.hide}}else{B.hide={event:B.hide}}}}if("style" in B){if("object"!==typeof B.style){B.style={classes:B.style}}}f.each(p,function(){if(this.sanitize){this.sanitize(B)}});return B}function v(W,C,Q,R){var P=this,L=document.body,I=k+"-"+Q,D=0,V=0,E=f(),M=".qtip-"+Q,N,O;P.id=Q;P.rendered=r;P.elements=N={target:W};P.timers={img:{}};P.options=C;P.checks={};P.plugins={};P.cache=O={event:{},target:f(),disabled:r,attr:R};function F(Z){var X=0,ab,Y=C,aa=Z.split(".");while(Y=Y[aa[X++]]){if(X<aa.length){ab=Y}}return[ab||C,aa.pop()]}function U(){var X=C.style.widget;E.toggleClass(d,X).toggleClass(l,!X);N.content.toggleClass(d+"-content",X);if(N.titlebar){N.titlebar.toggleClass(d+"-header",X)}if(N.button){N.button.toggleClass(k+"-icon",!X)}}function A(X){if(N.title){N.titlebar.remove();N.titlebar=N.title=N.button=y;if(X!==r){P.reposition()}}}function S(){var Y=C.content.title.button,X=typeof Y==="string",Z=X?Y:"Close tooltip";if(N.button){N.button.remove()}if(Y.jquery){N.button=Y}else{N.button=f("<a />",{"class":"ui-state-default "+(C.style.widget?"":k+"-icon"),title:Z,"aria-label":Z}).prepend(f("<span />",{"class":"ui-icon ui-icon-close",html:"&times;"}))}N.button.appendTo(N.titlebar).attr("role","button").hover(function(aa){f(this).toggleClass("ui-state-hover",aa.type==="mouseenter")}).click(function(aa){if(!E.hasClass(e)){P.hide(aa)}return r}).bind("mousedown keydown mouseup keyup mouseout",function(aa){f(this).toggleClass("ui-state-active ui-state-focus",aa.type.substr(-4)==="down")});P.redraw()}function H(){var X=I+"-title";if(N.titlebar){A()}N.titlebar=f("<div />",{"class":k+"-titlebar "+(C.style.widget?"ui-widget-header":"")}).append(N.title=f("<div />",{id:X,"class":k+"-title","aria-atomic":i})).insertBefore(N.content);if(C.content.title.button){S()}else{if(P.rendered){P.redraw()}}}function K(X){var Y=N.button,Z=N.title;if(!P.rendered){return r}if(!X){Y.remove()}else{if(!Z){H()}S()}}function T(Z,X){var Y=N.title;if(!P.rendered||!Z){return r}if(f.isFunction(Z)){Z=Z.call(W,O.event,P)}if(Z===r){return A(r)}else{if(Z.jquery&&Z.length>0){Y.empty().append(Z.css({display:"block"}))}else{Y.html(Z)}}P.redraw();if(X!==r&&P.rendered&&E.is(":visible")){P.reposition(O.event)}}function J(Z,X){var Y=N.content;if(!P.rendered||!Z){return r}if(f.isFunction(Z)){Z=Z.call(W,O.event,P)||""}if(Z.jquery&&Z.length>0){Y.empty().append(Z.css({display:"block"}))}else{Y.html(Z)}function aa(ac){var ab,ad={};function ae(af){if(af){delete ad[af.src];clearTimeout(P.timers.img[af.src]);f(af).unbind(M)}if(f.isEmptyObject(ad)){P.redraw();if(X!==r){P.reposition(O.event)}ac()}}if((ab=Y.find("img:not([height]):not([width])")).length===0){return ae()}ab.each(function(af,ag){if(ad[ag.src]!==g){return}(function ah(){if(ag.height||ag.width){return ae(ag)}P.timers.img[ag.src]=setTimeout(ah,700)}());f(ag).bind("error"+M+" load"+M,function(){ae(this)});ad[ag.src]=ag})}if(P.rendered<0){E.queue("fx",aa)}else{V=0;aa(f.noop)}return P}function B(){var aa=C.position,Y={show:C.show.target,hide:C.hide.target,viewport:f(aa.viewport),document:f(document),window:f(j)},Z={show:f.trim(""+C.show.event).split(" "),hide:f.trim(""+C.hide.event).split(" ")},X=f.browser.msie&&parseInt(f.browser.version,10)===6;function ac(af){if(E.hasClass(e)){return r}Y.show.trigger("qtip-"+Q+"-inactive");clearTimeout(P.timers.show);clearTimeout(P.timers.hide);var ag=function(){P.toggle(i,af)};if(C.show.delay>0){P.timers.show=setTimeout(ag,C.show.delay)}else{ag()}}function ab(ai){if(E.hasClass(e)||D||V){return r}var ag=f(ai.relatedTarget||ai.target),af=ag.closest(s)[0]===E[0],ah=ag[0]===Y.show[0];clearTimeout(P.timers.show);clearTimeout(P.timers.hide);if((aa.target==="mouse"&&af)||(C.hide.fixed&&((/mouse(out|leave|move)/).test(ai.type)&&(af||ah)))){ai.preventDefault();ai.stopImmediatePropagation();return}if(C.hide.delay>0){P.timers.hide=setTimeout(function(){P.hide(ai)},C.hide.delay)}else{P.hide(ai)}}function ad(af){if(E.hasClass(e)){return r}clearTimeout(P.timers.inactive);P.timers.inactive=setTimeout(function(){P.hide(af)},C.hide.inactive)}function ae(af){if(E.is(":visible")){P.reposition(af)}}E.bind("mouseenter"+M+" mouseleave"+M,function(af){var ag=af.type==="mouseenter";if(ag){P.focus(af)}E.toggleClass(c,ag)});if(C.hide.fixed){Y.hide=Y.hide.add(E);E.bind("mouseover"+M,function(){if(!E.hasClass(e)){clearTimeout(P.timers.hide)}})}if(/mouse(out|leave)/i.test(C.hide.event)){if(C.hide.leave==="window"){Y.window.bind("mouseout"+M,function(af){if(/select|option/.test(af.target)&&!af.relatedTarget){P.hide(af)}})}}else{if(/mouse(over|enter)/i.test(C.show.event)){Y.hide.bind("mouseleave"+M,function(af){clearTimeout(P.timers.show)})}}if((""+C.hide.event).indexOf("unfocus")>-1){Y.document.bind("mousedown"+M,function(ah){var af=f(ah.target),ag=!E.hasClass(e)&&E.is(":visible");if(af[0]!==E[0]&&af.parents(s).length===0&&af.add(W).length>1){P.hide(ah)}})}if("number"===typeof C.hide.inactive){Y.show.bind("qtip-"+Q+"-inactive",ad);f.each(q.inactiveEvents,function(af,ag){Y.hide.add(N.tooltip).bind(ag+M+"-inactive",ad)})}f.each(Z.hide,function(ag,ah){var af=f.inArray(ah,Z.show),ai=f(Y.hide);if((af>-1&&ai.add(Y.show).length===ai.length)||ah==="unfocus"){Y.show.bind(ah+M,function(aj){if(E.is(":visible")){ab(aj)}else{ac(aj)}});delete Z.show[af]}else{Y.hide.bind(ah+M,ab)}});f.each(Z.show,function(af,ag){Y.show.bind(ag+M,ac)});if("number"===typeof C.hide.distance){Y.show.add(E).bind("mousemove"+M,function(ai){var ah=O.origin||{},ag=C.hide.distance,af=Math.abs;if(af(ai.pageX-ah.pageX)>=ag||af(ai.pageY-ah.pageY)>=ag){P.hide(ai)}})}if(aa.target==="mouse"){Y.show.bind("mousemove"+M,function(af){b={pageX:af.pageX,pageY:af.pageY,type:"mousemove"}});if(aa.adjust.mouse){if(C.hide.event){E.bind("mouseleave"+M,function(af){if((af.relatedTarget||af.target)!==Y.show[0]){P.hide(af)}})}Y.document.bind("mousemove"+M,function(af){if(!E.hasClass(e)&&E.is(":visible")){P.reposition(af||b)}})}}if(aa.adjust.resize||Y.viewport.length){(f.event.special.resize?Y.viewport:Y.window).bind("resize"+M,ae)}if(Y.viewport.length||(X&&E.css("position")==="fixed")){Y.viewport.bind("scroll"+M,ae)}}function G(){var X=[C.show.target[0],C.hide.target[0],P.rendered&&N.tooltip[0],C.position.container[0],C.position.viewport[0],j,document];if(P.rendered){f([]).pushStack(f.grep(X,function(Y){return typeof Y==="object"})).unbind(M)}else{C.show.target.unbind(M+"-create")}}P.checks.builtin={"^id$":function(Z,aa,X){var ab=X===i?q.nextid:X,Y=k+"-"+ab;if(ab!==r&&ab.length>0&&!f("#"+Y).length){E[0].id=Y;N.content[0].id=Y+"-content";N.title[0].id=Y+"-title"}},"^content.text$":function(Y,Z,X){J(X)},"^content.title.text$":function(Y,Z,X){if(!X){return A()}if(!N.title&&X){H()}T(X)},"^content.title.button$":function(Y,Z,X){K(X)},"^position.(my|at)$":function(Y,Z,X){if("string"===typeof X){Y[Z]=new p.Corner(X)}},"^position.container$":function(Y,Z,X){if(P.rendered){E.appendTo(X)}},"^show.ready$":function(){if(!P.rendered){P.render(1)}else{P.toggle(i)}},"^style.classes$":function(Y,Z,X){E.attr("class",k+" qtip ui-helper-reset "+X)},"^style.widget|content.title":U,"^events.(render|show|move|hide|focus|blur)$":function(Y,Z,X){E[(f.isFunction(X)?"":"un")+"bind"]("tooltip"+Z,X)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){var X=C.position;E.attr("tracking",X.target==="mouse"&&X.adjust.mouse);G();B()}};f.extend(P,{render:function(X){if(P.rendered){return P}var Z=C.content.title.text,Y=C.position,aa=f.Event("tooltiprender");f.attr(W[0],"aria-describedby",I);E=N.tooltip=f("<div/>",{id:I,"class":k+" qtip ui-helper-reset "+l+" "+C.style.classes+" "+k+"-pos-"+C.position.my.abbreviation(),width:C.style.width||"",height:C.style.height||"",tracking:Y.target==="mouse"&&Y.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":r,"aria-describedby":I+"-content","aria-hidden":i}).toggleClass(e,O.disabled).data("qtip",P).appendTo(C.position.container).append(N.content=f("<div />",{"class":k+"-content",id:I+"-content","aria-atomic":i}));N.tip=f("<div />",{"class":"ui-tooltip-tip"}).appendTo(E);P.rendered=-1;V=1;D=1;if(Z){H();T(Z,r)}J(C.content.text,r);P.rendered=i;U();f.each(C.events,function(ab,ac){if(f.isFunction(ac)){E.bind(ab==="toggle"?"tooltipshow tooltiphide":"tooltip"+ab,ac)}});f.each(p,function(){if(this.initialize==="render"){this(P)}});B();E.queue("fx",function(ab){aa.originalEvent=O.event;E.trigger(aa,[P]);V=0;D=0;P.redraw();if(C.show.ready||X){P.toggle(i,O.event)}ab()});return P},get:function(Y){var X,Z;switch(Y.toLowerCase()){case"dimensions":X={height:E.outerHeight(),width:E.outerWidth()};break;case"offset":X=p.offset(E,C.position.container);break;default:Z=F(Y.toLowerCase());X=Z[0][Z[1]];X=X.precedance?X.string():X;break}return X},set:function(aa,ab){var Z=/^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,ac=/^content\.(title|attr)|style/i,ad=r,af=r,Y=P.checks,X;function ae(aj,ah){var ai,ak,ag;for(ai in Y){for(ak in Y[ai]){if(ag=(new RegExp(ak,"i")).exec(aj)){ah.push(ag);Y[ai][ak].apply(P,ah)}}}}if("string"===typeof aa){X=aa;aa={};aa[X]=ab}else{aa=f.extend(i,{},aa)}f.each(aa,function(ah,ai){var aj=F(ah.toLowerCase()),ag;ag=aj[0][aj[1]];aj[0][aj[1]]="object"===typeof ai&&ai.nodeType?f(ai):ai;aa[ah]=[aj[0],aj[1],ai,ag];ad=Z.test(ah)||ad;af=ac.test(ah)||af});a(C);D=V=1;f.each(aa,ae);D=V=0;if(E.is(":visible")&&P.rendered){if(ad){P.reposition(C.position.target==="mouse"?y:O.event)}if(af){P.redraw()}}return P},toggle:function(Z,aa){if(!P.rendered){if(Z){P.render(1)}else{return P}}var af=Z?"show":"hide",X=C[af],ab=E.is(":visible"),ac=!aa||C[af].target.length<2||O.target[0]===aa.target,ah=C.position,ad=C.content,ae,ag;if((typeof Z).search("boolean|number")){Z=!ab}if(!E.is(":animated")&&ab===Z&&ac){return P}if(aa){if((/over|enter/).test(aa.type)&&(/out|leave/).test(O.event.type)&&aa.target===C.show.target[0]&&E.has(aa.relatedTarget).length){return P}O.event=f.extend({},aa)}ag=f.Event("tooltip"+af);ag.originalEvent=aa?O.event:y;E.trigger(ag,[P,90]);if(ag.isDefaultPrevented()){return P}f.attr(E[0],"aria-hidden",!!!Z);if(Z){O.origin=f.extend({},b);P.focus(aa);if(f.isFunction(ad.text)){J(ad.text,r)}if(f.isFunction(ad.title.text)){T(ad.title.text,r)}if(!m&&ah.target==="mouse"&&ah.adjust.mouse){f(document).bind("mousemove.qtip",function(ai){b={pageX:ai.pageX,pageY:ai.pageY,type:"mousemove"}});m=i}P.reposition(aa);if(X.solo){f(s,X.solo).not(E).qtip("hide",ag)}}else{clearTimeout(P.timers.show);delete O.origin;if(m&&!f(s+'[tracking="true"]:visible',X.solo).not(E).length){f(document).unbind("mousemove.qtip");m=r}P.blur(aa)}function Y(){if(Z){if(f.browser.msie){E[0].style.removeAttribute("filter")}E.css("overflow","");if("string"===typeof X.autofocus){f(X.autofocus,E).focus()}ag=f.Event("tooltipvisible");ag.originalEvent=aa?O.event:y;E.trigger(ag,[P])}else{E.css({display:"",visibility:"",opacity:"",left:"",top:""})}}if(ac){E.stop(0,1)}if(X.effect===r){E[af]();Y.call(E)}else{if(f.isFunction(X.effect)){X.effect.call(E,P);E.queue("fx",function(ai){Y();ai()})}else{E.fadeTo(90,Z?1:0,Y)}}if(Z){X.target.trigger("qtip-"+Q+"-inactive")}return P},show:function(X){return P.toggle(i,X)},hide:function(X){return P.toggle(r,X)},focus:function(ab){if(!P.rendered){return P}var ac=f(s),Z=parseInt(E[0].style.zIndex,10),Y=q.zindex+ac.length,aa=f.extend({},ab),X,ad;if(!E.hasClass(z)){ad=f.Event("tooltipfocus");ad.originalEvent=aa;E.trigger(ad,[P,Y]);if(!ad.isDefaultPrevented()){if(Z!==Y){ac.each(function(){if(this.style.zIndex>Z){this.style.zIndex=this.style.zIndex-1}});ac.filter("."+z).qtip("blur",aa)}E.addClass(z)[0].style.zIndex=Y}}return P},blur:function(Y){var X=f.extend({},Y),Z;E.removeClass(z);Z=f.Event("tooltipblur");Z.originalEvent=X;E.trigger(Z,[P]);return P},reposition:function(ak,ah){if(!P.rendered||D){return P}D=1;var ao=C.position.target,an=C.position,af=an.my,ag=an.at,ai=an.adjust,Y=ai.method.split(" "),al=E.outerWidth(),aj=E.outerHeight(),ac=0,ad=0,ab=f.Event("tooltipmove"),aa=E.css("position")==="fixed",am=an.viewport,ap={left:0,top:0},Z=r,ae=P.plugins.tip,X={horizontal:Y[0],vertical:(Y[1]=Y[1]||Y[0]),enabled:am.jquery&&ao[0]!==j&&ao[0]!==L&&ai.method!=="none",left:function(aw){var ar=X.horizontal==="shift",av=am.offset.left+am.scrollLeft,at=af.x==="left"?al:af.x==="right"?-al:-al/2,aq=ag.x==="left"?ac:ag.x==="right"?-ac:-ac/2,ay=ae&&ae.size?ae.size.width||0:0,aB=ae&&ae.corner&&ae.corner.precedance==="x"&&!ar?ay:0,aA=av-aw+aB,au=aw+al-am.width-av+aB,ax=at-(af.precedance==="x"||af.x===af.y?aq:0),az=af.x==="center";if(ar){aB=ae&&ae.corner&&ae.corner.precedance==="y"?ay:0;ax=(af.x==="left"?1:-1)*at-aB;ap.left+=aA>0?aA:au>0?-au:0;ap.left=Math.max(am.offset.left+(aB&&ae.corner.x==="center"?ae.offset:0),aw-ax,Math.min(Math.max(am.offset.left+am.width,aw+ax),ap.left))}else{if(aA>0&&(af.x!=="left"||au>0)){ap.left-=ax}else{if(au>0&&(af.x!=="right"||aA>0)){ap.left-=az?-ax:ax}}if(ap.left!==aw&&az){ap.left-=ai.x}if(ap.left<av&&-ap.left>au){ap.left=aw}}return ap.left-aw},top:function(ay){var ar=X.vertical==="shift",aw=am.offset.top+am.scrollTop,at=af.y==="top"?aj:af.y==="bottom"?-aj:-aj/2,az=ag.y==="top"?ad:ag.y==="bottom"?-ad:-ad/2,aq=ae&&ae.size?ae.size.height||0:0,aB=ae&&ae.corner&&ae.corner.precedance==="y"&&!ar?aq:0,au=aw-ay+aB,av=ay+aj-am.height-aw+aB,ax=at-(af.precedance==="y"||af.x===af.y?az:0),aA=af.y==="center";if(ar){aB=ae&&ae.corner&&ae.corner.precedance==="x"?aq:0;ax=(af.y==="top"?1:-1)*at-aB;ap.top+=au>0?au:av>0?-av:0;ap.top=Math.max(am.offset.top+(aB&&ae.corner.x==="center"?ae.offset:0),ay-ax,Math.min(Math.max(am.offset.top+am.height,ay+ax),ap.top))}else{if(au>0&&(af.y!=="top"||av>0)){ap.top-=ax}else{if(av>0&&(af.y!=="bottom"||au>0)){ap.top-=aA?-ax:ax}}if(ap.top!==ay&&aA){ap.top-=ai.y}if(ap.top<0&&-ap.top>av){ap.top=ay}}return ap.top-ay}};if(f.isArray(ao)&&ao.length===2){ag={x:"left",y:"top"};ap={left:ao[0],top:ao[1]}}else{if(ao==="mouse"&&((ak&&ak.pageX)||O.event.pageX)){ag={x:"left",y:"top"};ak=(ak&&(ak.type==="resize"||ak.type==="scroll")?O.event:ak&&ak.pageX&&ak.type==="mousemove"?ak:b&&b.pageX&&(ai.mouse||!ak||!ak.pageX)?{pageX:b.pageX,pageY:b.pageY}:!ai.mouse&&O.origin&&O.origin.pageX?O.origin:ak)||ak||O.event||b||{};ap={top:ak.pageY,left:ak.pageX}}else{if(ao==="event"){if(ak&&ak.target&&ak.type!=="scroll"&&ak.type!=="resize"){ao=O.target=f(ak.target)}else{ao=O.target}}else{O.target=f(ao)}ao=f(ao).eq(0);if(ao.length===0){return P}else{if(ao[0]===document||ao[0]===j){ac=p.iOS?j.innerWidth:ao.width();ad=p.iOS?j.innerHeight:ao.height();if(ao[0]===j){ap={top:!aa||p.iOS?(am||ao).scrollTop():0,left:!aa||p.iOS?(am||ao).scrollLeft():0}}}else{if(ao.is("area")&&p.imagemap){ap=p.imagemap(ao,ag,X.enabled?Y:r)}else{if(ao[0].namespaceURI==="http://www.w3.org/2000/svg"&&p.svg){ap=p.svg(ao,ag)}else{ac=ao.outerWidth();ad=ao.outerHeight();ap=p.offset(ao,an.container,aa)}}}}if(ap.offset){ac=ap.width;ad=ap.height;Z=ap.flipoffset;ap=ap.offset}else{ap.left+=ag.x==="right"?ac:ag.x==="center"?ac/2:0;ap.top+=ag.y==="bottom"?ad:ag.y==="center"?ad/2:0}}}ap.left+=ai.x+(af.x==="right"?-al:af.x==="center"?-al/2:0);ap.top+=ai.y+(af.y==="bottom"?-aj:af.y==="center"?-aj/2:0);if(X.enabled){am={elem:am,height:am[(am[0]===j?"h":"outerH")+"eight"](),width:am[(am[0]===j?"w":"outerW")+"idth"](),scrollLeft:aa?0:am.scrollLeft(),scrollTop:aa?0:am.scrollTop(),offset:am.offset()||{left:0,top:0}};ap.adjusted={left:X.horizontal!=="none"?X.left(ap.left):0,top:X.vertical!=="none"?X.top(ap.top):0};if(ap.adjusted.left+ap.adjusted.top){E.attr("class",function(aq,ar){return ar.replace(/ui-tooltip-pos-\w+/i,k+"-pos-"+af.abbreviation())})}if(Z&&ap.adjusted.left){ap.left+=Z.left}if(Z&&ap.adjusted.top){ap.top+=Z.top}}else{ap.adjusted={left:0,top:0}}ab.originalEvent=f.extend({},ak);E.trigger(ab,[P,ap,am.elem||am]);if(ab.isDefaultPrevented()){return P}delete ap.adjusted;if(ah===r||isNaN(ap.left)||isNaN(ap.top)||ao==="mouse"||!f.isFunction(an.effect)){E.css(ap)}else{if(f.isFunction(an.effect)){an.effect.call(E,P,f.extend({},ap));E.queue(function(aq){f(this).css({opacity:"",height:""});if(f.browser.msie){this.style.removeAttribute("filter")}aq()})}}D=0;return P},redraw:function(){if(P.rendered<1||V){return P}var Y=C.position.container,aa,ab,X,Z;V=1;if(C.style.height){E.css("height",C.style.height)}if(C.style.width){E.css("width",C.style.width)}else{E.css("width","").addClass(u);ab=E.width()+1;X=E.css("max-width")||"";Z=E.css("min-width")||"";aa=(X+Z).indexOf("%")>-1?Y.width()/100:0;X=((X.indexOf("%")>-1?aa:1)*parseInt(X,10))||ab;Z=((Z.indexOf("%")>-1?aa:1)*parseInt(Z,10))||0;ab=X+Z?Math.min(Math.max(ab,Z),X):ab;E.css("width",Math.round(ab)).removeClass(u)}V=0;return P},disable:function(X){if("boolean"!==typeof X){X=!(E.hasClass(e)||O.disabled)}if(P.rendered){E.toggleClass(e,X);f.attr(E[0],"aria-disabled",X)}else{O.disabled=!!X}return P},enable:function(){return P.disable(r)},destroy:function(){var X=W[0],Y=f.attr(X,n);if(P.rendered){E.remove();f.each(P.plugins,function(){if(this.destroy){this.destroy()}})}clearTimeout(P.timers.show);clearTimeout(P.timers.hide);G();f.removeData(X,"qtip");if(C.suppress&&Y){f.attr(X,"title",Y);W.removeAttr(n)}W.removeAttr("aria-describedby").unbind(".qtip");delete x[P.id];return W}})}function t(B,A){var E,N,I,C,L,D=f(this),F=f(document.body),K=this===document?F:D,J=(D.metadata)?D.metadata(A.metadata):y,M=A.metadata.type==="html5"&&J?J[A.metadata.name]:y,G=D.data(A.metadata.name||"qtipopts");try{G=typeof G==="string"?(new Function("return "+G))():G}catch(H){h("Unable to parse HTML5 attribute data: "+G)}C=f.extend(i,{},q.defaults,A,typeof G==="object"?a(G):y,a(M||J));N=C.position;C.id=B;if("boolean"===typeof C.content.text){I=D.attr(C.content.attr);if(C.content.attr!==r&&I){C.content.text=I}else{h("Unable to locate content for tooltip! Aborting render of tooltip on element: ",D);return r}}if(N.container===r){N.container=F}if(N.target===r){N.target=K}if(C.show.target===r){C.show.target=K}if(C.show.solo===i){C.show.solo=F}if(C.hide.target===r){C.hide.target=K}if(C.position.viewport===i){C.position.viewport=N.container}N.at=new p.Corner(N.at);N.my=new p.Corner(N.my);if(f.data(this,"qtip")){if(C.overwrite){D.qtip("destroy")}else{if(C.overwrite===r){return r}}}if(C.suppress&&(L=f.attr(this,"title"))){f(this).removeAttr("title").attr(n,L)}E=new v(D,C,B,!!I);f.data(this,"qtip",E);D.bind("remove.qtip",function(){E.destroy()});return E}q=f.fn.qtip=function(B,F,G){var H=(""+B).toLowerCase(),E=y,A=H==="disable"?[i]:f.makeArray(arguments).slice(1),D=A[A.length-1],C=this[0]?f.data(this[0],"qtip"):y;if((!arguments.length&&C)||H==="api"){return C}else{if("string"===typeof B){this.each(function(){var I=f.data(this,"qtip");if(!I){return i}if(D&&D.timeStamp){I.cache.event=D}if((H==="option"||H==="options")&&F){if(f.isPlainObject(F)||G!==g){I.set(F,G)}else{E=I.get(F);return r}}else{if(I[H]){I[H].apply(I[H],A)}}});return E!==y?E:this}else{if("object"===typeof B||!arguments.length){C=a(f.extend(i,{},B));return q.bind.call(this,C,D)}}}};q.bind=function(B,A){return this.each(function(F){var D,C,E,H,G,J;J=f.isArray(B.id)?B.id[F]:B.id;J=!J||J===r||J.length<1||x[J]?q.nextid++:(x[J]=J);H=".qtip-"+J+"-create";G=t.call(this,J,B);if(G===r){return i}D=G.options;f.each(p,function(){if(this.initialize==="initialize"){this(G)}});C={show:D.show.target,hide:D.hide.target};E={show:f.trim(""+D.show.event).replace(/ /g,H+" ")+H,hide:f.trim(""+D.hide.event).replace(/ /g,H+" ")+H};if(/mouse(over|enter)/i.test(E.show)&&!/mouse(out|leave)/i.test(E.hide)){E.hide+=" mouseleave"+H}C.show.bind("mousemove"+H,function(K){b={pageX:K.pageX,pageY:K.pageY,type:"mousemove"}});function I(L){function K(){G.render(typeof L==="object"||D.show.ready);C.show.add(C.hide).unbind(H)}if(G.cache.disabled){return r}G.cache.event=f.extend({},L);G.cache.target=L?f(L.target):[g];if(D.show.delay>0){clearTimeout(G.timers.show);G.timers.show=setTimeout(K,D.show.delay);if(E.show!==E.hide){C.hide.bind(E.hide,function(){clearTimeout(G.timers.show)})}}else{K()}}C.show.bind(E.show,I);if(D.show.ready||D.prerender){I(A)}})};p=q.plugins={Corner:function(A){A=(""+A).replace(/([A-Z])/," $1").replace(/middle/gi,"center").toLowerCase();this.x=(A.match(/left|right/i)||A.match(/center/)||["inherit"])[0].toLowerCase();this.y=(A.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase();this.precedance=(A.charAt(0).search(/^(t|b)/)>-1)?"y":"x";this.string=function(){return this.precedance==="y"?this.y+this.x:this.x+this.y};this.abbreviation=function(){var B=this.x.substr(0,1),C=this.y.substr(0,1);return B===C?B:(B==="c"||(B!=="c"&&C!=="c"))?C+B:B+C}},offset:function(C,A,D){var F=C.offset(),H=A,I=0,E=document.body,B;function G(K,J){F.left+=J*K.scrollLeft();F.top+=J*K.scrollTop()}if(H){do{if(H.css("position")!=="static"){B=H[0]===E?{left:parseInt(H.css("left"),10)||0,top:parseInt(H.css("top"),10)||0}:H.position();F.left-=B.left+(parseInt(H.css("borderLeftWidth"),10)||0)+(parseInt(H.css("marginLeft"),10)||0);F.top-=B.top+(parseInt(H.css("borderTopWidth"),10)||0);I++}if(H[0]===E){break}}while(H=H.offsetParent());if(A[0]!==E&&I>1){G(A,1)}if((p.iOS<4.1&&p.iOS>3.1)||(!p.iOS&&D)){G(f(j),-1)}}return F},iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,3})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_","."))||r,fn:{attr:function(A,E){if(this.length){var B=this[0],D="title",C=f.data(B,"qtip");if(A===D&&C&&"object"===typeof C&&C.options.suppress){if(arguments.length<2){return f.attr(B,n)}else{if(C&&C.options.content.attr===D&&C.cache.attr){C.set("content.text",E)}return this.attr(n,E)}}}return f.fn["attr"+w].apply(this,arguments)},clone:function(B){var D=f([]),C="title",A=f.fn["clone"+w].apply(this,arguments);if(!B){A.filter("["+n+"]").attr("title",function(){return f.attr(this,n)}).removeAttr(n)}return A},remove:f.ui?y:function(A,B){f(this).each(function(){if(!B){if(!A||f.filter(A,[this]).length){f("*",this).add(this).each(function(){f(this).triggerHandler("remove")})}}})}}};f.each(p.fn,function(B,C){if(!C||f.fn[B+w]){return i}var A=f.fn[B+w]=f.fn[B];f.fn[B]=function(){return C.apply(this,arguments)||A.apply(this,arguments)}});q.version="nightly";q.nextid=0;q.inactiveEvents="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" ");q.zindex=2000001;q.defaults={prerender:r,id:r,overwrite:i,suppress:i,content:{text:i,attr:"title",title:{text:r,button:r}},position:{my:"top left",at:"bottom right",target:r,container:r,viewport:r,adjust:{x:0,y:0,mouse:i,resize:i,method:"flip flip"},effect:function(B,C,A){f(this).animate(C,{duration:200,queue:r})}},show:{target:r,event:"mouseenter",effect:i,delay:90,solo:r,ready:r,autofocus:r},hide:{target:r,event:"mouseleave",effect:i,delay:0,fixed:r,inactive:r,leave:"window",distance:r},style:{classes:"",widget:r,width:r,height:r},events:{render:y,move:y,show:y,hide:y,toggle:y,visible:y,focus:y,blur:y}}}(jQuery,window));var pixlr=function(){function windowSize(){var w=0,h=0;if(!(document.documentElement.clientWidth==0)){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight}else{w=document.body.clientWidth;h=document.body.clientHeight}return{width:w,height:h}}function extend(object,extender){var o={};for(var attribute in object){o[attribute]=object[attribute]}for(var attribute in extender){o[attribute]=extender[attribute]||object[attribute]}return o}function buildUrl(opt){var url="http://pixlr.com/"+opt.service+"/?s=c";for(var attribute in opt){if(attribute!=="service"){url+="&"+attribute+"="+escape(opt[attribute])}}return url}var bo={ie:window.ActiveXObject,ie6:window.ActiveXObject&&(document.implementation!=null)&&(document.implementation.hasFeature!=null)&&(window.XMLHttpRequest==null),quirks:document.compatMode==="BackCompat"};return{settings:{service:"editor"},overlay:{show:function(options){var opt=extend(pixlr.settings,options||{});var iframe=document.createElement("iframe"),div=pixlr.overlay.div=document.createElement("div"),idiv=pixlr.overlay.idiv=document.createElement("div");div.style.background="#696969";div.style.opacity=0.8;div.style.filter="alpha(opacity=80)";if((bo.ie&&bo.quirks)||bo.ie6){var size=windowSize();div.style.position="absolute";div.style.width=size.width+"px";div.style.height=size.height+"px";div.style.setExpression("top","(t=document.documentElement.scrollTop||document.body.scrollTop)+'px'");div.style.setExpression("left","(l=document.documentElement.scrollLeft||document.body.scrollLeft)+'px'")}else{div.style.width="100%";div.style.height="100%";div.style.top="0";div.style.left="0";div.style.position="fixed"}div.style.zIndex=2000000;idiv.style.border="1px solid #2c2c2c";if((bo.ie&&bo.quirks)||bo.ie6){idiv.style.position="absolute";idiv.style.setExpression("top","25+((t=document.documentElement.scrollTop||document.body.scrollTop))+'px'");idiv.style.setExpression("left","35+((l=document.documentElement.scrollLeft||document.body.scrollLeft))+'px'")}else{idiv.style.position="fixed";idiv.style.top="25px";idiv.style.left="35px"}idiv.style.zIndex=2000001;document.body.appendChild(div);document.body.appendChild(idiv);iframe.style.width=(div.offsetWidth-70)+"px";iframe.style.height=(div.offsetHeight-50)+"px";iframe.style.border="1px solid #b1b1b1";iframe.style.backgroundColor="#606060";iframe.style.display="block";iframe.frameBorder=0;iframe.src=buildUrl(opt);idiv.appendChild(iframe)},hide:function(callback){if(pixlr.overlay.idiv&&pixlr.overlay.div){document.body.removeChild(pixlr.overlay.idiv);document.body.removeChild(pixlr.overlay.div)}if(callback){eval(callback)}}},edit:function(options){var opt=extend(pixlr.settings,options||{});location.href=buildUrl(opt)},fireMessage:function(detail,id){document.fire(PBMessage.EVENT.NOTIFY,{message:new PBMessage({details:detail,type:PBMessage.MESSAGE_TYPE.SUCCESS}),id:id})}}}();
