var HoverHelper;(function(){var A={initialize:function(){this.triggerSelector=".flyoutContainer";this.flyoutSelector=".flyout";this.hoverClassName="hover";this.mouse=MouseUtil.getInstance();this.mouseOverDelay=0;this.mouseOutDelay=0;this.mouseOverKey="hoverHelperMouseOver";this.mouseOutKey="hoverHelperMouseOut";this.mouseOutIEKey="hoverHelperMouseOutIE";this.mouseOver=this.onMouseOver.bindAsEventListener(this);this.mouseOut=this.onMouseOut.bindAsEventListener(this);this.currentTrigger=null},onMouseOver:function(C){var F=Event.element(C);var D=F.up(this.triggerSelector);var E=this.mouseOverKey+(new Date()).getTime();this.mouse.observe(E);var G=function(){if(this.mouse.isOver(D)){D.addClassName(this.hoverClassName)}this.mouse.stopObserving(E)};setTimeout(G.bind(this),this.mouseOverDelay)},onMouseOut:function(D){var G=Event.element(D);var E=G.up(this.triggerSelector);var C=E.down(this.flyoutSelector);var F=this.mouseOutKey+(new Date()).getTime();this.mouse.observe(F);var H=function(){if(!this.mouse.isOver(E)&&!this.mouse.isOver(C)){E.removeClassName(this.hoverClassName)}else{var J=this.mouseOutIEKey+(new Date()).getTime();var I=function(){if(!this.mouse.isOver(E)&&!this.mouse.isOver(C)){E.removeClassName(this.hoverClassName);this.mouse.stopObserving(J)}};this.mouse.observe(J,I.bind(this))}this.mouse.stopObserving(F)};setTimeout(H.bind(this),this.mouseOutDelay)}};var B={};HoverHelper=Class.create(A);HoverHelper=Object.extend(HoverHelper,B)})();var MouseUtil;(function(){var A={initialize:function(){this.X=null;this.Y=null;this.isActive=false;this.mouseMove=this.onMouseMove.bindAsEventListener(this);this.observers=new Hash()},observe:function(C,D){if(this.observers.keys().length==0){this.startWatching()}this.observers.set(C,D)},stopObserving:function(C){this.observers.unset(C);if(this.observers.keys().length==0){this.stopWatching()}},isOver:function(G,F){if(G==null||typeof G=="undefined"){return false}if(this.X==null||this.Y==null){return false}var D=F||{T:0,R:0,B:0,L:0};var I=Element.cumulativeOffset(G);var H=Element.getDimensions(G);var E=((I.left-D.L<this.X)&&(this.X<(I.left+H.width+D.R)));var C=((I.top-D.T<this.Y)&&(this.Y<(I.top+H.height+D.B)));return(E&&C)},onMouseMove:function(C){this.X=Event.pointerX(C);this.Y=Event.pointerY(C);this.isActive=true;var E=this.observers.values();for(var D=0;D<E.length;D++){var F=E[D];if(typeof F=="function"){F(C)}}},startWatching:function(){Event.observe(document.body,"mousemove",this.mouseMove)},stopWatching:function(){Event.stopObserving(document.body,"mousemove",this.mouseMove);this.reset()},reset:function(){this.X=null;this.Y=null;this.isActive=false}};var B={};Controller.create("MouseUtil",A,B)})();var Bubble=Class.create(PBLayeredPanel,{pbType:"Bubble",initialize:function($super,A){$super(A.elemId);this.id=A.elemId||null;this.targetId=A.targetId||null;this.targetElem=$(this.targetId);this.posOffset=A.posOffset||null;this.eventOn=A.eventOn||null;this.eventOff=A.eventOff||null;this.callbackOn=A.callbackOn||null;this.callbackOff=A.callbackOff||null;this.callbackClose=A.callbackClose||null;this.offsetX=A.offsetX||0;this.offsetY=A.offsetY||0;this.useWindow=A.useWindow||null;if(this.targetElem){if(this.eventOn){if(this.useWindow){Event.observe(this.useWindow,this.eventOn,this.handleBubbleShow.bindAsEventListener(this),false)}else{Event.observe(this.targetElem,this.eventOn,this.handleBubbleShow.bindAsEventListener(this),false)}}if(this.eventOff){Event.observe(this.targetElem,this.eventOff,this.handleBubbleHide.bindAsEventListener(this),false)}}var B=$$("#"+this.elemId+" .closebox");if(B!="undefined"&&B!=null&&B.length>0){B=B[0];Event.observe(B,"click",this.handleCloseLink.bindAsEventListener(this),false)}this.setPosition()},handleBubbleShow:function(C){var B=this.getEventLink(C);var A=true;if(B&&typeof (B.tagName)!="undefined"&&B.tagName=="A"){A=false}if(typeof (this.callbackOn)!="function"||this.callbackOn(C)){this.setPosition();Element.show(this.elem)}return A},handleBubbleHide:function(C){var B=this.getEventLink(C);var A=true;if(B&&typeof (B.tagName)!="undefined"&&B.tagName=="A"){A=false}if(typeof (this.callbackOff)!="function"||this.callbackOff(C)){Element.hide(this.elem)}return A},handleCloseLink:function(A){if(typeof (this.callbackClose)!="function"||this.callbackClose()){Element.hide(this.elem)}return false},show:function(){return this.handleBubbleShow(null)},hide:function(){return this.handleBubbleHide(null)},close:function(){return this.handleCloseLink(null)},getEventLink:function(A){return(A&&A.type=="click")?Event.findElement(A,"A"):null},setPosition:function(){if(this.elem&&!Element.visible(this.elem)&&this.targetElem){if(this.posOffset){var C=Element.positionedOffset(this.targetElem)}else{var C=Element.cumulativeOffset(this.targetElem)}var B=this.elem.style;var A=B.visibility;B.visibility="hidden";Element.show(this.elem);B.left=C.left-this.elem.offsetWidth+this.offsetX+"px";B.top=C.top+this.offsetY+"px";B.visibility=A;Element.hide(this.elem)}}});var BubbleController=Class.create({initialize:function(){this.bubbles={};this.currentBubble=null;for(var A=0;A<arguments.length;A++){this.addBubble(arguments[A])}},addBubble:function(A){if(A.pbType&&A.pbType=="Bubble"){this.bubbles[A.id]=A}},close:function(B){var A=this.bubbles[B];if(typeof (A)!="undefined"){this.closeBubble(A)}},hide:function(B){var A=this.bubbles[B];if(typeof (A)!="undefined"){this.hideBubble(A)}},show:function(B){var A=this.bubbles[B];if(typeof (A)!="undefined"){this.showBubble(A)}},getBubbleByTargetId:function(D){var B=null;for(var C in this.bubbles){var A=this.bubbles[C];if(A.targetId==D){B=A;break}}return B},getBubbleByElementId:function(D){var B=null;for(var C in this.bubbles){var A=this.bubbles[C];if(A.elemId==D){B=A;break}}return B},showBubble:function(A){if(this.currentBubble&&this.currentBubble!==A){this.currentBubble.hide()}if(A){A.show()}this.currentBubble=A},hideBubble:function(A){if(A){A.hide()}if(A===this.currentBubble){this.currentBubble=null}},closeBubble:function(A){if(A){A.close()}if(A===this.currentBubble){this.currentBubble=null}}});var CatController;(function(){var A={bindHandlers:function(){if(photobucket.browser.isIE6){this.triggerSelector=".listFindStuffCategories li";this.flyoutSelector=".bttnSeeMore";var D=$$(this.triggerSelector+" .trigger");for(var E in D){var C=D[E];if(C&&C.tagName&&C.tagName.toLowerCase()=="a"){Event.observe(C,"mouseover",this.mouseOver);Event.observe(C,"mouseout",this.mouseOut)}}}}};var B={};Controller.create("CatController",A,B,HoverHelper)})();var CollapseableHeaderPromo=Class.create({initialize:function(){var B=$$(".collapseableHeaderPromo .closebox"),A;for(A=0;A<B.length;A++){Event.observe(B[A],"click",this.handleCloseClick.bindAsEventListener(this),false)}},handleCloseClick:function(C){var B=Event.element(C);var A=Element.up(B,".collapseableHeaderPromo");if(typeof (A)!="undefined"&&A){Effect.toggle(A,"blind")}return false}});var NotifyController;(function(){var publicMembers={form:null,idPrefix:null,deleteNotifyLI:null,deleteNotifyUL:null,noSubscriptionTextId:"containerUserSubscriptions",listPanelId:null,listPanelDivId:null,listPanelHeightMargin:"30",progress:null,warnInvalidEmail:false,viewerAlbumUrl:null,type:null,toggleButton:false,toggleButtonId:null,initialize:function(){Event.observe(document,NotifyController.EVENT.ADD,this.addSubscription.bindAsEventListener(this));Event.observe(document,NotifyController.EVENT.EDIT,this.editSubscription.bindAsEventListener(this));Event.observe(document,NotifyController.EVENT.SUBMIT,this.handleSubmitClick.bindAsEventListener(this));Event.observe(document,NotifyController.EVENT.DELETE,this.handleDeleteNotification.bindAsEventListener(this));Event.observe(document,NotifyController.EVENT.REGISTERBUTTON,this.registerButton.bindAsEventListener(this))},mixIn:function(cfg){for(var n in cfg){this[n]=cfg[n]}if(this.id){this.form=$(this.id);this.progress=new PBProgress({parentId:this.id,themed:true})}if(this.warnInvalidEmail){this.fireErrorMessage('WARNING: Our records show that your current email address is invalid.  You can change your email by going to your <a href="'+this.viewerAlbumUrl+'?action=accountoptions">account options</a>.')}},addSubscription:function(evt){if(!evt.memo.email){evt.memo.edit=0;evt.memo.returnUrl=document.location.href;this.fireLightboxByEditType(evt.memo)}else{this.forceSubscription(evt)}},forceSubscription:function(evt){this.type=evt.memo.type;var params="notify[comments]=true&notify[uploads]=true";params+="&notify[email]="+evt.memo.email;if(evt.memo.isRec){params+="&notify[isRec]=true"}if(evt.memo.type=="search"){params+="&notify[term]="+escape(evt.memo.term.replace(/['"]/g,""));params+="&notify[subname]="+escape(evt.memo.term.replace(/['"]/g,""))}else{if(evt.memo.type=="user"){params+="&notify[ownername]="+evt.memo.title;params+="&notify[subname]="+escape(evt.memo.title.replace(/['"]/g,""))}else{if(evt.memo.type=="group"){params+="&notify[ownername]="+evt.memo.ownername;params+="&notify[subname]="+escape(evt.memo.title.replace(/['"]/g,""))}}}new Ajax.Request("/subscribe/"+this.type,{method:"POST",parameters:params,evalJSON:"force",onSuccess:this.handleSubmit.bindAsEventListener(this)});this.flipButtonState()},editSubscription:function(evt){evt.memo.edit=1;this.fireLightboxByEditType(evt.memo)},fireLightboxByEditType:function(memo){if(PBLightbox.getInstance().panel.active){document.fire(PBLightbox.EVENT.DEACTIVATE)}this.type=memo.type;var contentVars="/subscriptionpanel/";contentVars+=(this.type==NotifyController.TYPE.SEARCH)?"search":"album";contentVars+="?"+Object.toQueryString(memo);document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:contentVars,cache:false})},handleSubmitClick:function(evt){document.fire(PBLightbox.PBMessage.EVENT.CLOSE);if(!this.getFormValue("email")){this.fireErrorMessage("Please enter a valid email address.");return }if(this.isLoggedIn){if(!this.getFormValue("subname").replace(/^\s+/,"")){this.fireErrorMessage("Please enter a name.");return }if(this.getFormValue("subname").search(/[^\w- ]+/)>=0){this.fireErrorMessage("Names can only contain a-z, A-Z, 0-9, dashes, underscores, and spaces.");return }}else{if(!this.getFormValue("secret")){this.fireErrorMessage("Please try typing the code below again");return }}document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);new Ajax.Request("/subscribe/"+this.type,{method:"POST",parameters:Form.serialize(this.form),evalJSON:"force",onSuccess:this.handleSubmit.bindAsEventListener(this)});this.flipButtonState()},handleSubmit:function(resp){var responseText=resp.responseText;var ro=resp.responseJSON;if(ro){if(ro.response.stat=="ok"){if(ro.response.reload){document.location.reload(true)}else{document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE);document.fire(PBLightbox.EVENT.DEACTIVATE);document.fire(PBMessage.EVENT.NOTIFY,{message:new PBMessage({type:PBMessage.MESSAGE_TYPE.SUCCESS,title:ro.response.message.title,details:ro.response.message.details})});$("MessagePanel").scrollTo()}}else{if(ro.response.captchaKey){var key=ro.response.captchaKey;this.getFormElt("captcha").src="/captcha.php?session="+key;this.getFormElt("captchaKey").value=key;this.getFormElt("secret").value=""}document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:this.getMessage(ro)})}}else{document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"Fatal Error",details:"No JSON response."})})}},handleDeleteNotification:function(evt){if(confirm("Are you sure you want to stop following this album? You will no longer receive notifications.")){var showProcessing=false;var obj=$(evt.memo.liObj);if(obj){this.deleteNotifyLI=evt.memo.liObj;this.listPanelDivId=evt.memo.listPanelDivId;this.listPanelId=evt.memo.listPanelId;this.listPanelOn=evt.memo.listPanelOn;this.deleteNotifyUL=$(this.deleteNotifyLI).up("ul");showProcessing=true}this.sendDeleteNotificationRequest(evt.memo.unsubscribeLink,showProcessing)}},sendDeleteNotificationRequest:function(unsubscribeLink,showProcessing){unsubscribeLink=unsubscribeLink.replace(/http:\/\/photobucket.com/i,"");var cacheBuster=Math.floor(Math.random()*10001);var params="type=edit&cb="+cacheBuster;if(showProcessing){Element.show("deleteNotificationProcessing")}new Ajax.Request(unsubscribeLink,{method:"GET",parameters:params,onSuccess:this.handleDeleteNotificationRequestSuccess.bindAsEventListener(this),onFailure:this.handleDeleteNotificationRequestFailure.bindAsEventListener(this)})},handleDeleteNotificationRequestSuccess:function(request){var responseText=request.responseText;var json=eval("("+responseText+")");if(json.response.stat=="ok"){document.location.reload(true)}else{this.showDeleteNotifyErrorMessage()}},handleDeleteNotificationRequestFailure:function(request){Element.hide("deletedNotificationProcessing");this.showBlockErrorMessage()},showDeleteNotifyErrorMessage:function(){document.fire(PBMessage.EVENT.NOTIFY,{id:"deleteNotifyMessagePanel",message:new PBMessage({details:"There was a problem deleting the subscription.",type:PBMessage.MESSAGE_TYPE.ERROR})})},getFormValue:function(suffix){return $F(this.getFormId(suffix))},getFormElt:function(suffix){return $(this.getFormId(suffix))},getFormId:function(suffix){if(this.idPrefix){return this.idPrefix+"_"+suffix}else{return suffix}},isFieldChecked:function(suffix){var elt=this.getFormElt(suffix);if(!elt){return false}else{return elt.checked}},getMessage:function(ro){var m;if(ro.response.stat=="ok"){m=new PBMessage(ro.response.message);m.type=PBMessage.MESSAGE_TYPE.SUCCESS}else{m=new PBMessage(ro.response.message);m.type=PBMessage.MESSAGE_TYPE.ERROR}return m},toggleSubscriptionBoxOff:function(){$(this.listPanelId).remove();this.listPanelOn=false;return },setPanelSize:function(size){$(this.listPanelId).setStyle({height:size});return },fireErrorMessage:function(detailsStr){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Attention",details:detailsStr,type:PBMessage.MESSAGE_TYPE.ERROR})});return },registerButton:function(evt){this.toggleButton=true;this.toggleButtonId=evt.memo.inputId},flipButtonState:function(){if(this.toggleButton){var aBttn=$(this.toggleButtonId);aBttn.onclick="";aBttn.innerHTML="Following";aBttn.addClassName("disabled")}else{$$(".notifyContainer."+this.type).each(function(elem){elem.addClassName("subscribed")})}}};var staticMembers={EVENT:{ADD:"NotifyController:add",EDIT:"NotifyController:edit",SUBMIT:"NotifyController:submit",DELETE:"NotifyController:delete",REGISTERBUTTON:"NotifyController:registerbutton"},TYPE:{USER:"user",GROUP:"group",SEARCH:"search"}};Controller.create("NotifyController",publicMembers,staticMembers)})();var BlockUserController=Class.create();BlockUserController.prototype={isGroup:false,ownerId:null,allUsersBlocked:false,staticBlockLink:null,albumURL:null,unBlockUL:null,unBlockSingleLI:null,blockUL:null,blockSingleLI:null,confirmText:null,blockText:null,listPanelOn:false,listPanelDivId:null,listPanelId:null,blockedHeaderTextId:"blockedHeaderText",blockedLinkTextId:"staticBlockLink",noSubscriberTextId:"containerUserSubscribers",fromEditSubscription:false,listPanelHeightMargin:"30",somethingChangedOnGroupOptionForm:false,initialize:function(A){for(var B in A){this[B]=A[B]}if(this.isGroup==0){this.confirmText="albums.";this.blockText=" my albums"}else{this.confirmText="group album.";this.blockText=" this group album"}this.staticBlockLink=$("staticBlockLink")},handleSingleUnblock:function(C,B,A,E,D){if(confirm("Are you sure you want to unblock this user?  Doing so will allow this user the ability to comment on or follow your "+this.confirmText)){this.unBlockSingleLI=C;this.unBlockUL=$(this.unBlockSingleLI).up("ul");this.sendUnblockSingleRequest(B,A,E,D)}},sendUnblockSingleRequest:function(B,A,E,C){var D="action=singleunblock&blockingId="+B+"&blockedId="+A+"&userType="+E+"&albumType="+C;Element.show("blockedCommentsProcessing");new Ajax.Request(this.albumURL,{method:"GET",parameters:D,onSuccess:this.handleSendUnblockSingleRequestSuccess.bind(this),onFailure:this.handleSendUnblockSingleRequestFailure.bind(this)})},handleSendUnblockSingleRequestSuccess:function(request){var responseText=request.responseText;var json=eval("("+responseText+")");Element.hide("blockedCommentsProcessing");if(json.response.stat=="ok"&&json.response.msg=="user unblocked"){document.location.reload(true)}else{this.showBlockErrorMessage()}},handleSendUnblockSingleRequestFailure:function(A){Element.hide("blockedCommentsProcessing");this.showBlockErrorMessage()},handleSingleBlock:function(){if(confirm("Are you sure you want to block this user?  Doing so will not allow this user the ability to comment on or follow your "+this.confirmText)){if(arguments.length>1){this.blockSingleLI=arguments[0];this.blockUL=$(this.blockSingleLI).up("ul");this.sendBlockSingleRequest(arguments[1],arguments[2],arguments[3])}else{var A=arguments[0];this.sendBlockSingleRequest(A.v,A.b,A.type)}}},sendBlockSingleRequest:function(C,B,A){var E="id="+C;if(A=="nonuser"){E+="&s_id="+B}else{E+="&b_id="+B}E+="&isGroup="+this.isGroup;var D=$("blockedSubscribersProcessing");if(D){Element.show("blockedSubscribersProcessing")}new Ajax.Request("/singleblock",{method:"GET",parameters:E,onSuccess:this.handleSendBlockSingleRequestSuccess.bind(this),onFailure:this.handleSendBlockSingleRequestFailure.bind(this)})},handleSendBlockSingleRequestSuccess:function(request){var responseText=request.responseText;var json=eval("("+responseText+")");var obj=$("blockedSubscribersProcessing");if(obj){Element.hide("blockedSubscribersProcessing")}if(json.response.stat=="ok"){document.location.reload(true)}else{this.showBlockErrorMessage()}},handleSendBlockSingleRequestFailure:function(A){Element.hide("blockedCommentsProcessing");this.showBlockErrorMessage()},loadLBText:function(){var C=$("blockConfirmHeader");var B=$("blockConfirmText");if(this.isGroup==1){this.somethingChangedOnGroupOptionForm=(somethingChanged)}var A=(this.somethingChangedOnGroupOptionForm)?" and save your group album options?":"?";if(!this.allUsersBlocked){C.innerHTML="Block all users";B.innerHTML="Are you sure you want to block ALL users"+A+"<br/><br/>Doing so will remove all comments and followers from your "+this.confirmText}else{C.innerHTML="Unblock all users";B.innerHTML="Are you sure you want to unblock ALL users"+A+"<br/><br/>Doing so will allow users the ability to comment on or follow your "+this.confirmText}return },handleBlockLinkToggle:function(A){this.sendBlockToggleAjaxRequest()},sendBlockToggleAjaxRequest:function(){var B=Math.floor(Math.random()*10001);var A=(this.allUsersBlocked)?"/unblockall/":"/blockall/";A+=this.ownerId;var C="isGroup="+this.isGroup+"&cb="+B;new Ajax.Request(A,{method:"GET",parameters:C,onSuccess:this.handleToggleBlockSuccess.bind(this),onFailure:this.handleToggleBlockFailure.bind(this)})},handleToggleBlockSuccess:function(request){var responseText=request.responseText;var json=eval("("+responseText+")");if(json.response.stat=="ok"&&json.response.msg=="save success"){this.allUsersBlocked=json.response.blocked;document.fire(PBLightbox.EVENT.DEACTIVATE);if(this.somethingChangedOnGroupOptionForm){$("createalbumform").submit()}else{window.location.reload(true)}}else{this.showBlockErrorMessage()}},handleToggleBlockFailure:function(A){this.showBlockErrorMessage()},toggleBlockLinkText:function(){if(this.allUsersBlocked&&this.listPanelOn){this.toggleBlockBoxOff()}if(!this.fromEditSubscription){var C=(this.allUsersBlocked)?"NO other users can comment on or subscribe to":"ALL users CAN comment on or subscribe to";$(this.blockedHeaderTextId).innerHTML=C+this.blockText;var A=(this.allUsersBlocked)?"Unblock all users":"Block all users"}else{var B=(this.allUsersBlocked)?"<p>No other users can comment on or subscribe to your albums.</p>":"<p>No one is subscribed to your albums.</p>";$(this.listPanelDivId).innerHTML=B;var A=(this.allUsersBlocked)?"Unblock all users":"Block all users from commenting on and subscribing to my albums"}this.staticBlockLink.innerHTML=A;return },toggleBlockBoxOff:function(){$(this.listPanelId).remove();this.listPanelOn=false;$(this.listPanelDivId).addClassName("noBlockedUsers");return },toggleSubscribeBoxOff:function(){$(this.listPanelId).remove();this.listPanelOn=false;return },setPanelSize:function(A){$(this.listPanelId).setStyle({height:A});return },showBlockErrorMessage:function(){controllerMessagePanel.printMessage({message:"Attention",details:"There was a problem saving your settings.  Please try again later.",type:"error"});Element.scrollTo("MessagePanel")}};var ThumbHoverController;(function(){var A={initialize:function(){$$(".thumbContainer").each(function(D){new B(D)})}};var C={};Controller.create("ThumbHoverController",A,C);var B=Class.create({cn:"hover",initialize:function(D){this.thumb=D;jq(this.thumb).hoverIntent({over:this.onThumb.bind(this),out:this.offThumb.bind(this)})},onThumb:function(D){this.thumb.addClassName(this.cn)},offThumb:function(D){this.thumb.removeClassName(this.cn)}})})();