var MessagePanelController=Object.extend(Class.create({}),{INSTANCE:null,getInstance:function(){var A;var C;function B(){A=Class.create({pbType:"PBMessagePanel",titleClass:".message",detailsClass:".details",initialize:function(D){this.id=D.id;this.elem=D},notify:function(D){var G=this.elem.down(this.titleClass);if(typeof G=="undefined"){G=this.loop(this.titleClass)}G.innerHTML=D.title||"";var F=this.elem.down(this.detailsClass);if(typeof F=="undefined"){F=this.loop(this.detailsClass)}F.innerHTML=D.details||"";for(var E in PBMessage.MESSAGE_TYPE){this.elem.removeClassName(PBMessage.MESSAGE_TYPE[E])}this.elem.addClassName(D.type);this.elem.show()},close:function(){this.elem.hide()},loop:function(F){var E=$$(".message",".details");for(var D=0;D<E.length;D++){if(E[D].hasClassName(F.replace(/./,""))){return E[D];break}}}});C=Class.create({pbType:"PBMessagePanelController",cssClass:".messagePanel",defaultPanelId:"MessagePanel",initialize:function(){this.panel={};Event.observe(document,PB.EVENT.PAGE_LOADED,this.onDomLoaded.bindAsEventListener(this));Event.observe(document,PBMessage.EVENT.NOTIFY,this.notify.bindAsEventListener(this));Event.observe(document,PBMessage.EVENT.CLOSE,this.close.bindAsEventListener(this))},onDomLoaded:function(D){var F=$$(this.cssClass).toArray();for(var E=0;E<F.length;E++){this.createMessagePanel(F[E])}},createMessagePanel:function(D){var E=new A(D);this.panel[E.id]=E},notify:function(D){var E=D.memo;var F=E.id||this.defaultPanelId;if(!this.panel[F]||!E.message||E.message.pbType!=PBMessage.TYPE){return }this.panel[F].notify(E.message);if(D.memo.gotoHash){window.location.hash="#"+F+"Hash"}},close:function(D){var E=D.memo;var F=E.id||this.defaultPanelId;if(!this.panel[F]){return }this.panel[F].close()},printMessage:function(E){var D=new PBMessage(E);this.notify({memo:{message:D}})},clearMessage:function(){this.close({memo:{}})}})}if(MessagePanelController.INSTANCE==null){B();MessagePanelController.INSTANCE=new C()}return MessagePanelController.INSTANCE}});var PBMessage=Class.create({initialize:function(A){if($H(PBMessage.MESSAGE_TYPE).any(function(B){return B.value==A.type})){this.type=A.type}else{this.type=PBMessage.MESSAGE_TYPE.SUCCESS}this.title=A.title||A.message;this.details=A.details;this.pbType=PBMessage.TYPE}});PBMessage=Object.extend(PBMessage,{TYPE:"PBMessage",MESSAGE_TYPE:{ERROR:"error",ALERT:"alert",SUCCESS:"status",CONFIRM:"confirm",ROADBLOCK_ALERT:"roadblockAlert",ROADBLOCK_STATUS:"roadblockStatus"},EVENT:{NOTIFY:"PBMessage:Notify",CLOSE:"PBMessage:Close"}});controllerMessagePanel=MessagePanelController.getInstance();var MessagePanelController=Object.extend(Class.create(),{MSSG_TYPE_ERROR:"error",MSSG_TYPE_MESSAGE:"message"});var controllerMessagePanel;MessagePanelController.prototype={panelIDPrefix:"album",initialize:function(B,E){this.panelIDPrefix=B;var D=$(B+"ErrorPanel");var A,C;C=D.select("a","linkErrorPanelClose");if(C.length>1){A=C[0]}else{A=C.pop()}if(A!=null){Event.observe(A,"click",this.handleCloseErrorClick.bindAsEventListener(this),false)}if(E){this.clearMessage()}controllerMessagePanel=this},handleCloseErrorClick:function(E){var D=$(this.panelIDPrefix+"ErrorPanel");var C;if(D!=null){D.className="";var A=D.select("span","panelErrorMessageContent");if(A!=null){A.innerHTML=""}var B=D.select("div","panelErrorDetails");if(B!=null){B.innerHTML=""}Element.hide(D)}},printMessage:function(B){var E,G,A;var F,C;var D=MessagePanelController.MSSG_TYPE_ERROR;if(typeof (B)=="object"){if(typeof (B.message)=="string"){F=B.message}if(typeof (B.details)=="string"){C=B.details}if(typeof (B.type)=="string"){D=B.type}}E=$(this.panelIDPrefix+"ErrorPanel");if(typeof (E)!="undefined"){E.className="";Element.addClassName(E,"panel"+D.capitalize());if(F){if((G=E.select("span","panelErrorMessageContent").pop())!=null){G.innerHTML=F}}if(C){if((A=E.select("div","panelErrorDetails").pop())!=null){A.innerHTML=C;Element.show(A)}}Element.show(E);if((elt=$("userMessagePanel"))!=null){elt.toggle()}}},clearMessage:function(){var B,C,A;if((B=$(this.panelIDPrefix+"ErrorPanel"))!=null){B.className="";if((C=B.select("span","panelErrorMessageContent").pop())!=null){C.innerHTML=""}if((A=B.select("div","panelErrorDetails").pop())!=null){A.innerHTML="";Element.hide(A)}if((elt=$("userMessagePanel"))!=null){elt.toggle()}}Element.hide(this.panelIDPrefix+"ErrorPanel")},setPaneIDPrefix:function(A){this.panelIDPrefix=A}};function trackCopyCodeClick(A,B){APIRequest.track(A);if((B===true)||(B==="true")){APIRequest.track("sponsored_slideshow_click")}}function trackCodeClick(E,D,B){var A=Event.element(E);if(D=="adobeexpress"){D="remix"}if(A){var C=A.value;if(C.match(/^http:/)){if(C.match(/albumview=grid$/)){APIRequest.track("image_code_click_SHARE_ALBUM_GRID")}else{if(C.indexOf("?")>-1){APIRequest.track("image_code_click_ALBUM_SHARE_URL")}else{APIRequest.track("image_code_click_ALBUM_URL_LINK")}}}else{if(C.match(/^<img src=/)||C.match(/^<embed/)||C.match(/^<a href=/)){APIRequest.track("image_code_click_ALBUM_HTML")}else{if(C.match(/^\[URL=http:/)||C.match(/^\[IMG\]http:/)){APIRequest.track("image_code_click_ALBUM_IMG")}}}}if(B==1){APIRequest.track("sponsored_slideshow_click")}return true}function trackCodeClickFullview(E,D,B){var A=Event.element(E);if(D=="adobeexpress"){D="remix"}if(A){var C=A.value;if(C.match(/^http:/)){if(C.indexOf("?")>-1){APIRequest.track("image_code_click_FULLVIEW_SHARE_URL")}else{APIRequest.track("image_code_click_FULLVIEW_URL_LINK")}}else{if(C.match(/^<img src=/)||C.match(/^<embed/)||C.match(/^<a href=/)){APIRequest.track("image_code_click_FULLVIEW_HTML")}else{if(C.match(/^\[URL=http:/)||C.match(/^\[IMG\]http:/)){APIRequest.track("image_code_click_FULLVIEW_IMG")}else{if(C.match(/^<table border=/)){APIRequest.track("image_code_click_FULLVIEW_FLASH")}}}}}if(B==1){APIRequest.track("sponsored_slideshow_click")}return true}function trackCodeClickMediaDetail(F,D,B){var A=Event.element(F);if(D=="adobeexpress"){D="remix"}if(A){var C=A.value;if(C.match(/^http:/)){var E=C.split("/");if(E[3]=="groups"||E[3]=="albums"){APIRequest.track("image_code_click_MEDIADETAIL_URL_LINK")}else{APIRequest.track("image_code_click_MEDIADETAIL_SHARE_URL")}}else{if(C.match(/^<img src=/)||C.match(/^<embed/)||C.match(/^<a href=/)){APIRequest.track("image_code_click_MEDIADETAIL_HTML")}else{if(C.match(/^\[URL=http:/)||C.match(/^\[IMG\]http:/)){APIRequest.track("image_code_click_MEDIADETAIL_IMG")}else{if(C.match(/^<table border=/)){APIRequest.track("image_code_click_MEDIADETAIL_FLASH")}}}}}if(B==1){APIRequest.track("sponsored_slideshow_click")}return true}function copyToClipboard(D){var E=false;var A=Math.floor(Math.random()*10001);try{var I=new SWFObject("/include/swf/_clipboard.swf?cb="+A,"detectFlashObj",1,1,"9.0.0");if(I.installedVer.major>9){E=true}}catch(H){}if(!E){var J="/include/swf/_clipboard.swf";var F="notifyTextCopied";var G="flashcopier";if(!$(G)){var B=document.createElement("div");B.id=G;document.body.appendChild(B)}$(G).innerHTML="";var C='<embed src="'+J+'" FlashVars="clipboard='+escape(D.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';$(G).innerHTML=C;copyToClipboardEffect(D)}D.select();return true}function copyToClipboardExternal(D,A,C){var B=$(D);copyToClipboardEffect(B);trackCopyCodeClick(A,C)}function copyToClipboardEffect(C){var D="notifyTextCopied";var F=Element.up(C);var A=document.createElement("div");A.setAttribute("id",D);A.appendChild(document.createTextNode("Copied"));F.appendChild(A);C.onblur=function(H){Element.hide(A);return true};var E=Element.cumulativeOffset(C);var G=Element.positionedOffset(C);Element.show(A);if(E.left<(A.offsetWidth+2)){A.style.left=(G.left+(C.offsetWidth+3))+"px"}else{A.style.left=(G.left-(A.offsetWidth+2))+"px"}A.style.top=G.top+"px";var B=Effect.Fade(A,{fps:75,from:1.9,to:0,duration:1,queue:"front",afterFinish:function(){Element.remove(A)}});window.status="Copied text to clipboard";return true}function fireMouseEvent(D,G,B,A){var F=false,E=true;if(typeof (B)=="boolean"){F=B}if(typeof (A)=="boolean"){E=A}if(typeof (D)!="undefined"&&D&&typeof (G)=="string"&&G.length>0){var C;if(document.createEvent){C=document.createEvent("MouseEvents");C.initEvent(G,F,E);D.dispatchEvent(C)}else{if(document.createEventObject){C=document.createEventObject();D.fireEvent("on"+G,C)}}}}function magickAdRender(F,E){var C;var H="INV"+F;if((C=document.getElementById(F))!=null){try{var D=E}catch(G){}if(typeof (D)!="undefined"){var A=navigator.userAgent.indexOf("MSIE");if(A>-1){var B='<iframe name="'+H+'" width="0" height="0" frameborder="0" AAM_EVENT="javascript:try { document.getElementById(\''+F+"').insertAdjacentElement('beforeEnd', window.frames['"+H+"'].document.getElementById('adDiv')) } catch(aamErr) { }\"></iframe>";C.innerHTML+='<div id="TMP'+F+'" style="display:none">'+escape('<body><div id="adDiv">'+D+"</div>")+"</div>"+B.replace(/AAM_EVENT/,"onload");window.frames[H].document.location="javascript:unescape(parent.document.getElementById('TMP"+F+"').innerHTML)"}else{document.writeln('<div id="'+H+'" style="display:none">'+D+'<script type="text/javascript" defer="true">document.getElementById(\''+F+"').innerHTML = document.getElementById('"+H+"').innerHTML;document.getElementById('"+H+"').innerHTML = '';<\/script></div>")}}}}function showToRightOfElement(I,D,G,F){if(!G){G=0}if(!F){F=0}var B=$(I);var E=$(D);var H=B;var C=0;var A=0;while(H){C+=H.offsetLeft;A+=H.offsetTop;H=H.offsetParent}if(navigator.userAgent.indexOf("Mac")!=-1&&typeof document.body.leftMargin!="undefined"){C+=document.body.leftMargin;A+=document.body.topMargin}E.style.left=C+parseInt(B.offsetWidth)+G+"px";E.style.top=A+F+"px";Element.show(E)}ShowHideRegistry=Class.create();ShowHideRegistry.prototype={eltHash:null,initialize:function(){this.eltHash=new Hash()},add:function(B){var A;if(!this.eltHash[B]&&(A=$(B))!=null){this.eltHash.set(B,A)}},remove:function(A){if(this.eltHash[A]){this.eltHash.remove(A)}},hideAllVisibility:function(){this.eltHash.each(function(A){A.value.style.visibility="hidden"})},hideAllDisplay:function(){this.eltHash.each(function(A){Element.hide(A.value)})},hideAllVisibleUnder:function(B){var A=$(B);var C=Position.cumulativeOffset(A);var D=A.getDimensions();this.eltHash.each(this.checkVisibility_Closure(C,D).bind(this))},checkVisibility_Closure:function(B,A){return function(E){var D=Position.cumulativeOffset(E.value);var C=E.value.getDimensions();if(!(B[0]>(D[0]+C.width)||(B[0]+A.width)<D[0]||B[1]>(D[1]+C.height)||(B[1]+A.height)<D[1])){E.value.style.visibility="hidden"}}},showAllVisibility:function(){this.eltHash.each(function(A){A.value.style.visibility="visible"})},showAllDisplay:function(){this.eltHash.each(function(A){Element.show(A.value)})},toggleAllVisibility:function(){this.eltHash.each(function(A){Element.toggle(A.value)})}};var flashRegistry=new ShowHideRegistry();function translateAjaxResponse(response){var jsonResp=null;if(response&&typeof (response.responseText)!="undefined"&&response.responseText){var json=eval("("+response.responseText+")");jsonResp=(json&&typeof (json.response)=="object"?json.response:null)}return jsonResp}function getEltOffsetPos(C,E){var D=C.offsetLeft,B=C.offsetTop;if(E){var A=C;while((A=A.offsetParent)!=null&&A!=E){D+=A.offsetLeft;B+=A.offsetTop}}return{left:D,top:B}}function viewContactsWindow(B,H){var A=550;var E=750;var D=(screen.width)?(screen.width-E)/2:0;var G=(screen.height)?(screen.height-A)/2:0;var C="height=450, width=620, top="+G+", left="+D+", menubar=no, location=no, resizable=yes, scrollbars=yes, status=no, titlebar=no";var F=window.open(B,"ModifyContacts",C);if(F.window.focus){F.window.focus()}if(typeof (H)=="boolean"&&H){return F}}function detectJavaScriptSupportChange(){var B=false;if(typeof readCookie=="function"&&typeof createCookie=="function"){var A="nojs";if(readCookie(A)!=null){createCookie(A,"",-1);B=true}}if(photobucket){photobucket.jsSupportChanged=B}}Event.observe(window,"load",detectJavaScriptSupportChange);var set_useragent_classes;if(set_useragent_classes){jq(document).ready(function(){var A=jq(document.body);if(photobucket.browser.isIE){A.addClass("is_ie")}if(photobucket.browser.isIE6){A.addClass("is_ie6")}if(photobucket.browser.isIE7){A.addClass("is_ie7")}if(photobucket.browser.isIE8){A.addClass("is_ie8")}if(photobucket.browser.isSafari){A.addClass("is_saf")}if(photobucket.browser.isFirefox){A.addClass("is_moz")}})}var photobucket={browser:{isIE:(navigator.userAgent.indexOf("MSIE")!=-1),isIE6:(navigator.userAgent.indexOf("MSIE 6")!=-1),isIE7:(navigator.userAgent.indexOf("MSIE 7")!=-1),isIE8:(navigator.userAgent.indexOf("MSIE 8")!=-1),isSafari:(navigator.userAgent.indexOf("AppleWebKit")!=-1),isFirefox:(navigator.userAgent.indexOf("Firefox")!=-1),isOpera:(navigator.userAgent.indexOf("Opera")!=-1)},ui:{getPageScroll:function(){var A;if(self.pageYOffset){A=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){A=document.documentElement.scrollTop}else{if(document.body){A=document.body.scrollTop}}}pageScrollObj={xScroll:null,yScroll:A};return pageScrollObj},getPageSize:function(){var C,A;if(window.innerHeight&&window.scrollMaxY){C=document.body.scrollWidth;A=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){C=document.body.scrollWidth;A=document.body.scrollHeight}else{C=document.body.offsetWidth;A=document.body.offsetHeight}}var B,D;if(self.innerHeight){B=self.innerWidth;D=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){B=document.documentElement.clientWidth;D=document.documentElement.clientHeight}else{if(document.body){B=document.body.clientWidth;D=document.body.clientHeight}}}if(A<D){pageHeight=D}else{pageHeight=A}if(C<B){pageWidth=B}else{pageWidth=C}pageSizeObj={pageWidth:pageWidth,pageHeight:pageHeight,windowWidth:B,windowHeight:D};return pageSizeObj},scrollTo:function(B,D,F,E){B=B||"#";D=D||"fast";F=F||null;E=(E===true||E==null)?true:false;if(B){if(B.indexOf("#")!=-1){var C=B.split("#",2);var A=jq("a[name='"+C[1]+"']");if(A){if(jq(document).height()-A.offset().top>=jq(window).height()||A.offset().top>jq(window).height()||jq(document).width()-A.offset().left>=jq(window).width()||A.offset().left>jq(window).width()){jq("html, body").animate({scrollTop:A.offset().top,scrollLeft:A.offset().left},D,F,function(){if(E){window.location=B}})}return false}}}},setButtonDisabled:function(B,A){if(B){B.disabled=A;if(A){Element.addClassName(B,"disabled")}else{Element.removeClassName(B,"disabled")}}},loadScript:function(A){var B=document.createElement("script");B.src=A;B.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(B)}}};function getDocumentUrl(){var A=document.location.href;A=A.split("?")[0];A=A.split("#")[0];return A}function cookieReader(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""}function createCookie(C,D,E){var A="";if(E){var B=new Date();B.setTime(B.getTime()+(E*24*60*60*1000));A="; expires="+B.toGMTString()}document.cookie=C+"="+escape(D)+A+"; path=/; domain= .photobucket.com"}function createCookieByUnixTimestamp(B,C,D){var A="";if(D){var E=new Date();E.setTime(D*1000);A="; expires="+E.toGMTString()}document.cookie=B+"="+escape(C)+A+"; path=/; domain= .photobucket.com"}function disableTextHighlight(A){if(typeof (A.onselectstart)!="undefined"){A.onselectstart=function(){return false}}else{if(typeof (A.style.MozUserSelect)!="undefined"){A.style.MozUserSelect="none"}else{A.onmousedown=function(){return false}}}A.style.cursor="default"}function getStringWidth(F,D,A){var C=document.createElement("span");if(D){C.className=D}C.style.whiteSpace="nowrap";C.innerHTML=F;if(A==null){A="stringWidthMeasure"}var E=$(A);E.appendChild(C);var B=C.offsetWidth;E.removeChild(C);return B}function truncateToPixels(C,A,G,B){if(getStringWidth(C,G,B)<=A){return C}A-=getStringWidth("....",G,B);var F=1;var E=C.length;var D=(F+E)/2;while(E-F>1){if(getStringWidth(C.substring(0,D),G,B)<=A){F=D}else{E=D}D=(F+E)/2}C=C.substring(0,E);while(getStringWidth(C,G,B)>A&&C.length>0){C=C.substring(0,C.length-1)}return C+"..."}function computeCountedAnchor(N,L,B,I,C,M,H,J,G){var E=H!=null?H:"xBox xBoxTheme";var A="+"+I;var F=I>0?getStringWidth(A,E,G):0;N=truncateToPixels(N,C-F,M,G);if(!B.include("?")&&!B.include("#")&&!B.endsWith("/")){B+="/"}var D="?sort=ascending";var K='<a href="'+B+D+'"';if(M!=null){K=K+' class="'+M+'"'}if(L!=null){K=K+' title="'+L+'"'}if(J!=null){K=K+' onclick="'+J+'"'}K=K+">"+N;if(I>0){K=K+'<span class="'+E+'">'+A+"</span>"}K=K+"</a>";return K}function promptRemix(A){if(A==""){var A=window.location.href.split("?")[0]}document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:A+"?action=interstitial&secondary_action=remix"})}MediaCounter=Class.create();MediaCounter.prototype={eltMediaCounter:null,floatMediaCount:null,floatImagesPerSecond:null,initialize:function(B,A){this.eltMediaCounter=$$("#cellImageCounter_"+A+" #counter")[0];if(this.eltMediaCounter){this.floatMediaCount=this.eltMediaCounter.innerHTML.gsub(",","")*1;this.floatImagesPerSecond=(B*1000000)/86400;new PeriodicalExecuter(this.updateMediaCount.bind(this),1)}},updateMediaCount:function(){this.floatMediaCount+=this.floatImagesPerSecond;Element.update(this.eltMediaCounter,this.commify(Math.round(this.floatMediaCount)))},commify:function(B){B+="";x=B.split(".");x1=x[0];x2=x.length>1?"."+x[1]:"";var A=/(\d+)(\d{3})/;while(A.test(x1)){x1=x1.replace(A,"$1,$2")}return x1+x2}};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();B.body.style.backgroundColor=this.backgroundcolor}}},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 PBProgressPanel;(function(){var A={defaultMsg:"Loading...",className:"progress",messageClassName:"message",elemSuffix:"_Progress",contentCache:new Hash(),initialize:function(){Event.observe(document,PBProgress.EVENT.ACTIVATE,this.activate.bindAsEventListener(this));Event.observe(document,PBProgress.EVENT.DEACTIVATE,this.deactivate.bindAsEventListener(this))},create:function(E){var C=$(E.parentId);if(C){var F=E.parentId+this.elemSuffix;var D;if(E.themed){D="<div class='modClrBg "+this.className+"' id='"+F+"' style='display:none;'><div class='txtClrDef "+this.messageClassName+"'>"}else{D="<div class='"+this.className+"' id='"+F+"' style='display:none;'><div class='"+this.messageClassName+"'>"}if(E.message){D+=E.message}else{D+=this.defaultMsg}D+="</div></div>";this.contentCache.set(E.parentId,D);return D}else{return false}},activate:function(C){if(C.memo instanceof PBProgress){var E=this.contentCache.get(C.memo.parentId);if(!E){E=this.create(C.memo)}var F=C.memo.parentId+this.elemSuffix;var D=$(C.memo.parentId);if(!$(F)||$(F).up()!=D){Element.insert(D,{top:E})}if(C.memo.message&&$(F).down()){$(F).down().innerHTML=C.memo.message}else{$(F).down().innerHTML=this.defaultMsg}this.setHeight($(F),D.getHeight());this.setWidth($(F),D.getWidth());D.style.position="relative";$(F).show();return true}else{return false}},deactivate:function(C){if(C.memo instanceof PBProgress){var D=C.memo.parentId+this.elemSuffix;if($(D)){$(D).hide()}return true}else{return false}},setHeight:function(D,C){D.style.height=C+"px"},setWidth:function(D,C){D.style.width=C+"px"}};var B={};Controller.create("PBProgressPanel",A,B)})();var PBProgress=Class.create({parentId:null,message:null,initialize:function(A){this.parentId=A.parentId;this.message=A.message;this.themed=A.themed}});PBProgress=Object.extend(PBProgress,{EVENT:{ACTIVATE:"PBProgress:Activate",DEACTIVATE:"PBProgress:Deactivate"}});var tabbedPanelHelper=Class.create();tabbedPanelHelper.prototype={activePanelIndex:null,key:null,totalPanels:null,initialize:function(A){this.activePanelIndex=A.defaultOpened;this.key=A.key;this.totalPanels=A.totalPanels;window[this.key]=this;Event.observe(document,tabbedPanelHelper.EVENT.SELECT_TAB,this.onSelectTab.bindAsEventListener(this))},handleCycle:function(E){var G=E.id;var B=G.split("_");var A=B[1];if(A!=this.activePanelIndex){var C=$(this.key+"_"+this.activePanelIndex);var D=$(this.key+"Body_"+this.activePanelIndex);var F=$(this.key+"_"+A);var I=$(this.key+"Body_"+A);this.toggleActive(C,D,false);this.toggleActive(F,I,true);this.activePanelIndex=A}else{var F=$(this.key+"_"+A);var I=$(this.key+"Body_"+A);this.toggleActive(F,I,true)}this.reset();var H=this.key+"."+G;document.fire(tabbedPanelHelper.EVENT.TAB_CHANGE,{tabPanel:this,tabLinkId:H})},toggleActive:function(B,A,C){if(C){Element.show(A);if(B.hasClassName("notactive")){B.removeClassName("notactive")}B.addClassName("active")}else{Element.hide(A);if(B.hasClassName("active")){B.removeClassName("active")}B.addClassName("notactive")}return },reset:function(){for(var B=1;B<=this.totalPanels;B++){if(B!=this.activePanelIndex){var C=$(this.key+"_"+B);var A=$(this.key+"Body_"+B);this.toggleActive(C,A,false)}}return },onSelectTab:function(A){var B=A.memo.index;var C=$("tabLink_"+B);this.handleCycle(C)}};tabbedPanelHelper=Object.extend(tabbedPanelHelper,{EVENT:{TAB_CHANGE:"tabbedPanelHelper:TAB_CHANGE",SELECT_TAB:"tabbedPanelHelper:SELECT_TAB"}});(function(){var A={initialize:function(B){var C=$(B.elem);if(C){Event.observe(C,"contextmenu",this.block.bindAsEventListener(this))}},block:function(B){Event.stop(B)}};Object.extend(PB.Util,{NoRightClick:Class.create(A)})})();var NoRightClickController;(function(){var A={className:"noRightClick",bindHandlers:function(){try{var B=document.body.select(this.className);B.each(function(D){new PB.Util.NoRightClick({elem:D})})}catch(C){}}};Controller.create("NoRightClickController",A,{})})();var ContactController;(function(){var A={panel:null,selectedContacts:null,firstPrompt:"First",lastPrompt:"Last",active:false,wizard:true,authWindow:null,isAuthWindowClosed:null,timerId:1,delay:100,urlBase:null,addContactsId:"addContacts",editContactId:"editContact",importContactsId:"importContacts",selectContactsId:"selectContacts",noContactsId:"noContacts",backButtonId:"backButton",importSourceId:"import_source",contactRowsId:"contactRows",selectallId:"selectall",addFirstnameId:"add_firstname",addLastnameId:"add_lastname",importUseridId:"import_userid",importPasswordId:"import_password",deleteManyId:"deleteMany",initialize:function(){Event.observe(document,ContactController.EVENT.ACTIVATE,this.activate.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.ADD,this.addContact.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.BACK,this.back.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.CANCEL,this.cancel.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.DELETE,this.deleteContact.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.DELETE_MANY,this.deleteManyContact.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.DISPLAY_EDIT,this.displayEdit.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.TOGGLE_EDIT,this.toggleEdit.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.EDIT,this.editContact.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.AUTH,this.auth.bindAsEventListener(this));Event.observe(document,PBLightbox.EVENT.DEACTIVATED,function(){this.active=false}.bind(this))},initializeElements:function(){this.addPanel=$(this.addContactsId);this.editPanel=$(this.editContactId);this.selectPanel=$(this.selectContactsId);this.noContactsPanel=$(this.noContactsId);this.backButton=$(this.backButtonId);this.selectAll=$(this.selectallId);this.deleteMany=$(this.deleteManyId);this.resetAddForm()},mixIn:function(C){for(var D in C){this[D]=C[D]}},activate:function(D){var E=D.memo?D.memo:{};E.contentUrl="/contactmanager";E.cache=false;if(E.importComplete){E.onComplete=this.importedComplete.bind(this,E.total)}else{E.onComplete=this.activated.bind(this,E.importSource)}if(PBLightbox.getInstance().panel.active){E.wizard=true;this.wizard=true}else{this.wizard=false}if(E.config){var C=new Hash(E.config);var F=new Hash();C.each(function(G){F.set("contactCfg_"+G.key,G.value)});E.parameters=F}document.fire(PBLightbox.EVENT.ACTIVATE,E);this.active=true;this.selectedContacts=new Hash()},activated:function(C){if(typeof (C)==="number"&&C>=0){this.showImport(C)}this.active=true;document.fire(ContactController.EVENT.ACTIVATED)},cancel:function(C){var D=C.memo?C.memo:{};document.fire(PBLightbox.PBMessage.EVENT.CLOSE);if(this.wizard){document.fire(PBLightbox.EVENT.BACK,D)}else{document.fire(PBLightbox.EVENT.DEACTIVATE,D)}document.fire(ContactController.EVENT.ONCANCEL);this.active=false},back:function(C){var D=C.memo?C.memo:{};document.fire(PBLightbox.PBMessage.EVENT.CLOSE);if(this.wizard){document.fire(PBLightbox.EVENT.BACK,D)}else{document.fire(PBLightbox.EVENT.DEACTIVATE,D)}var D={};if(this.selectOn){D.selectedContacts=this.selectedContacts}document.fire(ContactController.EVENT.ONBACK,D);this.active=false},addContact:function(C){var D="/contactmanager/add";if(C&&C.memo.form){if(typeof (this.addProgress)==="undefined"){this.addProgress=new PBProgress({parentId:this.addContactsId})}document.fire(PBProgress.EVENT.ACTIVATE,this.addProgress);var E=Form.serialize(C.memo.form,true);if(E.add_firstname==this.firstPrompt){E.add_firstname=""}if(E.add_lastname==this.lastPrompt){E.add_lastname=""}new Ajax.Request(D,{parameters:E,method:"POST",evalJSON:"force",onSuccess:this.handleAddContact.bindAsEventListener(this)})}else{return false}},handleAddContact:function(D){document.fire(PBProgress.EVENT.DEACTIVATE,this.addProgress);var C=D.responseJSON;document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:this.getMessage(C)});if(C.response.stat=="ok"){this.resetAddForm();if(this.noContactsPanel.visible()){this.toggleList(true)}this.insertRows(C.response.contactRow);if(this.selectOn){this.toggleRow(null,C.response.contactId)}}},deleteContact:function(C){var D="/contactmanager/delete";if(C&&C.memo.id){this.showBusyCursor();var E={id:C.memo.id};new Ajax.Request(D,{parameters:E,method:"POST",evalJSON:"force",onSuccess:this.handleDeleteContact.bindAsEventListener(this)})}else{return false}},handleDeleteContact:function(D){this.hideBusyCursor();var C=D.responseJSON;document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:this.getMessage(C)});if(C.response.stat=="ok"){this.getRow(C.response.contactId).remove();if(this.deleteMany){this.deleteMany.hide()}if(C.response.contactCount<=0&&this.selectPanel.visible()){this.toggleList(false)}}},deleteManyContact:function(C){var D="/contactmanager/deletemany";if(C&&C.memo.form){if(typeof (this.listProgress)==="undefined"){this.listProgress=new PBProgress({parentId:this.selectContactsId})}document.fire(PBProgress.EVENT.ACTIVATE,this.listProgress);var E=Form.serialize(C.memo.form,true);new Ajax.Request(D,{parameters:E,method:"POST",evalJSON:"force",onSuccess:this.handleDeleteManyContact.bindAsEventListener(this)})}},handleDeleteManyContact:function(D){document.fire(PBProgress.EVENT.DEACTIVATE,this.listProgress);var C=D.responseJSON;document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:this.getMessage(C)});if(C.response.stat=="ok"){var E=C.response.deletedIds;E.each(function(F){this.getRow(F).remove()}.bind(this));this.deleteMany.hide();if(C.response.contactCount<=0&&this.selectPanel.visible()){this.toggleList(false)}}},editContact:function(C){var D="/contactmanager/edit";if(C&&C.memo.form){if(typeof (this.editProgress)==="undefined"){this.editProgress=new PBProgress({parentId:this.editContactId})}document.fire(PBProgress.EVENT.ACTIVATE,this.editProgress);var E=Form.serialize(C.memo.form,true);new Ajax.Request(D,{parameters:E,method:"POST",evalJSON:"force",onSuccess:this.handleEditContact.bindAsEventListener(this)})}},handleEditContact:function(D){document.fire(PBProgress.EVENT.DEACTIVATE,this.editProgress);var C=D.responseJSON;document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:this.getMessage(C)});if(C.response.stat=="ok"){this.getRow(C.response.contactId).remove();this.insertRows(C.response.contactRow);this.toggleEdit();if(this.selectOn){this.toggleRow(null,C.response.contactId)}}},auth:function(D){var C=D.memo.siteBaseUrl+"/contactmanager/auth/";var E=C+"?importsrc="+D.memo.importSource;if(D.memo.importSource==2){E+="&promptinfo=1"}this.authWindow=window.open(E,"contactimporter","width=800,height=500,top=200,left=500");this.isAuthWindowClosed=false;this.timerId=window.setInterval(this.checkIsAuthWindowClosed.bind(this),this.delay)},checkIsAuthWindowClosed:function(){if(this.authWindow.closed){window.clearInterval(this.timerId);this.isAuthWindowClosed=true;var D=cookieReader("PB_importcnt");if(D==0){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Attention",details:"No contacts were imported.",type:"error"})});return }var I=unescape(cookieReader("PB_importstats"));if(I==""){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Attention",details:"No contacts were imported.",type:"error"})})}else{if(this.active){var C="/contactmanager/getrows";new Ajax.Request(C,{method:"get",onSuccess:this.retrieveNewRows.bindAsEventListener(this)})}var K,L,M,J;var G=I.split("~");for(var H=0;H<G.length;H++){var F=G[H].split("=");if(F[0]=="t"){K=F[1]}if(F[0]=="a"){L=F[1]}if(F[0]=="e"){M=F[1]}if(F[0]=="s"){J=F[1]}}if(L==K){var E=L+" of "+K+" contacts were successfully imported!"}else{var E=L+" of "+K+" contacts were successfully imported!<br/><br/>";E+=J+" were duplicates";E+=(M>0)?" and "+M+" could not be processed.":"."}if(!this.active){E+='<br/><br/>Click <a href="javascript:void(0);" onclick="document.fire(ContactController.EVENT.ACTIVATE);">here</a> to see your contacts.'}document.fire(ShareEmailPanelController.EVENT.RELOADCONTACTS);document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Success",details:E,type:"success"})})}}},retrieveNewRows:function(C){if(this.noContactsPanel.visible()){this.toggleList(true)}this.insertRows(C.responseJSON.response.rows);this.selectedContacts=new Hash()},importedComplete:function(C){this.active=true;document.fire(ContactController.EVENT.ACTIVATED);document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Success",details:C+" contacts were successfully imported!",type:"success"})})},displayEdit:function(C){this.toggleEdit();if(C&&C.memo.email){var F=$("edit_id");F.value=C.memo.id;var E=$("edit_firstname");E.value=C.memo.firstname;var D=$("edit_lastname");D.value=C.memo.lastname;var G=$("edit_email");G.value=C.memo.email}},toggleEdit:function(C){if(this.editPanel.visible()){this.editPanel.hide();this.addPanel.show();this.selectPanel.setStyle({visibility:"visible"})}else{this.addPanel.hide();this.editPanel.show();this.selectPanel.setStyle({visibility:"hidden"})}},insertRows:function(D){var C=$(this.contactRowsId);Element.insert(C,{top:D})},resetAddForm:function(){var E=$(this.addFirstnameId);if(E){E.value=this.firstPrompt;E.addClassName("prompt");Element.observe(E,"focus",function(F){this.clearPrompt(Event.element(F))}.bind(this))}var D=$(this.addLastnameId);if(D){D.value=this.lastPrompt;D.addClassName("prompt");Element.observe(D,"focus",function(F){this.clearPrompt(Event.element(F))}.bind(this))}var C=$("add_email");if(C){C.value=""}},resetImportForm:function(){var C=$(this.importUseridId);if(C){C.clear()}var D=$(this.importPasswordId);if(D){D.clear()}},getRow:function(C){return $("contactrow_"+C)},getContactObj:function(E){var D=Element.down(E,".name").innerHTML;var C=Element.down(E,".cemail").innerHTML;return{name:D,email:C}},getMessage:function(D){var C;C=new PBMessage(D.response.message);if(typeof (D.response.message.type)==="undefined"){if(D.response.stat=="ok"){C.type=PBMessage.MESSAGE_TYPE.SUCCESS}else{C.type=PBMessage.MESSAGE_TYPE.ERROR}}return C},toggleList:function(C){if(C){this.noContactsPanel.hide();this.selectPanel.show();if(this.selectOn){photobucket.ui.setButtonDisabled(this.backButton,false)}}else{if(this.selectAll){this.selectAll.checked=false}if(this.deleteMany){this.deleteMany.hide()}this.selectPanel.hide();this.noContactsPanel.show();if(this.selectOn){photobucket.ui.setButtonDisabled(this.backButton,true)}}},showBusyCursor:function(){$("lightbox").setStyle({cursor:"progress"})},hideBusyCursor:function(){$("lightbox").setStyle({cursor:"auto"})},clearPrompt:function(C){C.removeClassName("prompt");C.value="";Event.stopObserving(C,"focus")},toggleRow:function(D,I){var H;if(D){var F=Event.element(D);H=Element.up(F,".contactrow")}else{if(I){H=this.getRow(I)}}if(this.singleSelect){if(this.selectedContacts.size()>0){var G=this.selectedContacts.keys().pop();this.selectedContacts.unset(G);var E=$(G);if(E){var C=Element.down(E,".checkbox input[type='radio']");C.checked=false;E.removeClassName("rowselected")}}var C=Element.down(H,".checkbox input[type='radio']");C.checked=true;H.addClassName("rowselected");this.selectedContacts.set(H.id,this.getContactObj(H))}else{var C=Element.down(H,".checkbox input[type='checkbox']");if(H.hasClassName("rowselected")){H.removeClassName("rowselected");C.checked=false;this.selectedContacts.unset(H.id);if(this.selectAll){this.selectAll.checked=false}}else{H.addClassName("rowselected");C.checked=true;this.selectedContacts.set(H.id,this.getContactObj(H))}}if(this.deleteMany){if(this.selectedContacts.size()>0){this.deleteMany.show()}else{this.deleteMany.hide()}}},toggleSelectAll:function(D){var F=Event.element(D);if(F.id!=this.selectallId){this.selectAll.checked=!this.selectAll.checked}var C=$(this.contactRowsId);var E=Element.select(C,".checkbox input[type='checkbox']");E.each(function(H){H.checked=this.selectAll.checked;var G=Element.up(H,".contactrow");if(this.selectAll.checked){G.addClassName("rowselected");this.selectedContacts.set(G.id,this.getContactObj(G))}else{G.removeClassName("rowselected");this.selectedContacts.unset(G.id)}}.bind(this));if(this.selectAll.checked){this.deleteMany.show()}else{this.deleteMany.hide()}}};var B={EVENT:{ADD:"ContactController:add",ACTIVATE:"ContactController:activate",ACTIVATED:"ContactController:activated",BACK:"ContactController:back",CANCEL:"ContactController:cancel",DELETE:"ContactController:delete",DELETE_MANY:"ContactController:deleteMany",DISPLAY_EDIT:"ContactController:displayEdit",TOGGLE_EDIT:"ContactController:toggleEdit",EDIT:"ContactController:edit",DISPLAY_IMPORT:"ContactController:displayImport",TOGGLE_IMPORT:"ContactController:toggleImport",IMPORT:"ContactController:import",ONBACK:"ContactController:onBack",ONCANCEL:"ContactController:onCancel",AUTH:"ContactController:auth"}};Controller.create("ContactController",A,B)})();var AutoCompleteBase;(function(){var A={fieldToLoad:null,suggestions:null,arrMasterList:new Array(),arrFoundList:new Array(),masterLength:null,itemsFoundLength:null,searchString:null,suggestionsIsOn:false,activeIndex:-1,lastActiveId:"",lastVersionOfString:"",highLightedByArrowId:"",currentCaretPos:null,doInsertBetweenItems:false,omitFirstSpace:false,initialize:function(){},mixIn:function(C){for(var D in C){this[D]=C[D]}Event.observe(this.fieldToLoad,"keydown",this.scanKeyForUpDownArrow.bindAsEventListener(this));Event.observe(this.fieldToLoad,"keyup",this.scanForMatches.bindAsEventListener(this));Event.observe(this.fieldToLoad,"blur",this.delayHideSuggestions.bindAsEventListener(this))},scanKeyForUpDownArrow:function(C){if(this.suggestionsIsOn){if(C.keyCode==40){Event.stop(C);if(this.activeIndex<this.itemsFoundLength-1){this.highLightSuggestion("down")}}else{if(C.keyCode==38){Event.stop(C);if(this.activeIndex!=0){this.highLightSuggestion("up")}}else{if(C.keyCode==9){Event.stop(C)}}}}return },scanForMatches:function(H){searchForThis=this.fieldToLoad.value;if((H.keyCode==13||H.keyCode==9)&&this.suggestionsIsOn){searchForThis=searchForThis.replace(/\r|\n|\r\n/g,"");this.fieldToLoad.value=searchForThis;if(this.activeIndex!=-1){this.selectHighLighted(false,this.activeIndex)}return }if(this.fieldToLoad.value==""){this.lastVersionOfString=""}if(searchForThis.length==0){this.resetFoundList()}else{if(H.keyCode>=48&&H.keyCode<=90||H.keyCode>=96&&H.keyCode<=105||H.keyCode==110||H.keyCode==190||H.keyCode==8||H.keyCode==46||H.keyCode==32){if(searchForThis!=this.searchString){this.searchString=searchForThis;this.resetFoundList()}if(this.isInsertBetweenContacts()){var F=this.fieldToLoad.value;var D=F.substr(0,this.currentCaretPos);var E=/^.+,\s*(\w+)$/;var I;if(I=D.match(E)){this.doInsertBetweenItems=true;searchForThis=I[1]}var K=D.search(/,/);if(K==-1){this.doInsertBetweenItems=true;this.omitFirstSpace=true;searchForThis=D.replace(/\s/,"");this.searchString=D}else{this.omitFirstSpace=false;var J=D.split(",");var G=J.length-1;this.searchString=J[G]}}else{searchForThis=searchForThis.replace(this.lastVersionOfString,"")}if(this.masterLength>0){if(searchForThis!=""&&this.positionsToScan){for(var C in this.positionsToScan){this.scanner(searchForThis,this.positionsToScan[C])}}this.itemsFoundLength=this.arrFoundList.length;if(this.itemsFoundLength>0){this.formatAndDisplayResults()}}}}},scanner:function(D,G){D=D.toLowerCase();for(var C=0;C<this.masterLength;C++){var E=this.arrMasterList[C][G].toLowerCase();var F=E.indexOf(D);if(F!=-1&&!this.arrMasterList[C][this.foundPosition]){this.arrFoundList.push(new Array(C,this.addAndFormatToSuggestions(C,F,D.length,G)));this.arrMasterList[C][this.foundPosition]=true}}return },addAndFormatToSuggestions:function(H,E,I,K){var M,D,C=false;switch(K){case 0:M=true;break;case 1:D=true;break;default:C=true;break}var G=(M)?this.enBolden(E,this.arrMasterList[H][0],I):this.arrMasterList[H][0];var L=(D)?this.enBolden(E,this.arrMasterList[H][1],I):this.arrMasterList[H][1];var J=(C)?this.enBolden(E,this.arrMasterList[H][3],I):this.arrMasterList[H][3];var F='"'+G+" "+L+'" ';return displayName=(G!=""||L!="")?F+" "+J:J},enBolden:function(D,K,I){var J="";var F=D;var C=D+I;var E=K.substr(0,F)+"<b>";var H=K.substr(D,I);var G="</b>"+K.substr(F+I);return J=E+H+G},resetFoundList:function(){for(var C=0;C<this.masterLength;C++){this.arrMasterList[C][this.foundPosition]=false}this.startLinkWatch(false);this.arrFoundList.clear();this.suggestions.hide();this.lastActiveId="";this.suggestionsIsOn=false;this.doInsertBetweenItems=false;this.activeIndex=-1;return },formatAndDisplayResults:function(){var D="";for(var C=0;C<this.itemsFoundLength;C++){D+='<a href="javascript:void(0);" id="pos_'+C+'">'+this.arrFoundList[C][1]+"</a>"}this.suggestions.innerHTML=D;this.startLinkWatch(true);this.suggestionsIsOn=true;this.suggestions.show();this.highLightSuggestion("down");if(!photobucket.browser.isIE6){$("pos_0").scrollIntoView(true)}},startLinkWatch:function(E){for(var C=0;C<this.itemsFoundLength;C++){var D=$("pos_"+C);if(D){if(E){Event.observe(D,"mouseover",this.clearHighLightKey.bindAsEventListener(this));Event.observe(D,"click",this.clickSelect.bindAsEventListener(this))}else{D.stopObserving()}}}return },highLightSuggestion:function(D){if(D=="down"){if(this.activeIndex<this.itemsFoundLength){this.activeIndex++}}else{if(this.activeIndex>0){this.activeIndex--}}if(this.activeIndex>=0&&this.activeIndex<this.itemsFoundLength){var C="pos_"+this.activeIndex;var E=$(C);this.highLightMouseOn(E);this.highLightedByArrowId=C;if(!photobucket.browser.isIE6){E.scrollIntoView(true)}if(this.lastActiveId!=""){this.highLightMouseOff($(this.lastActiveId))}this.lastActiveId=C}return },clickSelect:function(E){var C=Event.element(E);var D=C.id.split("_");this.selectHighLighted(true,D[1]);return },moveToEnd:function(C){this.fieldToLoad.focus();if(this.fieldToLoad.setSelectionRange){this.fieldToLoad.setSelectionRange(C,C)}else{if(this.fieldToLoad.createTextRange){var D=this.fieldToLoad.createTextRange();D.collapse(true);D.moveEnd("character",C);D.moveStart("character",C);D.select()}}return },highLightMouseOn:function(C){Element.addClassName(C,"highlighted");return },highLightMouseOff:function(C){Element.removeClassName(C,"highlighted");return },clearHighLightKey:function(){if(this.highLightedByArrowId!=""){Element.removeClassName($(this.highLightedByArrowId),"highlighted")}},setCaretPosition:function(){var G=this.fieldToLoad;var E=0;if(document.selection){G.focus();var H="\001";var F=document.selection.createRange();var D=F.duplicate();var C=0;D.moveToElementText(G);F.text=H;C=(D.text.indexOf(H));F.moveStart("character",-1);F.text="";E=C}else{if(G.selectionStart||G.selectionStart=="0"){E=G.selectionStart}}this.currentCaretPos=E;return },isInsertBetweenContacts:function(){this.setCaretPosition();return(this.fieldToLoad.value.length==this.currentCaretPos||this.currentCaretPos==-1)?false:true},delayHideSuggestions:function(){var C=setTimeout(this.hideSuggestions.bind(this),500)},hideSuggestions:function(){this.suggestions.hide()},sortMultiDimensionalFirst:function(D,C,E){return((D[E]<C[E])?-1:((D[E]>C[E])?1:0))}};var B={};AutoCompleteBase=Class.create(A);AutoCompleteBase=Object.extend(AutoCompleteBase,B)})();var AutoCompleteEmailController;(function(){var A={fieldToLoad:null,foundPosition:null,positionsToScan:null,initialize:function($super){$super()},mixIn:function($super,C){$super(C);for(var D in C){this[D]=C[D]}Event.observe(this.fieldToLoad,"focus",this.clearTo.bindAsEventListener(this))},clearTo:function(C){if(this.fieldToLoad.value=="separate email addresses by commas."){Element.removeClassName(this.fieldToLoad,"toDefault");Element.addClassName(this.fieldToLoad,"to");this.fieldToLoad.value=""}return },loadArrayData:function(G){this.arrMasterList.clear();var D=G.contactLength;var F=G.contacts;for(var E=0;E<D;E++){var C=new Array();C.push(F[E].first,F[E].last,F[E].emailName,F[E].email,false);this.arrMasterList.push(C)}this.foundPosition=4;this.positionsToScan={first:0,last:1,email:3};this.masterLength=this.arrMasterList.length;return },selectHighLighted:function(L,K){var N=this.fieldToLoad.value;var E=(L)?K:this.activeIndex;var G=this.arrMasterList[this.arrFoundList[E][0]][0];var M=this.arrMasterList[this.arrFoundList[E][0]][1];var O="";if(G!=""&&M!=""){O='"'+G+" "+M+'"'}var F=this.arrMasterList[this.arrFoundList[E][0]][3];F=(O!="")?O+" "+F:F;var I=this.searchString;if(!this.doInsertBetweenItems){var D=N.replace(I,F+", ");D=(this.lastVersionOfString=="")?D:this.lastVersionOfString+D;this.fieldToLoad.value=D;this.lastVersionOfString=D}else{var C=(this.omitFirstSpace)?"":" ";var J=C+F+", ";var H=N.indexOf(I);var D=N.replace(I,J);this.fieldToLoad.value=D;this.lastVersionOfString=D;this.moveToEnd(H+J.length)}if(L){this.moveToEnd(this.fieldToLoad.value.length)}this.resetFoundList();return }};var B={};Controller.create("AutoCompleteEmailController",A,B,AutoCompleteBase)})();var DropDownMenu=Class.create();DropDownMenu.prototype={msSetTimeoutDelay:250,objActiveMenu:null,objActiveMenuHover:null,listMenuLinkObjects_Link:null,listMenuLinkObjects_Menu:null,handleSetTimeoutLink:{},handleSetTimeoutMenu:{},strDocumentClickElt:"HTML",bShowDebugging:false,overrideIEShield:false,initialize:function(){var C,A;this.listMenuLinkObjects_Link=new Object();this.listMenuLinkObjects_Menu=new Object();var B=typeof (arguments)!=="undefined"&&arguments;for(C=0;B&&C<arguments.length;C++){this.addMenu(arguments[C])}},addMenu:function(C){var J,I=null,O=null;var H,G,F,E;if(typeof (C)=="object"&&C&&typeof (C.linkID)=="string"&&C.linkID.length>0&&(O=$(C.linkID))!=null&&(I=$(C.subMenuID))!=null){J=new Object();J.linkID=C.linkID;J.subMenu=I;J.posPersist=false;J.onStateLinkClass=null;if(typeof (C.onStateLinkClass)=="string"&&C.onStateLinkClass.length>0){J.onStateLinkClass=C.onStateLinkClass}if(typeof (C.blurTimeout)=="number"&&C.blurTimeout>0){J.blurTimeout=C.blurTimeout}if(typeof (C.bCloseMenuOnClick)=="boolean"&&C.bCloseMenuOnClick){J.bCloseMenuOnClick=C.bCloseMenuOnClick;Event.observe(I,"click",this.handleCloseMenu.bindAsEventListener(this),false)}if(I&&typeof (C.positionDynamically)=="string"&&C.positionDynamically.length>0){Element.show(I);var K=I.offsetWidth;var A=I.offsetHeight;Element.hide(I);var N=C.positionDynamically.split(";");var M=null;if(typeof (C.posPersist)=="boolean"&&C.posPersist){J.posPersist=true;J.menuWidth=K;J.menuHeight=A}if(typeof (C.posFromElt)=="string"){if(C.posFromElt.length>0){M=$(C.posFromElt)}else{if(C.posFromElt.length==0){M=document.body}}}if(J.posPersist){J.posFromElt=M}var L=this.getOffset(O,M);for(F=0;F<N.length;F++){var D=N[F].split(":");var B=0;if(D.length>1&&!isNaN(D[1])){B=parseInt(D[1],10)}switch(D[0].toLowerCase()){case"top":I.style.top=(L.offsetTop+B)+"px";if(J.posPersist){J.posTop=B}break;case"left":I.style.left=(L.offsetLeft+B)+"px";if(J.posPersist){J.posLeft=B}break;case"right":I.style.left=(L.offsetLeft+O.offsetWidth-K-B)+"px";if(J.posPersist){J.posRight=B}break;case"bottom":I.style.top=(L.offsetTop+O.offsetHeight-A-B)+"px";if(J.posPersist){J.posBottom=B}break}}}if((typeof (C.overrideIEShield)=="undefined"||!C.overrideIEShield)&&photobucket.browser.isIE){J.iFrame=this.attachIframeShield(J)}this.listMenuLinkObjects_Link[C.linkID]=J;this.listMenuLinkObjects_Menu[C.subMenuID]=J;if(typeof (C.manualCloseLinkId)=="string"&&C.manualCloseLinkId.length>0&&(E=$(C.manualCloseLinkId))!=null){Event.observe(E,"click",this.handleCloseMenu.bindAsEventListener(this),false)}Event.observe(O,"mouseover",this.handleLinkMouseOver.bindAsEventListener(this),false);Event.observe(O,"mouseout",this.handleLinkMouseOut.bindAsEventListener(this),false);Event.observe(I,"mouseover",this.handleMenuMouseOver.bindAsEventListener(this),false);Event.observe(I,"mouseout",this.handleMenuMouseOut.bindAsEventListener(this),false)}},handleLinkMouseOver:function(C){var A=Event.findElement(C,"A"),B;if(A&&typeof (A.id)=="string"&&(B=this.findMenuByLinkId(A.id))!=null){if(!this.objActiveMenu||B.linkID!==this.objActiveMenu.linkID){this.closeMenu()}this.openMenu(B)}return false},handleLinkMouseOut:function(D){var A=Event.findElement(D,"A"),C;if(this.isMouseOver(A,D)){return }if(A&&typeof (A.id)=="string"&&(C=this.findMenuByLinkId(A.id))!=null){var B=C.blurTimeout||this.msSetTimeoutDelay;this.handleSetTimeoutLink[C.linkID]=setTimeout(this.callbackMenuLinkMouseout_Closure(C).bind(this),B)}},handleMenuMouseOver:function(D){var B=Event.element(D),A,C;if((Element.hasClassName((A=B),"headerDDMenu")||typeof (A=Element.up(B,"DIV.headerDDMenu"))!="undefined")&&typeof (A.id)!="undefined"&&(C=this.findMenuByMenuId(A.id))!=null){this.objActiveMenuHover=C}},handleMenuMouseOut:function(E){var B=Event.element(E),A;if((Element.hasClassName((A=B),"headerDDMenu")||typeof (A=Element.up(B,"DIV.headerDDMenu"))!="undefined")){var D=(A.id)?this.findMenuByMenuId(A.id):null;if(D&&!this.isMouseOver(A,E)){this.objActiveMenuHover=null;var C=D.blurTimeout||this.msSetTimeoutDelay;this.handleSetTimeoutMenu[D.linkID]=setTimeout(this.callbackMenuMouseout_Closure(D).bind(this),C)}}},handleCloseMenu:function(D){var B=Event.element(D),A,C;if((Element.hasClassName((A=B),"headerDDMenu")||typeof (A=Element.up(B,"DIV.headerDDMenu"))!="undefined")&&typeof (A.id)!="undefined"&&(C=this.findMenuByMenuId(A.id))!=null){this.closeMenu(C)}},callbackMenuLinkMouseout_Closure:function(A){return function(){if(!this.objActiveMenuHover||(A!==this.objActiveMenuHover&&A!==this.objActiveMenu)){this.closeMenu(A);clearTimeout(this.handleSetTimeoutLink[A.linkID]);this.handleSetTimeoutLink[A.linkID]=null}}},callbackMenuMouseout_Closure:function(A){return function(){if(this.objActiveMenu||(A!==this.objActiveMenu)){this.closeMenu(A);clearTimeout(this.handleSetTimeoutMenu[A.linkID]);this.handleSetTimeoutMenu[A.linkID]=null}}},getOffset:function(A,C){var B=Element.positionedOffset(A);offLeft=B.left;offTop=B.top;return{offsetLeft:offLeft,offsetTop:offTop}},positionMenu:function(A){var E;if(A.posPersist&&(E=$(A.linkID))!=null){var D=0,B=0;var C=this.getOffset(E,A.posFromElt);if(typeof (A.posTop)!="undefined"){A.subMenu.style.top=(C.offsetTop+A.posTop)+"px"}else{if(typeof (A.posBottom)!="undefined"){A.subMenu.style.top=(C.offsetTop+E.offsetHeight-A.menuHeight-A.posBottom)+"px"}}if(typeof (A.iFrame)!="undefined"){A.iFrame.style.top=A.subMenu.style.top}if(typeof (A.posLeft)!="undefined"){A.subMenu.style.left=(C.offsetLeft+A.posLeft)+"px"}else{if(typeof (A.posRight)!="undefined"){A.subMenu.style.left=(C.offsetLeft+E.offsetWidth-A.menuWidth-A.posRight)+"px"}}if(typeof (A.iFrame)!="undefined"){A.iFrame.style.left=A.subMenu.style.left}}},findMenuByLinkId:function(B){var A=null;if(this.listMenuLinkObjects_Link&&typeof (this.listMenuLinkObjects_Link[B])!="undefined"){A=this.listMenuLinkObjects_Link[B]}return A},findMenuByMenuId:function(B){var A=null;if(this.listMenuLinkObjects_Menu&&typeof (this.listMenuLinkObjects_Menu[B])!="undefined"){A=this.listMenuLinkObjects_Menu[B]}return A},openMenu:function(B){var A=false,C;if(B&&B.subMenu){A=true;this.positionMenu(B);Element.show(B.subMenu);if(B.iFrame){Element.show(B.iFrame)}this.toggleLinkOnState(B,true);if(this.objActiveMenu!=null&&this.objActiveMenu.subMenu!==B.subMenu){Element.hide(this.objActiveMenu.subMenu);if(this.objActiveMenu.iFrame){Element.hide(this.objActiveMenu.iFrame)}this.toggleLinkOnState(this.objActiveMenu,false)}this.objActiveMenu=B}return A},closeMenu:function(A){var B=this.objActiveMenu;if(typeof (A)!=="undefined"&&A){B=A}if(B&&Element.visible(B.subMenu)){Element.hide(B.subMenu);if(B.iFrame){Element.hide(B.iFrame)}this.toggleLinkOnState(B,false);this.objActiveMenu=null}},toggleLinkOnState:function(C,B){var D;if(C&&typeof (C.onStateLinkClass)=="string"&&C.onStateLinkClass&&(D=$(C.linkID))!=null){var A=Element.hasClassName(D,C.onStateLinkClass);if(B&&!A){Element.addClassName(D,C.onStateLinkClass)}else{if(!B&&A){Element.removeClassName(D,C.onStateLinkClass)}}}},attachIframeShield:function(B){var A=null;if(typeof (B)!="undefined"&&typeof (B.subMenu)!="undefined"){A=document.createElement("IFRAME");Element.show(B.subMenu);A.setAttribute("src","/include/iframe.html");A.setAttribute("id",B.subMenu.id+"_Iframe");A.setAttribute("scrolling","no");A.setAttribute("frameborder","0");A.setAttribute("allowtransparency","true");A.setAttribute("marginWidth",0);A.setAttribute("marginHeight",0);A.style.position="absolute";A.width=B.subMenu.offsetWidth;A.height=B.subMenu.offsetHeight;A.style.top=B.subMenu.offsetTop+"px";A.style.left=B.subMenu.offsetLeft+"px";A.style.display="none";A.style.zIndex=parseInt(Element.getStyle(B.subMenu,"z-index"))-1;Element.insert(B.subMenu,{before:A});Element.hide(B.subMenu)}return A},isMouseOver:function(D,H){var B=Event.pointerX(H);var G=Event.pointerY(H);var F=Element.cumulativeOffset(D);var E=Element.getDimensions(D);var C=((F.left<B)&&(B<(F.left+E.width)));var A=((F.top<G)&&(G<(F.top+E.height)));return(C&&A)}};(function(A){A.fn.hoverIntent=function(I,H){var J={sensitivity:7,interval:100,timeout:0};J=A.extend(J,H?{over:I,out:H}:I);var L,K,F,D;var E=function(M){L=M.pageX;K=M.pageY};var C=function(N,M){M.hoverIntent_t=clearTimeout(M.hoverIntent_t);if((Math.abs(F-L)+Math.abs(D-K))<J.sensitivity){A(M).unbind("mousemove",E);M.hoverIntent_s=1;return J.over.apply(M,[N])}else{F=L;D=K;M.hoverIntent_t=setTimeout(function(){C(N,M)},J.interval)}};var G=function(N,M){M.hoverIntent_t=clearTimeout(M.hoverIntent_t);M.hoverIntent_s=0;return J.out.apply(M,[N])};var B=function(P){var O=(P.type=="mouseover"?P.fromElement:P.toElement)||P.relatedTarget;while(O&&O!=this){try{O=O.parentNode}catch(P){O=this}}if(O==this){return false}var N=jQuery.extend({},P);var M=this;if(M.hoverIntent_t){M.hoverIntent_t=clearTimeout(M.hoverIntent_t)}if(P.type=="mouseover"){F=N.pageX;D=N.pageY;A(M).bind("mousemove",E);if(M.hoverIntent_s!=1){M.hoverIntent_t=setTimeout(function(){C(N,M)},J.interval)}}else{A(M).unbind("mousemove",E);if(M.hoverIntent_s==1){M.hoverIntent_t=setTimeout(function(){G(N,M)},J.timeout)}}};return this.mouseover(B).mouseout(B)}})(jQuery);(function(A){A.fn.extend({autocomplete:function(B,C){var D=typeof B=="string";C=A.extend({},A.Autocompleter.defaults,{url:D?B:null,data:D?null:B,delay:D?A.Autocompleter.defaults.delay:10,max:C&&!C.scroll?10:150},C);C.highlight=C.highlight||function(E){return E};C.formatMatch=C.formatMatch||C.formatItem;return this.each(function(){new A.Autocompleter(this,C)})},result:function(B){return this.bind("result",B)},search:function(B){return this.trigger("search",[B])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(B){return this.trigger("setOptions",[B])},unautocomplete:function(){return this.trigger("unautocomplete")}});A.Autocompleter=function(M,G){var I=new Array();var C={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var B=A(M).attr("autocomplete","off").addClass(G.inputClass);var K;var R="";var N=A.Autocompleter.Cache(G);var E=0;var V;var Y={mouseDownOnSelect:false};var S=A.Autocompleter.Select(G,M,D,Y);var X;A.browser.opera&&A(M.form).bind("submit.autocomplete",function(){if(X){X=false;return false}});B.bind((A.browser.opera?"keypress":"keyup")+".autocomplete",function(a){E=1;V=a.keyCode;switch(a.keyCode){case C.UP:a.preventDefault();if(S.visible()){S.prev()}else{U(0,true)}break;case C.DOWN:a.preventDefault();if(S.visible()){S.next()}else{U(0,true)}break;case C.PAGEUP:a.preventDefault();if(S.visible()){S.pageUp()}else{U(0,true)}break;case C.PAGEDOWN:a.preventDefault();if(S.visible()){S.pageDown()}else{U(0,true)}break;case G.multiple&&A.trim(G.multipleSeparator)==","&&C.COMMA:case C.TAB:case C.RETURN:Z();if(D()){a.preventDefault();X=true;return false}break;case C.ESC:S.hide();break;default:clearTimeout(K);K=setTimeout(U,G.delay);break}}).focus(function(){E++}).blur(function(){E=0;if(!Y.mouseDownOnSelect){T()}}).click(function(){if(E++>1&&!S.visible()){U(0,true)}}).bind("search",function(){var a=(arguments.length>1)?arguments[1]:null;function b(f,e){var c;if(e&&e.length){for(var d=0;d<e.length;d++){if(e[d].result.toLowerCase()==f.toLowerCase()){c=e[d];break}}}if(typeof a=="function"){a(c)}else{B.trigger("result",c&&[c.data,c.value])}}A.each(H(B.val()),function(c,d){F(d,b,b)})}).bind("flushCache",function(){N.flush()}).bind("setOptions",function(){A.extend(G,arguments[1]);if("data" in arguments[1]){N.populate()}}).bind("unautocomplete",function(){S.unbind();B.unbind();A(M.form).unbind(".autocomplete")});function Z(){for(var a=0;a<I.length;a++){I[a].abort()}I=new Array()}function D(e){var d=S.selected();if(!d){return false}var a=d.result;R=a;if(G.multiple){var h=H(B.val());if(h.length>1){var c=G.multipleSeparator.length;var g=A(M).selection().start;var f,b=0;A.each(h,function(j,k){b+=k.length;if(g<=b){f=j;return false}b+=c});h[f]=a;a=h.join(G.multipleSeparator)}a+=G.multipleSeparator}if(e&&e=="click"){B.val(a)}W();B.trigger("result",[d.data,d.value]);return true}function U(c,b){if(V==C.DEL){S.hide();return }var a=B.val();if(!b&&a==R){return }if(a==""){O();S.hide();Z()}R=a;a=J(a);if(a.length>=G.minChars){B.addClass(G.loadingClass);if(!G.matchCase){a=a.toLowerCase()}Z();F(a,L,W)}else{O();S.hide()}}function H(a){if(!a){return[""]}if(!G.multiple){return[A.trim(a)]}return A.map(a.split(G.multipleSeparator),function(b){return A.trim(a).length?A.trim(b):null})}function J(a){if(!G.multiple){return a}var c=H(a);if(c.length==1){return c[0]}var b=A(M).selection().start;if(b==a.length){c=H(a)}else{c=H(a.replace(a.substring(b),""))}return c[c.length-1]}function Q(a,b){if(G.autoFill&&(J(B.val()).toLowerCase()==a.toLowerCase())&&V!=C.BACKSPACE){B.val(B.val()+b.substring(J(R).length));A(M).selection(R.length,R.length+b.length)}}function T(){clearTimeout(K);K=setTimeout(W,200)}function W(){var a=S.visible();S.hide();clearTimeout(K);O();if(G.mustMatch){B.search(function(b){if(!b){if(G.multiple){var c=H(B.val()).slice(0,-1);B.val(c.join(G.multipleSeparator)+(c.length?G.multipleSeparator:""))}else{B.val("");B.trigger("result",null)}}})}}function L(b,a){if(a&&a.length&&E){O();S.display(a,b);Q(b,a[0].value);S.show()}else{W()}}function F(b,d,a){if(!G.matchCase){b=b.toLowerCase()}var c=N.load(b);if(c&&c.length){d(b,c)}else{if((typeof G.url=="string")&&(G.url.length>0)){var e={timestamp:+new Date()};A.each(G.extraParams,function(f,g){e[f]=typeof g=="function"?g():g});req=A.ajax({mode:"abort",port:"autocomplete"+M.name,dataType:G.dataType,url:G.url,data:A.extend({q:J(b),limit:G.max},e),success:function(g){var f=G.parse&&G.parse(g)||P(g);N.add(b,f);d(b,f)}});I.push(req)}else{S.emptyList();a(b)}}}function P(d){var a=[];var c=d.split("\n");for(var b=0;b<c.length;b++){var e=A.trim(c[b]);if(e){e=e.split("|");a[a.length]={data:e,value:e[0],result:G.formatResult&&G.formatResult(e,e[0])||e[0]}}}return a}function O(){B.removeClass(G.loadingClass)}};A.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:true,formatItem:function(B){return B[0]},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(C,B){return C.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+B.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:180};A.Autocompleter.Cache=function(C){var F={};var D=0;function H(K,J){if(!C.matchCase){K=K.toLowerCase()}var I=K.indexOf(J);if(C.matchContains=="word"){I=K.toLowerCase().search("\\b"+J.toLowerCase())}if(I==-1){return false}return I==0||C.matchContains}function G(J,I){if(D>C.cacheLength){B()}if(!F[J]){D++}F[J]=I}function E(){if(!C.data){return false}var J={},I=0;if(!C.url){C.cacheLength=1}J[""]=[];for(var L=0,K=C.data.length;L<K;L++){var O=C.data[L];O=(typeof O=="string")?[O]:O;var N=C.formatMatch(O,L+1,C.data.length);if(N===false){continue}var M=N.charAt(0).toLowerCase();if(!J[M]){J[M]=[]}var P={value:N,data:O,result:C.formatResult&&C.formatResult(O)||N};J[M].push(P);if(I++<C.max){J[""].push(P)}}A.each(J,function(Q,R){C.cacheLength++;G(Q,R)})}setTimeout(E,25);function B(){F={};D=0}return{flush:B,add:G,populate:E,load:function(L){if(!C.cacheLength||!D){return null}if(!C.url&&C.matchContains){var K=[];for(var I in F){if(I.length>0){var M=F[I];A.each(M,function(O,N){if(H(N.value,L)){K.push(N)}})}}return K}else{if(F[L]){return F[L]}else{if(C.matchSubset){for(var J=L.length-1;J>=C.minChars;J--){var M=F[L.substr(0,J)];if(M){var K=[];A.each(M,function(O,N){if(H(N.value,L)){K[K.length]=N}});return K}}}}}return null}}};A.Autocompleter.Select=function(E,J,L,P){var I={ACTIVE:"ac_over"};var K,F=-1,R,M="",S=true,C,O;function N(){if(!S){return }C=A("<div/>").hide().addClass(E.resultsClass).css("position","absolute").appendTo(document.body);O=A("<ul/>").appendTo(C).mouseover(function(T){if(Q(T).nodeName&&Q(T).nodeName.toUpperCase()=="LI"){F=A("li",O).removeClass(I.ACTIVE).index(Q(T));A(Q(T)).addClass(I.ACTIVE)}}).click(function(T){A(Q(T)).addClass(I.ACTIVE);L(T.type);J.focus();return false}).mousedown(function(){P.mouseDownOnSelect=true}).mouseup(function(){P.mouseDownOnSelect=false});if(E.width>0){C.css("width",E.width)}S=false}function Q(U){var T=U.target;while(T&&T.tagName!="LI"){T=T.parentNode}if(!T){return[]}return T}function H(T){K.slice(F,F+1).removeClass(I.ACTIVE);G(T);var X=A(J);if(F!=-1){var W=K.slice(F,F+1).addClass(I.ACTIVE)}else{X.val(M)}var U=W[0].innerHTML;U=U.replace(/<strong>/gi,"");U=U.replace(/<\/strong>/gi,"");X.val(U);if(E.scroll){var V=0;K.slice(0,F).each(function(){V+=this.offsetHeight});if((V+W[0].offsetHeight-O.scrollTop())>O[0].clientHeight){O.scrollTop(V+W[0].offsetHeight-O.innerHeight())}else{if(V<O.scrollTop()){O.scrollTop(V)}}}}function G(T){F+=T;if(F<0){F=-1}else{if(F>=K.size()){F=-1}}}function B(T){return E.max&&E.max<T?E.max:T}function D(){O.empty();var U=B(R.length);for(var V=0;V<U;V++){if(!R[V]){continue}var W=E.formatItem(R[V].data,V+1,U,R[V].value,M);if(W===false){continue}var T=A("<li/>").html(E.highlight(W,M)).addClass(V%2==0?"ac_even":"ac_odd").appendTo(O)[0];A.data(T,"ac_data",R[V])}K=O.find("li");if(E.selectFirst){K.slice(0,1).addClass(I.ACTIVE);F=0}if(A.fn.bgiframe){O.bgiframe()}}return{display:function(U,T){N();R=U;M=T;D()},next:function(){H(1)},prev:function(){H(-1)},pageUp:function(){if(F!=0&&F-8<0){H(-F)}else{H(-8)}},pageDown:function(){if(F!=K.size()-1&&F+8>K.size()){H(K.size()-1-F)}else{H(8)}},hide:function(){C&&C.hide();K&&K.removeClass(I.ACTIVE);F=-1},visible:function(){return C&&C.is(":visible")},current:function(){return this.visible()&&(K.filter("."+I.ACTIVE)[0]||E.selectFirst&&K[0])},show:function(){var V=A(J).offset();C.css({width:typeof E.width=="string"||E.width>0?E.width:A(J).width(),top:V.top+J.offsetHeight,left:V.left}).show();if(E.scroll){O.scrollTop(0);O.css({maxHeight:E.scrollHeight,overflow:"auto"});if(A.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var T=0;K.each(function(){T+=this.offsetHeight});var U=T>E.scrollHeight;O.css("height",U?E.scrollHeight:T);if(!U){K.width(O.width()-parseInt(K.css("padding-left"))-parseInt(K.css("padding-right")))}}}},selected:function(){var T=K&&K.filter("."+I.ACTIVE).removeClass(I.ACTIVE);return T&&T.length&&A.data(T[0],"ac_data")},emptyList:function(){O&&O.empty()},unbind:function(){C&&C.remove()}}};A.fn.selection=function(I,B){if(I!==undefined){return this.each(function(){if(this.createTextRange){var J=this.createTextRange();if(B===undefined||I==B){J.move("character",I);J.select()}else{J.collapse(true);J.moveStart("character",I);J.moveEnd("character",B);J.select()}}else{if(this.setSelectionRange){this.setSelectionRange(I,B)}else{if(this.selectionStart){this.selectionStart=I;this.selectionEnd=B}}}})}var G=this[0];if(G.createTextRange){var C=document.selection.createRange(),H=G.value,F="<->",D=C.text.length;C.text=F;var E=G.value.indexOf(F);G.value=H;this.selection(E,E+D);return{start:E,end:E+D}}else{if(G.selectionStart!==undefined){return{start:G.selectionStart,end:G.selectionEnd}}}}})(jQuery);(function(A){A.fn.tipsy=function(B){B=A.extend({fade:false,gravity:"n"},B||{});var C=null,D=false;this.hover(function(){A.data(this,"cancel.tipsy",true);var E=A.data(this,"active.tipsy");if(!E){E=A('<div class="tipsy"><div class="tipsy-inner">'+A(this).attr("title")+"</div></div>");E.css({position:"absolute",zIndex:100000});A(this).attr("title","");A.data(this,"active.tipsy",E)}var H=A.extend({},A(this).offset(),{width:this.offsetWidth,height:this.offsetHeight});E.remove().css({top:0,left:0,visibility:"hidden",display:"block"}).appendTo(document.body);var F=E[0].offsetWidth,G=E[0].offsetHeight;switch(B.gravity.charAt(0)){case"n":E.css({top:H.top+H.height,left:H.left+H.width/2-F/2}).addClass("tipsy-north");break;case"s":E.css({top:H.top-G,left:H.left+H.width/2-F/2}).addClass("tipsy-south");break;case"e":E.css({top:H.top+H.height/2-G/2,left:H.left-F}).addClass("tipsy-east");break;case"w":E.css({top:H.top+H.height/2-G/2,left:H.left+H.width}).addClass("tipsy-west");break}if(B.fade){E.css({opacity:0,display:"block",visibility:"visible"}).animate({opacity:1})}else{E.css({visibility:"visible"})}},function(){A.data(this,"cancel.tipsy",false);var E=this;setTimeout(function(){if(A.data(this,"cancel.tipsy")){return }var F=A.data(E,"active.tipsy");if(B.fade){F.stop().fadeOut(function(){A(this).remove()})}else{F.remove()}},100)})};A(document).ready(function(){A("a.label[title], label[title]").tipsy({gravity:"s"});A("span.label.down[title]").tipsy({gravity:"n"})})})(jQuery);(function(A){A.fn.toggleVal=function(C){if(!C||typeof C=="object"){C=A.extend({},A.fn.toggleVal.defaults,C)}else{if(typeof C=="string"&&C.toLowerCase()=="destroy"){var B=true}}return this.each(function(){if(B){A(this).unbind("focus.toggleval").unbind("blur.toggleval").removeData("defText");return false}var D="";switch(C.populateFrom){case"title":if(A(this).attr("title")){D=A(this).attr("title");A(this).val(D)}break;case"label":if(A(this).attr("id")){D=A('label[for="'+A(this).attr("id")+'"]').text();A(this).val(D)}break;case"custom":D=C.text;A(this).val(D);break;default:D=A(this).val()}A(this).addClass("toggleval").data("defText",D);if(C.removeLabels==true&&A(this).attr("id")){A('label[for="'+A(this).attr("id")+'"]').remove()}A(this).bind("focus.toggleval",function(){if(A(this).val()==A(this).data("defText")){A(this).val("")}A(this).addClass(C.focusClass)}).bind("blur.toggleval",function(){if(A(this).val()==""&&!C.sticky){A(this).val(A(this).data("defText"))}A(this).removeClass(C.focusClass);if(A(this).val()!=""&&A(this).val()!=A(this).data("defText")){A(this).addClass(C.changedClass)}else{A(this).removeClass(C.changedClass)}})})};A.fn.toggleVal.defaults={focusClass:"tv-focused",changedClass:"tv-changed",populateFrom:"default",text:null,removeLabels:false,sticky:false};A.extend(A.expr[":"],{toggleval:function(B){return A(B).data("defText")||false},changed:function(B){if(A(B).data("defText")&&A(B).val()!=A(B).data("defText")){return true}return false}})})(jQuery);var SearchController;(function(){var B={initialize:function(){var C=true;try{$$("form.search").each(function(E){new A(E,C);C=false})}catch(D){}}};Controller.create("SearchController",B,{});var A=Class.create({initialize:function(I,D){this.form=I;this.selected=this.form.down(".selected");this.isExperiment=this.form.down(".search_trial");this.isControl=this.form.hasClassName("abtest");if(D){if(this.isControl){tr("search_bar_a_impression")}else{if(this.isExperiment){tr("search_bar_b_impression")}}}this.inputField=this.form.down(".input_text");var E=jq(this.inputField);var H=E.width()+107;E.autocomplete("/suggest",{max:10,width:H,matchSubset:false,scroll:false,selectFirst:false,delay:100});var C=this;E.result(function(K,M,L){C.submit();jq(this).parents("form").submit()});this.defaultText=(this.inputField.hasClassName("defaultText"))?this.inputField.value:false;this.inputField.observe("blur",this.blur.bindAsEventListener(this));this.inputField.observe("focus",this.focus.bindAsEventListener(this));var J=this.form.down(".menuContainer");jq(J).hoverIntent({over:this.onMenu.bind(this),out:this.offMenu.bind(this)});this.options=this.form.select(".option");var G=(this.isExperiment)?this.selectModeTrial.bindAsEventListener(this):this.selectMode.bindAsEventListener(this);this.options.each(function(K){K.observe("click",G)});if(this.isControl||this.isExperiment){var F=this.form.down(".searchButton");F.observe("mouseup",this.buttonHandler.bindAsEventListener(this))}this.form.observe("submit",this.submit.bindAsEventListener(this))},selectMode:function(E){var C=E.element().innerHTML;var D=E.element().readAttribute("mode");this.selected.update(C);this.form.mode.value=D;this.offMenu()},selectModeTrial:function(H){var F=H.element();var E=(F.childNodes[0].data)?F.childNodes[0].data:F.childNodes[0].textContent;var G=F.readAttribute("mode");var D="checked";this.options.each(function(I){I.removeClassName(D)});F.addClassName(D);var C="Search "+E+"...";if(this.inputField.value==this.defaultText){this.inputField.value=C}this.defaultText=C;this.form.mode.value=G;this.offMenu()},onMenu:function(D){var C=false;jq(".ac_results").each(function(){var E=jq(this).css("display");if(E!="none"){C=true}});if(!C){this.form.addClassName("hover")}},offMenu:function(C){this.form.removeClassName("hover")},submit:function(H){var G=this.form.mode.value;var E=this.form.q.value;if(E==this.defaultText){H.stop();return false}E=escape(E);var D=this.form.action.split("/");if(D.pop()==""){D.pop()}D.push(G);if(G!="websearch"){D.push(E);D.push("");this.form.method="post"}else{this.form.method="get"}var C=D.join("/");C=C.replace(G+"/"+G,G);this.form.action=C;var F=this.form.loc.value;if(F=="HeaderSearch"){tr("homepage_searches_in_nav_box")}else{if(F=="HomepageSearchMid"){tr("homepage_searches_in_central_box")}}if(G=="groupsearch"){tr("ga_search_top_nav")}if(this.isControl){tr("search_bar_a_total_search");tr("search_bar_a_"+G+"_search")}else{if(this.isExperiment){tr("search_bar_b_total_search");tr("search_bar_b_"+G+"_search")}}},blur:function(D){var C=D.element();if(this.defaultText&&C.value==""){C.value=this.defaultText;C.addClassName("defaultText")}},focus:function(D){var C=D.element();if(this.defaultText&&C.value==this.defaultText){C.value="";C.removeClassName("defaultText")}},buttonHandler:function(D){var C=D.element();if(this.isControl){tr("search_bar_a_button_click")}else{if(this.isExperiment){tr("search_bar_b_button_click")}}}})})();if(typeof deconcept=="undefined"){var deconcept=new Object()}if(typeof deconcept.util=="undefined"){deconcept.util=new Object()}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object()}deconcept.SWFObject=function(K,B,L,D,H,I,F,E,C,J){if(!document.getElementById){return }this.DETECT_KEY=J?J:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(K){this.setAttribute("swf",K)}if(B){this.setAttribute("id",B)}if(L){this.setAttribute("width",L)}if(D){this.setAttribute("height",D)}if(H){this.setAttribute("version",new deconcept.PlayerVersion(H.toString().split(".")))}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true}if(I){this.addParam("bgcolor",I)}var A=F?F:"high";this.addParam("quality",A);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var G=(E)?E:window.location;this.setAttribute("xiRedirectUrl",G);this.setAttribute("redirectUrl","");if(C){this.setAttribute("redirectUrl",C)}};deconcept.SWFObject.prototype={useExpressInstall:function(A){this.xiSWFPath=!A?"expressinstall.swf":A;this.setAttribute("useExpressInstall",true)},setAttribute:function(A,B){this.attributes[A]=B},getAttribute:function(A){return this.attributes[A]},addParam:function(B,A){this.params[B]=A},getParams:function(){return this.params},addVariable:function(B,A){this.variables[B]=A},getVariable:function(A){return this.variables[A]},getVariables:function(){return this.variables},getVariablePairs:function(){var C=new Array();var B;var A=this.getVariables();for(B in A){C[C.length]=B+"="+A[B]}return C},getSWFHTML:function(){var B="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath)}B='<embed type="application/x-shockwave-flash" src="'+this.getAttribute("swf")+'" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'"';B+=' id="'+this.getAttribute("id")+'" name="'+this.getAttribute("id")+'" ';var F=this.getParams();for(var E in F){B+=[E]+'="'+F[E]+'" '}var D=this.getVariablePairs().join("&");if(D.length>0){B+='flashvars="'+D+'"'}B+="/>"}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath)}B='<object id="'+this.getAttribute("id")+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute("width")+'" height="'+this.getAttribute("height")+'" style="'+this.getAttribute("style")+'">';B+='<param name="movie" value="'+this.getAttribute("swf")+'" />';var C=this.getParams();for(var E in C){B+='<param name="'+E+'" value="'+C[E]+'" />'}var A=this.getVariablePairs().join("&");if(A.length>0){B+='<param name="flashvars" value="'+A+'" />'}B+="</object>"}return B},write:function(B){if(this.getAttribute("useExpressInstall")){var A=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(A)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title)}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var C=(typeof B=="string")?document.getElementById(B):B;C.innerHTML=this.getSWFHTML();return true}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"))}}return false}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var E=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var A=navigator.plugins["Shockwave Flash"];if(A&&A.description){E=new deconcept.PlayerVersion(A.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var B=1;var C=3;while(B){try{C++;B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+C);E=new deconcept.PlayerVersion([C,0,0])}catch(D){B=null}}}else{try{var B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(D){try{var B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");E=new deconcept.PlayerVersion([6,0,21]);B.AllowScriptAccess="always"}catch(D){if(E.major==6){return E}}try{B=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(D){}}if(B!=null){E=new deconcept.PlayerVersion(B.GetVariable("$version").split(" ")[1].split(","))}}}return E};deconcept.PlayerVersion=function(A){this.major=A[0]!=null?parseInt(A[0]):0;this.minor=A[1]!=null?parseInt(A[1]):0;this.rev=A[2]!=null?parseInt(A[2]):0};deconcept.PlayerVersion.prototype.versionIsValid=function(A){if(this.major<A.major){return false}if(this.major>A.major){return true}if(this.minor<A.minor){return false}if(this.minor>A.minor){return true}if(this.rev<A.rev){return false}return true};deconcept.util={getRequestParameter:function(C){var D=document.location.search||document.location.hash;if(C==null){return D}if(D){var B=D.substring(1).split("&");for(var A=0;A<B.length;A++){if(B[A].substring(0,B[A].indexOf("="))==C){return B[A].substring((B[A].indexOf("=")+1))}}}return""}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var B=document.getElementsByTagName("OBJECT");for(var C=B.length-1;C>=0;C--){B[C].style.display="none";for(var A in B[C]){if(typeof B[C][A]=="function"){B[C][A]=function(){}}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs)};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true}}if(!document.getElementById&&document.all){document.getElementById=function(A){return document.all[A]}}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;var swfApplication;function upgradeMessageDisplayed(){APIRequest.track("FLASH_UPGRADE_"+swfApplication+"_PROMPT")}function trackFlashInstall(A){if((swfApplication!=null)&&(swfApplication!="")){APIRequest.track("FLASH_UPGRADE_"+swfApplication+"_"+A)}}function trackFlashNotInstalled(){if((swfApplication!=null)&&(swfApplication!="")){APIRequest.track("FLASH_UPGRADE_"+swfApplication+"_NOFLASH")}}var globalStayingOnsite=false;if(typeof PbOffsiteDetector=="undefined"){PbOffsiteDetector={}}PbOffsiteDetector={init:function(A){jq(document).ready(function(){jq("a").live("click",function(){PbOffsiteDetector.setLinkType(jq(this).attr("href"))});jq("form").live("onSubmit",function(){PbOffsiteDetector.setLinkType(jq(this).attr("action"))});jq(window).bind("beforeunload",function(){if(globalStayingOnsite==false){A()}})})},userIsStaying:function(){globalStayingOnsite=true},setLinkType:function(A){var C=["photobucket.com","pbsrc.com"];var B=true;if(!(typeof A=="undefined")){if(A.indexOf("http://")==-1&&A.indexOf("https://")==-1){B=false}for(i=0;i<C.length;i++){if(A.indexOf(C[i])!==-1){B=false;break}}}if(B==false){PbOffsiteDetector.userIsStaying()}}};if(typeof Survey=="undefined"){Survey={}}Survey={onSubmit:function(B){jq(".req").remove();if(Survey.validate(jq("#"+B))){var A=jq("#"+B).serialize();jq.ajax({url:"/survey/save",data:A,type:"POST",success:Survey.success,error:Survey.error})}return false},validate:function(C){var A=true;var B=C.serializeArray();jq.each(B,function(D,E){if(!E.value){jq("#"+E.name.replace("[","\\[").replace("]","\\]")).after(' <span class="req"> *required </span>');A=false}});jq("ul.radiobuttons",C).each(function(){if(jq(this).find("input:radio").filter(":checked").length==0){jq("#"+this.id).after(' <span class="req"> *required </span>');A=false}});return A},onExit:function(){jq.ajax({url:"/survey/leave",type:"GET",cache:false,async:false});return false},success:function(A){try{if(A.indexOf("fail")>-1){Survey.error}}catch(B){Survey.error}document.fire(PBLightbox.EVENT.DEACTIVATE);return true},error:function(){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"An unknown error occurred.",type:PBMessage.MESSAGE_TYPE.ERROR})})},evaluateMultipleChoiceOther:function(A,B){if(jq.trim(B.toLowerCase())=="other"){jq("#answerform\\["+A+"\\]").after('<div id="other'+A+'">Please describe: <input type="text" name="other_'+A+'"  id="other_'+A+'" maxlength="256" size="30" /></div>')}else{jq("#other"+A).remove()}}};PBConnect={facebook:{},twitter:{},myspace:{},messenger:{}};PBConnect.isFacebookAPILoaded=false;PBConnect.loadFacebookAPI=function(A){var B=function(){FB.init(PBConnect.facebook.key,"http://"+PBConnect.facebook.basedomain+"/xd_receiver.htm");PBConnect.isFacebookAPILoaded=true;if(A){A()}};if(!PBConnect.isFacebookAPILoaded){jq.getScript("http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php/en_US",B)}};PBConnect.updateIcons=function(){jq("ul.connectedsites .iconplacement").each(function(B,A){jqv=jq(A);if(jqv.attr("uid")){PBConnect[jqv.attr("site")].setProfilePic(jqv.get(0))}})};PBConnect.syncLightboxToIcons=function(){jq("ul.connectedsites li").each(function(C,A){var B=jq(A).find(".iconplacement").attr("site");var D=$(B+"_upload_icon");if(jq(A).find(".authstatus span").hasClass("connected")){if(D){D.show()}}else{if(jq(A).find(".authstatus span").hasClass("notconnected")){if(D){D.hide()}}}})};PBConnect.facebook.setProfilePic=function(A){jqelt=jq(A);PBConnect.loadFacebookAPI(function(){FB_RequireFeatures(["XFBML"],function(){FB.XFBML.Host.autoParseDomTree=false;FB.XFBML.Host.addElement(new FB.XFBML.ProfilePic(jqelt.get(0)))})})};PBConnect.facebook.Login=function(){window.clearInterval(PBConnect.facebook.timer);PBConnect.facebook.timer=null;var A=jq("#connect input[name=ts]").val();var B=jq("#connect input[name=sig]").val();PBConnect.facebook.win=window.open("/connectcb/facebook_start?ts="+A+"&sig="+B,"Facebook_Auth","width=570,height=450,modal=yes,alwaysRaised=yes");if(!PBConnect.facebook.win){return true}if(!PBConnect.facebook.timer){PBConnect.facebook.timer=window.setInterval(PBConnect.facebook.winCheck,300)}return false};PBConnect.facebook.winCheck=function(){if(!PBConnect.facebook.win||PBConnect.facebook.win.closed){window.clearInterval(PBConnect.facebook.timer);PBConnect.facebook.timer=null;document.fire(AutoShareController.EVENT.VERIFYAUTH,{siteId:2,checkId:"facebook"})}};PBConnect.facebook.Logout=function(A){PBConnect.fireProgress();jq.post("/connectcb/facebook_logout",{site_auth_id:A,ts:jq("#connect_delete input[name=ts]").val(),sig:jq("#connect_delete input[name=sig]").val()},function(B){document.fire(AutoShareController.EVENT.LOGOUT,{checkId:"facebook"})});return false};PBConnect.twitter.setProfilePic=function(C){var B=jq(C);var A=B.attr("uname");B.find("img").attr("src","http://img.tweetimag.es/i/"+A+"_n")};PBConnect.twitter.Login=function(){window.clearInterval(PBConnect.twitter.timer);PBConnect.twitter.timer=null;var A=jq("#connect input[name=ts]").val();var B=jq("#connect input[name=sig]").val();PBConnect.twitter.win=window.open("/connectcb/twitter_start?ts="+A+"&sig="+B,"Twitter_Auth","width=800,height=450,modal=yes,alwaysRaised=yes");if(!PBConnect.twitter.win){return true}if(!PBConnect.twitter.timer){PBConnect.twitter.timer=window.setInterval(PBConnect.twitter.winCheck,300)}return false};PBConnect.twitter.winCheck=function(){if(!PBConnect.twitter.win||PBConnect.twitter.win.closed){window.clearInterval(PBConnect.twitter.timer);PBConnect.twitter.timer=null;document.fire(AutoShareController.EVENT.VERIFYAUTH,{siteId:3,checkId:"twitter"})}};PBConnect.twitter.Logout=function(A){PBConnect.fireProgress();jq.post("/connectcb/twitter_logout",{site_auth_id:A,ts:jq("#connect_delete input[name=ts]").val(),sig:jq("#connect_delete input[name=sig]").val()},function(B){document.fire(AutoShareController.EVENT.LOGOUT,{checkId:"twitter"})});return false};PBConnect.myspace.setProfilePic=function(B){var A=jq(B);var C=A.attr("uid");A.find("img").attr("src","/connectcb/myspace_profile_image?siteUserId="+C)};PBConnect.myspace.Login=function(){window.clearInterval(PBConnect.myspace.timer);PBConnect.myspace.timer=null;var A=jq("#connect input[name=ts]").val();var B=jq("#connect input[name=sig]").val();PBConnect.myspace.win=window.open("/connectcb/myspace_start?ts="+A+"&sig="+B,"Myspace_Auth","width=620,height=500,modal=yes,alwaysRaised=yes");if(!PBConnect.myspace.win){return true}if(!PBConnect.myspace.timer){PBConnect.myspace.timer=window.setInterval(PBConnect.myspace.winCheck,300)}return false};PBConnect.myspace.winCheck=function(){if(!PBConnect.myspace.win||PBConnect.myspace.win.closed){window.clearInterval(PBConnect.myspace.timer);PBConnect.myspace.timer=null;document.fire(AutoShareController.EVENT.VERIFYAUTH,{siteId:1,checkId:"myspace"})}};PBConnect.myspace.Logout=function(A){PBConnect.fireProgress();jq.post("/connectcb/myspace_logout",{site_auth_id:A,ts:jq("#connect_delete input[name=ts]").val(),sig:jq("#connect_delete input[name=sig]").val()},function(B){document.fire(AutoShareController.EVENT.LOGOUT,{checkId:"myspace"})});return false};PBConnect.messenger.Login=function(){window.clearInterval(PBConnect.messenger.timer);PBConnect.messenger.timer=null;var A=jq("#connect input[name=ts]").val();var B=jq("#connect input[name=sig]").val();PBConnect.messenger.win=window.open("/connectcb/messenger_start?ts="+A+"&sig="+B,"Messenger_Auth","width=465,height=375,modal=yes,alwaysRaised=yes");if(!PBConnect.messenger.win){return true}if(!PBConnect.messenger.timer){PBConnect.messenger.timer=window.setInterval(PBConnect.messenger.winCheck,300)}return false};PBConnect.messenger.winCheck=function(){if(!PBConnect.messenger.win||PBConnect.messenger.win.closed){window.clearInterval(PBConnect.messenger.timer);PBConnect.messenger.timer=null;document.fire(AutoShareController.EVENT.VERIFYAUTH,{siteId:4,checkId:"messenger"})}};PBConnect.messenger.Logout=function(A){PBConnect.fireProgress();jq.post("/connectcb/messenger_logout",{site_auth_id:A,ts:jq("#connect_delete input[name=ts]").val(),sig:jq("#connect_delete input[name=sig]").val()},function(B){document.fire(AutoShareController.EVENT.LOGOUT,{checkId:"messenger"})});return false};PBConnect.fireProgress=function(){document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE)};var AutoShareController;(function(){var A={fromSharePanel:null,initialize:function(){Event.observe(document,AutoShareController.EVENT.VERIFYAUTH,this.verifyauth.bindAsEventListener(this));Event.observe(document,AutoShareController.EVENT.LOGOUT,this.logout.bindAsEventListener(this));Event.observe(document,AutoShareController.EVENT.AUTOSHARE,this.autoshare.bindAsEventListener(this));Event.observe(document,AutoShareController.EVENT.CREATESETURL,this.createseturl.bindAsEventListener(this));Event.observe(document,AutoShareController.EVENT.EMAILSET,this.emailset.bindAsEventListener(this))},verifyauth:function(C){var F=C.memo.siteId;var E=C.memo.checkId;var G="siteId="+F+"&checkId="+E;var D="/connectcb/verifyAuth";new Ajax.Request(D,{method:"POST",parameters:G,evalJSON:"force",onSuccess:this.handleVerifyAuth.bindAsEventListener(this)})},handleVerifyAuth:function(O){if(O.responseJSON&&O.responseJSON.response.stat=="ok"){var L=O.responseJSON.response.checkId;var C=O.responseJSON.response.siteUname;var K=O.responseJSON.response.authId;var R=O.responseJSON.response.siteId;var H=O.responseJSON.response.siteImage;var Q=O.responseJSON.response.siteLink;var N=$("autocheck");if(N&&N.value=="yes"){var E=$("doautoshare");if(E){E.checked=true}}var I=$("connect_"+L);if(I){I.checked=true;I.onclick=""}var G=$("connect_"+L+"_uname");if(G){G.innerHTML="as "+C}var F=$("authServiceCnt");if(F){var P=parseInt(F.value);if(P==0){$("autoshareempty").toggle();$("autosharefull").toggle()}P+=1;F.value=P}var U=$(L+"_upload_icon");if(U){U.toggle()}var S=$("connect_"+L+"_row");if(S){S.removeClassName("notconnected");S.addClassName("connected");var J=$("accountOptions");if(J){tr("account_settings_connect")}else{tr("autoshare_connect")}var D=S.down(".connect_text");if(D){if(Q){D.innerHTML='Connected as <a href="'+Q+'" target="_blank">'+C+"</a>"}else{D.innerHTML="Connected as "+C}}var T=S.down(".connect_iconplacement");if(T){T.writeAttribute("uid",R);T.writeAttribute("uname",C);T.down("a").writeAttribute("href",Q);T.down("img").writeAttribute("src",H)}var M=S.down(".button.connect");if(M){M.onclick=function(){return PBConnect[L].Logout(K)};M.innerHTML="Disconnect"}}tr("share_connect");tr("share_"+L+"_connect")}},logout:function(I){document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE);var H=I.memo;var D=H.checkId;var E=$("authServiceCnt");if(E){E.value-=1;if(E.value==0){$("autoshareempty").toggle();$("autosharefull").toggle();$("doautoshare").checked=false}}var C=$(D+"_upload_icon");if(C){C.toggle()}var F=$("connect_"+D+"_row");if(F){F.removeClassName("connected");F.addClassName("notconnected");if($("accountOptions")){tr("account_settings_disconnect")}else{tr("autoshare_disconnect")}var K=F.down(".connect_text");if(K){K.innerHTML="You're not connected!"}var G=F.down(".connect_iconplacement");if(G){G.writeAttribute("uid",null);G.writeAttribute("uname",null);G.down("a").writeAttribute("href","");G.down("img").writeAttribute("src","")}var J=F.down(".button.connect");if(J){J.onclick=function(){return PBConnect[D].Login()};J.innerHTML="Connect"}}tr("share_disconnect");tr("share_"+D+"_disconnect")},autoshare:function(K){var J=K.memo;this.fromSharePanel=J.fromSharePanel;if(this.fromSharePanel){var L=J.ajaxParams}else{var I=$("autoshareform");var H=$$(".authService");var G=false;for(var F=0;F<H.length;F++){if(H[F].checked){G=true;switch(H[F].value){case"4":var D="messenger";break;case"3":var D="twitter";break;case"2":var D="facebook";break;case"1":var D="myspace";break}tr("post_upload_share_"+D+"_total");tr("post_upload_share_site_total")}}if(!G){var E=new PBMessage({title:"Please select a service to share to.",type:PBMessage.MESSAGE_TYPE.ERROR});this.fireMsg(E);return }if(this.getSelectedMediaSetCount()==0){var E=new PBMessage({title:"Please select an image or video to share.",type:PBMessage.MESSAGE_TYPE.ERROR});this.fireMsg(E);return }$("postuploadprogress").toggle();var L=I.serialize();tr("post_upload_share_total")}var C="/share/autoshare/";new Ajax.Request(C,{method:"POST",parameters:L,evalJSON:"force",onSuccess:this.handleAutoShare.bindAsEventListener(this)})},handleAutoShare:function(D){if(D.responseJSON&&D.responseJSON.response.stat=="ok"){var C=new PBMessage({title:D.responseJSON.response.message.title,details:D.responseJSON.response.message.details,type:PBMessage.MESSAGE_TYPE.SUCCESS})}else{var C=new PBMessage({title:"There was a problem setting up your share.",type:PBMessage.MESSAGE_TYPE.ERROR})}if(this.fromSharePanel){document.fire(SharePanelController.EVENT.PROGRESS.DEACTIVATE);this.fireLBMsg(C)}else{$("postuploadprogress").toggle();this.fireMsg(C)}},createseturl:function(L){var I=L.memo;var J=I.mediaCnt;var C=$("setId");var K=this.getSelectedMediaSetCount();if(K==0){var E=new PBMessage({title:"Please select an image or video to share.",type:PBMessage.MESSAGE_TYPE.ERROR});this.fireMsg(E);return }var G="";var M="";var D=$$(".selectedMedia");for(var H=0;H<D.length;H++){var F=(H>0)?"&":"";if(D[H].checked){M+=F+"selectedMedia[]="+D[H].value}}if(C&&(C.value!="")&&(K==J)){G+="useset=1&setId="+C.value}else{G+=M}document.fire(PBLightbox.EVENT.ACTIVATE,{contentUrl:"/createset?"+G,cache:false})},emailset:function(C){if(this.getSelectedMediaSetCount()==0){var D=new PBMessage({title:"Please select an image or video to share.",type:PBMessage.MESSAGE_TYPE.ERROR});this.fireMsg(D)}else{document.fire(SharePanelController.EVENT.SHOW,C.memo.shareMemo)}},getSelectedMediaSetCount:function(){var D=$$(".selectedMedia");var C=0;for(var E=0;E<D.length;E++){if(D[E].checked){C++}}return C},fireLBMsg:function(D){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:D});if(photobucket.browser.isIE){var C=$("autosharectrl");if(C){C.hide();C.show()}}},fireMsg:function(C){document.fire(PBMessage.EVENT.NOTIFY,{message:C})}};var B={EVENT:{VERIFYAUTH:"AutoShareController:verifyauth",LOGOUT:"AutoShareController:logout",AUTOSHARE:"AutoShareController:autoshare",CREATESETURL:"AutoShareController:createseturl",EMAILSET:"AutoShareController:emailset"}};Controller.create("AutoShareController",A,B)})();var ShareBase={currentAlbumView:null,albumEmbedType:"album",albumEmbedSize:"480x360",mediaData:null,getMessage:function(B){var A;if(B.response.stat=="ok"){A=new PBMessage(B.response.message);A.type=PBMessage.MESSAGE_TYPE.SUCCESS}else{A=new PBMessage(B.response.message);A.type=PBMessage.MESSAGE_TYPE.ERROR}return A},fireErrorMessage:function(A){document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Attention",details:A,type:PBMessage.MESSAGE_TYPE.ERROR})});return },isFieldChecked:function(B){var A=this.getPanelElt(B);if(!A){return false}else{return A.checked}},getPanelValue:function(A){return $F(this.getPanelId(A))},getPanelElt:function(A){return $(this.getPanelId(A))},getPanelId:function(A){if(this.idPrefix){return this.idPrefix+"_"+A}else{return A}},handleLinkViewUpdate:function(G){var F=G.memo;var D=SharePanelController.getInstance();this.currentAlbumView=F.type;var E=$(F.prefix+"_linkView_label");var A=$(F.prefix+"_gridView_label");var I=$(F.prefix+"_slideshowView_label");var C="selected";var B="unselected";if(!Element.hasClassName(E,B)){Element.addClassName(E,B)}if(Element.hasClassName(A,C)){Element.removeClassName(A,C)}if(Element.hasClassName(I,C)){Element.removeClassName(I,C)}var H=$(F.prefix+"_"+this.currentAlbumView+"View_label");if(this.currentAlbumView=="link"){Element.removeClassName(H,B)}else{Element.addClassName(H,C)}D.updateShareDirectUrls(this.baseSelector,this.getFullAlbumUrl())},handlePreviewLinkView:function(A){window.open(this.getFullAlbumUrl())},getFullAlbumUrl:function(){if(!this.currentAlbumView||this.currentAlbumView=="link"){return this.mediaData.albumUrl}else{return this.mediaData.albumUrl+"?albumview="+this.currentAlbumView}},handleEmbedUpdate:function(B){var C=B.memo;var A=SharePanelController.getInstance();if(C.type){A.albumEmbedType=this.albumEmbedType=C.type.value}else{if(C.size){A.albumEmbedSize=this.albumEmbedSize=C.size.value}}A.updateShareHTMLUrls(this.baseSelector,this.getRssEmbed())},handlePreviewAlbumEmbed:function(A){var B=this.getEmbedDimensions();window.open(this.getRssBase()+"/flash/rss_slideshow.swf?rssFeed="+this.getRssUrl()+"&os=1","albumEmbed","toolbar=no,width="+B.width+",height="+B.height)},getRssEmbed:function(){var B=this.getEmbedDimensions();var A="rssFeed="+this.getRssUrl();var C='<embed width="'+B.width+'" height="'+B.height+'" src="'+this.getRssBase()+'/flash/rss_slideshow.swf" flashvars="'+A+'" type="application/x-shockwave-flash" wmode="transparent" />';if(this.mediaData.isPremium){return C}else{return'<div style="width:'+B.width+'px;text-align:right;">'+C+'<a href="http://photobucket.com/redirect/album?showShareLB=1" target="_blank"><img src="http://pic.pbsrc.com/share/icons/embed/btn_geturs.gif" style="border:none;" /></a><a href="'+this.mediaData.albumUrl+'" target="_blank"><img src="http://pic.pbsrc.com/share/icons/embed/btn_viewall.gif" style="border:none;" /></a></div>'}},getEmbedDimensions:function(){var A=this.albumEmbedSize.split("x");return{width:A[0],height:A[1]}},getRssBase:function(){return this.mediaData.rssBase},getRssUrl:function(){var A=(this.albumEmbedType=="album"?this.mediaData.rssAlbum:this.mediaData.rssAccount);return A}};ShareBase=Class.create(ShareBase);var SharePanelController;(function(){var A={baseSelector:"#lightboxcontent",shareDataDest:"/share/data",form:null,idPrefix:"sharePanel",progress:null,mediaType:null,isLoggedIn:null,isAlbumPublic:null,hasGuestPassword:null,isAlbumShare:null,isAlbumIndex:false,isSetShare:null,albumName:null,albumLoc:null,albumDepth:null,albumEmbedType:"album",albumEmbedSize:"480x360",privacyChangeMode:null,albumShareToggle:null,lastTabEvent:null,lastPartnerID:null,recaptchaJsLoaded:false,autoShareSelectedMedia:null,initialize:function(){Event.observe(document,SharePanelController.EVENT.SHOW,this.handleShowPanel.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.CLOSE,this.handleClosePanel.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.INITFORMS,this.handleInitForm.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.PRIVACYCHANGESUBMIT,this.handlePrivacyChangeSubmit.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.SHOWFACEBOOK,this.handleShowFacebook.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.SHOWMYSPACE,this.handleShowMyspace.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.SHOWTWITTER,this.handleShowTwitter.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.PROGRESS.ACTIVATE,this.handleProgressActivate.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.PROGRESS.DEACTIVATE,this.handleProgressDeactivate.bindAsEventListener(this));Event.observe(document,tabbedPanelHelper.EVENT.TAB_CHANGE,this.handleTabbedPanelChange.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.TOGGLEEASYPANEL,this.toggleEasyPanel.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.AUTOSHARE,this.autoshare.bindAsEventListener(this));Event.observe(document,PB.EVENT.PAGE_LOADED,this.onPageLoaded.bindAsEventListener(this))},onPageLoaded:function(C){SharePanelMobileController.getInstance();ShareEmailPanelController.getInstance();SharePanelEasypostController.getInstance();SharePanelLinksController.getInstance();photobucket.ui.loadScript("http://cdn.gigya.com/wildfire/js/wfapiv2.js")},mixIn:function(C){for(var D in C){this[D]=C[D]}if(this.progressId){this.progress=new PBProgress({parentId:this.progressId,themed:true})}document.fire(SharePanelController.EVENT.MIXIN,C)},handleProgressActivate:function(C){document.fire(PBLightbox.PBProgress.EVENT.ACTIVATE)},handleProgressDeactivate:function(C){document.fire(PBLightbox.PBProgress.EVENT.DEACTIVATE)},handleShowPanel:function(F){if(this.isAlbumPublic){this.albumShareToggle=$("promptAlbum")}var G=F.memo;this.mediaType=(G.mediaType!="flash")?G.mediaType:"image";this.isAlbumShare=(this.mediaType=="album"||this.mediaType=="group album");this.isSetShare=(this.mediaType=="set");var D="";var I="";var J="";if(this.isAlbumShare){I=(G.albumUrl||getDocumentUrl());if(!I){return }if(G.showAdvanced){Element.toggle("shareEasy_advancedPanel");Element.toggle("shareEasy_hidePanel")}if(this.isAlbumPublic&&this.albumShareToggle){Element.hide(this.albumShareToggle)}this.toggleMobileTab(false);this.autoShareSelectedMedia="album~"+I;J="albumUrl="+I}else{if(this.isSetShare){this.toggleEasyTab(false);this.toggleLinkCodeTab(false);this.toggleMobileTab(false);var D=G.mediaUrl.replace("/player.swf?file=","");J="mediaUrl="+D}else{D=G.mediaUrl;if(!D){return }var H=D.indexOf("&hostname");if(H!=-1){D=D.substring(0,H)}D=D.replace("file=","mediaUrl=");D=D.replace("videoURL=","mediaUrl=");if(this.mediaType=="video"){D=D.replace("http://gvid","http://gs")}if(this.mediaType=="slideshow"){D=D.split("pbwurl=").pop();D=D.replace("http://w","http://s")}this.autoShareSelectedMedia="media~"+D;if(this.isAlbumPublic&&this.isAlbumIndex&&this.albumShareToggle){Element.show(this.albumShareToggle)}var C=(G.mediaType=="image")?true:false;this.toggleMobileTab(C);if(D.indexOf("http://")==0){D=encodeURIComponent(D)}J="mediaUrl="+D;if(G.searchType||this.searchType){J+="&sType="+(G.searchType||this.searchType)}if(this.searchTerm){J+="&sTerm="+escape(this.searchTerm)}if(this.searchOffset){J+="&sOffset="+this.searchOffset}}}var E=(this.isLoggedIn);this.toggleEmailTab(E);switch(G.tabType){case SharePanelController.TYPE.MOBILE:this.tabController.handleCycle($("tabLink_"+this.tabPanelMap.mobile));tr("sendmobile_step_one_view");break;case SharePanelController.TYPE.EMAIL:this.tabController.handleCycle($("tabLink_"+this.tabPanelMap.email));break;case SharePanelController.TYPE.LINKCODE:this.tabController.handleCycle($("tabLink_"+this.tabPanelMap.linkcode));break;default:this.tabController.handleCycle($("tabLink_"+this.tabPanelMap.easy));if(G.partnerID&&(!this.isAlbumShare||(this.isAlbumShare&&this.isAlbumPublic))){document.fire(SharePanelEasypostController.EVENT.DELAYED_APPLY_CONFIG,{type:G.partnerID});this.lastPartnerID=G.partnerID}break}PBLightbox.getInstance();document.fire(PBLightbox.EVENT.ACTIVATE,{content:this.contentId,hiddenIds:["cellAd","panelAdv","ad","containerMrecAd","findStuffMainAd","bannerAd"]});document.fire(SharePanelController.EVENT.PROGRESS.ACTIVATE);new Ajax.Request(this.shareDataDest,{method:"POST",parameters:J,evalJSON:"force",onSuccess:this.handleDataResponse.bindAsEventListener(this)})},handleDataResponse:function(D){var E=D;var C=this;var F=function(){C.recaptchaJsLoaded=true;document.fire(SharePanelController.EVENT.PROGRESS.DEACTIVATE);if(E.responseJSON&&E.responseJSON.response.stat=="ok"){Element.update("pb_recaptcha_placeholder",E.responseJSON.response.data.recaptchaHTML);var G={isAlbumShare:C.isAlbumShare,isSetShare:C.isSetShare,isLoggedIn:C.isLoggedIn,isAlbumPublic:C.isAlbumPublic,hasGuestPassword:C.hasGuestPassword,mediaType:C.mediaType,data:E.responseJSON.response.data};document.fire(SharePanelController.EVENT.INITFORMS,G)}else{document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:C.getMessage(E.responseJSON)});Element.hide(C.wrapperId)}};if(this.recaptchaJsLoaded){F()}else{jq.getScript("http://api.recaptcha.net/js/recaptcha_ajax.js",F)}},handleInitForm:function(L){var K=L.memo;this.mediaData=K.data;this.albumName=this.mediaData.albumName;this.albumLoc=this.mediaData.albumLoc;this.albumDepth=this.mediaData.albumDepth;this.isAlbumShare=K.isAlbumShare;this.isSetShare=K.isSetShare;if(this.mediaData.authServices){this.configureAutoShare(this.mediaData.authServices)}if(this.isAlbumShare){var I=(this.albumName.search(/album/i)!=-1)?this.albumName:this.albumName+" album";Element.update(this.getPanelElt("object"),I);this.updateShareDirectUrls(this.baseSelector,this.mediaData.albumUrl);this.updateShareHTMLUrls(this.baseSelector,this.getRssEmbed());var D=$$(this.baseSelector+" .albumViewCell_"+this.mediaData.albumView+" INPUT");for(var F=0;F<D.length;F++){D[F].checked=true}var N=$$(this.baseSelector+" .albumViewCell_"+this.mediaData.albumView+" LABEL");for(var F=0;F<N.length;F++){if(Element.hasClassName(N[F],"unselected")){Element.removeClassName(N[F],"unselected")}else{Element.addClassName(N[F],"selected")}}Element.update("linkcode_password_hint",this.mediaData.guest);$("automsg").innerHTML="Enter message here";if(this.isAlbumPublic){this.initStatePublic()}else{if(this.hasGuestPassword){this.initStatePrivateWithPassword()}else{if(!this.hasGuestPassword){this.initStatePrivateWithoutPassword()}}}}else{if(this.isSetShare){var M=$$(".selectedMedia");var E=0;for(var F=0;F<M.length;F++){if(M[F].checked){E++}}I=(E>1)?" "+E+" new uploads":" 1 new upload";Element.update(this.getPanelElt("object"),I);this.initStatePublic()}else{Element.update(this.getPanelElt("object"),(this.mediaType=="adobeexpress")?"this remix":"this "+this.mediaType);this.updateShareEmailImUrls(this.baseSelector,this.mediaData.linkFullsize);this.updateShareDirectUrls(this.baseSelector,this.mediaData.linkURL);this.updateShareHTMLUrls(this.baseSelector,this.mediaData.linkTAG);this.updateShareHTMLThumbUrls(this.baseSelector,this.mediaData.linkTAGThumb);this.updateShareIMGUrls(this.baseSelector,this.mediaData.linkIMG);this.updateShareIMGThumbUrls(this.baseSelector,this.mediaData.linkIMGThumb);this.updateShareEmbedUrls(this.baseSelector,this.mediaData.linkTAGEmbed);$("automsg").innerHTML="Enter message here";this.initStatePublic()}}var J=$$("#lightboxcontent .mediatype");for(var F=0;F<J.length;F++){Element.update(J[F],this.mediaType)}var H=$$("#lightboxcontent .thumb");for(var F=0;F<H.length;F++){Element.setStyle(H[F],{backgroundImage:"url("+this.mediaData.previewThumb+")"})}var C=$("mobilethumbwrap");if(C){C.style.width=this.mediaData.previewThumbWidth+"px";if(this.mediaData.previewThumbType!="image"){C.removeClassName("image");C.addClassName("video")}var G='<img src="'+this.mediaData.previewThumb+'" style="width:'+this.mediaData.previewThumbWidth+'px;" />';C.update(G)}},initStatePublic:function(){this.showPanels(".defaultpanel");if(!this.isLoggedIn){this.showPanels(".easypanel")}else{this.showPanels(".autoshare")}if(this.isAlbumShare){this.showPanels(".albumpanel")}else{this.showPanels(".mediapanel")}},initStatePrivate:function(){if(this.isAlbumShare&&this.isAlbumOwner){var C=(this.albumDepth==1&&!this.mediaData.isAccountPrivate)?"album":"account";Element.update("makepublictext","Embeddable album slideshows are only available for public "+C+"s, but this "+C+" is <b>private</b>.<br/><br/>Would you like to make this "+C+" <b>public</b>?");$("makepublic").value="Make "+C+" public";this.showPanels(".makepublicpanel")}},initStatePrivateWithPassword:function(){this.initStatePrivate();if(this.isAlbumShare){this.showPanels(".defaultpanel");this.showPanels(".albumpanel");this.showPanels(".privatepanelalbum_withpw")}},initStatePrivateWithoutPassword:function(){this.initStatePrivate();if(this.isAlbumShare){this.showPanels(".privatepanelalbum")}},initStateSetShare:function(){if(!this.isLoggedIn){this.showPanels(".easypanel")}else{this.showPanels(".autoshare")}this.showPanels(".defaultpanel")},handleClosePanel:function(C){document.fire(PBLightbox.EVENT.DEACTIVATE)},updateShareEmailImUrls:function(C,D){this.bulkUpdateInputs(C+" .shareEmailImUrl",D)},updateShareDirectUrls:function(C,D){this.bulkUpdateInputs(C+" .shareDirectUrl",D)},updateShareHTMLUrls:function(C,D){this.bulkUpdateInputs(C+" .shareHTMLUrl",D)},updateShareHTMLThumbUrls:function(C,D){this.bulkUpdateInputs(C+" .shareHTMLThumbUrl",D)},updateShareIMGUrls:function(C,D){this.bulkUpdateInputs(C+" .shareIMGUrl",D)},updateShareIMGThumbUrls:function(C,D){this.bulkUpdateInputs(C+" .shareIMGThumbUrl",D)},updateShareEmbedUrls:function(C,D){this.bulkUpdateInputs(C+" .shareEmbedUrl",D)},bulkUpdateInputs:function(C,F){var D=$$(C);for(var E=0;E<D.length;E++){switch(D[E].tagName){case"INPUT":case"TEXTAREA":D[E].value=F;break;default:D[E].innerHTML=F;break}}},toggleLinkCodeTab:function(E){var C=this.tabController.key;var D=$(C+"_"+this.tabPanelMap.linkcode);if(!E){D.hide()}else{D.show()}return },toggleMobileTab:function(E){var C=this.tabController.key;var D=$(C+"_"+this.tabPanelMap.mobile);if(!E){D.hide()}else{D.show()}return },toggleEmailTab:function(E){var C=this.tabController.key;var D=$(C+"_"+this.tabPanelMap.email);if(!E){D.hide()}else{D.show()}return },toggleEasyTab:function(E){var C=this.tabController.key;var D=$(C+"_"+this.tabPanelMap.easy);if(!E){D.hide()}else{D.show()}return },toggleEasyPanel:function(C){$("autosharepanel").toggle();$("easypanel").toggle()},showPanels:function(E){var C=$$(this.baseSelector+" "+E);for(var D=0;D<C.length;D++){if(E==".autoshare"){Element.toggle(C[D])}else{Element.show(C[D])}}},hidePanels:function(E){var C=$$(this.baseSelector+" "+E);for(var D=0;D<C.length;D++){Element.hide(C[D])}},handlePrivacyChangeSubmit:function(D){var E=D.memo;this.privacyChangeMode=E.mode;var H=$(E.form).guestpw;if(H&&H.value==""){this.fireErrorMessage("Please enter a guest password.")}else{var G=$(E.form).serialize();G+="&loc="+this.albumLoc;if(this.mediaData.isAccountPrivate&&this.privacyChangeMode!="guestpw"){G+="&makeacctpub=true"}var C=Math.floor(Math.random()*10001);G+="&cb="+C;var F=E.form.action;document.fire(SharePanelController.EVENT.PROGRESS.ACTIVATE);new Ajax.Request(F,{method:"POST",parameters:G,evalJSON:"force",onSuccess:this.handlePrivacyChangeSubmitSuccess.bindAsEventListener(this),onFailure:this.handlePrivacyChangeSubmitFailure.bindAsEventListener(this)});if(H){Element.update("linkcode_password_hint",H.value)}}},handlePrivacyChangeSubmitSuccess:function(D){if(D.responseJSON.status=="ok"){if(this.privacyChangeMode=="guestpw"){this.hasGuestPassword=true}else{if(this.privacyChangeMode=="public"){this.isAlbumPublic=true;this.hasGuestPassword=false;this.hidePanels(".makepublicpanel")}}this.hidePanels(".privatepanel");this.hidePanels(".privatepanelalbum");this.hidePanels(".privatepanelalbum_withpw");if(this.isAlbumShare&&this.isAlbumPublic){this.initStatePublic()}else{if(this.isAlbumShare&&this.hasGuestPassword){this.initStatePrivateWithPassword()}}document.fire(SharePanelController.EVENT.PROGRESS.DEACTIVATE);document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:"Success",details:"Your changes have been saved.",type:PBMessage.MESSAGE_TYPE.SUCCESS})});if(photobucket.browser.isIE){var C=$("autosharectrl");if(C){C.hide();C.show()}}}else{document.fire(SharePanelController.EVENT.PROGRESS.DEACTIVATE);this.fireErrorMessage("There was a problem saving your changes.")}},handlePrivacyChangeSubmitFailure:function(C){this.fireErrorMessage("There was a problem saving your guest password.  Please try again later.")},switchToAlbumShare:function(){if(this.albumShareToggle){Element.hide(this.albumShareToggle)}this.handleClosePanel();var C=(this.lastPartnerID!="")?this.lastPartnerID:"";document.fire(SharePanelController.EVENT.SHOW,{tabType:this.lastTabEvent,partnerID:C,mediaType:"album",albumUrl:this.mediaData.albumFullUrl})},handleShowFacebook:function(C){var D=C.memo;var E=D.url||document.location.href;var F="http://media.";if(E.startsWith(F)){E=E.split("?")[0];E=E.split("#")[0];E+=".xhtml"}if(this.isAlbumShare&&this.albumEmbedType=="account"){E+="?aetype=account"}window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(E),"sharer","toolbar=yes,width=642,height=436")},handleShowMyspace:function(C){var E=C.memo;var F=$("sharePanel_MySpaceForm");var D=$("sharePanel_MySpaceFormContent");if(F&&D&&E.html){D.value=unescape(E.html);window.open("http://www.myspace.com/index.cfm?fuseaction=postto&"+F.serialize(),"myspacesharer","toolbar=yes,resizable=yes,scrollbars=yes,width=1024,height=600")}},handleShowTwitter:function(C){var D=C.memo;var G=escape(D.thumbnail_url);var H=escape(D.thumbnail_url.replace("th_",""));var F="http://twitgoo.com/-share/?upload_url="+H+"&thumb_url="+G;if(this.isAlbumShare){var E=escape(D.encoded_url);F+="&tweet-text="+E}window.open(F,"twittersharer","toolbar=yes,resizable=yes,scrollbars=yes,width=800,height=650")},handleTabbedPanelChange:function(D){this.bulkUpdateInputs("#lightboxcontent .guestpw","");document.fire(PBLightbox.PBMessage.EVENT.CLOSE);var C=null;switch(D.memo.tabLinkId){case"sharePanelTabs.tabLink_1":this.lastTabEvent=SharePanelController.TYPE.EASY;C="share_easy_post_view";break;case"sharePanelTabs.tabLink_2":this.lastTabEvent=SharePanelController.TYPE.EMAIL;C="share_send_email_view";break;case"sharePanelTabs.tabLink_3":this.lastTabEvent=SharePanelController.TYPE.LINKCODE;C="share_get_link_code_view";break;default:this.lastTabEvent=SharePanelController.TYPE.MOBILE;C="share_send_to_phone_view";break}if(C){tr(C)}},configureAutoShare:function(E){for(var F in E){if(E[F].checked){var C=$("connect_"+F);var D=$("connect_"+F+"_uname");C.checked=true;C.onclick="";D.innerHTML="as "+E[F].siteUname}}},autoshare:function(C){$("autoShareSelectedMedia").value=this.autoShareSelectedMedia;var E=$("autoshareform");var D=E.serialize();document.fire(SharePanelController.EVENT.PROGRESS.ACTIVATE);document.fire(AutoShareController.EVENT.AUTOSHARE,{fromSharePanel:true,ajaxParams:D})},checkautomsgfocus:function(D){if(D.value=="Enter message here"){var E=$$(".automsg");for(var C=0;C<E.length;C++){E[C].removeClassName("asdefault");E[C].value=""}}},checkautomsgblur:function(D){var F=this.trim(D.value);if(F==""){var E=$$(".automsg");for(var C=0;C<E.length;C++){E[C].addClassName("asdefault");E[C].value="Enter message here"}}},trim:function(C){return C.replace(/^\s*/,"").replace(/\s*$/,"")}};var B={EVENT:{SHOW:"SharePanelController:show",CLOSE:"SharePanelController:close",INITFORMS:"SharePanelController:initforms",MIXIN:"SharePanelController:mixin",PRIVACYCHANGESUBMIT:"SharePanelController:privacychangesubmit",SHOWFACEBOOK:"SharePanelController:showfacebook",SHOWMYSPACE:"SharePanelController:showmyspace",SHOWTWITTER:"SharePanelController:showtwitter",TOGGLEEASYPANEL:"SharePanelController:toggleeasypanel",AUTOSHARE:"SharePanelController:autoshare",PROGRESS:{ACTIVATE:"SharePanelController:startprogress",DEACTIVATE:"SharePanelController:stopprogress"}},TYPE:{MOBILE:"SharePanelController:mobile",EMAIL:"SharePanelController:email",EASY:"SharePanelController:easy",LINKCODE:"SharePanelController:linkcode"}};Controller.create("SharePanelController",A,B,ShareBase)})();var SharePanelEasypostController;(function(){var A={baseSelector:"#sharePanelTabsBody_1",form:null,selectedClass:"easyPostSelected",facebookShareUrl:null,delayedConfigEvent:null,isGigyaInitialized:false,isAlbumShare:null,initialize:function(){Event.observe(document,SharePanelEasypostController.EVENT.APPLY_CONFIG,this.handleApplyConfig.bindAsEventListener(this));Event.observe(document,SharePanelEasypostController.EVENT.DELAYED_APPLY_CONFIG,this.handleDelayedApplyConfig.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.INITFORMS,this.handleInitForm.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.MIXIN,this.handleMixIn.bindAsEventListener(this));Event.observe(document,SharePanelEasypostController.EVENT.EMBEDUPDATE,this.handleEmbedUpdate.bindAsEventListener(this));Event.observe(document,SharePanelEasypostController.EVENT.PREVIEWALBUMEMBED,this.handlePreviewAlbumEmbed.bindAsEventListener(this))},handleMixIn:function(C){var D=C.memo;for(var E in D){this[E]=D[E]}},handleInitForm:function(C){var D=C.memo;this.isAlbumShare=D.isAlbumShare;this.mediaData=D.data;if(D.isAlbumShare){this.facebookShareUrl=this.mediaData.albumUrl}else{this.facebookShareUrl=this.mediaData.linkFullsize}if(this.delayedConfigEvent){this.handleApplyConfig(this.delayedConfigEvent);this.delayedConfigEvent=null}},handleDelayedApplyConfig:function(C){this.delayedConfigEvent=C},handleApplyConfig:function(L){var J=L.memo;var I=Element.down($("easyPostList"),"A."+this.selectedClass);if(I&&Element.hasClassName(I,this.selectedClass)){Element.removeClassName(I,this.selectedClass)}I=Element.down($("easyPostList"),"LI A."+J.type);if(!Element.hasClassName(I,this.selectedClass)){Element.addClassName(I,this.selectedClass)}Element.update($("easyPostTarget"),"2. Automatically post to "+I.innerHTML+":");var F={defaultContent:"embedCode",UIConfig:'<config><display showPost="true" showBookmark="false" showEmail="false" networksToShow="'+J.type+'"></display><body><background frame-thickness="0"></background><controls><buttons frame-color="#2067a5" gradient-color-begin="#81acd6" gradient-color-end="#165dab" color="#ffffff" corner-roundness="0;0;0;0" size="14" bold="true"></buttons></controls></body></config>'};switch(J.type){case"facebook":document.fire(SharePanelController.EVENT.SHOWFACEBOOK,{url:this.facebookShareUrl});Element.update("divWildfirePost","If you don't see a window open, <a href=\"http://www.facebook.com/sharer.php?u="+this.facebookShareUrl+'" target="_blank">click here to share on Facebok</a><br /><br />Want an easy way to show off your album on Facebook?<br />Check out the <a href="http://apps.facebook.com/pbphotos" target="_blank">My Photobucket</a> Facebook app!');break;case"friendster":F.friendsterSections="media";this.applyConfig(F);break;case"twitter":var D=escape(this.mediaData.previewThumb);var G=this.mediaData.previewThumb.replace("th_","");var C="http://twitgoo.com/-share/?upload_url="+G+"&thumb_url="+D;if(this.isAlbumShare){var E=escape(this.mediaData.encodedUrl);C+="&tweet-text="+E}window.open(C,"twittersharer","toolbar=yes,resizable=yes,scrollbars=yes,width=800,height=650");Element.update("divWildfirePost","If you don't see a window open, <a href=\""+C+'" target="_blank">click here to share on Twitgoo</a>!');break;default:this.applyConfig(F);break}var H=(this.isAlbumShare)?"album":"file";var K="share_"+H+"_easy_post_"+J.type+"_click";tr(K)},applyConfig:function(C){if(!this.isGigyaInitialized){Wildfire.initPost("386361","divWildfirePost",450,100,C);this.isGigyaInitialized=true}else{Wildfire.divWildfirePost.applyConfig(C)}}};var B={EVENT:{APPLY_CONFIG:"SharePanelEasypostController:applyconfig",DELAYED_APPLY_CONFIG:"SharePanelEasypostController:delayedapplyconfig",EMBEDUPDATE:"SharePanelEasypostController:embedUpdate",PREVIEWALBUMEMBED:"SharePanelEasypostController:previewAlbumEmbed"}};Controller.create("SharePanelEasypostController",A,B,ShareBase)})();var ShareEmailPanelController;(function(){var publicMembers={baseSelector:"#sharePanelTabsBody_2",albumUrl:null,currentAlbumView:null,form:null,eltToField:null,eltContactsTable:null,eltSelectAllCheck:null,listCheckBoxes:null,listTRs:null,eltSelectAllCheck:null,autoCompleteCtrler:null,contactsLoaded:false,JSONcontacts:null,toPromptText:"separate email addresses by commas.",sendEmailButton:null,fields:new Array("Please enter an email address.","shareToContacts","Please enter a subject","subject","Please enter a message","message"),clickTrackString:null,initialize:function(){Event.observe(document,SharePanelController.EVENT.INITFORMS,this.handleInitForms.bindAsEventListener(this));Event.observe(document,PBLightbox.EVENT.DEACTIVATED,this.clearAutoCompleter.bindAsEventListener(this));Event.observe(document,ShareEmailPanelController.EVENT.LINKVIEWUPDATE,this.handleLinkViewUpdate.bindAsEventListener(this));Event.observe(document,ShareEmailPanelController.EVENT.PREVIEWLINKVIEW,this.handlePreviewLinkView.bindAsEventListener(this));Event.observe(document,ShareEmailPanelController.EVENT.RELOADCONTACTS,this.reloadContacts.bindAsEventListener(this))},handleInitForms:function(evt){var memo=evt.memo;this.mediaData=memo.data;for(var n in memo){this[n]=memo[n]}if(this.mediaData.albumUrl){this.albumUrl=this.mediaData.albumUrl}if(this.mediaData.albumView){this.currentAlbumView=this.mediaData.albumView}if(this.isAlbumShare){this.clickTrackString="share_album_email_send_click"}else{this.clickTrackString="share_file_email_send_click"}this.handleInitEmailPanel()},handleInitEmailPanel:function(){this.autoCompleteCtrler=AutoCompleteEmailController.getInstance();this.autoCompleteCtrler.mixIn({fieldToLoad:$("shareToContacts"),suggestions:$("suggestionsContacts")});if(!this.contactsLoaded&&this.isLoggedIn){this.contactsLoaded=true;this.getContacts()}if(this.isLoggedIn){this.autoCompleteCtrler.loadArrayData(this.JSONcontacts)}if(this.mediaType=="set"){var selectedMediaElts=$$(".selectedMedia");var cnt=0;for(var i=0;i<selectedMediaElts.length;i++){if(selectedMediaElts[i].checked){cnt++}}var name=this.mediaData.name;$("subject").value=(cnt==1)?name+" wants to share a new upload":name+" wants to share new uploads";$("message").value=(cnt==1)?"Check out my new upload!":"Check out my new uploads!";$("directlinkemail").hide()}else{var type=(this.mediaType=="adobeexpress")?"remix":this.mediaType;var name=this.mediaData.name;var a=(type=="image"||type=="album")?"an":"a";$("subject").value=name+" wants to share "+a+" "+type;$("message").value="Check out this "+type+" on Photobucket!"}if(this.isAlbumShare&&!this.isAlbumPublic&&this.hasGuestPassword){$("privatepw").style.display="block"}this.sendEmailButton=$("sendemail");Event.observe(this.sendEmailButton,"click",this.handleSendEmail.bindAsEventListener(this));this.eltToField=$("shareToContacts");var contactEls=$$(".onclick_contact_activate");contactEls.each(function(n){Event.observe(n,"click",this.handleContactsClick.bindAsEventListener(this))}.bind(this));Event.observe(document,ContactController.EVENT.ACTIVATED,this.handleContactActivated.bindAsEventListener(this));return },handleSendEmail:function(evt){tr(this.clickTrackString);var validated=this.validateEmailFields();if(validated){var params="";if(this.isAlbumShare){var shareType="album";var mediaUrl=this.data.albumFullUrl;params+="viewchoice="+this.currentAlbumView+"&"}else{if(this.isSetShare){var shareType="set";var mediaUrl=this.data.mediaUrl;var mediaCnt=$("mediaCount");var setId=$("setId");var selectedMediaElts=$$(".selectedMedia");var selectedMedia="";var selectedCnt=0;for(var i=0;i<selectedMediaElts.length;i++){if(selectedMediaElts[i].checked){selectedCnt++;selectedMedia+="&selectedMedia[]="+selectedMediaElts[i].value}}if(selectedCnt==0){this.fireErrorMessage("Please select an image or video to share.");return }if((setId.value!="")&&(mediaCnt.value==selectedCnt)){params+="useexisting=1&setId="+setId.value+"&"}else{params+=selectedMedia+"&"}tr("post_upload_share_email_submit")}else{var shareType="media";var mediaUrl=this.data.mediaUrl}}var shareForm=$("shareEmailForm");var xhr=Form.serializeElements([shareForm.ts,shareForm.sig,shareForm.recaptcha_challenge_field,shareForm.recaptcha_response_field]);params+="sharetype="+shareType+"&mediaUrl="+mediaUrl+"&"+xhr+"&";var fields=this.fields;for(var i=1;i<fields.length;i+=2){var obj=$(fields[i]);params+=fields[i]+"="+escape(obj.value)+"&"}new Ajax.Request("/share/email/",{method:"POST",parameters:params,onSuccess:this.successEmailSend.bindAsEventListener(this),onFailure:this.failedEmailSend.bindAsEventListener(this)})}},validateEmailFields:function(){var validated=true;var fields=this.fields;for(var i=1;i<fields.length;i+=2){var obj=$(fields[i]);if(obj.value==""||obj.value==this.toPromptText){this.fireErrorMessage(fields[i-1]);validated=false;obj.focus();break}}return validated},successEmailSend:function(resp){var json=eval("("+resp.responseText+")");if(json.response.stat=="ok"){var m=json.response.message;document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:m.title,details:m.details,type:PBMessage.MESSAGE_TYPE.SUCCESS})});this.resetEmailForm();if(json.response.contactWasAdded){this.reloadContacts()}}else{var m=json.response.message;document.fire(PBLightbox.PBMessage.EVENT.NOTIFY,{message:new PBMessage({title:m.title,details:m.details,type:PBMessage.MESSAGE_TYPE.ERROR})})}Recaptcha.reload()},failedEmailSend:function(resp){this.fireErrorMessage("There was a problem sending your email.  Please try again later.")},resetEmailForm:function(){Element.removeClassName(this.eltToField,"to");Element.addClassName(this.eltToField,"toDefault");this.eltToField.value=this.toPromptText;this.clearAutoCompleter();this.autoCompleteCtrler.resetFoundList()},getContacts:function(){var contactsUrl="/sendcontacts";var cacheBuster=Math.floor(Math.random()*10001);var params="cb="+cacheBuster;new Ajax.Request(contactsUrl,{asynchronous:false,method:"GET",parameters:params,onSuccess:this.handleGetContactsSuccess.bind(this),onFailure:this.handleGetContactsFailure.bind(this)})},handleGetContactsSuccess:function(resp){var responseText=resp.responseText;var json=eval("("+responseText+")");if(json.response.stat=="ok"){this.JSONcontacts="";this.JSONcontacts=json.response.contactsAutoComplete}},handleGetContactsFailure:function(resp){this.fireErrorMessage("There was a problem retrieving your contact list.  Please try again later.")},reloadContacts:function(){if(this.autoCompleteCtrler){this.getContacts();this.autoCompleteCtrler.loadArrayData(this.JSONcontacts)}},clearAutoCompleter:function(){if(this.autoCompleteCtrler){this.autoCompleteCtrler.lastVersionOfString=""}},handleContactsClick:function(evnt){document.fire(ContactController.EVENT.ACTIVATE,{initialHeight:510,config:{backCtrl:true,backCtrlText:"Back to share",selectOn:true}})},handleContactActivated:function(evt){Event.observe(document,ContactController.EVENT.ONBACK,this.handleContactOnBack.bindAsEventListener(this));Event.observe(document,ContactController.EVENT.ONCANCEL,this.handleContactOnCancel.bindAsEventListener(this));this.toggleCloseBox("hide")},handleContactOnBack:function(evt){var contactString="";evt.memo.selectedContacts.each(function(c){var fn=c.value.name;fn=fn.replace(/&amp;/i,"&");fn=fn.replace(/&quot;/i,"'");contactString+='"'+fn+'" '+c.value.email+", "}.bind(this));if(!contactString.empty()){this.eltToField.removeClassName("toDefault");this.eltToField.addClassName("to");if(!this.eltToField.value.empty()&&this.eltToField.value!=this.toPromptText){this.eltToField.value+=contactString}else{this.eltToField.value=contactString}this.autoCompleteCtrler.lastVersionOfString=this.eltToField.value;this.eltToField.focus();var end=this.eltToField.value.length;if(this.eltToField.setSelectionRange){this.eltToField.setSelectionRange(end,end)}else{if(this.eltToField.createTextRange){var range=this.eltToField.createTextRange();range.collapse(true);range.moveEnd("character",end);range.moveStart("character",end);range.select()}}}this.reloadContacts();this.toggleCloseBox("show");Event.stopObserving(document,ContactController.EVENT.ONBACK);Event.stopObserving(document,ContactController.EVENT.ONCANCEL)},handleContactOnCancel:function(evt){this.reloadContacts();this.toggleCloseBox("show");Event.stopObserving(document,ContactController.EVENT.ONBACK);Event.stopObserving(document,ContactController.EVENT.ONCANCEL)},toggleCloseBox:function(mode){var closeBox=$$("a.onclick_deactivate_lightbox");if(closeBox[0]){if(mode=="show"){closeBox[0].show()}else{closeBox[0].hide()}}return }};var staticMembers={EVENT:{LINKVIEWUPDATE:"ShareEmailPanelController:linkViewUpdate",PREVIEWLINKVIEW:"ShareEmailPanelController:previewLinkView",EMBEDUPDATE:"ShareEmailPanelController:embedUpdate",PREVIEWALBUMEMBED:"ShareEmailPanelController:previewAlbumEmbed",RELOADCONTACTS:"ShareEmailPanelController:reloadcontacts"}};Controller.create("ShareEmailPanelController",publicMembers,staticMembers,ShareBase)})();var SharePanelLinksController;(function(){var A={baseSelector:"#sharePanelTabsBody_3",currentAlbumView:null,initialize:function(){Event.observe(document,SharePanelController.EVENT.MIXIN,this.handleMixIn.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.INITFORMS,this.handleInitForms.bindAsEventListener(this));Event.observe(document,SharePanelLinksController.EVENT.LINKVIEWUPDATE,this.handleLinkViewUpdate.bindAsEventListener(this));Event.observe(document,SharePanelLinksController.EVENT.PREVIEWLINKVIEW,this.handlePreviewLinkView.bindAsEventListener(this));Event.observe(document,SharePanelLinksController.EVENT.EMBEDUPDATE,this.handleEmbedUpdate.bindAsEventListener(this));Event.observe(document,SharePanelLinksController.EVENT.PREVIEWALBUMEMBED,this.handlePreviewAlbumEmbed.bindAsEventListener(this))},handleMixIn:function(C){var D=C.memo;for(var E in D){this[E]=D[E]}},handleInitForms:function(C){var D=C.memo;this.mediaData=D.data;if(this.mediaData.albumView){this.currentAlbumView=this.mediaData.albumView}}};var B={EVENT:{LINKVIEWUPDATE:"SharePanelLinksController:linkViewUpdate",PREVIEWLINKVIEW:"SharePanelLinksController:previewLinkView",EMBEDUPDATE:"SharePanelLinksController:embedUpdate",PREVIEWALBUMEMBED:"SharePanelLinksController:previewAlbumEmbed"}};Controller.create("SharePanelLinksController",A,B,ShareBase)})();var SharePanelMobileController;(function(){var A={idPrefix:"sendToMobileForm",baseIframeSrc:"http://sendtomobile.photobucket.com/?",thwaprIframeSrc:"http://www.thwapr.com/ipb.aspx?",thwaprMemo:false,initialize:function(){Event.observe(document,SharePanelController.EVENT.INITFORMS,this.handleInitForm.bindAsEventListener(this));Event.observe(document,SharePanelController.EVENT.MIXIN,this.handleMixIn.bindAsEventListener(this))},handleMixIn:function(C){var D=C.memo;for(var E in D){this[E]=D[E]}},handleInitForm:function(C){var D=C.memo;var H=$("shareMobileFrame");var E=(this.thwaprMemo.useThwapr)?this.thwaprIframeSrc:this.baseIframeSrc;E+="thumb="+encodeURIComponent(D.data.previewThumb);E+="&img="+encodeURIComponent(D.data.mediaUrl);if(this.thwaprMemo.useThwapr){if(D.data.mediatitle!=""){E+="&title="+escape(D.data.mediatitle)}var F=document.domain;E+="&PBPROXY="+F;PB.Controller.XdCom.getInstance().open();Event.observe(document,PB.Util.XdComReceiver.event.onMessage,this.onMessage.bindAsEventListener(this));if(this.thwaprMemo.shareasseturl){var G='<div id="thwaprSplash"><a href="javascript:void(0);" onclick="document.fire(SharePanelMobileController.EVENT.TOGGLETHWAPR);">';G+='<img src="'+unescape(this.thwaprMemo.shareasseturl)+'" style="width: 500px;" /></a></div>';Element.insert(H,{before:G});H.hide();Event.observe(document,SharePanelMobileController.EVENT.TOGGLETHWAPR,this.toggleThwapr.bindAsEventListener(this))}}H.src=E},onMessage:function(C){var D=C.memo;switch(D){case"close":document.fire(SharePanelController.EVENT.CLOSE);break}},toggleThwapr:function(C){$("thwaprSplash").hide();$("shareMobileFrame").show()}};var B={EVENT:{TOGGLETHWAPR:"SharePanelMobileController:toggleThwapr"}};Controller.create("SharePanelMobileController",A,B,ShareBase)})();(function(){var A={initialize:function(E,C){var D=/^(?:(?:(top|parent|frames\[(?:(?:['"][a-zA-Z\d-_]*['"])|\d+)\]))(?:\.|$))+/;if(D.test(E)){this.address=E}else{throw new Error("Invalid Message Target")}if(Object.isString(C)){this.memo=C}else{this.memo=C.toQueryString()}this.type=PB.Util.XdComMessage.type},toQueryString:function(){var C={address:this.address,memo:this.memo};return Object.toQueryString(C)}};var B={type:"XdComMessage"};Object.extend(PB.Util,{XdComMessage:Object.extend(Class.create(A),B)})})();(function(){var publicMembers={initialize:function(){},send:function(message){if(message.address&&message.memo){try{if(message.type!=PB.Util.XdComMessage.type){message=new PB.Util.XdComMessage(message.address,message.memo)}var target=eval(message.address);target.document.title=message.memo}catch(e){throw new Error("XdComMessage.address not found")}}else{throw new Error("Invalid Message")}}};var staticMembers={};Object.extend(PB.Util,{XdComSender:Object.extend(Class.create(publicMembers),staticMembers)})})();(function(){var A={initialize:function(){this.delay=100;this.timerId=-1;this.oTitle=document.title;this.dispatcher=this.dispatch.bind(this)},start:function(){if(this.timerId==-1){this.timerId=window.setInterval(this.dispatcher,this.delay)}},stop:function(){if(this.timerId!=-1){window.clearInterval(this.timerId);this.timerId=-1}},getMessage:function(){var C=null;if(document.title!=this.oTitle){C=document.title;document.title=this.oTitle}return C},dispatch:function(){var C=this.getMessage();if(C){document.fire(PB.Util.XdComReceiver.event.onMessage,C)}}};var B={event:{onMessage:"PB:XdComReceiverOnMessage"}};Object.extend(PB.Util,{XdComReceiver:Object.extend(Class.create(A),B)})})();(function(){var A={initialize:function(){this.sender=new PB.Util.XdComSender();this.receiver=new PB.Util.XdComReceiver()},open:function(){this.receiver.start()},close:function(){this.receiver.stop()},send:function(C){this.sender.send(C)}};var B={};Controller.create("XdCom",A,B)})();var PBLightbox;(function(){var A={panel:null,initialize:function(){var D;var C={active:false,contentUrl:null,ajaxOptions:null,onComplete:null,content:null,lightbox:null,lightboxId:"lightbox",messagePanelId:"lightboxMessagePanel",overlay:null,overlayId:"overlay",contentId:"lightboxcontent",contentClassName:"content",containerClassName:"container",closeClassName:"icon close",deactivateSelector:"onclick_deactivate_lightbox",initialHeight:null,defaultInitialHeight:350,hiddenIds:null,showCloseX:null,defaultShowCloseX:true,defaultClassXhref:"javascript:void(0)",cache:null,defaultCache:true,defaultHiddenIds:[],progress:null,draggable:null,draggableDefault:false,draggableObj:null,contentCache:new Hash(),wizard:null,defaultWizard:false,wizardStack:new Array(),initialize:function($super){$super(this.overlayId);this.ajaxOptions={method:"post",asynchronous:true,evalScripts:true,onComplete:this.handleComplete.bindAsEventListener(this),onFailure:this.handleFailure.bindAsEventListener(this),onException:this.handleException.bindAsEventListener(this)};this.lightbox=$(this.lightboxId);this.overlay=$(this.overlayId);try{controllerMessagePanel.createMessagePanel(this.lightboxId)}catch(E){}Event.observe(document,PBLightbox.EVENT.ACTIVATE,this.activate.bindAsEventListener(this));Event.observe(document,PBLightbox.EVENT.DEACTIVATE,this.deactivate.bindAsEventListener(this));Event.observe(document,PBLightbox.EVENT.BACK,this.back.bindAsEventListener(this));Event.observe(document,PBLightbox.PBProgress.EVENT.ACTIVATE,this.showProgress.bindAsEventListener(this));Event.observe(document,PBLightbox.PBProgress.EVENT.DEACTIVATE,this.hideProgress.bindAsEventListener(this));if($(this.messagePanelId)){Event.observe(document,PBLightbox.PBMessage.EVENT.NOTIFY,this.showMessage.bindAsEventListener(this));Event.observe(document,PBLightbox.PBMessage.EVENT.CLOSE,this.clearMessage.bindAsEventListener(this))}},activate:function(F){if(F&&F.memo){this.content=F.memo.content;this.contentUrl=F.memo.contentUrl;if(typeof (F.memo.wizard)==="boolean"){this.wizard=F.memo.wizard}else{this.wizard=this.defaultWizard}if(typeof (F.memo.onComplete)==="function"){this.onComplete=F.memo.onComplete}else{this.onComplete=null}if(F.memo.parameters){this.ajaxOptions.parameters=F.memo.parameters}else{this.ajaxOptions.parameters=null}if(F.memo.transparent){this.overlay.addClassName("transparent");this.makeTransparent()}else{this.overlay.removeClassName("transparent");this.makeOpaque()}if(F.memo.initialHeight){this.initialHeight=F.memo.initialHeight}else{this.initialHeight=this.defaultInitialHeight}if(F.memo.hiddenIds){this.hiddenIds=F.memo.hiddenIds}else{if(!this.wizard){this.hiddenIds=this.defaultHiddenIds}}if(typeof (F.memo.showCloseX)==="boolean"){this.showCloseX=F.memo.showCloseX}else{this.showCloseX=this.defaultShowCloseX}if(F.memo.closeXhref){this.closeXhref=F.memo.closeXhref}else{this.closeXhref=this.defaultClassXhref}if(typeof (F.memo.cache)==="boolean"){this.cache=F.memo.cache}else{this.cache=this.defaultCache}if(typeof (F.memo.draggable)==="boolean"){this.draggable=F.memo.draggable}else{this.draggable=this.draggableDefault}var G=photobucket.ui.getPageScroll();var E=photobucket.ui.getPageSize();this.setHeight(E.pageHeight);if(!F.memo.top){if(!photobucket.browser.isIE6){this.setTop(Math.ceil(E.windowHeight/15))}else{this.setTop(Math.ceil(G.yScroll+(E.windowHeight/15)))}}else{this.setTop(F.memo.top)}if(F.memo.left){this.setLeft(F.memo.left)}if(!this.active){this.setLightboxHeight(this.initialHeight)}this.setLightboxDisplay("block");if(this.contentUrl){this.showProgress()}this.populateLightbox();this.checkLightboxHeight();return true}else{return false}},back:function(E){if(this.active&&this.wizardStack.length>0){this.hideProgress();this.moveMessagePanel(document.body);var G=this.lightbox.firstDescendant();var F=this.lightbox.select("#"+this.wizardStack.pop())[0];G.hide();F.show();if(typeof (E.memo.onBack)==="function"){E.memo.onBack(E)}G.remove();this.assignContentId(F);this.moveMessagePanel(this.contentId)}},deactivate:function(E){this.clearLightbox();this.clearMessage();this.setLightboxDisplay("none");if(this.draggableObj){this.draggableObj.destroy()}this.showAds(this.hiddenIds);document.fire(PBLightbox.EVENT.DEACTIVATED);this.active=false;return true},showMessage:function(E){if(E&&E.memo){if(E.memo.parentId){this.moveMessagePanel(E.memo.parentId)}E.memo.id=this.messagePanelId;document.fire(PBMessage.EVENT.NOTIFY,E.memo);return true}else{return false}},clearMessage:function(E){var F={};if(E&&E.memo){F=E.memo}F.id=this.messagePanelId;document.fire(PBMessage.EVENT.CLOSE,F);return true},showProgress:function(E){if(!this.active&&this.contentUrl&&!$(this.contentId)){var G="<div class='"+this.containerClassName+"'><div id='"+this.contentId+"' class='"+this.contentClassName+"' style='height:"+this.initialHeight+"px'></div></div>";this.lightbox.update(G)}var F={};if(E&&E.memo){F=E.memo}F.parentId=this.contentId;this.progress=new PBProgress(F);document.fire(PBProgress.EVENT.ACTIVATE,this.progress);return true},hideProgress:function(E){if(this.progress){document.fire(PBProgress.EVENT.DEACTIVATE,this.progress);this.progress=null;return true}else{return false}},setHeight:function($super,E){this.overlay.style.height=E+"px";$super(E)},setLightboxHeight:function(E){if($(this.contentId)){$(this.contentId).style.height=E+"px"}},setTop:function(E){if(typeof E==="number"){this.lightbox.style.top=E+"px"}else{this.lightbox.style.top=E}},setLeft:function(E){if(typeof E==="number"){this.lightbox.style.left=E+"px"}else{this.lightbox.style.left=E}},setLightboxDisplay:function(E){this.overlay.style.display=E;this.lightbox.style.display=E},checkLightboxHeight:function(){var E="tall";if(this.lightbox.visible()&&this.lightbox.getHeight()>document.viewport.getHeight()){this.lightbox.addClassName(E);this.setTop(document.viewport.getScrollOffsets().top)}else{if(this.lightbox.hasClassName(E)){this.lightbox.removeClassName(E)}}},hideAds:function(E){if(E){E.each(function(F){if($(F)){var G=$(F).select("iframe");G.each(function(H){H.setStyle({visibility:"hidden"})})}})}},showAds:function(E){if(E){E.each(function(F){if($(F)){var G=$(F).select("iframe");G.each(function(H){H.setStyle({visibility:"visible"})})}})}},moveMessagePanel:function(E){document.fire(PBLightbox.PBMessage.EVENT.CLOSE);var F=$(this.messagePanelId);if(F&&$(E)){Element.insert($(E),{top:F.remove()})}},attachDeactivateListeners:function(){var E=Element.select(this.lightbox,"."+this.deactivateSelector);E.each(function(F){Event.observe(F,"click",this.deactivate.bindAsEventListener(this))}.bind(this))},populateLightbox:function(){this.hideAds(this.hiddenIds);if(this.content){if($(this.content)){if(this.active&&this.wizard){this.wizardPush($(this.content).innerHTML)}else{this.lightbox.update($(this.content).innerHTML);this.wizardStack.clear()}this.postLoad();return }else{this.deactivate();if(typeof console!=="undefined"){console.error("Id, '"+this.content+"', does not exist on page.")}}}if(this.contentUrl){var E=this.contentCache.keys().indexOf(this.contentUrl)>=0;if(E&&this.cache){if(this.active&&this.wizard){this.wizardPush(this.contentCache.get(this.contentUrl))}else{this.lightbox.update(this.contentCache.get(this.contentUrl));this.wizardStack.clear()}this.postLoad();return }else{if(this.contentUrl.indexOf("jsoncallback")>0){jquery.getJSON(this.contentUrl,this.ajaxOptions.parameters,this.handleGetJson.bind(this))}else{new Ajax.Request(this.contentUrl,this.ajaxOptions)}return }}else{this.postLoad();return }},handleGetJson:function(E){this.lightbox.update(E.html);this.postLoad()},wizardPush:function(E){this.hideProgress();this.moveMessagePanel(document.body);var F=this.lightbox.firstDescendant();F.hide();var G="wizardPanel"+this.wizardStack.length;F.id=G;this.wizardStack.push(G);var H=this.lightbox.select(".content, .lbContent")[0];H.id=G+"_content";Element.insert(this.lightbox,{top:E})},clearLightbox:function(){this.moveMessagePanel(document.body);this.lightbox.update("")},assignContentId:function(E){var F;if(E){F=E.select(".content, .lbContent")[0]}else{F=$$("#"+this.lightboxId+" .content, #"+this.lightboxId+" .lbContent")[0]}if(F&&F.id!=this.contentId){F.id=this.contentId}},postLoad:function(){this.active=true;var F=this.lightbox.down("."+this.containerClassName);if(F&&this.showCloseX){if(this.closeXhref){var G="<a href='"+this.closeXhref+"' title='close' class='"+this.closeClassName+" "+this.deactivateSelector+"'></a>"}else{var G="<a href='javascript:void(0)' title='close' class='"+this.closeClassName+" "+this.deactivateSelector+"'></a>"}F.insert({top:G})}this.attachDeactivateListeners();this.assignContentId();this.moveMessagePanel(this.contentId);if(this.draggable){this.lightbox.addClassName("draggableLB");var E={snap:function(H,K){var J=Math.min(Math.max(H,0),(document.viewport.getWidth()-this.lightbox.getWidth()));var I=Math.min(Math.max(K,0),(document.viewport.getHeight()-this.lightbox.getHeight()));return[J,I]}.bind(this),starteffect:null,endeffect:null,reverteffect:null};handles=this.lightbox.select(".handle");if(handles.length>0){E.handle="handle";this.lightbox.removeClassName("handle")}else{this.lightbox.addClassName("handle")}this.draggableObj=new Draggable(this.lightboxId,E)}else{this.lightbox.removeClassName("draggableLB");this.lightbox.removeClassName("handle");this.setLeft("0px");if(this.draggableObj){this.draggableObj.destroy()}}this.runComplete();this.hideProgress()},handleComplete:function(E){if(E.request.success()){if(this.active&&this.wizard){this.wizardPush(E.responseText)}else{this.lightbox.update(E.responseText);this.wizardStack.clear()}if(E&&!this.contentCache.get(E.request.url)&&this.cache){this.contentCache.set(E.request.url,E.responseText)}this.postLoad()}},handleFailure:function(E){if(typeof console!=="undefined"){console.error("Response failure: "+E.status+": "+E.statusText)}this.deactivate();return false},handleException:function(E){if(typeof console!=="undefined"){if(!E.isSameOrigin()){console.error("Exception: Ajax request is not to same origin domain.")}else{console.error("Exception during Ajax request.")}console.dir(E)}this.deactivate();return false},runComplete:function(){if(this.onComplete){try{this.onComplete()}catch(E){if(typeof console!=="undefined"){console.error("Exception executing onComplete.");console.dir(E)}this.deactivate()}}}};D=Class.create(PBLayeredPanel,C);this.panel=new D()}};var B={EVENT:{ACTIVATE:"PBLightbox:Activate",BACK:"PBLightbox:Back",DEACTIVATE:"PBLightbox:Deactivate",DEACTIVATED:"PBLightbox:Deactivated"},PBMessage:{EVENT:{NOTIFY:"PBLightbox:PBMessage:Notify",CLOSE:"PBLightbox:PBMessage:Close"}},PBProgress:{EVENT:{ACTIVATE:"PBLightbox:PBProgress:Activate",DEACTIVATE:"PBLightbox:PBProgres:Deactivate"}}};Controller.create("PBLightbox",A,B)})();