function createCookie(C,D,E){if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));var A="; expires="+B.toGMTString()}else{var A=""}document.cookie=C+"="+D+A+"; path=/; domain= .photobucket.com"}function readCookie(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length)}if(E.indexOf(D)==0){return E.substring(D.length,E.length)}}return null}var BubblesController=Class.create();BubblesController.prototype={listCtrlsBubbles:null,eltCurrentBubble:null,targetIdAttribute:"targetId",idBubble:null,initialize:function(){var C,E,A,F,D;this.listCtrlsBubbles=new Object();var B=arguments;if(arguments.length==1){B=$A(arguments[0])}$A(B).each(function(G){this.addBubble(G)},this)},addBubble:function(B){var C=null;if(typeof (B)=="object"&&typeof (B.idTarg)=="string"&&typeof (B.idBubble)=="string"&&B.idTarg&&B.idBubble&&(eltTarg=$(B.idTarg))!=null&&(eltBbl=$(B.idBubble))!=null){this.idBubble=B.idBubble;if(typeof (B.eventOn)=="string"){Event.observe(eltTarg,B.eventOn,this.handleBubbleShow.bindAsEventListener(this),false)}if(typeof (B.eventOff)=="string"){Event.observe(eltTarg,B.eventOff,this.handleBubbleHide.bindAsEventListener(this),false)}var A;if((A=$$("#"+eltBbl.id+" .closebox"))!=null){Event.observe(A[0],"click",this.handleCloseLink.bindAsEventListener(this),false);if(A[0].attributes[this.targetIdAttribute]){A[0].attributes[this.targetIdAttribute].value=B.idTarg}}this.listCtrlsBubbles[B.idTarg]=new Object();this.listCtrlsBubbles[B.idTarg].bubble=eltBbl;if(typeof (B.callbackOn)=="function"){this.listCtrlsBubbles[B.idTarg].callbackOn=B.callbackOn}if(typeof (B.callbackOff)=="function"){this.listCtrlsBubbles[B.idTarg].callbackOff=B.callbackOff}if(typeof (B.callbackClose)=="function"){this.listCtrlsBubbles[B.idTarg].callbackClose=B.callbackClose}if(photobucket.browser.isIE6){this.appendIframe(eltBbl)}}},handleBubbleShow:function(E){var C=Event.element(E);var D=Event.findElement(E,"A");var A=true,B;if(E.type=="click"&&D&&typeof (D.tagName)!="undefined"&&D.tagName=="A"){A=false}if(typeof (C.id)!=="undefined"){if(typeof (this.listCtrlsBubbles[C.id].callbackOn)!="function"||this.listCtrlsBubbles[C.id].callbackOn()){B=this.listCtrlsBubbles[C.id].bubble;this.showBubble(B)}}return A},handleBubbleHide:function(D){var B=Event.element(D);var C=Event.findElement(D,"A");var A=true;if(D.type=="click"&&C&&typeof (C.tagName)!="undefined"&&C.tagName=="A"){A=false}if(typeof (this.listCtrlsBubbles[B.id].callbackOff)!="function"||this.listCtrlsBubbles[B.id].callbackOff()){eltBubble=this.listCtrlsBubbles[B.id].bubble;this.hideBubble(eltBubble)}return A},handleCloseLink:function(D){var C=Event.findElement(D,"A");var A=C.attributes[this.targetIdAttribute];if(C&&C.parentNode&&C.parentNode.parentNode){if(!A||typeof (this.listCtrlsBubbles[A.value].callbackClose)!="function"||this.listCtrlsBubbles[A.value].callbackClose()){var B=C.parentNode.parentNode;this.hideBubble(B)}}return false},showBubble:function(A){if(this.eltCurrentBubble&&this.eltCurrentBubble!==A){Element.hide(this.eltCurrentBubble)}if(A){Element.show(A)}this.eltCurrentBubble=A},hideBubble:function(A){if(A){Element.hide(A)}if(A===this.eltCurrentBubble){this.eltCurrentBubble=null}},getDimensionsOfChild:function(F,C){var D=F.style;var I=D.visibility;var G=D.position;var B=D.display;D.visibility="hidden";D.position="absolute";D.display="block";var H=C.style;var A=C.offsetWidth;var E=C.offsetHeight;D.display=B;D.position=G;D.visibility=I;return{width:A,height:E}},appendIframe:function(A){var C=A.select(".bubble_content")[0];var B=document.createElement("iframe");B.setAttribute("src","");B.className="iframe";var D=this.getDimensionsOfChild(A,C);B.setAttribute("width",D.width-1);B.setAttribute("height",D.height-1);B.setAttribute("FRAMEBORDER",0);A.appendChild(B);C.addClassName("withIframe")},hide:function(A){var B=null;if(typeof (B=this.listCtrlsBubbles[A])!="undefined"){B=B.bubble}if(B){this.hideBubble(B)}},show:function(A){var B=null;if(typeof (B=this.listCtrlsBubbles[A])!="undefined"){B=B.bubble}if(B){this.showBubble(B)}}};var ThemePreviewController;(function(){var A={initialize:function(){this.previewTheme=null;this.hasOtherAlbums=false;this.cancelUrl=null;this.skipUrl=null;this.otherAlbumsFormId="otherAlbums";this.editAction="&action=themeadd&tab=2";this.saveAction="&action=themechoose";this.saveMessage=null;this.saveHandler=this.onSaveResponse.bindAsEventListener(this);this.saveOthersHandler=this.onSaveOthersResponse.bindAsEventListener(this);Event.observe(document,ThemePreviewController.EVENT.REMOVE,this.remove.bindAsEventListener(this));Event.observe(document,ThemePreviewController.EVENT.SAVE,this.save.bindAsEventListener(this));Event.observe(document,ThemePreviewController.EVENT.EDIT,this.edit.bindAsEventListener(this));Event.observe(document,ThemePreviewController.EVENT.SKIP,this.skip.bindAsEventListener(this));Event.observe(document,ThemePreviewController.EVENT.SAVE_OTHERS,this.saveOthers.bindAsEventListener(this));Event.observe(document,ThemePreviewController.EVENT.SELECT_ALL,this.selectAll.bindAsEventListener(this));Event.observe(document,ThemePreviewController.EVENT.DESELECT_ALL,this.deselectAll.bindAsEventListener(this))},setTheme:function(E,D,C){this.previewTheme=E;this.saveAction=(this.previewTheme.themeId)?"&action=themechoose":"&action=themesavecustom";if(D==""){this.cancelUrl=null}else{if(D==-1){this.cancelUrl=this.serializeTheme()+this.editAction}else{if(D!=null){this.cancelUrl=D}else{this.cancelUrl=this.serializeTheme()+this.editAction}}}if(C){this.skipUrl=C}},remove:function(C){if(this.cancelUrl){document.location=this.cancelUrl}else{document.location.href=document.location.pathname}},save:function(C){document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);var D=this.serializeTheme()+this.saveAction;new Ajax.Request(D,{method:"get",evalJSON:"force",onSuccess:this.saveHandler})},onSaveResponse:function(D){var C=this.getMessage(D);this.saveMessage=this.getSaveMessage(D);if(this.hasOtherAlbums){var G=D.responseJSON.response;var E=G.themeId;if(E&&!this.previewTheme.themeId){this.previewTheme.themeId=E}var F=$("newThemeIcon");if(F&&G.themeIcon){F.innerHTML=G.themeIcon}document.fire(PBLightbox.EVENT.DEACTIVATE);document.fire(PBLightbox.EVENT.ACTIVATE,{transparent:true,top:100,showCloseX:false,content:"themeOtherAlbums"});document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:C})}else{document.fire(PBLightbox.EVENT.DEACTIVATE);if(this.saveMessage){document.fire(PBMessage.EVENT.NOTIFY,{message:this.saveMessage})}else{document.fire(PBMessage.EVENT.NOTIFY,{message:C})}}document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE)},edit:function(C){document.location=this.serializeTheme()+this.editAction},skip:function(C){if(this.skipUrl){document.location=this.skipUrl}document.fire(PBLightbox.EVENT.DEACTIVATE);if(this.saveMessage){document.fire(PBMessage.EVENT.NOTIFY,{message:this.saveMessage});this.saveMessage=null}},saveOthers:function(C){this.saveAction=(this.previewTheme.themeId)?"&action=themechoose":"&action=themesavecustom";var D=this.serializeTheme()+this.saveAction;var G=$(this.otherAlbumsFormId);var H=false;for(var E=0;E<G.elements.length;E++){var F=G.elements[E];if(F.checked){D+="&albumLoc[]="+G.elements[E].value;H=true}}if(H){document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE);new Ajax.Request(D,{method:"get",evalJSON:"force",onSuccess:this.saveOthersHandler})}else{this.skip(C)}},onSaveOthersResponse:function(C){if(this.skipUrl){this.skip()}else{document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE);document.fire(PBLightbox.EVENT.DEACTIVATE);this.saveMessage=this.getSaveMessage(C);if(this.saveMessage){document.fire(PBMessage.EVENT.NOTIFY,{message:this.saveMessage})}else{document.fire(PBMessage.EVENT.NOTIFY,{message:this.getMessage(C)})}}},selectAll:function(C){var E=$(this.otherAlbumsFormId);for(var D=0;D<E.elements.length;D++){E.elements[D].checked=true}},deselectAll:function(C){var E=$(this.otherAlbumsFormId);for(var D=0;D<E.elements.length;D++){E.elements[D].checked=false}},getMessage:function(D){var C;var E=D.responseJSON;if(E&&E.response.stat=="ok"){C=new PBMessage({title:"Theme Saved",details:"",type:PBMessage.MESSAGE_TYPE.SUCCESS})}else{C=new PBMessage({title:"Failed to save theme.",details:"",type:PBMessage.MESSAGE_TYPE.ERROR})}return C},getSaveMessage:function(D){var C=null;var E=D.responseJSON;if(E&&E.response.stat=="ok"&&E.response.message){C=new PBMessage(E.response.message)}return C},serializeTheme:function(){var C="?";if(this.previewTheme.themeId){C+="previewTheme="+this.previewTheme.themeId}else{if(this.previewTheme.palette&&this.previewTheme.palette.id){C+="customTheme[palette_id]="+this.previewTheme.palette.id}if(this.previewTheme.border&&this.previewTheme.border.id){C+="&customTheme[border_id]="+this.previewTheme.border.id}if(this.previewTheme.background){if(this.previewTheme.background.id){C+="&customTheme[background_id]="+this.previewTheme.background.id}if(this.previewTheme.background.url){C+="&customTheme[background_url]="+this.previewTheme.background.url}if(this.previewTheme.background["class"]){C+="&customTheme[background_position]="+this.previewTheme.background["class"]}}}return C}};var B={EVENT:{REMOVE:"ThemePreviewController:remove",SAVE:"ThemePreviewController:save",EDIT:"ThemePreviewController:edit",SKIP:"ThemePreviewController:skip",SAVE_OTHERS:"ThemePreviewController:save_others",SELECT_ALL:"ThemePreviewController:select_all",DESELECT_ALL:"ThemePreviewController:deselect_all"}};Controller.create("ThemePreviewController",A,B)})();var PBLayeredPanel=Class.create({iframe:null,height:null,width:null,transparent:"0",opaque:"65",opacity:null,backgroundcolor:"#000",nofilter:false,initialize:function(A){this.elemId=A;this.elem=$(this.elemId);this.opacity=this.opaque;if(photobucket.browser.isIE6){this.appendIframe()}},setWidth:function(A){this.width=A;if(this.iframe){this.iframe.width=A;this.writeIframeContent()}},setHeight:function(A){this.height=A;if(this.iframe){this.iframe.height=A;this.writeIframeContent()}},setOpacity:function(A){this.opacity=A;if(this.iframe){this.writeIframeContent()}},makeTransparent:function(){this.setOpacity(this.transparent)},makeOpaque:function(){this.setOpacity(this.opaque)},setBackgroundcolor:function(A){this.backgroundcolor=A;if(this.iframe){this.writeIframeContent()}},writeIframeContent:function(){var B=null;if(this.iframe){B=this.iframe.contentWindow.document;if(B){if(B.documentElement){B.replaceChild(B.createElement("html"),B.documentElement)}B.open();var A="";if(!this.nofilter){A=";filter:alpha(opacity="+this.opacity+")"}B.write("<div style='height:"+this.height+";width:"+this.width+A+";background-color:"+this.backgroundcolor+";'></div>");B.close()}}},appendIframe:function(){this.iframe=document.createElement("iframe");this.iframe.id=this.elemId+"PBLayeredPanelIFrame";this.iframe.className="PBLayeredPanelIFrame";this.iframe.setAttribute("frameBorder",0);this.iframe.setAttribute("marginWidth",0);this.iframe.setAttribute("marginHeight",0);this.iframe.setAttribute("scrolling","no");this.iframe.setAttribute("allowtransparency","true");var A=this.getOffsetDimensions();this.height=A.height-1;this.width=A.width-1;this.iframe.height=this.height;this.iframe.width=this.width;Element.insert(this.elem,{top:this.iframe});this.iframe=$(this.iframe);this.elem.addClassName("withIframe");this.writeIframeContent()},removeIframe:function(){if(photobucket.browser.isIE6){this.iframe.remove()}},getOffsetDimensions:function(){var B=this.elem.style;var E=B.visibility;var C=B.position;var A=B.display;B.visibility="hidden";B.position="absolute";B.display="block";var F=this.elem.offsetWidth;var D=this.elem.offsetHeight;B.display=A;B.position=C;B.visibility=E;return{width:F,height:D}}});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;if(this.targetElem){if(this.eventOn){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;if((B=$$("#"+this.elemId+" .closebox"))!=null){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(!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 PBUpload=Class.create({initialize:function(A){this.linkWhiteList={swfuploadCancelButtonId:1,linkErrorPanelClose:1,bttnCopy_album:1,bttnUpload_web:1};this.oldUploadVersionCookie="upload_version";this.uploadVersionCookie="upload_version1";this.uploadVersionCookieLifespan=30;this.panels={};this.config=A;if(!this.config){this.config={}}for(var B in this.config){this[B]=this.config[B]}this.menu=new PBUploadMenu();this.bubbles=new PBUploadBubbles();this.boundBlockClickHander=this.blockClickHandler.bindAsEventListener(this);Event.observe(document,PBUploader.MESSAGE.QUEUE_COMPLETE,this.queueCompleteHandler.bindAsEventListener(this),false);Event.observe(document,PBUploader.MESSAGE.UPLOAD_CANCELED,this.queueCompleteHandler.bindAsEventListener(this),false);Event.observe(document,PBUpload.MESSAGE.ERROR,this.printErrorMessage.bindAsEventListener(this),false);Event.observe(document,PBUpload.MESSAGE.CLEAR_ERROR,this.clearErrorMessage.bindAsEventListener(this),false);Event.observe(document,PBUpload.MESSAGE.DOWNGRADE,this.downgradeHandler.bindAsEventListener(this),false);Event.observe(document,PBUpload.MESSAGE.OPTIONS_UPDATED,this.handleImageDimsUpdate.bindAsEventListener(this),false);Event.observe(document,PBUploader.MESSAGE.AFTER_SUBMIT,this.uploadStartedHandler.bindAsEventListener(this));Event.observe(document,PBUploader.MESSAGE.BEFORE_UPLOAD_COMPLETE,this.beforeUploadCompleteHandler.bindAsEventListener(this));this.clearOldCookie()},handleImageDimsUpdate:function(D){var C=null;if(typeof (D.memo)!="undefined"&&typeof (D.memo.currentOptionValue)!="undefined"){C=D.memo.currentOptionValue}var B=$("image_size_Local","image_size_Web");for(var A=0;C&&B&&A<B.length;A++){this.setSelectedImageSizeOption(B[A],C)}document.fire(PBUpload.MESSAGE.CLOSE_OPTIONS_PANEL)},uploadStartedHandler:function(A){this.startBlocking();this.track("Start")},queueCompleteHandler:function(A){this.stopBlocking()},beforeUploadCompleteHandler:function(A){this.track("End")},blockClickHandler:function(E){var C=Event.element(E);var D=Event.findElement(E,"A");if(!(C.id in this.linkWhiteList)){var A=C.tagName.toUpperCase();if(A=="IMG"||A=="A"||C.type=="button"||(D&&D.tagName=="A")){var B=confirm("Clicking on this could interrupt your upload.\n\nAre you sure you want to do this?");if(!B){Event.stop(E);this.stopBlocking();return false}}}},handleSuppressReturn:function(A){if(A.keyCode==Event.KEY_RETURN){Event.stop(A)}return true},printErrorMessage:function(A){if(typeof (controllerMessagePanel)!="undefined"){controllerMessagePanel.printMessage({message:A.memo.message,details:A.memo.details,type:PBMessage.MESSAGE_TYPE.ERROR})}},clearErrorMessage:function(){if(typeof (controllerMessagePanel)!="undefined"){controllerMessagePanel.clearMessage()}},downgradeHandler:function(A){v=(A.memo&&A.memo.noFlash)?0:1;createCookie(this.uploadVersionCookie,v,this.uploadVersionCookieLifespan);var B=window.location.href.replace(/\?first=1/,"");window.location.replace(B)},addPanel:function(C,A){for(var B in this.config){A[B]=A[B]||this.config[B]}this.panels[C]=A;if(typeof A.onAdded=="function"){A.onAdded()}},startBlocking:function(){Event.observe(document,"click",this.boundBlockClickHander,true);this.menu.locked=true},stopBlocking:function(){Event.stopObserving(document,"click",this.boundBlockClickHander,true);this.menu.locked=false},setSelectedImageSizeOption:function(C,B){C.options[C.selectedIndex].selected=false;for(var A=0;A<C.options.length;A++){if(C.options[A].value==B){C.options[A].selected=true}}},clearOldCookie:function(){if(cookieReader(this.oldUploadVersionCookie)){createCookie(this.oldUploadVersionCookie,"",-1)}createCookie("uploadStartTimeCookie","",-1);createCookie("uploadEndTimeCookie","",-1);createCookie("uploadSession","",-1)},track:function(A){var B=new Date();B.setTime(B.getTime());document.cookie="upload"+A+"TimeCookie="+escape(B.getTime())}});PBUpload=Object.extend(PBUpload,{MESSAGE:{DOWNGRADE:"pb:Downgrade",ERROR:"pb:Error",CLEAR_ERROR:"pb:ClearError",OPTIONS_UPDATED:"pb:OptionsUpdated",CLOSE_OPTIONS_PANEL:"pb:CloseOptionsPanel",OPEN_OPTIONS_PANEL:"pb:OpenOptionsPanel",MENU_ITEM_CLICKED:"pb:MenuItemClicked"}});var PBUploadBubbles=Class.create({initialize:function(){this.bubbleCookie="pbuBbbl";this.cookieLifespan=90;this.cookieValDelimeter="|";this.closedBubbles=this.getClosedBubbles();this.initialBubble=null;this.controller=new BubbleController();this.localUploadBubbleElemId="bubbleLocalUploadHelp";Event.observe(document,PBUpload.MESSAGE.MENU_ITEM_CLICKED,this.onMenuItemClicked.bindAsEventListener(this),false);Event.observe(document,"dom:loaded",this.onDOMLoadHandler.bindAsEventListener(this));Event.observe(document,PBUploader.MESSAGE.UPLOAD_DIALOG_OPEN,this.uploadDialogOpenHandler.bindAsEventListener(this),false)},onDOMLoadHandler:function(A){if(this.initialBubble){this.controller.show(this.initialBubble.id)}},onMenuItemClicked:function(B){if(this.controller.currentBubble){this.controller.hide(this.controller.currentBubble.id)}var A=this.controller.getBubbleByElementId(this.getBubbleElementId(B.memo.menuItemIndex));if(A){this.controller.show(A.id)}},setOpen:function(){var A=this.self.controller.getBubbleByElementId(this.elemId);if(this.self.closedBubbles[A.id]){return false}else{return true}},setClosed:function(){var A=this.self.controller.getBubbleByElementId(this.elemId);return this.self.close(A.id)},uploadDialogOpenHandler:function(){var A=this.controller.getBubbleByElementId(this.localUploadBubbleElemId);if(A){this.controller.close(A.id)}},addBubble:function(A,H,D,I,E,B,F,C){var G=new Bubble({elemId:A,targetId:H,eventOn:"click",callbackOn:(D)?this.setOpen.bind({self:this,elemId:A}):null,callbackClose:(I)?this.setClosed.bind({self:this,elemId:A}):null,offsetX:E,offsetY:B,posOffset:typeof (C)=="undefined"?false:C});this.controller.addBubble(G);if(F){this.initialBubble=G}},close:function(A){this.closedBubbles[A]=true;this.setClosedBubbleCookie(A);return true},setClosedBubbleCookie:function(B){var A=readCookie(this.bubbleCookie);if(A&&A.indexOf(B)==-1){A+=this.cookieValDelimeter+B}else{if(!A||A==""){A=B}}createCookie(this.bubbleCookie,A,this.cookieLifespan)},getClosedBubbles:function(){var B={};var D;if(D=readCookie(this.bubbleCookie)){var A=D.split(this.cookieValDelimeter);for(var C=0;C<A.length;C++){B[A[C]]=true}}return B},getBubbleElementId:function(A){return"bubble"+A+"UploadHelp"}});var PBUploadMenu=Class.create({initialize:function(){this.activeUploadPanel=null;this.listPanels=(new Array()).toArray();this.listTabs=(new Array()).toArray();this.locked=false;Event.observe(document,PBUpload.MESSAGE.OPEN_OPTIONS_PANEL,this.moreOptionsHandler.bindAsEventListener(this),false);Event.observe(document,PBUpload.MESSAGE.CLOSE_OPTIONS_PANEL,this.hideMoreOptionsHandler.bindAsEventListener(this),false)},handleUploadMenuItemClick:function(D){if(this.locked){return false}var B=Event.findElement(D,"LI");var A=this.getIdSuffix(B.id);var C;if(A&&!Element.hasClassName(B,"current")&&(C=$("panelUploader_"+A))!=null){this.resetTabsAndPanels();Element.addClassName(B,"current");Element.show(C);this.activeUploadPanel=C;document.fire(PBUpload.MESSAGE.MENU_ITEM_CLICKED,{menuItemIndex:A})}return true},moreOptionsHandler:function(A){APIRequest.track("UPLOAD_MORE_OPTIONS");var C,B;if((C=$("panelUploader_Options"))!=null&&(B=$("groupUploadPanels"))!=null){document.fire(PBUpload.MESSAGE.MENU_ITEM_CLICKED,{menuItemIndex:""});Element.hide(B);Element.show(C)}},hideMoreOptionsHandler:function(B){var D,C;if((D=$("panelUploader_Options"))!=null&&(C=$("groupUploadPanels"))!=null){var A;Element.show(C);Element.hide(D);if(this.activeUploadPanel&&(A=this.getIdSuffix(this.activeUploadPanel.id))!=null){document.fire(PBUpload.MESSAGE.MENU_ITEM_CLICKED,{menuItemIndex:A})}}},addItem:function(C,B){var A=$(C);var D=$(B);if(A!=null&&D!=null){this.listTabs[this.listTabs.length]=D;this.listPanels[this.listPanels.length]=A;Event.observe(D,"click",this.handleUploadMenuItemClick.bindAsEventListener(this),false);if(Element.visible(A)){this.activeUploadPanel=A}}},getIdSuffix:function(B){var A=null;B=B.split("_");if(B.length>=2){A=B[1]}return A},resetTabsAndPanels:function(){var A;for(A=0;A<this.listTabs.length;A++){if(Element.hasClassName(this.listTabs[A],"current")){Element.removeClassName(this.listTabs[A],"current")}}for(A=0;A<this.listPanels.length;A++){if(Element.visible(this.listPanels[A])){Element.hide(this.listPanels[A])}}}});var PBUploadPanel={initialize:function(A){A.id=A.id||"PBUploadPanel";A.bUserPremium=A.bUserPremium||false;A.validImageFiles=A.validImageFiles||new Array();A.formId=A.formId||"";A.formCompleteId=A.formCompleteId||"";A.uploader=null;A.progressPanelId="panelUploader_Progress";for(var B in A){this[B]=A[B]}Event.observe(document,PBUploader.MESSAGE.AFTER_SUBMIT,this.onAfterSubmit.bindAsEventListener(this),false);Event.observe(document,PBUploader.MESSAGE.BEFORE_UPLOAD_COMPLETE,this.onBeforeUploadComplete.bindAsEventListener(this),false);Event.observe(document,PBUploader.MESSAGE.UPLOAD_CANCELED,this.onUploadCanceled.bindAsEventListener(this),false)},onAfterSubmit:function(A){try{var C=A.memo.id;if(C==this.id){this.afterSubmit();uploadController.panels.progress.id=this.id;uploadController.panels.progress.queue=this.upload.queue;this.toggleProgressUI(true)}}catch(B){}},onBeforeUploadComplete:function(A){try{var D=A.memo.id;var B=A.memo.form;if(D==this.id){this.beforeUploadCompleteSubmit(B)}}catch(C){}},onUploadCanceled:function(A){try{var C=A.memo;if(C==this.id){this.toggleProgressUI(false)}}catch(B){}},onAdded:function(A){switch(this.uploadStrategy){case PBUploadPanel.UPLOAD_STRATEGY.SWFUPLOADER:var C={id:this.id,formId:this.formId,formCompleteId:this.formCompleteId,progressContainerId:this.progressContainerId,processId:this.processId,swfUploadConfig:this.getSwfUploadConfig()};for(var B in A){C[B]=A[B]}this.upload=new SwfUploader(C);break;case PBUploadPanel.UPLOAD_STRATEGY.SERIAL:var C={id:this.id,formId:this.formId,formCompleteId:this.formCompleteId};this.upload=new SerialUploader(C);break;default:break}},afterSubmit:function(){},beforeUploadCompleteSubmit:function(A){},toggleProgressUI:function(A,B){if(A){if(B){Element.hide($(this.id))}Element.show($(this.progressPanelId))}else{Element.show($(this.id));Element.hide($(this.progressPanelId))}}};PBUploadPanel=Class.create(PBUploadPanel);PBUploadPanel=Object.extend(PBUploadPanel,{UPLOAD_STRATEGY:{SERIAL:0,SWFUPLOADER:1}});var PBUploadPanelAlbum={fetchLimit:50,preloadCount:20,fetchTriggerPoint:40,totalFileCount:0,multiSelect:true,fetchingMessageIdPrefix:"fetching_",disabledClass:"button_disabled",uploadStrategy:PBUploadPanel.UPLOAD_STRATEGY.SERIAL,initialize:function($super,A){A.formCompleteId=A.formCompleteId||"frmUploadAlbumComplete";A.imageContainerId=A.imageContainerId||"albumImageContainer";A.uploadButtonId=A.uploadButtonId||"bttnCopy_album";A.menuOptionId=A.menuOptionId||"tabUpload_Album";A.progressContainerId=A.progressContainerId||"progressContainer";$super(A);this.id="panelUploader_Album";this.messageElem=null;this.selectedAlbumId=null;this.fetcher=new PBAlbumMediaFetcher({limit:this.fetchLimit});this.fileCounter=0;this.selectionCounter=0;Event.observe(document,PBFile.MESSAGE.THUMBNAIL_LOADED,this.onThumbnailLoaded.bindAsEventListener(this),false);Event.observe(document,PBFetcher.MESSAGE.FETCH_STARTED,this.handleFetchStarted.bindAsEventListener(this),false);Event.observe(document,PBFetcher.MESSAGE.FETCH_COMPLETE,this.handleFetchCompleted.bindAsEventListener(this),false);Event.observe(document,PBUploader.MESSAGE.QUEUE_COMPLETE,this.queueCompleteHandler.bindAsEventListener(this))},queueCompleteHandler:function(A){if(A.memo.queue!==this.upload.queue){return }for(var B in this.upload.queue){this.remove(A,B)}this.toggleProgressUI(false)},onAdded:function($super){$super();this.uploadButton=$(this.uploadButtonId);if(typeof PBUpload!="undefined"){this.firstDisplay=this.handleFirstDisplay.bindAsEventListener(this);Event.observe(document,PBUpload.MESSAGE.MENU_ITEM_CLICKED,this.firstDisplay,false)}},handleFirstDisplay:function(A){if(A.memo.menuItemIndex=="Album"){Event.stopObserving(document,PBUpload.MESSAGE.MENU_ITEM_CLICKED,this.firstDisplay,false);this.switchAlbum()}},select:function(C,D){Event.stop(C);if(!this.multiSelect){var A=this.upload.getFirstIdInQueue();if(A){this.remove(C,A)}}this.selectionCounter++;var B=this.generateFile(D,this.selectionCounter);B.select();this.upload.add(D,B);this.enableUpload();return false},remove:function(B,C){var A=this.upload.queue[C];A.deselect();this.selectionCounter--;this.upload.remove(C);Event.stop(B);if(this.upload.isEmpty()){this.disableUpload()}return false},switchAlbum:function(A){this.fetch();var B=this.getSelectedAlbum();var C=B.value;if(this.selectedAlbumId!=null){$(this.selectedAlbumId).hide()}$(C).show();this.selectedAlbumId=C},onThumbnailLoaded:function(A){var B=A.memo;if(!B.wasPreloaded&&B.count==this.fetchTriggerPoint&&this.fileCounter<this.totalFileCount){this.fetch()}B=null},onUploadCanceled:function($super,A){$super(A);this.selectionCounter=0},handleFetchStarted:function(A){var B=A.memo.custom.targetId;var C=$(B);if(C){this.removeMessage();this.messageElem=document.createElement("div");this.messageElem.setAttribute("id",this.fetchingMessageIdPrefix+B);this.messageElem.className="fetching";var D=document.createTextNode("loading images...");this.messageElem.appendChild(D);C.appendChild(this.messageElem)}},handleFetchCompleted:function(H){var I=H.memo.requestOptions;var D=H.memo.response;if(!D.media){return }var A=D.media.toArray();this.removeMessage();var C=$(I.targetId);var F=C.innerHTML;for(var E=0;E<A.length;E++){F+=this.createImageHTML(A[E])}C.innerHTML=F;var G=0;for(var E=0;E<A.length;E++){var B=A[E];B.count=++G;this.add(B)}},enableUpload:function(){Element.removeClassName(this.uploadButton,this.disabledClass)},disableUpload:function(){Element.addClassName(this.uploadButton,this.disabledClass)},fetch:function(){var B=this.getSelectedAlbum();var A={id:B.value,total:B.attributes.mediaCount.value,fetchParams:{action:"getalbummedia",album:(B.defaultSelected)?null:B.attributes.location.value}};for(var C in this.fetchParams){A.fetchParams[C]=this.fetchParams[C]}this.fetcher.fetch(A)},createImageHTML:function(A){var C=A.id;var B='<a id="'+C+'" media="'+A.type+'" style="display:none" class="imageSelector" ';if(this.group){B+=' href="javascript: void(0);" title="'+A.tURL+'" ';B+=" onclick=\"ffga.loadSelection(event,'"+A.tURL+"','"+C+"');\"> "}else{B+=' href="'+A.mURL+'" title="'+A.tURL+'" ';B+=" onclick=\"return uploadController.panels.album.select(event,'"+C+"');\"> "}B+='<img id="'+C+'_image" src="http://pic.photobucket.com/spacer.gif"/>';B+='<div id="'+C+'_temp" class="temp"></div>';if(this.group){B+='<div id="'+C+'_remove" class="remove" onclick="ffga.panels.album.remove(event,\''+C+"');\"></div>"}else{B+='<div id="'+C+'_remove" class="remove" onclick="uploadController.panels.album.remove(event,\''+C+"');\"></div>"}B+='<div id="'+C+'_add" class="add"></div>';B+="</a>";return B},add:function(A){this.fileCounter++;var C={id:A.id,url:A.mURL,thumb:A.tURL,count:A.count,validExtArray:this.validImageFiles,album:this.album,groupHash:this.groupHash};var B=new PBAlbumFile(C);if(A.count<=this.preloadCount){B.wasPreloaded=true;B.load();B=null}else{B.pollVisibility(this.imageContainerId)}},generateFile:function(E,D){var C=$(E);var A={id:E,url:C.href,thumb:C.title,count:D,validExtArray:this.validImageFiles,album:this.album,groupHash:this.groupHash,media:C.attributes.media.value};var B=new PBAlbumFile(A);return B},beforeUploadCompleteSubmit:function(A){try{this.upload.addCompletionInput(A,"skiptagging","1")}catch(B){return false}return true},getSelectedAlbum:function(){var A=$("albumSelector");return A.options[A.selectedIndex]},removeMessage:function(){if(this.messageElem){Element.remove(this.messageElem);this.messageElem=null}}};PBUploadPanelAlbum=Class.create(PBUploadPanel,PBUploadPanelAlbum);var PBUploadPanelComputer={uploadStrategy:PBUploadPanel.UPLOAD_STRATEGY.SWFUPLOADER,initialize:function($super,A){A.id=A.id||"panelUploader_Local";A.videoThreshold=A.videoThreshold||3000000;A.videoSponsor=A.videoSponsor||"",A.videoBanner=A.videoBanner||false,A.videoPlaying=A.videoPlaying||false;A.videoWidth=A.videoWidth||300;A.videoHeight=A.videoHeight||250;A.swfVersion=A.swfVersion||"9.0.2";A.videoMinFlashVersion=A.videoMinFlashVersion||"9.0.0";A.videoDivId=A.videoDivId||"swfuploadMovieId";A.containerId=A.containerId||"swfuploadContainer";A.moreOptionsLinkId=A.moreOptionsLinkId||"moreUploadOptions_Local";A.msgOptionsLinkId=A.msgOptionsLinkId||"linkUploadOptions_statusmessage";A.downgradeLinkId=A.downgradeLinkId||"oldUploaderLinkId";A.progressPanelId=A.progressPanelId||"panelUploader_Progress";A.adId=A.adId||"panelAdv";A.sponsorVideoId=A.sponsorVideoId||"sponsoredVideo";A.uploadLimit=A.uploadLimit||50;A.validImageFiles=A.validImageFiles.split(",")||new Array();A.validVideoFiles=A.validVideoFiles.split(",")||new Array();A.bUserPremium=A.bUserPremium||false;A.authCookie="pbauth";A.guestCookie="pbguest";A.convertResponseToJSON=A.convertResponseToJSON||true;A.label=A.label||"Choose files";$super(A);if($(this.moreOptionsLinkId)){Event.observe(this.moreOptionsLinkId,"click",this.moreOptionsHandler.bindAsEventListener(this),false)}if($(this.msgOptionsLinkId)){Event.observe(this.msgOptionsLinkId,"click",this.moreOptionsHandler.bindAsEventListener(this),false)}Event.observe(this.downgradeLinkId,"click",this.downgradeHandler.bindAsEventListener(this),false);Event.observe(document,PBUploader.MESSAGE.QUEUE_COMPLETE,this.uploadCompleteHandler.bindAsEventListener(this),false)},afterSubmit:function(){if(this.videoSponsor!=""&&this.upload.totalUploadSize>this.videoThreshold){this.startSponsorVideo()}},uploadCompleteHandler:function(A){var B=A.memo;if(B.from==PBUploadPanelProgress.TYPE&&this.id==B.id){this.toggleProgressUI(false,A)}},moreOptionsHandler:function(){document.fire(PBUpload.MESSAGE.OPEN_OPTIONS_PANEL)},downgradeHandler:function(){if(typeof (window.event)!="undefined"){window.event.returnValue=false}document.fire(PBUpload.MESSAGE.DOWNGRADE)},getSwfUploadConfig:function(){var B=[this.validImageFiles,this.validVideoFiles];var A={upload_url:this.getUploadURL(),flash_url:"/include/swf/uploader/flash9/PBUpload.swf?v="+encodeURIComponent(this.swfVersion),file_size_limit:"100 MB",file_types_description:"Image and Video Files",file_upload_limit:this.uploadLimit,file_queue_limit:this.uploadLimit,file_types:"*."+B.flatten().compact().join(";*."),video_file_types:"*."+this.validVideoFiles.flatten().compact().join(";*."),convertResponseToJSON:this.convertResponseToJSON,label:this.label,buttonWidth:110,buttonHeight:28,transparent:true,multiSelect:true,custom_settings:{auth:decodeURIComponent(readCookie(this.authCookie)),guest:decodeURIComponent(readCookie(this.guestCookie)),selectButtonId:"swfuploadSelectButtonId",validVideoFiles:this.validVideoFiles,bPremiumUser:this.bUserPremium,videoMaxLength:(this.bUserPremium)?10:5,parentId:this.containerId,groupHash:this.groupHash,multiSelect:true,contest:false},debug:(location.search.indexOf("debug=true")>0)};return A},getUploadURL:function(){var A=document.location.href;if(photobucket.browser.isSafari){A=encodeURI(A)}return A},startSponsorVideo:function(){var C=$(this.sponsorVideoId);if(C&&!this.videoPlaying){var A=new SWFObject(this.videoSponsor,this.sponsorVideoId+"Obj",this.videoWidth,this.videoHeight,this.videoMinFlashVersion);A.useExpressInstall("/flash/playerProductInstall.swf");A.addParam("quality","high");A.addParam("menu","false");A.addParam("wmode","transparent");A.addParam("allowScriptAccess","always");if(A.write(C)){this.videoPlaying=true;$(this.adId).hide();C.show();if(this.videoBanner){var B=document.createElement("iframe");B.src=this.videoBanner;B.setAttribute("width","300");B.setAttribute("height","25");B.setAttribute("marginWidth","0");B.setAttribute("marginHeight","0");B.setAttribute("frameBorder","0");B.setAttribute("scrolling","no");Element.insert(C,{top:B})}APIRequest.track("SPONSOR_VIDEO_STARTED")}}},toggleProgressUI:function($super,B,A){$super(B,false);for(var C in A.memo.files){if(A.memo.files[C].isVideo){$(this.videoDivId).style.display="block";break}}}};PBUploadPanelComputer=Class.create(PBUploadPanel,PBUploadPanelComputer);var PBUploadPanelLocalSmall={uploadStrategy:PBUploadPanel.UPLOAD_STRATEGY.SWFUPLOADER,initialize:function($super,A){A.removeParams=A.removeParams||false;A.id=A.id||"panelUploader_LocalSmall";A.swfVersion=A.swfVersion||"9.0.2";A.containerId=A.containerId||"swfuploadContainer";A.uploadLimit=A.uploadLimit||50;A.validImageFiles=A.validImageFiles.split(",")||new Array();A.validVideoFiles=A.validVideoFiles.split(",")||new Array();A.bUserPremium=A.bUserPremium||false;A.authCookie="pbauth";A.guestCookie="pbguest";A.multiSelect=A.multiSelect||false;A.isContest=A.isContest||false;A.convertResponseToJSON=A.convertResponseToJSON||true;A.transparentFlash=A.transparentFlash||false;$super(A)},getSwfUploadConfig:function(){var B=[this.validImageFiles,this.validVideoFiles];var A={upload_url:this.getUploadURL(),flash_url:"/include/swf/uploader/flash9/PBUpload.swf?v="+encodeURIComponent(this.swfVersion),file_size_limit:"100 MB",file_types_description:"Image and Video Files",file_upload_limit:this.uploadLimit,file_queue_limit:0,file_types:"*."+B.flatten().compact().join(";*."),video_file_types:"*."+this.validVideoFiles.flatten().compact().join(";*."),convertResponseToJSON:this.convertResponseToJSON,label:this.label,buttonWidth:90,buttonHeight:23,transparent:this.transparentFlash,custom_settings:{auth:decodeURIComponent(cookieReader(this.authCookie)),guest:decodeURIComponent(cookieReader(this.guestCookie)),selectButtonId:"swfuploadSelectButtonId",validVideoFiles:this.validVideoFiles,bPremiumUser:this.bUserPremium,videoMaxLength:(this.bUserPremium)?10:5,parentId:this.containerId,groupHash:this.groupHash,multiSelect:this.multiSelect,contest:this.isContest},debug:(location.search.indexOf("debug=true")>0)};return A},getUploadURL:function(){var A=(this.removeParams)?document.location.pathname:document.location.href;if(photobucket.browser.isSafari){A=encodeURI(A)}return A}};PBUploadPanelLocalSmall=Class.create(PBUploadPanel,PBUploadPanelLocalSmall);var PBUploadPanelLocalContest={pbtype:"PBUploadPanelLocalContest",flashVideoPlayer:null,initialize:function(A){A.postProcessImageURL=A.postProcessImageURL||false;A.filename=A.filename||false;A.state=(A.filename)?PBUploadPanelLocalContest.STATE.POSTUPLOAD:PBUploadPanelLocalContest.STATE.PREUPLOAD;A.lightbox=A.lightbox||{};A.lightbox.beforeUploadId=A.lightbox.beforeUploadId||null;A.lightbox.afterUploadId=A.lightbox.afterUploadId||null;A.lightbox.obj=null;for(var B in A){this[B]=A[B]}Event.observe(document,PBUploader.MESSAGE.QUEUE_COMPLETE,this.uploadComplete.bindAsEventListener(this));Event.observe(document,PBUploadPanelLocalContest.MESSAGE.ONSUBMIT,this.onSubmit.bindAsEventListener(this));this.onLightboxClosed=this.onInitialLightboxClosed.bindAsEventListener(this);this.validationHandler=this.onSubmitValidation.bindAsEventListener(this);this.uploadResponse=null;if(photobucket.browser.isIE){Event.observe(window,"load",this.onPBPageLoad.bindAsEventListener(this))}else{Event.observe(document,PB.EVENT.PAGE_LOADED,this.onPBPageLoad.bindAsEventListener(this))}},onPBPageLoad:function(A){PBUploader.addMethods({CONTEST:true});this.flashVideoPlayer=$("panelAdv").down("embed",0);if(this.lightbox.beforeUploadId&&this.state==PBUploadPanelLocalContest.STATE.PREUPLOAD){this.loadAndShowLightbox(this.lightbox.beforeUploadId);if(this.flashVideoPlayer){Event.observe(document,PBLightbox.EVENT.DEACTIVATE,this.onLightboxClosed)}}else{if(this.lightbox.afterUploadId&&this.state==PBUploadPanelLocalContest.STATE.POSTUPLOAD){this.addEntryThumbnail();this.loadAndShowLightbox(this.lightbox.afterUploadId)}}},onInitialLightboxClosed:function(A){this.flashVideoPlayer.playPress();Event.stopObserving(document,PBLightbox.EVENT.DEACTIVATE,this.onLightboxClosed)},uploadComplete:function(A){var B=A.memo;if(B.queue&&(B.from==PBUploader.TYPE||B.from==PBUploadPanelProgress.TYPE)){for(var E in B.queue){this.uploadResponse=B.queue[E].uploadResp;this.filename=this.uploadResponse.filename;break}if(this.uploadResponse.stat=="ok"){if(this.postProcessImageURL){var D="&current="+this.filename;var C="&postSaveUrl="+encodeURIComponent(document.location.toString());document.location.href=this.postProcessImageURL+D+C}else{this.addEntryThumbnail();this.loadAndShowLightbox(this.lightbox.afterUploadId)}}else{document.fire(PBUpload.MESSAGE.ERROR,{message:"Attention",details:this.uploadResponse.errormsg})}}},onSubmit:function(A){var B=$(A.memo);var C=B.serialize(true);C.filename=this.filename;new Ajax.Request("/groupcontestsubmit",{method:"get",parameters:C,evalJSON:"force",onSuccess:this.validationHandler,onFailure:this.failureHandler})},onSubmitValidation:function(G){var C={type:PBMessage.MESSAGE_TYPE.ERROR};var F=null;try{var E=G.responseJSON.response;if(E.stat=="ok"){document.location.href="http://"+document.location.hostname+document.location.pathname}else{if(E.fields){F=$("messageError");C.details=(F)?F.innerHTML:"Please fix the following errors and submit your entry again: ";var A=Object.values(E.fields);for(var B=0;B<A.length;B++){C.details+="<div class='error'>"+A[B]+"</div>"}}else{C.details=E.message}document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage(C)})}}catch(D){C.details="We were not able to validate your submission.  Please try again later.";document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage(C)})}},loadAndShowLightbox:function(B){if(B){var A={content:B};document.fire(PBLightbox.EVENT.ACTIVATE,A)}},addEntryThumbnail:function(){var B=$("contestEntry");var A="th_"+this.filename.replace(/\.flv$/i,".jpg");B.src=A;document.fire(ImageUtils.MESSAGE.SCALE,{image:B,maxwidth:160,maxheight:120})}};PBUploadPanelLocalContest=Class.create(PBUploadPanelLocalContest);PBUploadPanelLocalContest=Object.extend(PBUploadPanelLocalContest,{MESSAGE:{ONSUBMIT:"PBUploadPanelLocalContest:ONSUBMIT"},STATE:{PREUPLOAD:0,POSTUPLOAD:1}});function setFlashCookie(B){var A=new Date();A.setTime(A.getTime()+(30*24*60*60*1000));document.cookie="pb_"+B+"=true; expires="+A.toGMTString()+"; path=/"}var PBUploadPanelWeb={webInputCount:3,webInputMax:20,strDefaultWebFileText:"paste web URL here",uploadStrategy:PBUploadPanel.UPLOAD_STRATEGY.SERIAL,initialize:function($super,A){$super(A);this.classInitWebFileInput="noFileWeb";this.formId="frmUploadWeb";this.formCompleteId="frmUploadWebComplete";this.moreOptionsLinkId="moreUploadOptions_Web";this.imageSizeFieldName="image_size";this.id="panelUploader_Web";if($(this.moreOptionsLinkId)){Event.observe(this.moreOptionsLinkId,"click",this.moreOptionsHandler.bindAsEventListener(this),false)}Event.observe(document,PBUploader.MESSAGE.QUEUE_COMPLETE,this.queueCompleteHandler.bindAsEventListener(this))},queueCompleteHandler:function(A){if(A.memo.queue!==this.upload.queue){return }for(var B=0;B<this.webInputMax;B++){var C=$("text_web_"+B);if(C){this.resetWebInput(C)}}this.toggleProgressUI(false)},handleAddMoreInputs:function(B){for(var A=this.webInputCount;A<this.webInputMax;A++){$("text_web_"+A).show()}$("linkAddMore_web").hide();$("linkRemoveMore_web").show();$(this.id).addClassName("autoHeight")},handleRemoveMoreInputs:function(B){for(var A=this.webInputCount;A<this.webInputMax;A++){$("text_web_"+A).hide()}$("linkAddMore_web").show();$("linkRemoveMore_web").hide();$(this.id).removeClassName("autoHeight")},handleWebFileInputFocus:function(B){var A=Event.element(B);if(A!=null){if(A.value==this.strDefaultWebFileText){A.value="";Element.removeClassName(A,this.classInitWebFileInput)}}return true},handleFileInputChange:function(E){var B=Event.element(E);var D=$(this.formId);var A={validExtArray:this.validImageFiles,id:B.value,url:B.value,album:D.album.value,groupHash:this.groupHash};var C=new PBWeb(A);C.validate(this.bUserPremium);if(C.hasInvalidProtocol){document.fire(PBUpload.MESSAGE.ERROR,{message:"Upload Error",details:C.protocolErrorMessage});this.resetWebInput(B);return false}else{if(C.hasInvalidExtension){document.fire(PBUpload.MESSAGE.ERROR,{message:"Upload Error",details:C.fileTypeErrorMessage});this.resetWebInput(B);return false}}this.upload.add(C.id,C);document.body.fire(PBUpload.MESSAGE.CLEAR_ERROR);return true},moreOptionsHandler:function(){document.fire(PBUpload.MESSAGE.OPEN_OPTIONS_PANEL)},onUploadCanceled:function($super,A){$super(A);for(var B=0;B<this.webInputMax;B++){this.resetWebInput($("text_web_"+B))}},afterSubmit:function($super){if(this.upload.isEmpty()){document.fire(PBUploadMessages.ERROR,{message:"Attention",details:"Please select a url to upload."})}else{$super()}},beforeUploadCompleteSubmit:function(A){try{var C;if((C=this.getResizeValue($(this.formId)))!=null){this.upload.addCompletionInput(A,"resize",C)}}catch(B){return false}return true},resetWebInput:function(A){Element.addClassName(A,this.classInitWebFileInput);A.value=this.strDefaultWebFileText},getResizeValue:function(C){var B=C[this.imageSizeFieldName];var A=B.options[B.selectedIndex];var D=null;if(!A.defaultSelected){D=A.value}return D}};PBUploadPanelWeb=Class.create(PBUploadPanel,PBUploadPanelWeb);var PBUploadPanelOptions=Class.create({initialize:function(){var A;if((A=$("bttnSaveOptions1"))!=null){Event.observe(A,"click",this.handleSaveOptionsPanel.bindAsEventListener(this),false)}if((A=$("bttnSaveOptions2"))!=null){Event.observe(A,"click",this.handleSaveOptionsPanel.bindAsEventListener(this),false)}if((A=$("bttnCancelOptions1"))!=null){Event.observe(A,"click",this.handleCloseOptionsPanel.bindAsEventListener(this),false)}if((A=$("bttnCancelOptions2"))!=null){Event.observe(A,"click",this.handleCloseOptionsPanel.bindAsEventListener(this),false)}},handleCloseOptionsPanel:function(A){document.fire(PBUpload.MESSAGE.CLOSE_OPTIONS_PANEL);return true},handleSaveOptionsPanel:function(I){this.toggleButtonState("bttnCancelOptions1",true);this.toggleButtonState("bttnCancelOptions2",true);this.toggleButtonState("bttnSaveOptions1",true);this.toggleButtonState("bttnSaveOptions2",true);var J=Form.getElements("form_upload_options");var G=null;for(i=0;J&&i<J.length;i++){if(J[i]!=null&&J[i].name=="image_size"&&J[i].checked==true){G=J[i]}}var F=$("auto_tagging");var D=0;if(F&&F.checked==true){D=1}var A=$("scramble_filename");var C=new Date();var B=null;if(A.checked){C.setTime(C.getTime()+(90*24*60*60*1000));B="expires="+C.toGMTString();document.cookie="scramble_filename = true; "+B+"; domain=.photobucket.com; path=/"}else{C.setTime(C.getTime()-(90*24*60*60*1000));B="expires="+C.toGMTString();document.cookie="scramble_filename = false; "+B+"; domain=.photobucket.com; path=/"}if(G!=null){var E={default_image_size:G.value,auto_tagging:D};var H=$("group_hash_value");if(H){E.group_hash_value=H.value}new APIRequest("setuploadoptions",false,E,this.handleSuccessSaveOptions.bind(this),this.handleFailureSaveOptions.bind(this))}},handleSuccessSaveOptions:function(B){if(B.stat=="ok"){this.toggleButtonState("bttnCancelOptions1",false);this.toggleButtonState("bttnCancelOptions2",false);this.toggleButtonState("bttnSaveOptions1",false);this.toggleButtonState("bttnSaveOptions2",false);var A=Form.getElements("form_upload_options");var D=null;var C=null;for(i=0;A&&i<A.length;i++){if(A[i].name=="image_size"){D=Element.up(A[i],"td");if(D){if(A[i].checked==true){Element.addClassName(D,"checked");Element.removeClassName(D,"unchecked");C=A[i]}else{Element.addClassName(D,"unchecked");Element.removeClassName(D,"checked")}}}}document.fire(PBUpload.MESSAGE.OPTIONS_UPDATED,{currentOptionValue:C.value})}},handleFailureSaveOptions:function(A){var B=error.msg;alert("Error saving options: "+B);this.toggleButtonState("bttnCancelOptions1",false);this.toggleButtonState("bttnCancelOptions2",false);this.toggleButtonState("bttnSaveOptions1",false);this.toggleButtonState("bttnSaveOptions2",false);document.fire(PBUpload.MESSAGE.CLOSE_OPTIONS_PANEL)},toggleButtonState:function(C,B){var A;if(C&&(A=$(C))!=null){A.disabled=B;if(B){if(!Element.hasClassName(A,"button_disabled")){Element.addClassName(A,"button_disabled")}if(C.indexOf("Save")>-1){A.value="Saving"}}else{if(Element.hasClassName(A,"button_disabled")){Element.removeClassName(A,"button_disabled")}if(C.indexOf("Save")>-1){A.value="Save"}}}}});var PBUploadPanelProgress=Class.create(PBLayeredPanel,{initialize:function($super,A){this.opaque=0;$super(A.elemId);this.cancelButtonId=A.cancelId;this.id="";this.queue={};this.progressBarMaxWidth=168;this.progressPercentElem=null;this.progressBarElem=null;this.progressFilesElem=null;this.progressContainerId="totalProgress";this.progressBarId="totalProgressBar";this.progressPercentId="totalProgressPercent";Event.observe(this.cancelButtonId,"click",this.cancelQueueHandler.bindAsEventListener(this),false);Event.observe(document,PBUploadPanelProgress.MESSAGE.TOTAL_PROGRESS_UPDATE,this.uploadTotalProgress.bindAsEventListener(this))},cancelQueueHandler:function(A){document.fire(PBUploader.MESSAGE.UPLOAD_CANCELED,this.id);document.body.fire(PBUploader.MESSAGE.QUEUE_COMPLETE,{from:PBUploadPanelProgress.TYPE,id:this.id,queue:this.queue})},uploadTotalProgress:function(A){var D=(isNaN(A.memo))?0:A.memo;var C=Math.ceil(D*100);var B=Math.ceil(D*this.progressBarMaxWidth);if(!this.progressPercentElem){this.progressPercentElem=$(this.progressPercentId)}if(this.progressPercentElem){this.progressPercentElem.innerHTML=C}if(!this.progressBarElem){this.progressBarElem=$(this.progressBarId)}if(this.progressBarElem){this.progressBarElem.style.width=B+"px"}}});PBUploadPanelProgress=Object.extend(PBUploadPanelProgress,{MESSAGE:{TOTAL_PROGRESS_UPDATE:"PBUploadPanelProgress:TOTAL_PROGRESS_UPDATE"},TYPE:"PBUploadPanelProgress"});var PBProgressBar=Class.create({pbType:"PBProgress",initialize:function(A){this.progressContainerId=A.containerId||"fsUploadProgress";this.progressTextIdPrefix="progressName";this.progressBarIdPrefix="progressBar";this.progressBarMaxWidth=0;this.progressBarElem=null;this.progressTextElem=null;this.id="";for(var B in A){this[B]=A[B]}this.addUIComponent();this.setText(this.id,this.count,0)},update:function(B){if(this.progressBarMaxWidth==0){this.progressBarMaxWidth=$(this.progressContainerId).offsetWidth}var A=Math.ceil(B*this.progressBarMaxWidth);this.progressBarElem.style.width=A+"px"},setText:function(C,B,A){if(A){C+=" ("+B+" of "+A+")"}this.progressTextElem.innerHTML=C},hide:function(){Effect.Fade(this.id)},addUIComponent:function(){var A=$(this.progressContainerId);if(A!=null){this.progressBarMaxWidth=A.offsetWidth;this.progressTextElem=document.createElement("div");this.progressTextElem.className="progressStatus";this.progressTextElem.id=this.progressTextIdPrefix+this.id;this.progressBarElem=document.createElement("div");this.progressBarElem.className="progressBar modClrHi";this.progressBarElem.id=this.progressBarIdPrefix+this.id;var B=document.createElement("div");B.className="progressContainer";if(this.count%2==1){B.className+=" modClrHdr"}B.id=this.id;B.appendChild(this.progressBarElem);B.appendChild(this.progressTextElem);A.appendChild(B)}}});var PBUploader={pbType:"PBUploader",initialize:function(A){this.id="";this.formCompleteId="";this.formId="";this.queue={};this.queueLocked=false;this.canceled=false;this.totalUploaded=0;this.totalUploadSize=0;for(var B in A){this[B]=A[B]}Event.observe(document,PBUploader.MESSAGE.UPLOAD_CANCELED,this.uploadCanceledHandler.bindAsEventListener(this),false);Event.observe(document,PBFile.MESSAGE.UPLOAD_CHANGE,this.fileChangeHandler.bindAsEventListener(this),false);this.completeForm=$(this.formCompleteId)},submit:function(A){},uploadCanceledHandler:function(A){for(var B in this.queue){this.queue[B].cancel()}this.canceled=true;this.reset()},fileChangeHandler:function(B){var C=B.memo;if(!this.queue[C.id]){return false}var A=0;for(var D in this.queue){A+=this.queue[D].getBytesUploaded()}this.totalUploaded=A;document.fire(PBUploadPanelProgress.MESSAGE.TOTAL_PROGRESS_UPDATE,(this.totalUploaded/this.totalUploadSize))},add:function(B,A){if(!this.queueLocked){this.queue[B]=A;this.totalUploadSize+=A.getSize()}},remove:function(A){if(!this.queueLocked){this.totalUploadSize-=this.queue[A].getSize();delete this.queue[A]}},isEmpty:function(){for(var A in this.queue){return false}return true},updateFileStatusBarText:function(){for(var B in this.queue){var A=this.queue[B];A.updateProgressBarText(this.getCount())}},getFirstIdInQueue:function(){var A=null;for(A in this.queue){break}return A},isUploadComplete:function(){return(this.totalUploaded>=this.totalUploadSize)},uploadComplete:function(){if(this.completeForm!=null&&!this.CONTEST){var C=false;var A=0;var B=0;for(var G in this.queue){C=true;var D=this.queue[G];if(D.isVideo){A++}else{B++}for(var F in D.uploadResp){this.addCompletionInput(this.completeForm,F+"[]",D.uploadResp[F])}}if(C){document.fire(PBUploader.MESSAGE.BEFORE_UPLOAD_COMPLETE,{id:this.id,form:this.completeForm,pbType:this.pbType,queue:this.queue});if(!this.canceled){if(B>0){this.addCompletionInput(this.completeForm,"imageCount",B)}if(A>0){this.addCompletionInput(this.completeForm,"videoCount",A)}if(this.addMediaParam){var E="video";if(B>0&&A>0){E="mixed"}else{if(B>0){E="image"}}this.addCompletionInput(this.completeForm,"media",E)}this.completeForm.submit()}}}else{document.fire(PBUploader.MESSAGE.QUEUE_COMPLETE,{from:PBUploader.TYPE,pbType:this.pbType,queue:this.queue})}this.reset()},addCompletionInput:function(B,C,A){new Insertion.Bottom(B,'<input type="hidden" name="'+C+'" value="'+A+'">')},reset:function(){try{this.queue={};this.canceled=false;this.queueLocked=false;this.totalUploaded=0;this.totalUploadSize=0}catch(A){}},getCount:function(){var A=0;for(var B in this.queue){A++}return A}};PBUploader=Class.create(PBUploader);PBUploader=Object.extend(PBUploader,{MESSAGE:{AFTER_SUBMIT:"PBUploader:AfterSubmit",BEFORE_UPLOAD_COMPLETE:"PBUploader:BeforeUploadComplete",UPLOAD_COMPLETE:"PBUploader:UploadComplete",UPLOAD_CANCELED:"PBUploader:UploadCanceled",UPLOAD_DIALOG_OPEN:"PBUploader:UploadDialogOpen",QUEUE_COMPLETE:"PBUploader:QueueComplete"},TYPE:"PBUploader"});var SerialUploader={uploadId:null,uploadInterval:500,uploadingFileIndex:null,uploadingFileArray:null,pbType:"SerialUploader",initialize:function($super,A){$super(A);this.uploadingFileArray=(new Array()).toArray();this.uploadingFileIndex=0;Event.observe(document,PBUploader.MESSAGE.UPLOAD_COMPLETE,this.onFileUploaded.bindAsEventListener(this),false)},submit:function(D){if(!this.statusPollingId){if(!this.isEmpty()){var B=0;for(var C in this.queue){var A=this.queue[C];A.setProgress(++B);this.uploadingFileArray[this.uploadingFileArray.length]=A}this.updateFileStatusBarText();this.upload(this.uploadingFileArray[this.uploadingFileIndex]);this.queueLocked=true;document.fire(PBUploader.MESSAGE.AFTER_SUBMIT,{id:this.id,pbType:this.pbType})}else{document.fire(PBUpload.MESSAGE.ERROR,{message:"Alert",details:"Please select some files."})}}return false},onFileUploaded:function(B){var D=B.memo;if(!this.queue[D.id]){return false}if(D.canceled){return }var C=this.uploadingFileArray[this.uploadingFileIndex];if(C&&D.id==C.id&&!this.canceled){var A=this.uploadingFileArray.length-1;if(this.uploadingFileIndex<A){this.upload(this.uploadingFileArray[++this.uploadingFileIndex])}else{this.uploadComplete()}}},upload:function(A){if(!A.canceled&&A.beforeUpload(this)){A.upload()}},reset:function($super){$super();this.uploadingFileIndex=0;this.uploadingFileArray=(new Array()).toArray()}};SerialUploader=Class.create(PBUploader,SerialUploader);var SwfUploader={pbType:"SwfUploader",initialize:function($super,A){A.formCompleteId="frmUploadComplete";$super(A);this.swfupload=new SWFUpload(this.swfUploadConfig);this.registerHandlers()},openDialogHandler:function(){document.fire(PBUploader.MESSAGE.UPLOAD_DIALOG_OPEN)},fileQueued:function(D){try{if(!D.type){var A=D.name.split(".");D.type=A[A.length-1]}D.type=D.type.toLowerCase();if(D.type.indexOf(".")>-1){D.type=D.type.substring(1)}var F=false;for(var C=0;C<this.swfupload.customSettings.validVideoFiles.length;C++){if(D.type==this.swfupload.customSettings.validVideoFiles[C]){F=true;D.processId=this.processId;break}}var E=(F)?new PBVideo(D):new PBImage(D);E=this.onBeforeQueue(E);this.add(E.id,E)}catch(B){this.swfupload.debug(B)}},submit:function(D,B){try{if(!this.isEmpty()){var C=0;for(var E in this.queue){this.queue[E].setProgress(++C,this.progressContainerId)}this.updateFileStatusBarText();this.swfupload.startUpload();this.queueLocked=true;document.fire(PBUploader.MESSAGE.AFTER_SUBMIT,{id:this.id,pbType:this.pbType,queue:this.queue})}}catch(A){this.swfupload.debug(A)}},uploadStart:function(B){try{B=this.queue[B.id];this.swfupload.setFilePostName(B.post_name);this.swfupload.setPostParams(B.getPostParams(this.swfupload.customSettings.auth,this.swfupload.customSettings.groupHash,this.swfupload.customSettings.guest,this.swfupload.customSettings.contest));return true}catch(A){this.swfupload.debug("upload failed. "+A)}return false},uploadProgress:function(B,D,C){try{this.queue[B.id].onUploadChange(D)}catch(A){this.swfupload.debug(A)}},uploadSuccess:function(C,B){try{this.queue[C.id].onUploadComplete(B)}catch(A){this.swfupload.debug(A)}},swfUploadComplete:function(A){if(!this.isUploadComplete()){this.swfupload.startUpload()}},fileQueueError:function(D,B,E){try{switch(B){case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:var A="Your first "+this.swfUploadConfig.file_upload_limit+" files are uploading now.  ";if(this.swfUploadConfig.custom_settings.groupHash){A="You can upload up to "+this.swfUploadConfig.file_queue_limit+" files at once into a group album.  "+A}else{A+="To upload more than "+this.swfUploadConfig.file_queue_limit+' files at once, use our <a id="linkBulkUpload" href="?action=bulkuploader" title="New Quicker and Easier Uploads. Try Now">bulk uploader</a>.'}this.reportError(0,A);APIRequest.track("UPLOAD_FLASH_LIMIT");break;case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.reportError(0,"Video files must be under "+this.swfUploadConfig.file_size_limit+".");this.swfupload.debug("Error Code: File too big, File name: "+D.name+", File size: "+D.size+", Message: "+E);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:this.reportError(D.id,"Cannot upload Zero Byte files.");this.swfupload.debug("Error Code: Zero byte file, File name: "+D.name+", File size: "+D.size+", Message: "+E);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:this.reportError(D.id,"Invalid File Type.");this.swfupload.debug("Error Code: Invalid File Type, File name: "+D.name+", File size: "+D.size+", Message: "+E);break;default:if(D!==null){this.reportError(D.id,"Unhandled Error")}this.swfupload.debug("Error Code: "+B+", File name: "+D.name+", File size: "+D.size+", Message: "+E);break}}catch(C){this.swfupload.debug(C)}},uploadError:function(C,A,D){try{switch(A){case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:this.reportError(C.id,"Upload Error: "+D);this.swfupload.debug("Error Code: HTTP Error, File name: "+C.name+", Message: "+D);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:this.reportError(C.id,"Upload Failed.");this.swfupload.debug("Error Code: Upload Failed, File name: "+C.name+", File size: "+C.size+", Message: "+D);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:var E=this.queue[C.id];if(E){E.fail("A network error caused your upload to fail. Please try your upload again.")}this.swfupload.debug("Error Code: IO Error, File name: "+C.name+", Message: "+D);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:this.reportError(C.id,"Security Error");this.swfupload.debug("Error Code: Security Error, File name: "+C.name+", Message: "+D);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:this.reportError(C.id,"Upload limit exceeded.");this.swfupload.debug("Error Code: Upload Limit Exceeded, File name: "+C.name+", File size: "+C.size+", Message: "+D);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:this.reportError(C.id,"Failed Validation.  Upload skipped.");this.swfupload.debug("Error Code: File Validation Failed, File name: "+C.name+", File size: "+C.size+", Message: "+D);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:this.cancelQueueHandler();break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:break;default:this.reportError(C.id,"Unhandled Error: "+A);this.swfupload.debug("Error Code: "+A+", File name: "+C.name+", File size: "+C.size+", Message: "+D);break}}catch(B){this.swfupload.debug(B)}},cancelQueue:function($super,A){for(var B in this.queue){this.cancelUpload(B)}$super(A)},add:function($super,B,A){if(!this.queueLocked){if(this.completeForm){A.setResize(this.getResizeValue())}$super(B,A)}},onBeforeQueue:function(A){return A},reportError:function(B,A){document.fire(PBUpload.MESSAGE.ERROR,{message:"Attention",details:A})},registerHandlers:function(){this.swfupload.addSetting("file_dialog_start_handler",this.openDialogHandler.bind(this));this.swfupload.addSetting("file_queued_handler",this.fileQueued.bind(this));this.swfupload.addSetting("file_queue_error_handler",this.fileQueueError.bind(this));this.swfupload.addSetting("file_dialog_complete_handler",this.submit.bind(this));this.swfupload.addSetting("upload_start_handler",this.uploadStart.bind(this));this.swfupload.addSetting("upload_progress_handler",this.uploadProgress.bind(this));this.swfupload.addSetting("upload_error_handler",this.uploadError.bind(this));this.swfupload.addSetting("upload_success_handler",this.uploadSuccess.bind(this));this.swfupload.addSetting("upload_complete_handler",this.swfUploadComplete.bind(this));Event.observe(document,PBUploader.MESSAGE.UPLOAD_CANCELED,this.cancelQueue.bindAsEventListener(this),false);Event.observe(document,PBUploader.MESSAGE.UPLOAD_COMPLETE,this.uploadComplete.bindAsEventListener(this),false)},uploadComplete:function($super,A){var B=A.memo;if(!this.queue[B.id]){return false}if(this.isUploadComplete()){if(this.completeForm){var C;if((C=this.getResizeValue())!=null){this.addCompletionInput(this.completeForm,"resize",C)}this.addCompletionInput(this.completeForm,"addtype","local");this.addMediaParam=true}$super()}},getResizeValue:function(){var B=this.completeForm.image_size;var A=B.options[B.selectedIndex];var C=null;if(!A.defaultSelected){C=A.value}return C}};SwfUploader=Class.create(PBUploader,SwfUploader);var SWFUpload=function(A){this.initSWFUpload(A)};SWFUpload.prototype.initSWFUpload=function(B){try{this.customSettings={};this.settings=B;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(A){delete SWFUpload.instances[this.movieName];throw A}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.1.0 beta 1";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(B,A){this.settings[B]=(this.settings[B]==undefined)?A:this.settings[B]};this.ensureDefault("upload_url","");this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload_f9.swf");this.ensureDefault("flash_color","#FFFFFF");this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){var B,A;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}B=document.getElementsByTagName("body")[0];if(B==undefined){alert("no body element yet");throw"Could not find the 'body' element."}A=document.createElement("div");A.style.width="1px";A.style.height="1px";B.appendChild(A);A.innerHTML=this.getFlashHTML()};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="1" height="1" style="-moz-user-focus: ignore;">','<param name="movie" value="',this.settings.flash_url,'" />','<param name="bgcolor" value="',this.settings.flash_color,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />',"</object>"].join("")};SWFUpload.prototype.getFlashVars=function(){var A=this.buildParamString();return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;params=",encodeURIComponent(A),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;videoFileTypes=",encodeURIComponent(this.settings.video_file_types),"&amp;convertResponseToJSON=",encodeURIComponent(this.settings.convertResponseToJSON),"&amp;multiSelect=",encodeURIComponent(this.settings.multiSelect),"&amp;label=",encodeURIComponent(this.settings.label),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element"}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var C=this.settings.post_params;var B=[];if(typeof (C)==="object"){for(var A in C){if(C.hasOwnProperty(A)){B.push(encodeURIComponent(A.toString())+"="+encodeURIComponent(C[A].toString()))}}}return B.join("&")};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:             ",this.settings.upload_url,"\n","\t","use_query_string:       ",this.settings.use_query_string.toString(),"\n","\t","file_post_name:         ",this.settings.file_post_name,"\n","\t","post_params:            ",this.settings.post_params.toString(),"\n","\t","file_types:             ",this.settings.file_types,"\n","\t","file_types_description: ",this.settings.file_types_description,"\n","\t","file_size_limit:        ",this.settings.file_size_limit,"\n","\t","file_upload_limit:      ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:       ",this.settings.file_queue_limit,"\n","\t","flash_url:              ",this.settings.flash_url,"\n","\t","flash_color:            ",this.settings.flash_color,"\n","\t","debug:                  ",this.settings.debug.toString(),"\n","\t","custom_settings:        ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof (this.settings.swfupload_loaded_handler)==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof (this.settings.file_dialog_start_handler)==="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof (this.settings.file_queued_handler)==="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof (this.settings.file_queue_error_handler)==="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof (this.settings.upload_start_handler)==="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof (this.settings.upload_progress_handler)==="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof (this.settings.upload_error_handler)==="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof (this.settings.upload_success_handler)==="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof (this.settings.upload_complete_handler)==="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof (this.settings.debug_handler)==="function").toString(),"\n"].join(""))};SWFUpload.prototype.addSetting=function(B,C,A){if(C==undefined){return(this.settings[B]=A)}else{return(this.settings[B]=C)}};SWFUpload.prototype.getSetting=function(A){if(this.settings[A]!=undefined){return this.settings[A]}return""};SWFUpload.prototype.callFlash=function(C,B,E){B=!!B||false;E=E||[];var A=this;var D=function(){var F=A.getMovieElement();if(typeof (F[C])==="function"){if(E.length===0){return F[C]()}else{if(E.length===1){return F[C](E[0])}else{if(E.length===2){return F[C](E[0],E[1])}else{if(E.length===3){return F[C](E[0],E[1],E[2])}else{throw"Too many arguments"}}}}}else{alert("invalid function name:"+C);throw"Invalid function name"}};if(B){setTimeout(D,0)}else{return D()}};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(A){this.callFlash("StartUpload",false,[A])};SWFUpload.prototype.cancelUpload=function(A){this.callFlash("CancelUpload",false,[A])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(A){this.callFlash("SetStats",false,[A])};SWFUpload.prototype.setCredentials=function(B,A){this.callFlash("SetCrednetials",false,[B,A])};SWFUpload.prototype.getFile=function(A){if(typeof (A)==="number"){return this.callFlash("GetFileByIndex",false,[A])}else{return this.callFlash("GetFile",false,[A])}};SWFUpload.prototype.addFileParam=function(A,B,C){return this.callFlash("AddFileParam",false,[A,B,C])};SWFUpload.prototype.removeFileParam=function(A,B){this.callFlash("RemoveFileParam",false,[A,B])};SWFUpload.prototype.setUploadURL=function(A){this.settings.upload_url=A.toString();this.callFlash("SetUploadURL",false,[A])};SWFUpload.prototype.setPostParams=function(A){this.settings.post_params=A;this.callFlash("SetPostParams",false,[A])};SWFUpload.prototype.setFileTypes=function(A,B){this.settings.file_types=A;this.settings.file_types_description=B;this.callFlash("SetFileTypes",false,[A,B])};SWFUpload.prototype.setFileSizeLimit=function(A){this.settings.file_size_limit=A;this.callFlash("SetFileSizeLimit",false,[A])};SWFUpload.prototype.setFileUploadLimit=function(A){this.settings.file_upload_limit=A;this.callFlash("SetFileUploadLimit",false,[A])};SWFUpload.prototype.setFileQueueLimit=function(A){this.settings.file_queue_limit=A;this.callFlash("SetFileQueueLimit",false,[A])};SWFUpload.prototype.setFilePostName=function(A){this.settings.file_post_name=A;this.callFlash("SetFilePostName",false,[A])};SWFUpload.prototype.setUseQueryString=function(A){this.settings.use_query_string=A;this.callFlash("SetUseQueryString",false,[A])};SWFUpload.prototype.setDebugEnabled=function(A){this.settings.debug_enabled=A;this.callFlash("SetDebugEnabled",false,[A])};SWFUpload.prototype.queueEvent=function(B,C){if(C==undefined){C=[]}else{if(!(C instanceof Array)){C=[C]}}var A=this;if(typeof (this.settings[B])==="function"){this.eventQueue.push(function(){this.settings[B].apply(this,C)});setTimeout(function(){A.executeNextEvent()},0)}else{if(this.settings[B]!==null){throw"Event handler "+B+" is unknown or is not a function"}}};SWFUpload.prototype.executeNextEvent=function(){var A=this.eventQueue.shift();A.apply(this)};SWFUpload.prototype.flashReady=function(){var A=this.getMovieElement();if(typeof (A.StartUpload)!=="function"){throw"ExternalInterface methods failed to initialize."}this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(A){this.queueEvent("file_queued_handler",A)};SWFUpload.prototype.fileQueueError=function(A,C,B){this.queueEvent("file_queue_error_handler",[A,C,B])};SWFUpload.prototype.fileDialogComplete=function(A,B){this.queueEvent("file_dialog_complete_handler",[A,B])};SWFUpload.prototype.uploadStart=function(A){this.queueEvent("return_upload_start_handler",A)};SWFUpload.prototype.returnUploadStart=function(A){var B;if(typeof (this.settings.upload_start_handler)==="function"){B=this.settings.upload_start_handler.call(this,A)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"}}if(B===undefined){B=true}B=!!B;this.callFlash("ReturnUploadStart",false,[B])};SWFUpload.prototype.uploadProgress=function(A,C,B){this.queueEvent("upload_progress_handler",[A,C,B])};SWFUpload.prototype.uploadError=function(A,C,B){this.queueEvent("upload_error_handler",[A,C,B])};SWFUpload.prototype.uploadSuccess=function(B,A){this.queueEvent("upload_success_handler",[B,A])};SWFUpload.prototype.uploadComplete=function(A){this.queueEvent("upload_complete_handler",A)};SWFUpload.prototype.debug=function(A){this.queueEvent("debug_handler",A)};SWFUpload.prototype.debugMessage=function(C){if(this.settings.debug){var A,D=[];if(typeof (C)==="object"&&typeof (C.name)==="string"&&typeof (C.message)==="string"){for(var B in C){if(C.hasOwnProperty(B)){D.push(B+": "+C[B])}}A=D.join("\n")||"";D=A.split("\n");A="EXCEPTION: "+D.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(A)}else{SWFUpload.Console.writeLine(C)}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(D){var B,A;try{B=document.getElementById("SWFUpload_Console");if(!B){A=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(A);B=document.createElement("textarea");B.id="SWFUpload_Console";B.style.fontFamily="monospace";B.setAttribute("wrap","off");B.wrap="off";B.style.overflow="auto";B.style.width="700px";B.style.height="350px";B.style.margin="5px";A.appendChild(B)}B.value+=D+"\n";B.scrollTop=B.scrollHeight-B.clientHeight}catch(C){alert("Exception: "+C.name+" Message: "+C.message)}};var SWFUpload;if(typeof (SWFUpload)==="function"){SWFUpload.prototype.flashVersionRequired="9.0.0";SWFUpload.prototype.flashContainer=null;SWFUpload.prototype.componentId="SwfUploadObj";SWFUpload.prototype.uploadVersionCookie="upload_version1";SWFUpload.prototype.uploadVersionCookieLifespan=30;SWFUpload.prototype.loadFlash=function(){var A;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}if(this.customSettings.parentId){A=$(this.customSettings.parentId)}else{A=document.getElementsByTagName("body")[0]}if(A==undefined){throw"Could not find the target element."}this.flashContainer=document.createElement("div");this.flashContainer.id=this.componentId;this.flashContainer.style.width=this.settings.buttonWidth+"px";this.flashContainer.style.height=this.settings.buttonHeight+"px";A.appendChild(this.flashContainer);this.getFlashHTML()};SWFUpload.prototype.getFlashHTML=function(){var A=new SWFObject(this.settings.flash_url,this.movieName,this.settings.buttonWidth,this.settings.buttonHeight,this.flashVersionRequired);A.addParam("quality","high");A.addParam("menu","false");A.addParam("bgcolor",this.settings.flash_color);A.addParam("allowScriptAccess","always");A.addParam("flashvars",this.getFlashVars());if(this.settings.transparent){A.addParam("wmode","transparent")}if(A.installedVer.major<9||!A.write(this.flashContainer)){createCookie(this.uploadVersionCookie,0,this.uploadVersionCookieLifespan);location.reload(true)}}}var PBFetcher=Class.create({pbType:"PBFetcher",initialize:function(A){this.limit=10;for(var B in A){this[B]=A[B]}this.fetchSuccess=this.handleFetch.bindAsEventListener(this)},fetch:function(A){A=this.getFetchConfig(A);if(A){new Ajax.Request(A.url,{method:"get",evalJSON:"force",onSuccess:this.fetchSuccess,custom:A.custom});document.fire(PBFetcher.MESSAGE.FETCH_STARTED,A)}},getFetchConfig:function(){return{url:"",options:{}}},handleFetch:function(D){var C=D.responseJSON.response;var A=D.request.options.custom;if(!C){return }var B={response:C,requestOptions:A};document.fire(PBFetcher.MESSAGE.FETCH_COMPLETE,B)}});PBFetcher=Object.extend(PBFetcher,{MESSAGE:{FETCH_STARTED:"PBFetcher:FetchStarted",FETCH_COMPLETE:"PBFetcher:FetchComplete"}});var PBAlbumMediaFetcher={pbType:"PBAlbumMediaFetcher",initialize:function($super,A){$super(A);this.fetchedAlbums={}},getFetchConfig:function(G){var H=this.getAlbum(G.id);var D="getalbummedia";var B=H.mediaCount;var F=G.total||0;var E;if(F==-1){E=H.mediaCount+this.limit}else{E=Math.min(H.mediaCount+this.limit,F)}if(B>=E){return null}var A=location.pathname+"?start="+B+"&end="+E;for(var C in G.fetchParams){var I=G.fetchParams[C];if(I){A+="&"+C+"="+I}}A+="&cb="+(new Date()).getTime();var G={url:A,custom:{targetId:G.id}};return G},handleFetch:function($super,F){$super(F);var B=F.request.options.custom;var D=F.responseJSON.response.media;var E=B.targetId;var A=this.getAlbum(E);var C=D.length;A.mediaCount+=C;this.setAlbum(E,A)},getAlbum:function(A){if(this.fetchedAlbums[A]){return this.fetchedAlbums[A]}else{return{mediaCount:0}}},setAlbum:function(B,A){this.fetchedAlbums[B]=A}};PBAlbumMediaFetcher=Class.create(PBFetcher,PBAlbumMediaFetcher);var PBFileUtils=Class.create({initialize:function(A){this.validExtArray=A||new Array()},getFilename:function(D){var A="";var C="([^=;\\\\/#\\?&:]+\\.("+this.validExtArray.join("|")+"))";var B=new RegExp(C,"gi");if((m=D.match(B))!=null){A=m[0]}return A}});var PBFile={initialize:function(A){this.action="";this.post_name="";this.name="";this.type="";this.size=0;this.id="";this.bytesUploaded=0;this.count=0;this.resize=null;this.uploadResp=null;this.progress=null;this.hasBeenUploaded=false;this.isUploading=false;this.canceled=false;this.groupHash="";this.scrambleCookie="scramble_filename";for(var B in A){this[B]=A[B]}this.addUIComponent();this.uploadSuccess=this.uploadCallSuccess.bind(this);this.uploadFailure=this.uploadCallFailure.bind(this)},onUploadComplete:function(A){this.hasBeenUploaded=true;this.isUploading=false;this.setServerResponse(A);this.completed();this.progress.hide()},onUploadChange:function(A){if(A){this.bytesUploaded=A}this.progress.update(this.getBytesUploaded()/this.getSize());var B=$(this.id)||document;B.fire(PBFile.MESSAGE.UPLOAD_CHANGE,this)},onUploadCanceled:function(){Effect.Fade(this.id)},updateProgressBarText:function(A){if(this.progress){this.progress.setText(this.name,this.count,A)}},setCount:function(A){this.count=A},getSize:function(){return this.size},getBytesUploaded:function(){return this.bytesUploaded},setResize:function(A){this.resize=A},beforeUpload:function(A){return true},upload:function(A){if(A){var B=location.pathname+"?action="+this.action;for(var C in A){B+="&"+C+"="+A[C]}B+="&cb="+(new Date()).getTime();new Ajax.Request(B,{method:"get",evalJSON:"force",onSuccess:this.uploadSuccess,onFailure:this.uploadFailure});this.isUploading=true}},fail:function(A){this.uploadCallFailure({stat:"fail",errormsg:A})},setProgress:function(B,A){this.count=B;this.progress=new PBProgressBar({id:this.id+"_pbar",count:this.count,containerId:A})},addUIComponent:function(){},uploadCallSuccess:function(A){this.onUploadComplete(A)},uploadCallFailure:function(A){if(!A.filename){A.filename=this.name}this.onUploadComplete(A)},completed:function(){this.onUploadChange(this.getSize());var A=$(this.id)||document;A.fire(PBUploader.MESSAGE.UPLOAD_COMPLETE,this)},hide:function(){this.progress.hide()},cancel:function(){this.canceled=true;this.completed();this.hide()},setServerResponse:function(response){try{this.uploadResp=eval(response)}catch(e){this.uploadResp={stat:"fail",filename:this.name,errormsg:response}}}};PBFile=Class.create(PBFile);PBFile=Object.extend(PBFile,{MESSAGE:{UPLOAD_CHANGE:"PBFile:UploadChange",ENCODING_CHANGE:"PBFile:EncodingChange",THUMBNAIL_LOADED:"PBFile:ThumbnailLoaded"}});var PBImage={initialize:function($super,A){$super(A);this.action="uploadimage";this.post_name="the_image"},getPostParams:function(D,C,E){var B={pbauth:D,action:this.action};if(this.resize){B.image_size=this.resize}if(C){B.group_hash=C}if(E){B.pbguest=E}var A=readCookie(this.scrambleCookie);if(A){B.scramble_filename=A}return B}};PBImage=Class.create(PBFile,PBImage);var PBVideo={isVideo:true,initialize:function($super,A){$super(A);this.title="";this.action="uploadvideo";this.post_name="the_video";this.processElemId="UPLOAD_METER_ID";this.encodingProgress=0;this.encodingPollingId=null;this.preEncodingPollingId=null;this.isStatusCallPending=false;var B=$(this.processElemId);if(B!=null){this.processId=B.value}else{if(A.processId!=null){this.processId=A.processId}}},onUploadChange:function($super,A){$super(A);if(A==this.size&&!this.canceled){this.startPreEncodingProgress()}},onUploadComplete:function(data){this.stopPreEncodingProgress();var bSuccess=false;try{data=eval(data);bSuccess=(data.stat!="fail")}catch(e){}if(bSuccess){this.name=data.filename;this.onUploadChange(this.size);this.startPollingEncodingProgress();document.fire(PBFile.MESSAGE.UPLOAD_CHANGE,this)}else{this.setServerResponse(data);this.cancel()}},onEncodingComplete:function(A){clearInterval(this.encodingPollingId);this.encodingPollingId=null;this.setServerResponse(A);this.completed();this.hide()},onEncodingChange:function(A){this.encodingProgress=A;document.fire(PBFile.MESSAGE.ENCODING_CHANGE,this);this.onUploadChange()},getSize:function(){return this.size*2},getBytesUploaded:function(){if(this.encodingProgress==0){return this.bytesUploaded}else{var A=this.size+this.size*this.encodingProgress/100;return A}},getPostParams:function(E,C,F,D){var B={pbauth:E,action:this.action,video_desc:this.title,UPLOAD_METTER_ID:this.processId,UPLOAD_IDENTIFIER:this.processId};if(C){B.group_hash=C}if(F){B.pbguest=F}if(D){B.swfupload=1}var A=readCookie(this.scrambleCookie);if(A){B.scramble_filename=A}return B},setResize:function(A){},startPreEncodingProgress:function(){this.preEncodingPollingId=setInterval(this.executePreEncodingStatusCall.bind(this),2000)},executePreEncodingStatusCall:function(){if(this.preEncodingPollingId){if(this.encodingProgress<20){this.encodingProgress+=5;this.onEncodingChange(this.encodingProgress)}else{this.stopPreEncodingProgress()}}},stopPreEncodingProgress:function(){clearInterval(this.preEncodingPollingId);this.preEncodingPollingId=null},startPollingEncodingProgress:function(){this.stopPreEncodingProgress();if(!this.encodingPollingId){this.encodingPollingId=setInterval(this.executeEncodingStatusCall.bind(this),2000)}},executeEncodingStatusCall:function(){if(!this.isStatusCallPending){new APIRequest("getvideoprogress",false,{id:this.processId},this.statusCallSuccess.bind(this),this.statusCallFailure.bind(this),false);this.isStatusCallPending=true}},statusCallSuccess:function(A){this.isStatusCallPending=false;if(A.stat=="ok"){var C=A.videoprogress.stage;var B=parseFloat(A.videoprogress.encoding_progress);if(0<B&&B<=100&&B>this.encodingProgress){this.onEncodingChange(B);if(B==100){this.onEncodingComplete(A)}}}},statusCallFailure:function(A){this.isStatusCallPending=false;this.onEncodingComplete(A)},setServerResponse:function(A){var B={stat:(A.stat)?A.stat:"",filename:(A.filename)?A.filename:this.name,errormsg:(A.errormsg)?A.errormsg:""};this.uploadResp=B},cancel:function($super){this.encodingProgress=100;$super()}};PBVideo=Class.create(PBFile,PBVideo);var PBWeb=Class.create(PBFile,{initialize:function($super,A){this.groupHash=null;$super(A);if(this.validExtArray&&this.url){this.utils=new PBFileUtils(this.validExtArray);var B=this.utils.getFilename(this.url);this.name=B;this.type=(B.indexOf(".")>-1)?B.split(".").pop().toLowerCase():null}this.action="uploadweb";this.isValidated=false;this.hasInvalidProtocol=true;this.hasInvalidExtension=true;this.fileTypeErrorMessage="";this.protocolErrorMessage="";this.size=10},validate:function(A){this.hasInvalidProtocol=!this.validateProtocol();this.hasInvalidExtension=!this.validateExtension(A);this.isValidated=(!this.hasInvalidProtocol&&!this.hasInvalidExtension)},upload:function($super){if(this.isValidated){var A={the_web:this.url,image_size:this.resize,group_hash:this.groupHash,json:1};$super(A)}},validateProtocol:function(){var A=!(this.url.search(/^(http|https|ftp):\/\//i)==-1);if(!A){this.setProtocolErrorMessage()}return A},validateExtension:function(C){var B=this.validExtArray.join("|");var A=(B.indexOf(this.type)>-1)&&(C||this.type!="swf");if(!A){this.setFileTypeErrorMsg(C)}return A},beforeUpload:function(C){try{var A=$(C.formId);if(A.image_size&&A.image_size.options){var D=A.image_size.options[A.image_size.selectedIndex].value;this.setResize(D)}}catch(B){return false}return true},setServerResponse:function(A){try{var C=A.responseJSON.response;this.uploadResp=C}catch(B){}},setProtocolErrorMessage:function(){this.protocolErrorMessage='"'+this.url+'" does not look like a valid URL.<br/>Please click on the my computer tab to upload a local file.'},setFileTypeErrorMsg:function(D){var C="";var B=(this.name!="")?'"'+this.name+'"':this.name;if(!D&&this.type=="swf"){C="The file "+B+" is a SWF: SWF file uploading is no longer available on free accounts. SWF files can be uploaded to PRO accounts only."}else{var A=this.validExtArray.length-1;var E=this.validExtArray.slice(0,A).join(", ")+", or "+this.validExtArray[A];C="To add an image from a website, be sure to use the <b>image URL</b>. ";C+="To find this, right mouse click on the image, choose Properties, ";C+="and then copy the full URL address - be sure to scroll, as the image ";C+="URL should end with "+E+"."}this.fileTypeErrorMessage=C}});var PBAlbumFile=Class.create(PBFile,{initialize:function($super,A){this.isLoaded=false;this.wasPreloaded=false;this.pollingInterval=2000;this.visibilityPollingId=null;this.container=null;this.elem=null;this.imageElem=null;this.tempElem=null;this.addElem=null;this.removeElem=null;this.groupHash=null;this.media=null;$super(A);this.action="uploadweb";this.progressContainerId="progressContainer";this.size=10;this.bVideo=(this.media=="video");var C="?file=";var B=this.url.indexOf(C);if(this.media&&this.media=="video"&&B>0){this.url=this.url.substring(B+C.length)}this.name=this.id},select:function(){Element.addClassName($(this.id),"selected")},deselect:function(){Element.removeClassName($(this.id),"selected")},load:function(){this.imageElem.src=this.thumb;this.tempElem.style.visibility="hidden";this.imageElem.style.visibility="visible";this.isLoaded=true},pollVisibility:function(A){this.container=$(A);this.visibilityPollingId=setInterval(this.checkVisibility.bind(this),this.pollingInterval)},upload:function($super){var A={the_web:encodeURIComponent(this.url),image_size:this.resize,group_hash:this.groupHash,json:1,album:1};if(this.bVideo){A.video=1}$super(A)},cancel:function($super){$super();this.deselect()},addUIComponent:function(){this.elem=$(this.id);this.imageElem=$(this.id+"_image");this.tempElem=$(this.id+"_temp");this.addElem=$(this.id+"_add");this.removeElem=$(this.id+"_remove");this.elem.show()},checkVisibility:function(){if(this.isLoaded){this.stopPolling()}else{if(this.isVisible()){this.stopPolling();this.load();document.fire(PBFile.MESSAGE.THUMBNAIL_LOADED,this)}}return },stopPolling:function(){clearInterval(this.visibilityPollingId);this.visibilityPollingId=null;this.container=null},isVisible:function(){var F=$(this.id);if(this.container&&F){var B=this.container.offsetHeight;var E=this.container.offsetTop;var A=this.container.scrollTop;var C=B+E+A;var D=F.offsetTop;if(D<C){return true}}return false},setServerResponse:function(A){try{var C=A.responseJSON.response;this.uploadResp=C}catch(B){}}});var SaveToAlbum=Class.create();var saveObj;SaveToAlbum.prototype={mediaurls:null,ajaxOptions:null,albumtoview:null,albumUrl:null,formName:null,submitEvtObj:null,initialize:function(B){if(typeof (B)=="object"&&B){if(typeof (B.mediaUrl)=="string"&&B.mediaUrl){this.mediaurls=[B.mediaUrl]}if(typeof (B.mediaurls)=="object"&&B.mediaurls){this.mediaurls=B.mediaurls}if(typeof (B.albumUrl)=="string"&&B.albumUrl){this.albumUrl=B.albumUrl}if(typeof (B.formName)=="string"&&B.formName){this.formName=B.formName}}this.ajaxOptions={method:"post",asynchronous:true};this.submitEvtObj=this.submit.bindAsEventListener(this);Object.extend(this.ajaxOptions,B.ajaxOptions||{});saveObj=this;this.loggedIn=($("loginPrompt")!=null)?false:true;if(this.loggedIn){Form.focusFirstElement("formSaveToAlbum");Event.observe($("formSaveToAlbum"),"submit",this.submitEvtObj)}else{if(this.mediaurls!=null&&this.mediaurls.size()==1){var A=this.mediaurls.first();this.createCookie("savetoalbum",A,1)}}Event.observe(document,PBLightbox.EVENT.DEACTIVATE,this.deactivate.bindAsEventListener(this))},submit:function(B){Event.stop(B);var D;if((D=$("view_in_album"))!=null){Event.observe(D,"click",this.handleViewInAlbum.bindAsEventListener(this))}document.fire(PBLightbox.PBMessage.EVENT.CLOSE);var F=this.getClientSideValidationErrorMessage();if(typeof (F=="string")&&F){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({details:F,type:PBMessage.MESSAGE_TYPE.ERROR})})}else{$("panelProcessingSaveToAlbum").show();$("savetoalbumbody").hide();$("saving").show();var A=this.getAlbum();var C=(this.albumUrl==null)?"?action=interstitial&secondary_action=savetoalbum":this.albumUrl+"?action=interstitial&secondary_action=savetoalbum";var G="";if(this.mediaurls.size()==1){C+="&selectedmedia[]="+this.mediaurls.first()}else{this.mediaurls.each(function(H){G+="&selectedmedia[]="+H})}G+="&album="+escape(A.albumname);if(A.isNew){G+="&rootalbum="+escape(A.rootalbum)}var E=SaveToAlbum.MESSAGE.UNKNOWN_ERROR;new Ajax.Request(C,{method:"post",parameters:G,onSuccess:this.callbackSuccess,onFailure:function(H){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({details:E,type:PBMessage.MESSAGE_TYPE.ERROR})});$("panelProcessingSaveToAlbum").hide()}})}},callbackSuccess:function(H){try{var B=H.responseText.evalJSON().response;var G=B.message;var A=B.stat;var D=B.details;if(typeof (A)=="string"){if(A=="ok"){var E=B.albumtoview;saveObj.albumtoview=E;$("panelProcessingSaveToAlbum").hide();$("saveToAlbumContent").hide();$("saveButtonPanel").hide();$("saveToAlbumSuccess").show();var C=$("saveToAlbumSuccess").select("iframe").first();C.src=C.src;document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:G})})}else{if(A=="fail"){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:G,details:D,type:PBMessage.MESSAGE_TYPE.ERROR})})}}}}catch(F){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({details:unknownErrorMessage,type:PBMessage.MESSAGE_TYPE.ERROR})})}$("panelProcessingSaveToAlbum").hide()},getAlbum:function(){var D=$("sel_album");var E=$("newalbum");var A;if(typeof (D)=="object"&&D){var A={albumname:D.getValue(),isNew:false};if(A.albumname=="new"){var C=D.options;var B=C[0].value;A={albumname:E.getValue().strip(),isNew:true,rootalbum:B}}}return A},getClientSideValidationErrorMessage:function(){var C;if(!typeof (this.msg)=="object"){return }var B=$("sel_album");if(typeof (B)=="object"&&B){var A=B.getValue();if(A=="new"){var E=/^[_a-zA-Z0-9- ]+$/;var F=$("newalbum");var D;if(typeof (F)=="object"&&F){D=F.getValue().strip()}if(!(typeof (D=="string")&&D.length>0)){C=SaveToAlbum.MESSAGE.ENTER_ALBUM_NAME}else{if(!(typeof (D=="string")&&D.match(E))){C=SaveToAlbum.MESSAGE.INVALID_ALBUM_NAME_FORMAT}else{if(!(typeof (D=="string")&&D.length>=2&&D.length<=50)){C=SaveToAlbum.MESSAGE.INVALID_ALBUM_NAME_LENGTH}}}if(typeof (C)=="string"){$("newalbum").focus()}}}return C},handleViewInAlbum:function(B){Event.stop(B);var A=this.albumtoview;window.location.href=A},deactivate:function(){if(this.loggedIn){Event.stopObserving($("formSaveToAlbum"),"submit",this.submitEvtObj)}else{this.createCookie("savetoalbum","",-1)}},createCookie:function(C,D,E){var A;if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));A="; expires="+B.toGMTString()}else{A=""}document.cookie=C+"="+D+A+"; domain=.photobucket.com; path=/"}};SaveToAlbum=Object.extend(SaveToAlbum,{MESSAGE:{INVALID_ALBUM_NAME_LENGTH:"Album name must be between 2 and 50 alphanumeric characters.",INVALID_ALBUM_NAME_FORMAT:"Album name must contain only letters, numbers, underscores and hyphens.",ENTER_ALBUM_NAME:"Please enter a new album name.",UNKNOWN_ERROR:"An unknown error has occurred."}});function showNewAlbum(C){var B=false;if(C.options[C.selectedIndex].value=="new"){B=true}document.fire(PBLightbox.PBMessage.EVENT.CLOSE);var A=$("inputNewalbum");$("newalbum").clear();if(B){A.show();$("newalbum").focus()}else{A.hide()}}var LoginPrompt=Class.create({mediaUrl:null,initialize:function(A){if(typeof (A)=="object"&&A){if(A.mediaUrl!=null){this.createCookie("savetoalbum",A.mediaUrl,1)}}document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"You are not logged in.",details:'<a href="/login">click here</a> to login',type:PBMessage.MESSAGE_TYPE.ERROR})})},createCookie:function(C,D,E){var A;if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));A="; expires="+B.toGMTString()}else{A=""}document.cookie=C+"="+D+A+"; domain=.photobucket.com; path=/"}});var VanityUrl=Class.create();VanityUrl.prototype={vanity:null,vanityForm:null,vanity_prompt:"your name here",vanityBubble:null,validVanity:null,initialize:function(){this.submitEvtObj=this.submit.bindAsEventListener(this);this.vanityForm=$("editVanityUrlForm");if(this.vanityForm){Event.observe(this.vanityForm,"submit",this.submitEvtObj,false)}this.vanity=$("vanity");if(this.vanityForm&&this.vanity){Event.observe(this.vanity,"focus",this.unsetPrompt.bindAsEventListener(this),false);Event.observe(this.vanity,"focus",this.clearInput.bindAsEventListener(this),false);if($("definedVanity")&&$("definedVanity").value.length>0){this.vanity.value=$("definedVanity").value;$("modify_warning").show()}else{if(this.vanity.value==this.vanity_prompt){this.vanity.addClassName("prompt")}}this.vanityBubble=new Bubble({posOffset:"true",elemId:"vanityHelp",targetId:"vanity",eventOn:"pb:vanitynameunavailable",callbackOn:this.populateVanitySuggestions.bindAsEventListener(this),offsetX:430,offsetY:-12})}Event.observe(document,PBLightbox.EVENT.DEACTIVATE,this.deactivate.bindAsEventListener(this))},deactivate:function(){Event.stopObserving(this.vanityForm,"submit",this.submitEvtObj)},submit:function(A){$("saveButtonPanel").hide();$("panelProcessing").show();$("vanity").writeAttribute("readonly",true);if(this.validateVanity()){if(!this.validVanity){$("panelProcessing").hide();$("saveButtonPanel").show();$("vanity").writeAttribute("readonly",false);Event.stop(A)}}else{document.fire(PBLightbox.EVENT.DEACTIVATE)}},validateVanity:function(){var A=this.vanity;if(!(A.value.length==0)){if($("definedVanity")&&$("definedVanity").value.length){if(A.value==$("definedVanity").value){return false}}if(A.value.search(/[^\w-]+/)>=0){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Invalid Custom URL",details:"Custom URLs can only contain a-z, A-Z, 0-9, dashes, and underscores.",type:PBMessage.MESSAGE_TYPE.ERROR})});A.activate()}else{document.fire(PBLightbox.PBMessage.EVENT.CLOSE);new APIRequest("isvanitynameavailable",true,{vanityname:A.value},function(B){if(B.available==0){A.fire("pb:vanitynameunavailable",{suggestions:B.suggestions})}else{this.validVanity=true;this.vanityBubble.hide()}}.bind(this),null,null,null,false)}}else{this.validVanity=true}return true},populateVanitySuggestions:function(F){var E=$("vanitynameSuggestions");var A=E.childElements();for(var B=0;B<A.length;B++){A[B].remove()}var D=F.memo.suggestions;for(var C=0;C<D.length;C++){li=document.createElement("li");a=document.createElement("a");a.href="javascript:void(0);";a.id=D[C]["suggestion"];a.appendChild(document.createTextNode(D[C]["suggestion"]));li.appendChild(a);E.appendChild(li);Event.observe(a,"click",this.handleSuggestionClick.bindAsEventListener(this),false)}return true},handleSuggestionClick:function(A){this.vanity.value=A.target.id;this.vanityBubble.hide()},clearInput:function(B){var A=B.target;if(A.value==this.vanity_prompt){A.value=""}},unsetPrompt:function(A){A.target.removeClassName("prompt")}};var AddFavoriteController=Class.create();AddFavoriteController.prototype={initialize:function(A){this.loginUrl=A.loginUrl||false;var B=$("addFavoriteLink");if(B){Event.observe(B,"click",this.handleLaunchLightbox.bind(this))}if(A.openLightbox){Event.observe(window,"load",this.handleLaunchLightbox.bind(this))}},handleLaunchLightbox:function(A){if(this.loginUrl){Event.stop(A);window.location.href=this.loginUrl}else{var B={contentUrl:"?action=interstitial&secondary_action=addfavoritetpl",initialHeight:150,onComplete:function(){new Favorite()}};document.fire(PBLightbox.EVENT.ACTIVATE,B)}}};var Favorite=Class.create();Favorite.prototype={submitEvtObj:null,initialize:function(A){this.ajaxOptions={method:"post",asynchronous:true};this.submitEvtObj=this.submit.bindAsEventListener(this);Form.focusFirstElement("addFavoriteForm");Event.observe($("addFavoriteForm"),"submit",this.submitEvtObj)},submit:function(A){Event.stop(A);this.showBusy();var C={};C.action="addtofavorites";C.name=$("addToFavorites_albumName").value;C.url=$("album_url").value;var B=this;new Ajax.Request(this.getDocUrl(),{method:"post",parameters:C,onSuccess:function(H){var E=H.responseText.evalJSON().response;var G=E.message;var D=E.stat;var F=E.details;if(E.stat=="ok"){B.showComplete();$("add_favorite_container").hide();$("remove_favorite_container").show()}else{document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({details:E.err_string,type:PBMessage.MESSAGE_TYPE.ERROR})})}B.hideBusy()},onFailure:function(D){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({details:"An unknown error occurred.",type:PBMessage.MESSAGE_TYPE.ERROR})});B.hideBusy()}})},getDocUrl:function(){var A=document.location.href;A=A.split("?")[0];A=A.split("#")[0];return A},showBusy:function(){$("saveButtonPanel").hide();$("panelProcessingAddFavorite").show()},hideBusy:function(){$("saveButtonPanel").show();$("panelProcessingAddFavorite").hide()},showComplete:function(){$("favorite_complete").show();$("favorite_contents").hide()}};var confirmUserInfo=Class.create();confirmUserInfo.prototype={elt:null,eltEmail:null,eltFname:null,eltLname:null,eltBMon:null,eltBDay:null,eltBYear:null,eltSaveButton:null,eltCurrentEmail:null,eltValidateUrl:null,eltValidated:null,eltConfirmUnderAge:null,initialize:function(){this.elt=$("confirmInfoForm");this.eltSaveButton=$("save");if(this.eltSaveButton){this.eltSaveButton.onclick=this.handleFormSubmitValidation.bindAsEventListener(this)}if(this.elt){Event.observe(this.elt,"submit",this.stopFormSubmit.bindAsEventListener(this),false)}},handleFormSubmitValidation:function(){this.eltEmail=$("email");this.eltFname=$("fname");this.eltLname=$("lname");this.eltBMon=$("birthMonth");this.eltBDay=$("birthDay");this.eltBYear=$("birthYear");this.eltCurrentEmail=$("currentemail");this.eltValidateUrl=$("validateurl");var D=$("underage");D.value=0;this.eltValidated=true;var A=new Array("An email address is required.",this.eltEmail,"A first name is required.",this.eltFname,"A last name is required.",this.eltLname,"Please enter a valid birth month.",this.eltBMon,"Please enter a valid birth day.",this.eltBDay,"Please enter a valid birth year.",this.eltBYear);for(var C=1;C<A.length;C+=2){if(C<=5){if(A[C].value==""){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Attention",details:A[C-1],type:PBMessage.MESSAGE_TYPE.ERROR})});this.eltValidated=false}}else{if(A[C].selectedIndex==0){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Attention",details:A[C-1],type:PBMessage.MESSAGE_TYPE.ERROR})});this.eltValidated=false}}}if(this.eltValidated){var B=this.eltValidateUrl.value;var E="action=accountoptions&confirmuserinfo=1&email="+escape(this.eltEmail.value)+"&fname="+escape(this.eltFname.value)+"&lname="+escape(this.eltLname.value)+"&bMon="+escape(this.eltBMon.value)+"&bDay="+escape(this.eltBDay.value)+"&bYear="+escape(this.eltBYear.value);new Ajax.Request(B,{method:"get",parameters:E,onSuccess:this.handleAjaxSuccess.bind(this),onFailure:this.handleAjaxFailure.bind(this)})}},handleAjaxSuccess:function(req){var response=req.responseText;response=eval("("+response+")");if(response.response.stat=="ok"&&this.eltValidated==true){this.elt.submit()}else{document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Attention",details:response.response.message,type:PBMessage.MESSAGE_TYPE.ERROR})});if(response.response.underage==true){this.handleUnderAge()}}},handleAjaxFailure:function(A){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Attention",details:"There was a problem saving your user information.",type:PBMessage.MESSAGE_TYPE.ERROR})})},handleUnderAge:function(){var A=$("underage");A.value=1;this.eltConfirmUnderAge=$("underageconfirm");if(this.eltConfirmUnderAge){this.eltConfirmUnderAge.onclick=this.submitUnderAge.bindAsEventListener(this)}return },submitUnderAge:function(){this.elt.submit()},stopFormSubmit:function(A){Event.stop(A)}};function albumpost(A){document.albumform.action.value=A;document.albumform.submit()}var AlbumThumbnailView=Class.create();AlbumThumbnailView.prototype={strNoDescriptionDefault:"click to add title",objCopyCode:null,objImageEditBubbleCtrl:null,objOrganizeBubbleCtrl:null,nSelectedMediaCounter:0,bAllChecked:false,descOrigBGColor:null,descBGColor:null,descHoverColor:null,bLinkOptionsOpen:false,urlBase:"",objLightbox:null,albumType:"user",eltForm:null,eltAction:null,strCurrSaveToAlbumIndex:"",initialize:function(G){var C,F,E=0;if(typeof (G)=="string"&&G.length>0){this.albumType=G}this.urlDomain=document.location.host;this.urlBase=this.getDocUrl();this.eltForm=$("thumbForm");this.eltAction=$("thumbAction");this.pendingQueue={};if(typeof (BubblesController)!="undefined"&&BubblesController){new BubblesController({idTarg:"txtTitleEdit_0",idBubble:"optionsHelp",eventOn:"",eventOff:""});new BubblesController({idTarg:"urlcode0",idBubble:"shareTagsHelp",eventOn:"",eventOff:""});if((C=$("bubbleImageEdit"))!=null&&(F=$("editBubbleEltID"))!=null&&F.value){Event.observe("imageEditBubbleCloseBox","click",this.setImageEditBubbleSeen.bindAsEventListener(this),false);this.objImageEditBubbleCtrl=new BubblesController({idBubble:"bubbleImageEdit",idTarg:F.value,eventOff:"click",callbackOff:this.setImageEditBubbleSeen.bind(this)});this.setImageEditBubblePostion(F.value)}if(((C=$("bubbleOrganize"))!=null)&&((F=$("lnkOrganize"))!=null)){Event.observe("organizeCloseBox","click",this.setOrganizeBubbleSeen.bindAsEventListener(this),false);this.objOrganizeBubbleCtrl=new BubblesController({idBubble:"bubbleOrganize",idTarg:"organize",eventOff:"click",callbackOff:this.setOrganizeBubbleSeen.bind(this)});this.setOrganizeBubblePostion()}}if((C=$("sponsoredMediaCount"))!=null&&typeof (C.value)!="undefined"&&!isNaN(E=parseInt(C.value))){for(D=0;D<E;D++){if((C=$("linkSponsoredSaveToAlbum_"+D))!=null){Event.observe(C,"click",this.handleSponsoredSaveToAlbum.bindAsEventListener(this,D))}}}var B=this.getCheckboxes();for(var D in B){var A=B[D];if(A.checked){this.nSelectedMediaCounter++;eltLI=Element.up(A,"LI");this.highlightSelectedCell(A,eltLI);this.handlePendingChecked(A)}}this.enableDisableBatchActions(this.nSelectedMediaCounter==0);return true},findByClassName:function(E,D){var B=null,C,A;for(C=0,A=E.length;E&&C<A;C++){if(Element.hasClassName(E[C],D)){B=E[C];break}}return B},findByName:function(E,C){var B=null,D,A;for(D=0,A=E.length;E&&D<A;D++){if(E[D].name==C){B=E[D];break}}return B},handleSelectAllCheck:function(E){var B=Event.element(E),D,A;var C=this.eltForm.elements["selectedmedia[]"];if(B){this.bAllChecked=B.checked;if(typeof (C)=="object"&&typeof (C.length)=="undefined"){C=[C]}for(D=0,A=C.length;C&&D<A;D++){if(typeof (C[D].name)!="undefined"&&C[D].name=="selectedmedia[]"){C[D].checked=this.bAllChecked;this.highlightSelectedCell(C[D],Element.up(C[D],"LI"));this.handleImageCheckPersist(Element.up(C[D],"LI"))}}}return true},handleImageCheck:function(C){var A=Event.element(C);var B=Event.findElement(C,"LI");this.highlightSelectedCell(A,B);return true},handleImageCheckPersist:function(D){var A=D.id.split("_");var C=A[1];var B=$("checkMedia_"+C);if($("chk_"+C).checked){B.style.display="block"}else{B.style.display="none"}},handleMultipleSaveToAlbum:function(F){APIRequest.track("save_to_album_"+this.albumType+"_thumbnail_multi");var C=this.eltForm.elements["selectedmedia[]"];if(typeof (C)=="object"&&typeof (C.length)=="undefined"){C=[C]}C=$A(C);var D={urls:new Array(),files:new Array()};C.each(function(J,H){if(J.checked){var I=$("mediaUrl_"+H).value;var G=J.value;D.urls.push(I);D.files.push(G)}});var B="?action=interstitial&secondary_action=retrievealbums";if(D.urls.size()==1){B+="&mediaUrl="+D.urls.first()}else{var E;D.files.each(function(G){E+="&selectedmedia[]="+G})}var A={contentUrl:B,parameters:E,initialHeight:200,onComplete:function(){new SaveToAlbum({mediaurls:D.urls})}};document.fire(PBLightbox.EVENT.ACTIVATE,A)},handleMultipleTag:function(A){if(this.nSelectedMediaCounter>0){if(!this.validateMultiSelection()){return false}this.eltAction.value="tageditmany";this.eltForm.submit()}return true},handleMultipleDelete:function(B){if(this.nSelectedMediaCounter>0){if(!this.validateMultiSelection()){return false}var A=confirm("WARNING: Deleting files may cause your direct links, slideshows, remixes or scrapbooks to break.\n\nAre you sure you want to do this?");if(A){this.eltAction.value="delete";this.eltForm.submit()}}return true},handleMultipleMove:function(A){if(this.nSelectedMediaCounter>0){this.eltAction.value="moveoptions";this.eltForm.submit()}return true},handleMultipleCodegen:function(A){if(this.nSelectedMediaCounter>0){this.eltAction.value="codegen";this.eltForm.submit()}return true},handleLinkOptionsClick:function(A){if(this.bLinkOptionsOpen==false){Element.show("containerLinkOptions");this.bLinkOptionsOpen=true}else{Element.hide("containerLinkOptions");this.bLinkOptionsOpen=false}Event.stop(A);return true},handleLinkOptionsSave:function(A){this.eltAction.value="changelinkoptions";this.eltForm.submit();return true},handleApproval:function(D,A,C){var B=location.pathname;B+="?action=";B+=(C)?"approvemedia":"rejectmedia";B+="&mediaUrl="+A;new Ajax.Request(B,{method:"get",onSuccess:function(F){if(C){$("approval_"+D).hide()}else{$("media_"+D).hide()}var E=$("chk_"+D);E.attributes.isPending.value=""}})},handlePendingChecked:function(C){var B=C.attributes.isPending;if(B&&B.value.indexOf("|")>-1){var A=B.value.split("|");if(C.checked){this.pendingQueue[A[0]]={id:A[0],url:A[1]}}else{delete this.pendingQueue[A[0]]}this.enableApprovalBatchAction()}},handleMultipleApproval:function(A){for(var C in this.pendingQueue){var B=this.pendingQueue[C];this.handleApproval(B.id,B.url,true)}this.pendingQueue={};this.enableApprovalBatchAction();return false},enableApprovalBatchAction:function(){var B=false;for(var A in this.pendingQueue){B=true;break}photobucket.ui.setButtonDisabled($("approve_selected"),!B)},handleSingleSaveToAlbum:function(C){APIRequest.track("save_to_album_"+this.albumType+"_thumbnail_single");var A=$("mediaUrl_"+C).value;var B={contentUrl:"?action=interstitial&secondary_action=retrievealbums&mediaUrl="+A,initialHeight:200,onComplete:function(){new SaveToAlbum({mediaUrl:A})}};document.fire(PBLightbox.EVENT.ACTIVATE,B)},handleSponsoredSaveToAlbum:function(C){APIRequest.track("save_to_album_"+this.albumType+"_thumbnail_sponsored");var E=arguments[1];var B=false;if($("loggedIn")!=null){B=true}var A=$("sponsoredMediaURL_"+E).value;if(B){var D={contentUrl:"?action=interstitial&secondary_action=retrievealbums&mediaUrl="+A,initialHeight:200,onComplete:function(){new SaveToAlbum({mediaUrl:A})}};document.fire(PBLightbox.EVENT.ACTIVATE,D)}else{var D={contentUrl:"/promptlogin",initialHeight:400,onComplete:function(){new LoginPrompt({mediaUrl:A})}};document.fire(PBLightbox.EVENT.ACTIVATE,D)}},enableDisableBatchActions:function(D){var A=["tag_selected","delete_selected","move_selected","codegen","savetoalbum_selected"];for(var C=0;C<A.length;C++){var B=$(A[C]);photobucket.ui.setButtonDisabled(B,D)}this.enableApprovalBatchAction()},highlightSelectedCell:function(A,B){if(A&&B){if(A.checked&&!B.hasClassName("selectedCell")){B.addClassName("selectedCell");this.nSelectedMediaCounter++}else{if(!A.checked&&B.hasClassName("selectedCell")){B.removeClassName("selectedCell");this.nSelectedMediaCounter--}}this.handlePendingChecked(A);this.enableDisableBatchActions(this.nSelectedMediaCounter==0)}},getCheckboxes:function(){var A=(new Array()).toArray();if(typeof (A=document.forms.thumbForm.elements["selectedmedia[]"])!="undefined"){if(typeof (A)!="object"||typeof (A.length)=="undefined"){A=([A]).toArray()}}return A},validateMultiSelection:function(){var D=false;var B=this.getCheckboxes();for(var C=0;C<B.length;C++){var E=B[C];if(!E.checked){continue}if(typeof E.attributes.isReadOnly!="undefined"){E.checked=false;var A=Element.up(E,"LI");this.highlightSelectedCell(E,A)}else{D=true}}return D},createCookie:function(C,D,E){var A;if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));A="; expires="+B.toGMTString()}else{A=""}document.cookie=C+"="+D+A+"; domain=.photobucket.com; path=/"},parseVideoUrl:function(B){var A=B;B=B.split("?");if(B.length>1){B=B[1].split("file=");if(B.length>1){A=B[1]}}return A},getStrMediaType:function(B){var C=null,A;if(B&&(A=$("sponsoredMediaType_"+B))!=null&&typeof (A.value)!="undefined"){C=A.value}return C},getUrlMedia:function(C){var D=null,B;if(C&&(B=$("sponsoredMediaURL_"+C))!=null&&typeof (B.value)!="undefined"){D=B.value;var A=this.getStrMediaType(C);if(A=="video"){D=this.parseVideoUrl(D)}}return D},setImageEditBubblePostion:function(C){var B=$(C);var A=$("containerThumbnails");var E;if(B&&(E=$("bubbleImageEdit"))!=null){if(!Element.visible(E)){var D=getEltOffsetPos(B,A);Element.show(E);E.style.left=D.left-E.offsetWidth+28+"px";E.style.top=D.top+B.offsetHeight+10+"px";E.style.zIndex=9800}}return true},setImageEditBubbleSeen:function(){var B={};B.action="newEditorBubbleView";new Ajax.Request(this.urlBase,{method:"post",parameters:B});var A=$("bubbleImageEdit");this.objImageEditBubbleCtrl.hideBubble(A)},setOrganizeBubblePostion:function(){var B=$("lnkOrganize");var A=$("containerBreadcrumb");var D;if(B&&(D=$("bubbleOrganize"))!=null){var C=getEltOffsetPos(B,A);Element.show(D);D.style.right=A.offsetWidth-C.left+6+"px";D.style.top=B.offsetTop-15+"px";D.style.zIndex=9000}return true},setOrganizeBubbleSeen:function(){var C={};C.action="organizeBubbleView";new Ajax.Request(this.urlBase,{method:"post",parameters:C});var B=$("bubbleOrganize");this.objOrganizeBubbleCtrl.hideBubble(B);var A=$$("div.hasOrganizeBubble");if(A&&A.length>0){A[0].removeClassName("hasOrganizeBubble")}},getDocUrl:function(){var A=document.location.href;A=A.split("?")[0];A=A.split("#")[0];return A}};function getEltIndex(B){var A=null,C;if(B&&typeof (B.id)!="undefined"&&typeof (C=B.id.split("_")[1])=="string"){A=C}return A}function determineMediaType(B){var A;var C;if((A=getEltIndex(B))!=null){var D=$("mediaUrl_"+A);var E=D.value;if(E.indexOf("/remix/player.swf")!=-1){C="remix"}else{if(E.indexOf("/player.swf")!=-1){C="video"}else{C="photo"}}}else{C="photo"}return C}function singleActionPreparation(A,C){var F=null,B=null,E,D=false;if(typeof (F=document.forms.thumbForm)!="undefined"){B=F.elements["selectedmedia[]"];F.elements.action.value=C}if(B){for(i=0,len=B.length;i<len;i++){if((E=getEltIndex(B[i]))!=null){if(E!=A){B[i].checked=false;D=true}else{B[i].checked=true}}}if(!D){B.checked=true}F.submit()}}function handleSingleMove(B){var A;if((A=getEltIndex(B))!=null){singleActionPreparation(A,"moveoptions")}return false}function handleSingleDelete(C){var B;var A=confirm("WARNING: Deleting files may cause your direct links, slideshows, remixes or scrapbooks to break.\n\nAre you sure you want to do this?");if(A&&(B=getEltIndex(C))!=null){singleActionPreparation(B,"delete")}return false}function highlightInputText(A){if(A){A.select()}return true}function handleTitleClick(E){var F;var D=window.location.href.split("?")[0];if(E&&typeof (E.id)!="undefined"){var H=E.id;H=H.split("_");if(H[0]=="title"){var C,G=null,B=null;C=H[1];B=E.innerHTML;if(C&&(F=$("mediaUrl_"+C))!=null){G=F.value;var A=determineMediaType(E);if(A=="remix"){G=G.split("&")[0];G=decodeURIComponent(G)}}G=decodeURIComponent(G);if(G&&B&&C){new InplaceEditor({srcTextId:E.id,strAltTextSrcInputId:"mediaTitle_"+C,strTitleEltId:"pTitle_"+C,nDisplayLength:12,textEditId:"txtTitleEdit_"+C,bttnOkId:"okTitleEdit_"+C,bttnCancelId:"cancelTitleEdit_"+C,errorMssgId:"errorMssgTitleEdit_"+C,bSetFormSubmit:true,strDefaultText:"click to add title",strAttrToUpdate:"title",ajax:new AjaxWrapper(D,{method:"post",parameters:{action:"mediasettitle",media:G,title:B}})})}}}fireMouseEvent(E,"click");return false}function handleGridTitleClick(E){var F;var D=window.location.href.split("?")[0];if(E&&typeof (E.id)!="undefined"){var H=E.id;H=H.split("_");if(H[0]=="title"){var C,G=null,B=null;C=H[1];B=E.innerHTML;if(C&&(F=$("mediaUrl_"+C))!=null){G=F.value;var A=determineMediaType(E);if(A=="remix"){G=G.split("&")[0];G=decodeURIComponent(G)}}G=decodeURIComponent(G);if(G&&B&&C){new InplaceEditor({srcTextId:E.id,strAltTextSrcInputId:"mediaTitle_"+C,strTitleEltId:"containerTitle_"+C,nDisplayLength:12,textEditId:"txtTitleEdit_"+C,bttnOkId:"okTitleEdit_"+C,bttnCancelId:"cancelTitleEdit_"+C,errorMssgId:"errorMssgTitleEdit_"+C,bSetFormSubmit:false,strDefaultText:"click to add title",strAttrToUpdate:"title",ajax:new AjaxWrapper(D,{method:"post",parameters:{action:"mediasettitle",media:G,title:B}})})}}fireMouseEvent(E,"click")}return false}function handleGridDescriptionClick(E){var F;var D=window.location.href.split("?")[0];if(E&&typeof (E.id)!="undefined"){var H=E.id;H=H.split("_");if(H[0]=="description"){var C,G=null,B=null;C=H[1];B=E.innerHTML;if(C&&(F=$("mediaUrl_"+C))!=null){G=F.value;var A=determineMediaType(E);if(A=="remix"){G=G.split("&")[0];G=decodeURIComponent(G)}}G=decodeURIComponent(G);if(G&&B&&C){new InplaceEditor({srcTextId:E.id,strAltTextSrcInputId:"mediaDescription_"+C,strTitleEltId:"containerDescription_"+C,nDisplayLength:55,textEditId:"txtDescriptionEdit_"+C,bttnOkId:"okDescriptionEdit_"+C,bttnCancelId:"cancelDescriptionEdit_"+C,errorMssgId:"errorMssgDescriptionEdit_"+C,bSetFormSubmit:false,strDefaultText:"click to add description",strAttrToUpdate:"desc",ajax:new AjaxWrapper(D,{method:"post",parameters:{action:"mediasetdesc",media:G,desc:B}})})}}fireMouseEvent(E,"click")}return false}var ThumbLoadedHelper=Class.create();ThumbLoadedHelper.prototype={initialize:function(){this.paddingAdjustment=20;this.marginAdjustment=10;this.minWidth=90;this.minHeight=90},handleThumbLoad:function(A,G){var E=Event.element(A);if(!E.tagName){E=A.currentTarget}var F=$(G);if(F&&E){var B=Element.up(E,".image");if(B&&(this.minHeight>B.getHeight())){B.style.marginTop=this.marginAdjustment+"px"}var C=Math.max(E.getWidth()-this.paddingAdjustment,this.minWidth);F.style.width=C+"px";F.style.display="block";var D=E.getHeight()-F.getHeight();F.style.top=D+"px"}}};function clearTo(){obj=document.getElementById("to");if(obj.value=="separate email addresses by commas."){obj.className="to";obj.value=""}return }function clearSuccess(){obj=document.getElementById("to");obj.value="";return }var GroupShare=Class.create();GroupShare.prototype={eltContactDiv:null,eltNoContacsDiv:null,eltContactInner:null,eltToField:null,eltSendInvite:null,eltEmailContactInsert:null,eltDoneButton:null,eltNoContactsCancel:null,eltInsertButton:null,eltProgressMeter:null,eltNoContacsDiv:null,eltContactsTable:null,eltSelectAllCheck:null,listCheckBoxes:null,listTRs:null,shareUrl:null,track:null,eltSelectAllCheck:null,initialize:function(){var A;this.eltContactDiv=$("contactSelect");this.eltNoContacsDiv=$("noContacts");this.eltContactInner=$("contactDivInner");this.eltToField=$("to");this.eltEmailContactInsert=$("emailContactInsert");this.eltDoneButton=$("btnContactsDone");this.eltNoContactsCancel=$("btnNoContactsCancel");this.eltSendInvite=$("share");this.eltInsertButton=$("btnContactsInsert");this.eltProgressMeter=$("progressMeter");this.eltNoContacsDiv=$("noContacts");this.shareUrl=$("shareUrl");this.track=$("track");if(this.eltEmailContactInsert){this.eltEmailContactInsert.onclick=this.handleToButtonClick.bindAsEventListener(this)}if(this.eltInsertButton){this.eltInsertButton.onclick=this.handleInsertButtonClick.bindAsEventListener(this)}if(this.eltDoneButton){this.eltDoneButton.onclick=this.handleDoneButtonClick.bindAsEventListener(this)}if(this.eltNoContactsCancel){this.eltNoContactsCancel.onclick=this.handleNoContactsCancelClick.bindAsEventListener(this)}if(this.eltSendInvite){Event.observe(this.eltSendInvite,"submit",this.handleEmailSendInvite.bindAsEventListener(this),false)}},clearDefaultToFieldText:function(){clearTo()},handleEmailSendInvite:function(I){var B=true;var A=this.shareUrl.value;var H=$("uname");var G=$("to");var C=$("message");var F=new Array("recipient",G,"message",C);for(var D=1;D<F.length;D+=2){if(F[D].value==""||F[D].value=="separate email addresses by commas."){var E="A "+F[D-1]+" is required.";controllerMessagePanel.printMessage({message:"Attention",details:E,type:MessagePanelController.MSSG_TYPE_ERROR});Event.stop(I);break}}},handleToButtonClick:function(C){this.windowCleaner();Element.show(this.eltContactDiv);var A=new APIRequest("getusercontacts",false,null,this.xHandlerSuccess.bind(this),this.xHandlerFailure.bind(this),true);var B=new Ajax.Request("?action=getusercontacts",{asynchronous:true,method:"GET",parameters:null,onSuccess:A.handleSuccess.bind(A),onFailure:A.handleFailure.bind(A)});return true},handleInsertButtonClick:function(F){this.clearDefaultToFieldText();var E=new Array();var C;var B;var A=this.eltToField.value;A=A.replace(/[, ]*$/,"");for(i=0;i<this.listCheckBoxes.length;i++){if(this.listCheckBoxes[i].checked){B=this.listCheckBoxes[i].value;if(B&&A.indexOf(B)<0&&E.indexOf(B)<0){E.push(B)}}}if(E.length>0){var D=E.join(", ");if(A){A+=", "}this.eltToField.value=A+D}this.windowCleaner()},handleCheckContact:function(D){var B=Event.element(D);var A=Event.findElement(D,"TR");if(B&&A){if(B.checked){Element.addClassName(A,"selectedRow")}else{Element.removeClassName(A,"selectedRow")}}var C=this.getAllContactsCheckedState();if(C==this.ALL_CHECKED){if(!this.eltSelectAllCheck.checked){this.eltSelectAllCheck.checked=true}photobucket.ui.setButtonDisabled(this.eltInsertButton,false)}else{if(C==this.ALL_UNCHECKED){if(this.eltSelectAllCheck.checked){this.eltSelectAllCheck.checked=false}photobucket.ui.setButtonDisabled(this.eltInsertButton,true)}else{photobucket.ui.setButtonDisabled(this.eltInsertButton,false)}}return true},handleCheckAllContacts:function(A){if(this.eltSelectAllCheck&&this.listCheckBoxes){if(this.eltSelectAllCheck.checked){this.listCheckBoxes.each(function(B){B.checked=true});this.listTRs.each(function(B){Element.addClassName(B,"selectedRow")});photobucket.ui.setButtonDisabled(this.eltInsertButton,false)}else{this.listCheckBoxes.each(function(B){B.checked=false});this.listTRs.each(function(B){Element.removeClassName(B,"selectedRow")});photobucket.ui.setButtonDisabled(this.eltInsertButton,true)}}return true},getAllContactsCheckedState:function(){var C=0,B,A,D=this.SOME_CHECKED;for(B=0,A=this.listCheckBoxes.length;this.listCheckBoxes[B]&&B<A;B++){if(this.listCheckBoxes[B].checked){C++}}if(this.listCheckBoxes.length==C){D=this.ALL_CHECKED}else{if(C==0){D=this.ALL_UNCHECKED}}return D},handleDoneButtonClick:function(A){this.windowCleaner()},handleNoContactsCancelClick:function(A){this.windowCleaner()},windowCleaner:function(){var A;Element.update(this.eltContactInner,"");this.listTRs=null;this.listCheckBoxes=null;if(this.eltSelectAllCheck){this.eltSelectAllCheck.checked=false}photobucket.ui.setButtonDisabled(this.eltInsertButton,true);Element.hide(this.eltContactDiv);Element.hide(this.eltNoContacsDiv);Element.hide(this.eltContactInner);Element.show(this.eltProgressMeter)},getDisplayName:function(A){var B="";if(A.first&&A.last){B=A.first+" "+A.last}else{if(A.first){B=A.first}else{if(A.last){B=A.last}}}return B},getTHEAD:function(){var A="<thead>\n";A+="<tr>";A+='<th class="cellSelectAll">';A+='<input type="checkbox" name="select_all" id="select_all" value="entry_all" title="select/unselect all">';A+="</th>";A+="<th>Name</th>";A+="<th>Details</th>";A+="</tr>\n";A+="</thead>\n";return A},xHandlerFailure:function(A){var B="<!-- Scrolling content -->";B+='<table id="contactsList">';B+=this.getTHEAD();B+="<tbody>";B+='<tr><td colspan="3">Error retrieving contact list from the server...</td></tr>';B+="</tbody></table><!-- END: scrolling content -->";Element.update(this.eltContactInner,B);Element.show(this.eltContactInner);Element.hide(this.eltProgressMeter)},xHandlerSuccess:function(A){var C="<!-- Scrolling content -->\n";C+='<table id="contactsList">\n';C+=this.getTHEAD();C+="<tbody>\n";if(A.usercontacts&&A.usercontacts.contacts_count>0){var D=A.usercontacts;for(var B=0;B<D.contacts_count;B++){C+="<tr>";C+="<th>";C+='<input type="checkbox" name="selectedcontacts[]" id="entry_'+B+'" value="'+D[B].contact.primary_email+'">';C+="</th>";C+="<td>";C+='<label for="entry_'+B+'">'+this.getDisplayName(D[B].contact)+"</label>";C+="</td>";C+="<td>";C+='<label for="entry_'+B+'">'+D[B].contact.primary_email+"</label>";C+="</td>";C+="</tr>\n"}C+="</tbody></table><!-- END: scrolling content -->";Element.update(this.eltContactInner,C);this.eltContactsTable=$("contactsList");this.eltSelectAllCheck=$("select_all");Element.show(this.eltContactInner);Element.hide(this.eltProgressMeter);if(this.eltSelectAllCheck!=null){this.eltSelectAllCheck.onclick=this.handleCheckAllContacts.bindAsEventListener(this)}this.attachContactList()}else{Element.hide(this.eltContactDiv);Element.show(this.eltNoContacsDiv)}},attachContactList:function(){var B,D,C,A;if(this.eltContactsTable!=null&&(D=this.eltContactsTable.getElementsByTagName("INPUT"))!=null){D=$A(D);this.listCheckBoxes=D.findAll(function(E){return(E.name=="selectedcontacts[]"&&E.type=="checkbox")});for(C=0,A=this.listCheckBoxes.length;this.listCheckBoxes&&C<A;C++){this.listCheckBoxes[C].onclick=this.handleCheckContact.bindAsEventListener(this)}}if(this.eltContactsTable!=null&&(D=this.eltContactsTable.getElementsByTagName("TR"))!=null){D=$A(D);this.listTRs=D.findAll(function(E){return(E.parentNode&&E.parentNode.tagName=="TBODY")})}}};var ImageUtils={initialize:function(){Event.observe(document,ImageUtils.MESSAGE.SCALE,this.scaleImage.bindAsEventListener(this))},scaleImage:function(B){var F=B.memo.maxheight;var A=B.memo.maxwidth;var E=B.memo.image;var C=E.style;C.width="auto";C.height="auto";try{if(E.offsetWidth>E.offsetHeight){C.width=A+"px"}else{C.height=F+"px"}}catch(D){C.width=A+"px";C.height=F+"px"}}};ImageUtils=Class.create(ImageUtils);ImageUtils=Object.extend(ImageUtils,{MESSAGE:{SCALE:"ImageUtils:SCALE"}});new ImageUtils();var linksMoHelper=Class.create();linksMoHelper.prototype={checkMedia:null,initialize:function(A){this.checkMedia=(A.chkMedia)?true:false},isMouseLeaveOrEnter:function(C,B){if(photobucket.browser.isIE){if(C.type!="mouseout"&&C.type!="mouseover"){return false}var A=C.relatedTarget?C.relatedTarget:C.type=="mouseout"?C.toElement:C.fromElement;while(A&&A!=B){A=A.parentNode;return(A!=B)}}else{if(C.type=="mouseout"){return false}else{return true}}},showShareLinks:function(B){var A=$("panel_"+B);if(this.checkMedia){var C=$("checkMedia_"+B);if(C.style.display=="none"){C.show()}}A.show()},hideShareLinks:function(B){var A=$("panel_"+B);if(this.checkMedia){var C=$("checkMedia_"+B);if($("chk_"+B).checked){C.show()}else{C.hide()}}A.hide()},isMouseOver:function(B,I){if(photobucket.browser.isIE){var F=Event.pointerX(I);var E=Event.pointerY(I);var A=Element.cumulativeOffset(B);var C=Element.getDimensions(B);var D=C.height;var H=((A.left<F)&&(F<(A.left+C.width)));var G=((A.top<E)&&(E<(A.top+D)));return(H&&G)}else{return this.isMouseLeaveOrEnter(I,B)}}};var PublishThemeController=Class.create();PublishThemeController.prototype={form:null,formId:"formPublishTheme",nameId:"publishThemeName",categoriesName:"theme_category_ids[]",categories:null,maxCat:3,numCat:null,initialize:function(){this.form=$(this.formId);this.categories=this.form.select("UL#listCategories LI INPUT[type=checkbox]");Event.observe(this.form,"submit",this.handleSubmit.bindAsEventListener(this),false);this.categories.each(function(A){Event.observe(A,"click",this.handleSelect.bindAsEventListener(this))}.bind(this));this.numCat=this.numSelected()},numSelected:function(){return this.categories.findAll(function(A){return A.checked}).size()},handleSelect:function(A){if(A.target.checked){if(this.numCat<this.maxCat){this.numCat++;if(this.numCat==this.maxCat){this.toggleUnselected(A.target)}}}else{this.numCat--;if(this.numCat==this.maxCat-1){this.toggleUnselected(A.target)}}},toggleUnselected:function(A){this.categories.each(function(B){if(!B.checked&&B!=A){B.disabled=!B.disabled}}.bind(this))},handleSubmit:function(C){var B=$(this.nameId);if(B&&B.value){var A={method:"post",asynchronous:true,evalJSON:"force",parameters:this.form.serialize(true),onSuccess:this.handleSuccess.bindAsEventListener(this),onFailure:function(D){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"An unknown error occurred.",type:PBMessage.MESSAGE_TYPE.ERROR})})}};new Ajax.Request("?action=submitsharedtheme",A)}else{document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({type:PBMessage.MESSAGE_TYPE.ERROR,title:"Error: No Theme Name.",details:"A theme name is required. Please enter a name for your theme."})})}Event.stop(C)},handleSuccess:function(B){try{var C=B.responseJSON.response;if(C&&C.stat&&C.stat=="ok"){document.fire(PBLightbox.EVENT.DEACTIVATE);document.fire(PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:C.message.title,details:C.message.details,type:PBMessage.MESSAGE_TYPE.SUCCESS})})}else{if(C.stat&&C.stat=="fail"){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:C.message.title,details:C.message.details,type:PBMessage.MESSAGE_TYPE.ERROR})})}}}catch(A){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"An unknown error occurred.",type:PBMessage.MESSAGE_TYPE.ERROR})})}}};