if(typeof(SAPO)=="undefined"||!SAPO){throw"SAPO Not Loaded!"}var s$css=false;SAPO.Pond={sourcesAdded:false,locks:{},errorAddingSources:0,periodicTasks:false,periodicTasksInterval:false,periodicTasksTime:60000,timelineLastIndex:9,timelineLastEventId:0,timelineInterval:false,timelineRefreshRate:60000,messageShowTime:2000,messageAnimTime:0.5,discoverSourcesTimeout:2000,keyboardLockTimeout:4000,cookieDuration:1296000,notificationsInterval:false,checkNewEventsUrl:false,allFiltersSelection:false,urlParser:/http(s:|:)\/\/(.*?) /g,shortenUrls:{},enableAutoShorten:false,pondRequestToken:false,pondTokenItems:[],buttonsCheckNewEvents:[],lastEventsReceived:false,olderButton:false,uploadFileToken:false,initialFormAction:false,uploader:false,loaderInterval:false,uploadForm:false,sourcesButtonsBehaviourAdded:false,tabIndex:19,kbdShortcuts:true,selectedNode:false,mouseLockTimeout:false,usernameTimeout:false,usernameCheck:true,passwordMaxSize:255,passwordMinSize:6,goToTop:false,recursionLevel:0,activeFilters:{unread:false,favorites:false},entityAccountCache:{},showEntityInfo:false,openPublishTimeout:false,closePublishTimeout:false,statusTextHasFocus:false};SAPO.Pond.getTabIndex=function(){SAPO.Pond.tabIndex=SAPO.Pond.tabIndex+1;return SAPO.Pond.tabIndex};SAPO.Pond.onUnloadEvent=function(a){a.stop();a.returnValue="";return a.returnValue};SAPO.Pond.setUnloadLock=function(){SAPO.Pond.setLock("unload");Event.observe(window,"beforeunload",SAPO.Pond.onUnloadEvent)};SAPO.Pond.removeUnloadLock=function(){SAPO.Pond.unsetLock("unload");Event.stopObserving(window,"beforeunload",SAPO.Pond.onUnloadEvent)};SAPO.Pond.setLock=function(a){SAPO.Pond.locks[a]=true};SAPO.Pond.unsetLock=function(a){SAPO.Pond.locks[a]=false};SAPO.Pond.getLock=function(a){if(typeof SAPO.Pond.locks[a]=="undefined"){return false}return SAPO.Pond.locks[a]};SAPO.Pond.getEntity=function(b){var a=SAPO.Pond.entityAccountCache;if(typeof a[b]!="undefined"){return a[b]}return false};SAPO.Pond.saveEntity=function(c,b){var a=SAPO.Pond.entityAccountCache;if(typeof a[c]=="undefined"){a[c]=b}};SAPO.Pond.checkEmpty=function(a,b){if(a.value===""){SAPO.Pond.showError(SAPO.Pond.messages[b]);return true}return false};SAPO.Pond.genericOnFailure=function(a){if(a.status<600&&a.status>=400){SAPO.Pond.showError(a.statusText)}};SAPO.Pond.showDropdownPopup=function(a,b){if(SAPO.Pond.getLock("dropdown")){return false}SAPO.Pond.setLock("dropdown");var c=s$("userMessages");if(c!==null){c.style.visibility="hidden";c.style.height="90px";s$("userMessageContent").innerHTML=a;if(typeof b!="undefined"){c.className=b}Effect.SlideDown("userMessages",{duration:SAPO.Pond.messageAnimTime});c.style.visibility="visible";SAPO.Pond.setCloseOnEsc(true);setTimeout(SAPO.Pond.autoHideMessage,SAPO.Pond.messageShowTime)}else{SAPO.Pond.unsetLock("dropdown")}};SAPO.Pond.showMessage=function(a){SAPO.Pond.showDropdownPopup(a,"info")};SAPO.Pond.showError=function(a){SAPO.Pond.showDropdownPopup(a,"error")};SAPO.Pond.autoHideMessage=function(){if(SAPO.Pond.getLock("dropdown")){Effect.SlideUp("userMessages",{duration:SAPO.Pond.messageAnimTime});SAPO.Pond.unsetLock("dropdown")}};SAPO.Pond.setFormToken=function(a){SAPO.Pond.updateRequestToken(a);SAPO.Utility.Cookie.set("SAPOPondFormToken",a)};SAPO.Pond.getFormToken=function(){var a=SAPO.Utility.Cookie.get();return a.SAPOPondFormToken};SAPO.Pond.updateRequestToken=function(b){for(var a=0,c=SAPO.Pond.pondTokenItems.length;a<c;a++){SAPO.Pond.pondTokenItems[a].value=b}};SAPO.Pond.ajaxRequest=function(a,e){if(SAPO.Pond.getLock("ajax"+a)){return false}SAPO.Pond.setLock("ajax"+a);var b=e;var d=false,f=false;var c=s$("loadingMessage");if(typeof b.onFailure=="undefined"){b.onFailure=SAPO.Pond.genericOnFailure}if(typeof(b.parameters)=="undefined"){b.parameters={}}b.parameters.FormToken=SAPO.Pond.getFormToken();if(typeof b.setLoading!="undefined"&&b.setLoading===true){if(typeof(b.onLoading!="undefined")){f=b.onLoading}b.onLoading=function(g){s$css.removeClassName(c,"hidden");f(g)}}if(typeof(b.onSuccess!="undefined")){d=b.onSuccess}b.onSuccess=function(g){if(!s$css.hasClassName(c,"hidden")){s$css.addClassName(c,"hidden")}if(typeof d=="function"){d(g)}};b.onComplete=function(g){if(g.status===400||g.status===401){document.location=document.location}var h=g.getResponseHeader("POND-FormToken");if(h){SAPO.Pond.setFormToken(h)}SAPO.Pond.unsetLock("ajax"+a)};return new Ajax.Request(a,b)};SAPO.Pond.makeLoader=function(b){var a=document.createElement("img");a.src="/img/loader.gif";a.alt="loading";a.id=b;a.className="hidden";return a};SAPO.Pond.isElement=function(b,a){if(b.nodeType===Node.ELEMENT_NODE){if(b.tagName.toLowerCase()==a){return true}}return false};SAPO.Pond.selectTag=function(e,a,c){var b,d;if(typeof c!="undefined"){c=[]}else{c=false}d=e.length;for(b=0;b<d;b++){if(SAPO.Pond.isElement(e[b],a)){if(!c){return e[b]}c.push(e[b])}}return c};SAPO.Pond.showAddFriendButton=function(c,g,a,f){var d,e;var b=c.getElementsByTagName("input");for(d=0,e=b.length;d<e;d++){if(b[d].type=="checkbox"&&b[d].checked===true){s$css.removeClassName(g,"hidden");s$css.addClassName(a,"hidden");break}s$css.removeClassName(a,"hidden");s$css.addClassName(g,"hidden")}};SAPO.Pond.discoverSources=function(a,b,d){if(!SAPO.Utility.Validator.url(b)){SAPO.Pond.showMessage(SAPO.Pond.message("invalid_source_url"));return false}var c="/datasources?action=js_discover_sources&SourceURL="+encodeURIComponent(b);SAPO.Pond.ajaxRequest(c,{onFailure:function(e,g,h,f){if(SAPO.Pond.errorGettingSources<10){SAPO.Pond.errorGettingSources=0;e.parentNode.removeChild(e);SAPO.Pond.showError(f.statusText)}else{setTimeout(SAPO.Pond.discoverSources.bind(this,e,b,h),SAPO.Pond.discoverSourcesTimeout)}}.bind(this,a,b,d),onSuccess:function(q,f,g,h){var l=h.responseText;if(h.status===202){setTimeout(SAPO.Pond.discoverSources.bind(this,q,f,g),SAPO.Pond.discoverSourcesTimeout);return false}else{if(h.status===204){q.parentNode.removeChild(q);SAPO.Pond.showError(h.statusText);return false}}q.parentNode.removeChild(q);var p=document.getElementById("discoveredSources");var o,m,e,k;if(g=="add_friend"){o=s$("add_friend");m=SAPO.Pond.selectTag(o.childNodes,"input",true);k=m[0];m=m[1];e=SAPO.Pond.selectTag(o.childNodes,"span")}else{var j=Element.select(p.parentNode,'input[type="submit"]');k=j[0];m=j[1];e=p.parentNode.getElementsByTagName("span")[0]}if(l!==""&&p!==null){s$css.removeClassName(p,"hidden");p.innerHTML=l}SAPO.Pond.showAddFriendButton(p,m,e,k);if(!SAPO.Pond.sourcesButtonsBehaviourAdded){Event.observe(p,"click",SAPO.Pond.showAddFriendButton.bind(this,p,m,e,k));if(g==="add_friend"){Event.observe(m,"click",function(r){r.stop();this.form.action="/entities?action=add_sources";SAPO.Pond.sourcesAdded=true;this.form.submit()}.bindAsEventListener(m))}else{var n=/user/.test(document.location);Event.observe(m,"click",function(r,s){r.stop();if(s){this.form.action="/user?action=add_sources"}else{this.form.action="/entities?action=add_sources"}SAPO.Pond.sourcesAdded=true;this.form.submit()}.bindAsEventListener(m,n))}SAPO.Pond.sourcesButtonsBehaviourAdded=true}return true}.bind(this,a,b,d)})};SAPO.Pond.checkNewEvents=function(){var a=false;if(SAPO.Pond.getLock("CheckNewEvents")){return}if(SAPO.Pond.checkNewEventsUrl){a=SAPO.Pond.checkNewEventsUrl}else{a=Element.select(document,".timeline_newer")[0].href;SAPO.Pond.checkNewEventsUrl=a}SAPO.Pond.ajaxRequest(a,{onSuccess:function(c){if(c.status==205||c.status==206){if(c.status==205){clearInterval(SAPO.Pond.timelineInterval);SAPO.Pond.lastEventsReceived=false}else{if(c.request.url!=SAPO.Pond.checkNewEventsUrl){return}SAPO.Pond.lastEventsReceived=c.responseText.replace(/\n/g,"")}var d,g;var b=Element.select(document,".newevents");for(var e=0,f=b.length;e<f;e++){d=SAPO.Pond.selectTag(b[e].childNodes,"a");g=SAPO.Pond.selectTag(b[e].childNodes,"span");s$css.addClassName(g,"hidden");s$css.removeClassName(d,"hidden")}}}})};SAPO.Pond.insertNewEventsTimeline=function(c,f){var b=document.createElement("div");b.innerHTML=f;if(SAPO.Pond.kbdShortcuts){SAPO.Pond.setEventSelection(b)}var g=b.childNodes.length;if(c.childNodes.length===0){c.appendChild(b.childNodes[g-1]);g-=1;s$css.removeClassName(c,"hidden");var j=s$("no_events");if(j){s$css.addClassName(j,"hidden")}}var a=c.childNodes[0];var h;for(var e=g-1;e>=0;e--){if(SAPO.Pond.isElement(b.childNodes[e],"div")){if(g-1<10){b.childNodes[e].style.display="none"}h="tmpEvent"+e+Math.floor(Math.random()*99999);b.childNodes[e].id=h;a=c.insertBefore(b.childNodes[e],a);if(g-1<10){Effect.Appear(h,{duration:0.6})}}}var d=f.match(/id="event_(\w+)/)[1];SAPO.Pond.checkNewEventsUrl=String(SAPO.Pond.checkNewEventsUrl).replace(/NewerThanID=(\w*)/,"NewerThanID="+d);SAPO.Pond.showMessage(SAPO.Pond.messages.newer_events_loaded)};SAPO.Pond.checkNewEventsHandler=function(d,e){if(SAPO.Pond.lastEventsReceived){d.stop();SAPO.Pond.setLock("CheckNewEvents");if(e){window.scrollTo(0,0)}SAPO.Pond.insertNewEventsTimeline(this,SAPO.Pond.lastEventsReceived);SAPO.Pond.lastEventsReceived=false;var c;for(var a=0,b=SAPO.Pond.buttonsCheckNewEvents.length;a<b;a++){c=SAPO.Pond.buttonsCheckNewEvents[a];s$css.addClassName(c[1],"hidden");s$css.removeClassName(c[0],"hidden")}SAPO.Pond.lastEventsReceived=false;SAPO.Pond.unsetLock("CheckNewEvents");if(SAPO.Pond.kbdShortcuts){SAPO.Pond.goToTop=false}}};SAPO.Pond.setCheckNewEvents=function(e){var a,d;for(var b=0,c=e.length;b<c;b++){a=SAPO.Pond.selectTag(e[b].childNodes,"a");d=SAPO.Pond.selectTag(e[b].childNodes,"span");SAPO.Pond.buttonsCheckNewEvents.push([d,a]);s$css.addClassName(a,"hidden");s$css.removeClassName(d,"hidden");Event.observe(a,"click",SAPO.Pond.checkNewEventsHandler.bindAsEventListener(s$("events"),(b==(c-1))))}SAPO.Pond.timelineInterval=setInterval(SAPO.Pond.checkNewEvents,SAPO.Pond.periodicTasksTime);setInterval(SAPO.Pond.updateFuzzyTimes,SAPO.Pond.periodicTasksTime)};SAPO.Pond.markEvent=function(c,a){var d=c.match(/value="(.*?)"/i);var b=c.match(/name="(.*?)"/i);a.value=d[1];a.name=b[1]};SAPO.Pond.deleteEvent=function(a){SAPO.Component.Dialog.info({message:a.html.replace(/\n/g,""),width:420,className:"modal",onComplete:function(){var b=s$("dialogClose");if(b!==null){Event.observe(b,"click",function(d){d.stop();SAPO.Component.Dialog.removeLayer()})}var c=s$("deleteDialog").getElementsByTagName("form")[0];Event.observe(c,"click",function(d){d.stop();if(d.target.tagName){if(d.target.tagName!="input"&&d.target.type!="submit"){return false}}SAPO.Pond.timelineActionsEvents(this,d.target)}.bindAsEventListener(c));SAPO.Pond.setCloseOnEsc();SAPO.Pond.setAcceptOnEnter(c)}})};SAPO.Pond.removeEventNode=function(b){var a=b.parentNode;Effect.Fade(a);setTimeout(function(){a.parentNode.removeChild(a)},1100)};SAPO.Pond.confirmDelete=function(b){SAPO.Component.Dialog.removeLayer();var a=s$("event_"+b.eventID);if(a!==null){SAPO.Pond.removeEventNode(a)}SAPO.Pond.showMessage(b.response.statusText)};SAPO.Pond.replyEvent=function(b){var g=s$("actions_"+b.eventID);var h=document.createElement("DIV");SAPO.Pond.setLock("mouseFocus");var k=new RegExp('<div id="reply_to_event_[A-Za-z0-9]*">((\\n|\\r|\\s|.)*)<\\/div>',"");var c=k.exec(b.html);h.innerHTML=c[1];h.id="reply_to_event_"+b.eventID;h.style.height="38px";var d=s$(b.target.id);d.name="reply_close";d.id="reply_close_"+b.eventID;if(g!==null){g.parentNode.insertBefore(h,g)}h=s$(h.id);var j=h.getElementsByTagName("form")[0];j.SmallText.tabIndex=SAPO.Pond.getTabIndex();j.sendReply.tabIndex=SAPO.Pond.getTabIndex();var l=SAPO.Pond.selectTag(j.childNodes,"fieldset");var f=SAPO.Pond.selectTag(l.childNodes,"input");var a=j.counter;Event.observe(f,"keyup",SAPO.Pond.counterEvent.bindAsEventListener(f,a));Event.observe(f,"change",SAPO.Pond.counterEvent.bindAsEventListener(f,a));Event.observe(f,"focus",SAPO.Pond.counterEvent.bindAsEventListener(f,a));f.focus();if(typeof f.setSelectionRange=="function"){var e=f.value.length;f.setSelectionRange(e,e)}setTimeout(function(){SAPO.Pond.unsetLock("mouseFocus")},800)};SAPO.Pond.replyDismiss=function(c){var a=s$("reply_to_event_"+c.eventID);SAPO.Pond.setLock("mouseFocus");var b;if(a!==null){a.parentNode.removeChild(a);if(typeof c.response!="undefined"){SAPO.Pond.showMessage(c.response.statusText)}b=s$("reply_close_"+c.eventID);if(b!==null){b.name="reply";b.id=b.id.replace("reply_close_","button_reply_to_event_")}}setTimeout(function(){SAPO.Pond.unsetLock("mouseFocus")},800)};SAPO.Pond.showRT=function(f,g){var j,d,e,b;var h=s$("event_short_"+f);if(h===null){return false}j=h.innerHTML;var a=h.parentNode.getElementsByTagName("p");for(e=0,b=a.length;e<b;e++){if(s$css.hasClassName(a[e],"identification")){d=a[e].getElementsByTagName("a")[1].innerHTML;break}}var c=s$("short_text_form");if(c!==null){var k=Element.select(c,"input[name=SmallText]");k=k[0];k.value="RT @"+d+": "+SAPO.Utility.String.trim(SAPO.Utility.String.stripTags(j));window.scrollTo(0,0);k.focus()}else{g.form.submit()}};SAPO.Pond.timelineResponseActions={set_read:function(a){s$css.removeClassName(a.pondE.parentNode,"unread");SAPO.Pond.markEvent(a.html,a.target);if(SAPO.Pond.activeFilters.unread===true){SAPO.Pond.removeEventNode(a.pondE)}},set_unread:function(a){if(!s$css.hasClassName(a.pondE.parentNode,"unread")){s$css.addClassName(a.pondE.parentNode,"unread");SAPO.Pond.markEvent(a.html,a.target)}},set_favorite:function(a){if(!s$css.hasClassName(a.pondE.parentNode,"favorite")){s$css.addClassName(a.pondE.parentNode,"favorite");SAPO.Pond.markEvent(a.html,a.target)}},set_unfavorite:function(a){s$css.removeClassName(a.pondE.parentNode,"favorite");SAPO.Pond.markEvent(a.html,a.target);if(SAPO.Pond.activeFilters.favorites===true){SAPO.Pond.removeEventNode(a.pondE)}},"delete":SAPO.Pond.deleteEvent,confirm:SAPO.Pond.confirmDelete,reply:SAPO.Pond.replyEvent,sendReply:SAPO.Pond.replyDismiss};SAPO.Pond.timelineActionsEvents=function(a,b){var d;var c={};d=b.name;c[d]=d;c.EventID=a.EventID.value;if(d=="reply"){c.ScreenName=a.ScreenName.value}if(d=="RT"){SAPO.Pond.showRT(a.EventID.value,b);return false}if(d=="sendReply"){c.SmallText=a.SmallText.value}if(d=="reply_close"){SAPO.Pond.replyDismiss({eventID:b.id.replace("reply_close_","")});return false}if(typeof a.confirm!="undefined"){c.confirm=a.confirm.value}SAPO.Pond.ajaxRequest(a.action,{parameters:c,onSuccess:function(h,e){var f=e.responseText;var g=$("event_"+this.EventID.value);SAPO.Pond.timelineResponseActions[h]({response:e,pondE:g,html:f,target:b,eventID:c.EventID})}.bind(a,d)})};SAPO.Pond.viewActionsTop=function(e){var d=false;if(e[0]){var a=e[0];d=a.getElementsByTagName("a");var c=d.length;for(var b=0;b<c;b++){if(s$css.hasClassName(d[b],"timeline_newer")||s$css.hasClassName(d[b],"timeline_first")||s$css.hasClassName(d[b],"timeline_older")){s$css.addClassName(d[b],"hidden")}}}};SAPO.Pond.setLoadEventsShortcuts=function(b){var a=s$("events");if(b.type=="keyup"&&SAPO.Pond.isShiftShortcut(b)&&b.keyCode===78){if(SAPO.Pond.lastEventsReceived!==false){SAPO.Pond.checkNewEventsHandler.call(a,b,true)}}if(b.type=="keyup"&&SAPO.Pond.isShiftShortcut(b)&&b.keyCode===79){SAPO.Pond.loadOlderEvent.call(a,b)}};SAPO.Pond.resetNodeEvents=function(d){var e=s$("actions_"+d);var a=e.getElementsByTagName("form");var c=a.length;for(var b=0;b<c;b++){if(SAPO.Pond.kbdShortcuts){Event.observe(e.parentNode,"mouseover",SAPO.Pond.selectionEv.bindAsEventListener(e.parentNode))}}};SAPO.Pond.loadOlderEvent=function(f){f.stop();if(SAPO.Pond.getLock("older")){return false}SAPO.Pond.setLock("older");var e=SAPO.Pond.timelineLastEventId;var d=new RegExp("/entities");var c="";var g;var h=s$("loadOlderContentImg");if(d.test(SAPO.Pond.olderButton.href)){var a=SAPO.Pond.olderButton.href.match(/EntityID=(\w+)/);var b=a[1];g=SAPO.Pond.olderButton.href.match(/action=(\w+)/);c="/entities?EntityID="+b+"&OlderThanID="+e+"&action="+g[1]}else{g=SAPO.Pond.olderButton.href.match(/action=(\w+)/);c="/events?OlderThanID="+e+"&action="+g[1]}SAPO.Pond.ajaxRequest(c,{setLoading:true,onLoading:function(){s$css.addClassName(SAPO.Pond.olderButton,"hidden");s$css.removeClassName(h,"hidden")}.bind(this),onFailure:function(j){s$css.addClassName(h,"hidden");s$css.removeClassName(SAPO.Pond.olderButton,"hidden");setTimeout(function(){SAPO.Pond.unsetLock("older")},SAPO.Pond.keyboardLockTimeout);SAPO.Pond.showError(j.statusText)}.bind(this),onSuccess:function(j){s$css.addClassName(h,"hidden");s$css.removeClassName(SAPO.Pond.olderButton,"hidden");Element.insert(this,j.responseText.replace(/\n/g,""));var p=this.getElementsByTagName("div");var n=p.length;var m=/event_/;var l=/event_detail/;var o=false;var q;for(var k=0;k<n;k++){q=p[k];if(typeof q.id=="undefined"||q.id===""){continue}if(o){if(!m.test(q.id)||l.test(q.id)){continue}SAPO.Pond.resetNodeEvents(q.id.replace("event_",""));SAPO.Pond.timelineLastIndex=k}else{if(q.id=="event_"+SAPO.Pond.timelineLastEventId){o=true}}}SAPO.Pond.timelineLastEventId=p[SAPO.Pond.timelineLastIndex].id.replace("event_","");SAPO.Pond.showMessage(SAPO.Pond.messages.older_events_loaded);setTimeout(function(){SAPO.Pond.unsetLock("older")},SAPO.Pond.keyboardLockTimeout)}.bind(this)})};SAPO.Pond.viewActionsBottom=function(e){var f=false;if(e[1]){var j=e[1];f=j.getElementsByTagName("a");var b=f.length;for(var c=0;c<b;c++){if(s$css.hasClassName(f[c],"timeline_newer")||s$css.hasClassName(f[c],"timeline_first")){s$css.addClassName(f[c],"hidden")}else{if(s$css.hasClassName(f[c],"timeline_older")){var a=s$("events");if(a!==null){var h=a.getElementsByTagName("div");var d=h.length;SAPO.Pond.olderButton=f[c];if(d){for(var g=0;g<d;g++){if(h[g].id&&/event_/.test(h[g].id)&&!/event_detail/.test(h[g].id)){SAPO.Pond.timelineLastIndex=g}}SAPO.Pond.timelineLastEventId=h[SAPO.Pond.timelineLastIndex].id.replace("event_","");Event.observe(SAPO.Pond.olderButton,"click",SAPO.Pond.loadOlderEvent.bindAsEventListener(a,SAPO.Pond.olderButton));SAPO.Pond.olderButton.parentNode.appendChild(SAPO.Pond.makeLoader("loadOlderContentImg"))}else{s$css.addClassName(SAPO.Pond.olderButton,"hidden")}}else{s$css.addClassName(f[c],"hidden")}}}}}};SAPO.Pond.timelineFilters=function(j){Event.observe(j,"click",function(p){var o=p.target;if(SAPO.Pond.isElement(o,"input")&&o.type=="checkbox"){if(o.id=="cb_unread"&&o.checked===true){SAPO.Pond.activeFilters.unread=true}if(o.id=="cb_favorites"&&o.checked===true){SAPO.Pond.activeFilters.favorites=true}if(!SAPO.Pond.allFiltersSelection){this.submit()}}}.bindAsEventListener(j));var d=s$("cb_unread");if(d!==null&&d.checked===true){SAPO.Pond.activeFilters.unread=true}var n=s$("cb_favorites");if(n!==null&&n.checked===true){SAPO.Pond.activeFilters.favorites=true}var h=function(o){o.stop();if(o.type=="mouseover"){s$css.removeClassName(this,"hidden")}else{s$css.addClassName(this,"hidden")}};var a=function(s,p){var o,q,t,r=p.length;s.stop();for(q=0;q<r;q++){if(SAPO.Pond.isElement(p[q],"li")){t=Element.select(p[q],'[type="checkbox"]')[0];if(t){o=t;o.checked=(p[q]===this)}}}o.form.submit()};var f=function(r){r.stop();var s,p,q=this.length;var o=false;SAPO.Pond.allFiltersSelection=true;for(p=0;p<q;p++){opt=this[p];if(SAPO.Pond.isElement(opt,"li")){s=Element.select(opt,'[type="checkbox"]');if(s.length>0){s[0].checked=true;o=s[0]}}}if(o){o.form.submit()}};Element.select(j,"input[type=submit]")[0].style.display="none";var g,m=Element.select(j,"ul");var l=Element.select(m[0],"li");var k,e,b=l.length;for(e=0;e<b;e++){g=l[e];if(SAPO.Pond.isElement(g,"li")){k=SAPO.Pond.selectTag(g.childNodes,"a");if(k===null||(k.id&&k.id=="link_select_all_services")){break}Event.observe(g,"mouseover",h.bindAsEventListener(k));Event.observe(g,"mouseout",h.bindAsEventListener(k));Event.observe(k,"click",a.bindAsEventListener(g,l))}}var c=s$("link_select_all_services");if(c!==null){s$css.removeClassName(c,"hidden");Event.observe(c,"click",f.bindAsEventListener(l))}};SAPO.Pond.addFriends=function(b){var a=Element.select(b,"[type=submit]");if(a[0].hasClassName("hidden")){a[0].removeClassName("hidden");a[1].addClassName("hidden")}Event.observe(b,"submit",function(f){var d=this.getElementsByTagName("input");var g={};for(var e in d){if(d[e].type=="text"){g[d[e].name]=d[e].value}}if(g.EntityName===""){f.stop();SAPO.Pond.showError(SAPO.Pond.messages.invalid_friend_name);return false}if(!SAPO.Pond.sourcesAdded&&(g.SourceURL===""||!SAPO.Utility.Validator.url(g.SourceURL))){f.stop();SAPO.Pond.showError(SAPO.Pond.messages.invalid_source_url);return false}var c=document.createElement("img");c.alt="loading";c.src="/img/loader.gif";this.appendChild(c);if(!SAPO.Pond.sourcesAdded){f.stop();SAPO.Pond.discoverSources.call(this,c,g.SourceURL,"add_friend");return false}}.bindAsEventListener(b))};SAPO.Pond.discoverSourcesSection=function(b){var a=Element.select(b,'input[type="submit"]');s$css.removeClassName(a[0],"hidden");s$css.addClassName(a[1],"hidden");s$css.removeClassName(b.getElementsByTagName("span")[0],"hidden");Event.observe(b,"submit",function(f){var d=this.getElementsByTagName("input");var g={};for(var e in d){if(d.hasOwnProperty(e)){g[d[e].name]=d[e].value}}if(typeof(g.EntityName)!="undefined"&&g.EntityName===""){f.stop();SAPO.Pond.showError(SAPO.Pond.messages.invalid_friend_name);return false}if(!SAPO.Pond.sourcesAdded&&(g.SourceURL===""||!SAPO.Utility.Validator.url(g.SourceURL))){f.stop();SAPO.Pond.showError(SAPO.Pond.messages.invalid_source_url);return false}var c=document.createElement("img");c.alt="loading";c.src="/img/loader.gif";this.appendChild(c);if(!SAPO.Pond.sourcesAdded){f.stop();SAPO.Pond.discoverSources.call(this,c,g.SourceURL,"");return false}}.bindAsEventListener(b))};SAPO.Pond.expandEvent=function(h,e,g,c,d){s$css.addClassName(c,"hidden");s$css.removeClassName(e[1],"hidden");s$css.removeClassName(g.parentNode,"unread");var b=d.match(/name="(.*?)"/);var f=d.match(/value="(.*?)"/);var a=Element.select(h,'input[name="set_read"]')[0];if(a){a.name=b[1];a.value=f[1]}};SAPO.Pond.toggleEvent=function(j){var f,d,a;if(j.type=="click"){f=j.target}else{f=Element.select(SAPO.Pond.selectedNode.node,".detail");a=f.length;if(a===0){return false}for(d=0;d<a;d++){if(!s$css.hasClassName(f[d],"hidden")){f=f[d];break}}}var l=f.parentNode.id.replace(/actions_/,"");var h=s$("event_"+l);var e=s$("event_short_"+l);var b=s$("actions_"+l);var g=Element.select(b,".detail");var c=s$("event_detail_"+l);if(c!==null){if(!s$css.hasClassName(c,"hidden")){s$css.addClassName(c,"hidden");s$css.removeClassName("event_short_"+l,"hidden");s$css.addClassName(g[1],"hidden");s$css.removeClassName(g[0],"hidden")}else{s$css.removeClassName(c,"hidden");s$css.addClassName(g[0],"hidden");SAPO.Pond.expandEvent(b,g,h,e,c.parentNode.innerHTML)}return false}var k=s$("expandLoader"+l);if(k===null){k=SAPO.Pond.makeLoader("expandLoader"+l);g[0].parentNode.insertBefore(k,g[0]);k=s$("expandLoader"+l)}SAPO.Pond.ajaxRequest(f.href,{onFailure:function(m,n){s$css.addClassName(k,"hidden");s$css.removeClassName(g[0],"hidden");SAPO.Pond.showError(n.statusText)},onSuccess:function(m){var n=m.responseText;n=n.replace(/\n/g,"");n=n.replace(/(<input(.*?)>)/g,'<input class="hidden"$2>');if(n!==""){Element.insert(e,{after:n});s$css.addClassName(k,"hidden");SAPO.Pond.expandEvent(b,g,h,e,n)}else{s$css.removeClassName(k,"hidden");s$css.addClassName(g[0],"hidden")}}.bind(f)});s$css.removeClassName(k,"hidden");s$css.addClassName(g[0],"hidden")};SAPO.Pond.setTimelineActions=function(e){var b,c;Event.observe(e,"click",function(f){if(typeof f.target.tagName!="undefined"){if(s$css.hasClassName(f.target,"detail")){f.stop();SAPO.Pond.toggleEvent(f)}if(SAPO.Pond.isElement(f.target,"input")&&f.target.type=="submit"){f.stop();SAPO.Pond.timelineActionsEvents(f.target.form,f.target)}}});var a=$$(".set_all_read");if(a.length){for(b=0,c=a.length;b<c;b++){s$css.removeClassName(a[b],"hidden");Event.observe(a[b],"click",SAPO.Pond.setAllReadEvent.bindAsEventListener(e))}}var d=$$(".set_all_unread");if(d.length){for(b=0,c=d.length;b<c;b++){s$css.removeClassName(d[b],"hidden");Event.observe(d[b],"click",SAPO.Pond.setAllUnreadEvent.bindAsEventListener(e))}}if(SAPO.Pond.kbdShortcuts){Event.observe(document,"keyup",SAPO.Pond.timelineKeyboardShortcuts);Event.observe(document,"keydown",SAPO.Pond.timelineKeyboardShortcuts);Event.observe(document,"keypress",SAPO.Pond.shortcutsHelp)}};SAPO.Pond.setAllReadEvent=function(g,a){g.stop();if(typeof a=="undefined"){a=this}var j=a.getElementsByTagName("div");var c=[];var f=[];var e,b=j.length;for(e=0;e<b;e++){if(s$css.hasClassName(j[e],"unread")){var h=j[e];var d=h.getElementsByTagName("div")[0];c.push(d);f.push(d.id.replace("event_",""));if(SAPO.Pond.activeFilters.unread===true){SAPO.Pond.removeEventNode(d)}}}if(c.length===0){return false}SAPO.Pond.ajaxRequest("/events?action=mark",{setLoading:true,parameters:{"EventID[]":f,reloadURL:"/events?",set_read:"Mark all as read"},onSuccess:SAPO.Pond.markEventsOnSuccess.bind(a,c)})};SAPO.Pond.setAllUnreadEvent=function(g,a){g.stop();if(typeof a=="undefined"){a=this}var j=a.getElementsByTagName("div");var c=[];var f=[];var e,b=j.length;var h=false,d;for(e=0;e<b;e++){h=j[e];if(s$css.hasClassName(h,"node")){if(!(s$css.hasClassName(h,"unread"))){d=h.getElementsByTagName("div")[0];c.push(d);f.push(d.id.replace("event_",""))}}}if(c.length===0){return false}SAPO.Pond.ajaxRequest("/events?action=mark",{setLoading:true,parameters:{"EventID[]":f,reloadURL:"/events?",set_unread:"Mark all as Unread"},onSuccess:SAPO.Pond.markEventsOnSuccess.bind(a,c)})};SAPO.Pond.markEventsOnSuccess=function(h,g){var l=g.responseText;var n=l.match(/value="(.*?)"/i);var b=l.match(/name="(.*?)"/i);var m=h.length;var k,a,d,c,j,e,f;for(k=0;k<m;k++){if(s$css.hasClassName(h[k].parentNode,"unread")){s$css.removeClassName(h[k].parentNode,"unread");f="set_read"}else{s$css.addClassName(h[k].parentNode,"unread");f="set_unread"}d=h[k].id.replace("event_","actions_");c=s$(d).getElementsByTagName("form")[0];for(j=0,e=c.elements.length;j<e;j++){if(c.elements[j].name==f){a=c.elements[j]}}a.value=n[1];a.name=b[1]}if(SAPO.Pond.activeFilters.unread===true){document.location=document.location}else{if(f=="set_read"){SAPO.Pond.showMessage(SAPO.Pond.messages.marked_all_read)}else{if(f=="set_unread"){SAPO.Pond.showMessage(SAPO.Pond.messages.marked_all_unread)}}}};SAPO.Pond.isSimpleShortcut=function(a){if(!a.shiftKey&&!a.ctrlKey&&!a.metaKey&&!a.altKey){return true}return false};SAPO.Pond.isShiftShortcut=function(a){if(a.shiftKey===true&&!a.ctrlKey&&!a.metaKey&&!a.altKey){return true}return false};SAPO.Pond.setCloseOnEsc=function(b,a){if(SAPO.Pond.kbdShortcuts){var c=function(d){if(d.keyCode===27&&SAPO.Pond.isSimpleShortcut(d)){if(b===true){SAPO.Pond.autoHideMessage()}else{SAPO.Component.Dialog.removeLayer()}if(a&&SAPO.Pond.getLock(a)){SAPO.Pond.unsetLock(a)}Event.stopObserving(document,"keyup",c)}};Event.observe(document,"keyup",c)}};SAPO.Pond.setAcceptOnEnter=function(b){if(SAPO.Pond.kbdShortcuts){var a=Element.select(b,"input[type=submit]");if(a.length===0){return false}a[0].focus();var c=function(d){if(d.keyCode===13&&SAPO.Pond.isSimpleShortcut(d)){d.stop();Event.stopObserving(document,"keyup",c.bindAsEventListener(this));SAPO.Component.Dialog.removeLayer()}};Event.observe(document,"keyup",c.bindAsEventListener(a[0]))}};SAPO.Pond.isTextField=function(a){if(a.tagName&&a.nodeType===Node.ELEMENT_NODE){if(a.tagName.toLowerCase()=="input"){if(a.type=="text"||a.type=="password"){return false}}else{if(a.tagName.toLowerCase()=="textarea"){return false}}}return true};SAPO.Pond.timelineKeyboardShortcuts=function(e){var a=74;var d=75;var f=40;var b=38;if(!SAPO.Pond.isTextField(e.target)){return false}if(e.keyCode===a||e.keyCode===f){e.stop();if(e.type=="keyup"){SAPO.Pond.handleNodeNavigation("next")}}if(e.keyCode===d||e.keyCode===b){e.stop();if(e.type=="keyup"){SAPO.Pond.handleNodeNavigation("prev")}}SAPO.Pond.setShortTextShortcuts(e);SAPO.Pond.setLoadEventsShortcuts(e);if(e.type=="keyup"&&SAPO.Pond.isShiftShortcut(e)&&e.keyCode===77){if(SAPO.Pond.getLock("allread")){return false}SAPO.Pond.setLock("allread");SAPO.Pond.setAllReadEvent(e,s$("events"));setTimeout(function(){SAPO.Pond.unsetLock("allread")},SAPO.Pond.keyboardLockTimeout)}else{if(e.type=="keyup"&&SAPO.Pond.isShiftShortcut(e)&&e.keyCode===85){if(SAPO.Pond.getLock("allread")){return false}SAPO.Pond.setLock("allread");SAPO.Pond.setAllUnreadEvent(e,s$("events"));setTimeout(function(){SAPO.Pond.unsetLock("allread")},SAPO.Pond.keyboardLockTimeout)}}var c=false;if(SAPO.Pond.selectedNode!==false&&SAPO.Pond.getLock("event")===false){if(e.type=="keyup"&&SAPO.Pond.isSimpleShortcut(e)){SAPO.Pond.setLock("event");if(e.keyCode===79){SAPO.Pond.toggleEvent(e);setTimeout(function(){SAPO.Pond.unsetLock("event")},1000);return false}if(e.keyCode===77){c=SAPO.Pond.getButtonByAction("set_read","set_unread")}if(e.keyCode===70){c=SAPO.Pond.getButtonByAction("set_favorite","set_unfavorite")}if(e.keyCode===84){c=SAPO.Pond.getButtonByAction("RT")}if(e.keyCode===82){c=SAPO.Pond.getButtonByAction("reply");if(c===false){c=SAPO.Pond.getButtonByAction("reply_close")}}if(c!==false){SAPO.Pond.timelineActionsEvents(c.parentNode,c)}setTimeout(function(){SAPO.Pond.unsetLock("event")},500)}}};SAPO.Pond.shortcutsHelp=function(b){var a="shortcutsHelp";if(!SAPO.Pond.isTextField(b.target)){return false}if(SAPO.Pond.getLock(a)){return false}if(b.type=="keypress"&&String.fromCharCode(b.charCode||b.keyCode)=="?"){SAPO.Pond.ajaxRequest("/user?action=shortcut_help",{setLoading:true,onSuccess:function(c){var d=c.responseText;SAPO.Component.Dialog.info({message:d.replace(/\n/g,""),width:420,className:"modal",onComplete:function(){var e=s$("dialogClose");if(e!==null){Event.observe(e,"click",function(f){f.stop();SAPO.Component.Dialog.removeLayer();if(SAPO.Pond.getLock(a)){SAPO.Pond.unsetLock(a)}})}SAPO.Pond.setLock(a);SAPO.Pond.setCloseOnEsc(false,a)}})}})}};SAPO.Pond.getButtonByAction=function(){var b,c,a;for(b=0,c=arguments.length;b<c;b++){a=Element.select(SAPO.Pond.selectedNode.node,"input[name="+arguments[b]+"]");if(a.length>0){if(Element.hasClassName(a[0],"hidden")){return a[1]}else{return a[0]}}}return false};SAPO.Pond.handleNodeNavigation=function(b){var a=s$("events");if(SAPO.Pond.selectedNode===false&&b=="prev"){return false}if(SAPO.Pond.selectedNode===false&&b=="next"){SAPO.Pond.setSelectedNode(SAPO.Pond.selectTag(a.childNodes,"div"),true,true);return false}SAPO.Pond.setSelectedNode(SAPO.Pond.getNode(b),false,true)};SAPO.Pond.setSelectedNode=function(c,f,a){var b=false;var e=SAPO.Pond.selectedNode;var d=e.node;if(!f){if(d===c){return false}s$css.removeClassName(d,"node_selected")}if(e!==false){if(e.keyboard===false&&a===true){e.keyboard=true;b=true}}if(!b){e=SAPO.Pond.selectedNode={node:c,keyboard:a};d=e.node}s$css.addClassName(d,"node_selected");if(a&&!f){if(SAPO.Pond.goToTop){window.scrollTo(0,0)}else{window.scrollTo(0,d.offsetTop-10)}SAPO.Pond.setLock("mouseFocus");clearTimeout(SAPO.Pond.mouseLockTimeout);SAPO.Pond.mouseLockTimeout=setTimeout(function(){SAPO.Pond.unsetLock("mouseFocus");clearTimeout(SAPO.Pond.mouseLockTimeout);SAPO.Pond.mouseLockTimeout=false},1000)}};SAPO.Pond.getNode=function(a){var b=SAPO.Pond.selectedNode.node;while(true){if(a=="next"){b=b.nextSibling}else{if(a=="prev"){b=b.previousSibling}}if(b===null||SAPO.Pond.goToTop){if(a=="prev"){SAPO.Pond.goToTop=true}if(a=="next"){SAPO.Pond.goToTop=false}return SAPO.Pond.selectedNode.node}if(SAPO.Pond.isElement(b,"div")){return b}}};SAPO.Pond.selectionEv=function(a){if(SAPO.Pond.getLock("mouseFocus")){return false}if(SAPO.Pond.selectedNode===false){SAPO.Pond.setSelectedNode(this,true,false)}else{SAPO.Pond.setSelectedNode(this,false,false)}};SAPO.Pond.getCurrentNode=function(a){if(SAPO.Pond.recursionLevel<5){SAPO.Pond.recursionLevel++;if(s$css.hasClassName(a,"node")&&typeof a.parentNode.id!="undefined"&&a.parentNode.id=="events"){SAPO.Pond.recursionLevel=0;return a}else{return SAPO.Pond.getCurrentNode(a.parentNode)}}else{SAPO.Pond.recursionLevel=0;return false}};SAPO.Pond.setEventSelection=function(a){Event.observe(a,"mouseover",function(c){if(SAPO.Pond.getLock("mouseFocus")||SAPO.Pond.getLock("recursion")){return false}SAPO.Pond.setLock("recursion");var b=SAPO.Pond.getCurrentNode(c.target);SAPO.Pond.unsetLock("recursion");if(b===false){return false}if(SAPO.Pond.selectedNode===false){SAPO.Pond.setSelectedNode(b,true,false)}else{SAPO.Pond.setSelectedNode(b,false,false)}}.bindAsEventListener(a))};SAPO.Pond.counterEvent=function(d,a){var c=this;if(!SAPO.Pond.isElement(this,"input")){c=this.SmallText}var b=140-c.value.length;a.value=b;if(b>=0){if(s$css.hasClassName(a,"countOverflow")){s$css.removeClassName(a,"countOverflow")}}else{s$css.addClassName(a,"countOverflow")}};SAPO.Pond.shortTextPost=function(b){var a=s$("char_counter");a.value=140;Event.observe(b.SmallText,"keyup",function(e,c){var f=this.value;var d=140-f.length;if(d>=0){if(s$css.hasClassName(c,"countOverflow")){s$css.removeClassName(c,"countOverflow")}}else{s$css.addClassName(c,"countOverflow")}c.value=d}.bindAsEventListener(b.SmallText,a));Event.observe(b.SmallText,"change",SAPO.Pond.counterEvent.bindAsEventListener(b,a));Event.observe(b.SmallText,"focus",SAPO.Pond.counterEvent.bindAsEventListener(b,a));Event.observe(b,"submit",function(d,c){d.stop();var e=true;if(c.value<0){e=confirm(SAPO.Pond.messages.truncate_short_publish)}if(e){this.submit()}}.bindAsEventListener(b,a))};SAPO.Pond.enablePunyUrl=function(e){var d=s$("form_puny_url");if(d){s$css.removeClassName(d,"hidden");var c=d.getElementsByTagName("a")[0];Event.observe(c,"click",function(j,h){j.stop();var g=s$("text_link").value;if(SAPO.Utility.Validator.url(g)&&!SAPO.Pond.shortenUrls[g]){SAPO.Pond.shortenUrls[g]={isPuny:false,url:""};var f="/PunyURL/GetCompressedURLByURLJSON?url="+g;SAPO.Pond.ajaxRequest(f,{setLoading:true,onSuccess:function(m,n,k){var o=k.responseJSON;var l=o.punyURL.ascii;SAPO.Pond.shortenUrls[l]={isPuny:true,url:m};SAPO.Pond.shortenUrls[m].url=l;n.SmallText.value=n.SmallText.value+" "+SAPO.Pond.shortenUrls[m].url}.bind(d.text_link,g,h)})}else{if(SAPO.Pond.shortenUrls[g]&&!SAPO.Pond.shortenUrls[g].isPuny){h.SmallText.value=h.SmallText.value+" "+SAPO.Pond.shortenUrls[g].url}else{SAPO.Pond.showError(SAPO.Pond.messages.invalid_url)}}}.bindAsEventListener(d,e))}var b=document.createElement("div");b.className="hidden";var a=s$("main");a.appendChild(b)};SAPO.Pond.saveServicePreferences=function(h){var d;var f=h.getElementsByTagName("fieldset");if(f.length<=1){d=f[0].getElementsByTagName("input")}else{d=f[1].getElementsByTagName("input")}var a,c,e=d.length;var b=SAPO.Utility.Cookie.get();var g=function(){SAPO.Utility.Cookie.set(this.name,((this.checked)?1:0),SAPO.Pond.cookieDuration)};for(c=0;c<e;c++){a=d[c];if(a.type!="checkbox"){continue}if(typeof(b[a.name])!="undefined"){a.checked=((Number(b[a.name]))?true:false)}else{SAPO.Utility.Cookie.set(a.name,1,SAPO.Pond.cookieDuration)}Element.observe(a,"click",g.bindAsEventListener(a))}};SAPO.Pond.setShortTextShortcuts=function(b){if(b.type=="keyup"&&SAPO.Pond.isShiftShortcut(b)&&b.keyCode===84){var a=s$("short_text_form");var c=SAPO.Pond.selectedNode.node;if(a!==null&&typeof c!="undefined"){SAPO.Pond.showRT(c.id.replace("event_",""),null)}}};SAPO.Pond.addStuff=function(c){if(c.id!=="addstuff_intro"){c.style.display="none"}var b=s$("link_add_source");var a=(b)?b:s$("link_add_stuff");s$css.removeClassName(a,"hidden");Event.observe(a,"click",function(d){d.stop();if(this.style.display==="none"){Effect.Appear(this)}else{Effect.Fade(this)}}.bindAsEventListener(c))};SAPO.Pond.getCurrentTile=function(b){var a;if(SAPO.Pond.recursionLevel<4){SAPO.Pond.recursionLevel++;if(typeof b.parentNode.id!="undefined"){a=b.parentNode.id.match(/(mosaic_entity_)([A-Z0-9]+)/);if(a!==null){SAPO.Pond.recursionLevel=0;return{node:b.parentNode,entityID:a[2]}}}return SAPO.Pond.getCurrentTile(b.parentNode)}else{SAPO.Pond.recursionLevel=0;return false}};SAPO.Pond.showEntityServices=function(c,b){var d=s$("entity_tooltip_info");var a=false;if(d===null){d=document.createElement("div");d.id="entity_tooltip_info";a=true;d.className="entity_tooltip_sources"}else{d.style.display="block"}if(d.innerHTML!=c){d.innerHTML=c}d.style.top=parseInt(b.pointerY()-20)+"px";d.style.left=parseInt(b.pointerX()+5)+"px";if(a){document.getElementsByTagName("body")[0].appendChild(d)}};SAPO.Pond.dragAndDrop=function(h){var d=h.getElementsByTagName("div");var b,f=d.length;var a=function(j){if(SAPO.Pond.getLock("drag")){j.stop()}};var c=function(){SAPO.Pond.setLock("drag")};var e=function(){setTimeout(function(){SAPO.Pond.unsetLock("drag")},500)};for(b=0;b<f;b++){Event.observe(d[b].getElementsByTagName("a")[0],"click",a);new Draggable(d[b],{revert:true,onStart:c,onEnd:e})}var g=s$("mergeBox");if(g!==null){Droppables.add(g,{hoverclass:"mergeBoxHover",onDrop:SAPO.Pond.mergeBoxOnDrop})}SAPO.Pond.setMergeBoxGeneralEvents(h)};SAPO.Pond.setMergeBoxGeneralEvents=function(h){var d,e;var g=s$("mergeBoxList");if(g!==null){var f=g.getElementsByTagName("a");e=f.length;for(d=0;d<e;d++){Event.observe(f[d],"click",SAPO.Pond.deleteFromMergeBox)}}var b=g.getElementsByTagName("a");var a=g.parentNode.getElementsByTagName("form");if(b.length<2){s$css.addClassName(a[0],"hidden");s$css.addClassName(a[1],"hidden")}var c=a[0].merge;if(c){Event.observe(c,"click",function(m){m.stop();var k,l,n={};var j=this.getElementsByTagName("input");for(k=0,l=j.length;k<l;k++){n[j[k].name]=j[k].value}SAPO.Pond.ajaxRequest(this.action,{setLoading:true,parameters:n,onSuccess:function(o){SAPO.Component.Dialog.info({message:o.responseText.replace(/\n/g,""),width:420,className:"modal",onComplete:function(){var p=s$("dialogClose");if(p!==null){Event.observe(p,"click",function(r){r.stop();SAPO.Component.Dialog.removeLayer()})}var q=s$("mergeDialog").getElementsByTagName("form")[0];SAPO.Pond.setCloseOnEsc();SAPO.Pond.setAcceptOnEnter(q)}})}})}.bindAsEventListener(a[0]))}Event.observe(a[1].getElementsByTagName("input")[2],"click",SAPO.Pond.clearMergeBox)};SAPO.Pond.isUserOnMergebox=function(a){var d=s$("mergeBox");var b=new RegExp("EntityID=(\\w+)","g");var c=b.exec(d.innerHTML);while(c!==null){if(a===c[1]){return true}c=b.exec(d.innerHTML)}return false};SAPO.Pond.mergeBoxOnDrop=function(a,e,c){a.style.top="0px";a.style.left="0px";var d=a.getElementsByTagName("a")[0];var b=d.href.match(/EntityID=(\w*)/)[1];if(SAPO.Pond.isUserOnMergebox(b)){return false}SAPO.Pond.ajaxRequest("/entities?action=mergebox_add",{parameters:{EntityID:b,returnURL:"/entities?action=showlist"},onSuccess:function(j){var l=s$("mergeBoxList");var g=s$("mergeBoxEmpty");var h=l.parentNode.getElementsByTagName("form");if(!s$css.hasClassName(g,"hidden")){s$css.addClassName(g,"hidden")}var f=document.createElement("div");f.innerHTML=j.responseText;Event.observe(f.childNodes[0],"click",SAPO.Pond.deleteFromMergeBox);l.appendChild(f.childNodes[0]);if(s$css.hasClassName(l,"hidden")){s$css.removeClassName(l,"hidden")}var k=l.getElementsByTagName("a");if(k.length>=2){s$css.removeClassName(h[0],"hidden");s$css.removeClassName(h[1],"hidden")}s$css.addClassName(d,"selected")}})};SAPO.Pond.deleteFromMergeBox=function(b){b.stop();var a=b.target.href.match(/EntityID=(\w*)/)[1];SAPO.Pond.ajaxRequest("/entities?action=mergebox_remove",{parameters:{EntityID:a,returnURL:"/entities?"},onSuccess:function(e){var h=b.target.parentNode.parentNode;h.removeChild(b.target.parentNode);SAPO.Pond.showMessage(e.statusText);var d=h.parentNode.getElementsByTagName("form");if(h.getElementsByTagName("a").length===0){var c=s$("mergeBoxEmpty");if(c!==null){s$css.removeClassName(c,"hidden")}}if(h.getElementsByTagName("a").length<2){s$css.addClassName(d[0],"hidden");s$css.addClassName(d[1],"hidden")}if(h.getElementsByTagName("a").length===0){s$css.addClassName(s$("mergeBoxList"),"hidden")}var g=Element.select(s$("mosaic_entity_"+a),"a.selected");var j=g.length;for(var f=0;f<j;f++){s$css.removeClassName(g[f],"selected")}}})};SAPO.Pond.clearMergeBox=function(a,b){a.stop();var c=s$("mergeBoxList");SAPO.Pond.ajaxRequest("/entities?action=mergebox_clear",{setLoading:true,onSuccess:function(e){c.innerHTML="";s$css.removeClassName(s$("mergeBoxEmpty"),"hidden");s$css.addClassName(c,"hidden");var d=c.parentNode.getElementsByTagName("form");s$css.addClassName(d[0],"hidden");s$css.addClassName(d[1],"hidden");var g=Element.select(s$("entity_mosaic"),"a.selected");var h=g.length;for(var f=0;f<h;f++){s$css.removeClassName(g[f],"selected")}}})};SAPO.Pond.setNotifications=function(c){var a=c.getElementsByTagName("form");var b=s$("notifications");SAPO.Pond.individualNotificationEvents(a);c=SAPO.Pond.selectTag(b.childNodes,"form");if(c!==false){Event.observe(c,"submit",function(g){g.stop();var h,e=[],d,f;h=Element.select(c,"input[type=hidden]");for(d=0,f=h.length;d<f;d++){if(h[d].name==="notifications[]"){e.push(h[d].value)}}SAPO.Pond.ajaxRequest(c.action,{method:"post",parameters:{"notifications[]":e,returnURL:c.returnURL.value},onSuccess:function(j){var l=s$("notification_list");var k=s$("notifications");Effect.Fade(k.parentNode);setTimeout(function(){l.innerHTML="";s$css.addClassName(k.parentNode,"hidden")},1000);SAPO.Pond.showMessage(j.statusText)}})}.bindAsEventListener(this))}if(a.length===1){SAPO.Pond.hideDismissAll(b)}SAPO.Pond.notificationsInterval=setInterval(function(e){var d="/notifications?action=js_fetch&force=";if(SAPO.Pond.timelineInterval===false){d+="true"}else{d+="false"}SAPO.Pond.ajaxRequest(d,{onSuccess:SAPO.Pond.updateNotifications.bind(this,e)})}.bind(this,c),SAPO.Pond.periodicTasksTime)};SAPO.Pond.individualNotificationEvents=function(a){var b,d;var c=function(f,e){f.stop();SAPO.Pond.ajaxRequest(e.action,{method:"post",parameters:{"notifications[]":e["notifications[]"].value,returnURL:e.returnURL.value},onSuccess:function(h){e.parentNode.parentNode.removeChild(e.parentNode);SAPO.Pond.showMessage(h.statusText);var g=s$("notification_list").getElementsByTagName("form");var j=s$("notifications");if(parseInt(g.length,10)===0){Effect.Fade(j.parentNode);setTimeout(function(){s$css.addClassName(j.parentNode,"hidden")},1000)}if(parseInt(g.length,10)===1){SAPO.Pond.hideDismissAll(j)}}})};for(b=0,d=a.length;b<d;b++){Event.observe(a[b],"submit",c.bindAsEventListener(this,a[b]))}};SAPO.Pond.updateNotifications=function(l,j){var m,e,b;var q=s$("notification_list");var d=Element.select(q,"input[type=hidden]");var f="",r="";for(m=0,e=d.length;m<e;m++){if(d[m].name==="notifications[]"){f+=","+d[m].value}}var c=document.createElement("div");c.innerHTML=j.responseText;var o=Element.select(c,"input[type=hidden]");for(m=0,e=o.length;m<e;m++){if(o[m].name==="notifications[]"){r+=","+o[m].value}}if(r!==f){q.innerHTML=c.innerHTML;var p=Element.select(l,"input[type=hidden]");for(m=0,e=p.length;m<e;m++){if(p[m].name==="notifications[]"){p[m].parentNode.removeChild(p[m])}}var n=Element.select(l,"input[type=submit]");var k=s$("notifications");var h=s$css.hasClassName(k.parentNode,"hidden");var a=r.split(",");var g;e=a.length;for(m=0;m<e;m++){if(a[m]!==""){g=document.createElement("INPUT");g.type="hidden";g.name="notifications[]";g.value=a[m];if(!h){g.style.display="none"}n[0].parentNode.insertBefore(g,n[0]);if(!h){Effect.Appear(g)}}}e--;b=s$("notification_list").getElementsByTagName("form");SAPO.Pond.individualNotificationEvents(b);if(h){k.parentNode.display="none";s$css.removeClassName(k.parentNode,"hidden");Effect.Appear(k.parentNode)}if(e===1){SAPO.Pond.hideDismissAll(k)}else{if(e>1){SAPO.Pond.showDismissAll(k)}}}};SAPO.Pond.hideDismissAll=function(b){var a=SAPO.Pond.selectTag(b.childNodes,"form");if(!s$css.hasClassName(a,"hidden")){s$css.addClassName(a,"hidden")}};SAPO.Pond.showDismissAll=function(b){var a=SAPO.Pond.selectTag(b.childNodes,"form");if(s$css.hasClassName(a,"hidden")){s$css.removeClassName(a,"hidden")}};SAPO.Pond.confirmEntityDelete=function(a){Event.observe(a,"click",function(b){b.stop();SAPO.Pond.ajaxRequest(this.href,{setLoading:true,onSuccess:function(c){SAPO.Component.Dialog.info({message:c.responseText.replace(/\n/g,""),width:420,className:"modal",onComplete:function(){var d=s$("dialogClose");if(d!==null){Event.observe(d,"click",function(f){f.stop();SAPO.Component.Dialog.removeLayer()})}var e=s$("deleteDialog").getElementsByTagName("form")[0];SAPO.Pond.setCloseOnEsc();SAPO.Pond.setAcceptOnEnter(e)}})}})}.bindAsEventListener(a))};SAPO.Pond.confirmAccountAction=function(a){Event.observe(a,"click",function(b){if(b.target.tagName.toLowerCase()!="a"){return}if(/^remove_/.test(b.target.id)){b.stop();SAPO.Pond.ajaxRequest(b.target.href,{setLoading:true,onSuccess:function(c){SAPO.Component.Dialog.info({message:c.responseText.replace(/\n/g,""),width:420,className:"modal",onComplete:function(){var d=s$("dialogClose");if(d!==null){Event.observe(d,"click",function(f){f.stop();SAPO.Component.Dialog.removeLayer()})}var e=s$("deleteDialog").getElementsByTagName("form")[0];SAPO.Pond.setCloseOnEsc();SAPO.Pond.setAcceptOnEnter(e)}})}})}if(/^separate_/.test(b.target.id)){b.stop();SAPO.Pond.ajaxRequest(b.target.href,{setLoading:true,onSuccess:function(c){SAPO.Component.Dialog.info({message:c.responseText.replace(/\n/g,""),width:420,className:"modal",onComplete:function(){var d=s$("dialogClose");if(d!==null){Event.observe(d,"click",function(f){f.stop();SAPO.Component.Dialog.removeLayer()})}var e=s$("deleteDialog").getElementsByTagName("form")[0];SAPO.Pond.setCloseOnEsc();SAPO.Pond.setAcceptOnEnter(e)}})}})}}.bindAsEventListener(a))};SAPO.Pond.autoChangeLanguage=function(b){s$css.addClassName(Element.select(b,'input[type="submit"]')[0],"hidden");var a=b.getElementsByTagName("select")[0];Event.observe(a,"change",function(){this.submit()}.bind(b))};SAPO.Pond.toggleSidebarBoxes=function(g){var f=$$("h2.sideBarTitles");var b=$$(".sideBarChildren");var d,c,e=f.length;var a=function(j,h){j.stop();if(s$css.hasClassName(this,"hidden")){h.className="open";SAPO.Utility.Cookie.set("SAPOPond"+h.id,"open");s$css.removeClassName(this,"hidden")}else{h.className="closed";SAPO.Utility.Cookie.set("SAPOPond"+h.id,"closed");s$css.addClassName(this,"hidden")}};for(c=0;c<e;c++){d=f[c].getElementsByTagName("span")[0];if(d){SAPO.Pond.setSidebars(b[c],d);Element.observe(f[c],"click",a.bindAsEventListener(b[c],d))}}};SAPO.Pond.setSidebars=function(c,a){var b=SAPO.Utility.Cookie.get();if(typeof b["SAPOPond"+a.id]!="undefined"){if(b["SAPOPond"+a.id]=="open"){a.className="open";s$css.removeClassName(c,"hidden")}if(b["SAPOPond"+a.id]=="closed"){a.className="closed";s$css.addClassName(c,"hidden")}}};SAPO.Pond.setChainUpload=function(a){Event.observe(a,"submit",function(f){f.stop();if(SAPO.Pond.checkEmpty(a.file,"file_empty")){return false}var d=Element.select(a,"input[type=radio]");var c=false;for(var b=0,e=d.length;b<e;b++){if(d[b].checked===true){c=true}}if(!c){SAPO.Pond.showError(SAPO.Pond.messages.no_service_selected);return false}SAPO.Pond.initialFormAction=a.action;SAPO.Pond.setUnloadLock();SAPO.Pond.setFileToken(a)})};SAPO.Pond.setFileUpload=function(a){Event.observe(a,"submit",function(e){e.stop();if(SAPO.Pond.checkEmpty(a.SmallText,"title_empty")){return false}if(SAPO.Pond.checkEmpty(a.file,"file_empty")){return false}var f=Element.select(a,"input[type=checkbox]");var c=false;for(var b=0,d=f.length;b<d;b++){if(f[b].checked===true){c=true}}if(!c){SAPO.Pond.showError(SAPO.Pond.messages.no_service_selected);return false}SAPO.Pond.initialFormAction=a.action;SAPO.Pond.setUnloadLock();SAPO.Pond.setFileToken(a)})};SAPO.Pond.setFileToken=function(a){SAPO.Pond.uploadForm=a;a.appendChild(SAPO.Pond.createProgressBar());s$css.addClassName(Element.select(SAPO.Pond.uploadForm,"input[type=submit]")[0],"hidden");SAPO.Pond.ajaxRequest("/publish?action=get_filetoken",{setLoading:true,onSuccess:function(b){SAPO.Pond.uploadFileToken=b.responseText;if(!SAPO.Pond.uploadFileToken){SAPO.Pond.uploadCleanup();SAPO.Pond.showError(SAPO.Pond.messages.uploadfail);return false}a.target="fileuploader"+Math.ceil(Math.random()*10000);var d=a.action.match(/publish\?action=post_submit_(image|video)/);if(d===null){return false}a.action="/upload?Media="+d[1]+"&FileToken="+SAPO.Pond.uploadFileToken;var c;if(SAPO.Browser.IE){c=document.createElement('<iframe id="iframeFormSubmit" src="" name="'+a.target+'" height="0" width="0">')}else{c=document.createElement("IFRAME");c.setAttribute("id","iframeFormSubmit");c.setAttribute("name",a.target);c.src="";c.width=0;c.height=0}a.parentNode.appendChild(c);a.submit();SAPO.Pond.loaderInterval=setInterval(SAPO.Pond.updateLoader,1000)},onFailure:function(b){SAPO.Pond.uploadCleanup();SAPO.Pond.showError(SAPO.Pond.messages.uploadfail)}})};SAPO.Pond.updateLoader=function(){var a;if(SAPO.Pond.uploadForm.id.match(/timeline_add_(image|video)_form/)){a=SAPO.Pond.finishChainUpload}else{a=SAPO.Pond.finishNormalUpload}if(!SAPO.Pond.uploader.interval){clearTimeout(SAPO.Pond.loaderInterval);SAPO.Pond.loaderInterval=false;a();return}if(SAPO.Pond.uploader.value==100){return}SAPO.Pond.ajaxRequest("/status?FileToken="+SAPO.Pond.uploadFileToken+"&Json=true",{method:"get",onSuccess:function(c){var e,d,b;if(c.responseJSON.Result.Status=="200"){e=c.responseJSON.Response.State;d=c.responseJSON.Response.TotalLength;b=c.responseJSON.Response.UploadedLength;if(e=="waiting"){return}else{if(e=="uploading"){if(d>0){SAPO.Pond.uploader.value=b*100/d}}else{if(e=="completed"){SAPO.Pond.uploader.value=100}}}}else{clearTimeout(SAPO.Pond.loaderInterval);SAPO.Pond.loaderInterval=false;a(true)}},onFailure:function(b){clearTimeout(SAPO.Pond.loaderInterval);SAPO.Pond.loaderInterval=false;a(true)}})};SAPO.Pond.createProgressBar=function(){var a,b;a=s$("file_uploading_bar");if(a){return false}a=document.createElement("div");a.style.width="250px";a.style.display="block";a.id="file_uploading_bar";a.className="progressBarWrapper";b=document.createElement("input");b.type="text";b.readOnly=true;b.value="0%";b.style.width="35px";b.id="file_uploading_progress";b.className="progressBar";a.appendChild(b);SAPO.Pond.uploader={loader:a,progress:b,value:0,visibleValue:0,interval:setInterval(SAPO.Pond.updateProgressBar,100)};return a};SAPO.Pond.updateProgressBar=function(){if(SAPO.Pond.uploader.visibleValue>=100){clearInterval(SAPO.Pond.uploader.interval);SAPO.Pond.uploader.interval=false;SAPO.Pond.uploader.progress.style.width="246px";SAPO.Pond.uploader.progress.value="100%";return true}var a=SAPO.Pond.uploader.visibleValue+5;if(a>SAPO.Pond.uploader.value){a=SAPO.Pond.uploader.value}if(a>100){SAPO.Pond.uploader.visibleValue=100}else{SAPO.Pond.uploader.visibleValue=a}SAPO.Pond.uploader.progress.style.width=parseInt(SAPO.Pond.uploader.visibleValue*2,10)+36+"px";SAPO.Pond.uploader.progress.value=parseInt(SAPO.Pond.uploader.visibleValue,10)+"%"};SAPO.Pond.finishNormalUpload=function(a){if(typeof a=="undefined"){a=false}else{a=true}if(!a){SAPO.Pond.uploadForm.file.parentNode.removeChild(SAPO.Pond.uploadForm.file);var b=document.createElement("INPUT");b.type="hidden";b.value=SAPO.Pond.uploadFileToken;b.name="FileToken";SAPO.Pond.uploadForm.appendChild(b);SAPO.Pond.uploadCleanup();SAPO.Pond.uploadForm.submit()}else{SAPO.Pond.uploadCleanup();SAPO.Pond.showError(SAPO.Pond.messages.uploadfail)}};SAPO.Pond.finishChainUpload=function(b){if(typeof b=="undefined"){b=false}else{b=true}if(!b){SAPO.Pond.uploadForm.action="/publish?action=chain_post";var d=Element.select(SAPO.Pond.uploadForm,"input[name=SmallText]")[0];d.value=SAPO.Pond.uploadForm.file.value.match(/([^\\^\/]*)$/)[1];SAPO.Pond.uploadForm.file.value="";var a=Element.select(SAPO.Pond.uploadForm,"input[name=FileToken]")[0];a.value=SAPO.Pond.uploadFileToken;var c=s$("iframeFormSubmit");Event.observe(c,"load",function(h){var g,e;try{e=SAPO.Utility.String.evalJSON(this.contentWindow.document.body.innerHTML);g=true}catch(f){g=false}SAPO.Pond.uploadCleanup();if(g){shortTextForm=s$("short_text_form");if(shortTextForm.SmallText.value.length>0){shortTextForm.SmallText.value+=(" "+e.ShortURL)}else{shortTextForm.SmallText.value=e.SmallText}shortTextForm.ChainPostID.value=e.ChainPostID;SAPO.Pond.showTimelineShortPost()}else{SAPO.Pond.showError(SAPO.Pond.messages.uploadfail)}}.bindAsEventListener(c));SAPO.Pond.uploadForm.submit()}else{SAPO.Pond.showError(SAPO.Pond.messages.uploadfail);SAPO.Pond.uploadCleanup()}};SAPO.Pond.uploadCleanup=function(){if(SAPO.Pond.uploader.interval){clearTimeout(SAPO.Pond.uploader.interval);SAPO.Pond.uploader.interval=false}if(SAPO.Pond.loaderInterval){clearTimeout(SAPO.Pond.loaderInterval);SAPO.Pond.loaderInterval=false}var b=s$("iframeFormSubmit");if(b){b.parentNode.removeChild(b)}SAPO.Pond.removeUnloadLock();var c=s$("file_uploading_bar");if(c){c.parentNode.removeChild(c)}SAPO.Pond.uploadFileToken=false;SAPO.Pond.uploader.value=0;SAPO.Pond.uploader.visibleValue=0;SAPO.Pond.uploader=false;SAPO.Pond.uploadForm.action=SAPO.Pond.initialFormAction;SAPO.Pond.uploadForm.target="";var a=Element.select(SAPO.Pond.uploadForm,"input[type=submit]")[0];if(s$css.hasClassName(a,"hidden")){s$css.removeClassName(a,"hidden")}};SAPO.Pond.getFuzzyTime=function(a,d){var c=function(f,e){return SAPO.Pond.messages[e+((f>1)?"s":"")].replace("%d",f)};var b=a-d;if(d===0){c=SAPO.Pond.messages.fuzzy_never}else{if(b>=31557600){return c(Math.floor(b/31557600),"fuzzy_year")}else{if(b>=2629800){return c(Math.floor(b/2629800),"fuzzy_month")}else{if(b>=604800){return c(Math.floor(b/604800),"fuzzy_week")}else{if(b>=86400){return c(Math.floor(b/86400),"fuzzy_day")}else{if(b>=3600){return c(Math.floor(b/3600),"fuzzy_hour")}else{if(b>=60){return c(Math.floor(b/60),"fuzzy_minute")}else{if(b>0){return c(0,"fuzzy_second")}else{if(b===0){return SAPO.Pond.messages.fuzzy_now}else{return SAPO.Pond.messages.fuzzy_future}}}}}}}}}};SAPO.Pond.updateFuzzyTimes=function(){var a=$$(".timestamp_hidden");var b=0;var d=parseInt((new Date().getTime())/1000,10);for(var e=0,c=a.length;e<c;e++){b=parseInt(a[e].innerHTML,10);s$(a[e].id.replace("_","_target_")).value=SAPO.Pond.getFuzzyTime(d,b)}};SAPO.Pond.defaultStyle=function(){var b=document.createElement("STYLE");b.media="screen";b.type="text/css";var d="";d+=".node:hover {";d+="-moz-box-shadow:0 0 0 transparent;";d+="-webkit-box-shadow:0 0 0 transparent;";d+="box-shadow:0 0 0 transparent;";d+="background: transparent;";d+="} ";d+=".node:hover .nodeactions ul.nodeoptions {";d+="visibility: hidden;";d+="} ";if(typeof b.styleSheet!=="undefined"){b.styleSheet.cssText=d}else{b.appendChild(document.createTextNode(d))}var a=document.getElementsByTagName("head")[0];var c=document.getElementsByTagName("title")[0];a.insertBefore(b,c.nextSibling)};SAPO.Pond.setVivoShadows=function(a){for(i=0;i<a.length;i++){molduras=Element.select(a[i],".moldura");centers=Element.select(a[i],".s_center");if(centers.length>0&&molduras.length>0){style="height: "+(parseInt(s$css.getStyle(molduras[0],"height"))-250)+"px;";s$css.setStyle(centers[0],style);s$css.setStyle(centers[0],"background-repeat: repeat-y;")}}};SAPO.Pond.isVivoPhone=function(b,a){return false};SAPO.Pond.signupActions=function(l){Event.observe(l,"submit",function(D){var E=this.Username;if(E.value.length<1){D.stop();SAPO.Pond.showError(SAPO.Pond.messages.username_empty);return false}E=this.Email;if(E.value===""){D.stop();SAPO.Pond.showError(SAPO.Pond.messages.email_empty);return false}E=this.Password;if(E.value.length<SAPO.Pond.passwordMinSize){D.stop();SAPO.Pond.showError(SAPO.Pond.messages.password_size);return false}if(this.Password.value!=this.PasswordConfirmation.value){D.stop();SAPO.Pond.showError(SAPO.Pond.messages.password_unmatched);return false}}.bindAsEventListener(l));var z=s$("btnContinue");var y=s$("btnChangePhone");if(z){Event.observe(z,"click",function(E){var D=s$("signup_form");if(!D.DDD.value||!D.Number.value){return false}else{D.DDD.disable();D.Number.disable();this.addClassName("hidden");y.removeClassName("hidden");if(SAPO.Pond.isVivoPhone(D.DDD.value,D.Number.value)){s$("vol_password_fields").removeClassName("hidden")}else{s$("vivolog_password_fields").removeClassName("hidden")}}}.bindAsEventListener(z))}if(y){Event.observe(y,"click",function(E){E.stop();var D=s$("signup_form");D.DDD.enable();D.Number.enable();this.addClassName("hidden");z.removeClassName("hidden");s$("vol_password_fields").addClassName("hidden");s$("vivolog_password_fields").addClassName("hidden")}.bindAsEventListener(y))}var k=s$("phoneNumberEmptyError");var n=s$("DDD");var C=s$("Number");if(k){var B=function(D){if(n&&C){if(n.value.length>0&&C.value.length>0){k.addClassName("hidden");z.enable();return true}}k.removeClassName("hidden");z.disable();return false};Event.observe(n,"change",B);Event.observe(n,"keyup",B);Event.observe(n,"keydown",B);Event.observe(n,"keypress",B);Event.observe(C,"change",B);Event.observe(C,"keyup",B);Event.observe(C,"keydown",B);Event.observe(C,"keypress",B)}var s=new SAPO.Component.Passwordmeter({meter:"points",elmParentMeter:"meter_point_parent",classNameMeter:"meter_point"});var c=s$("Password");Event.observe(c,"keyup",function(E,D){D.set(this.value)}.bindAsEventListener(c,s));var h=s$("Username");var o=s$("checkUsername");var u=s$("checkUsernameSuccess");var q=s$("checkUsernameError");var A=function(){clearTimeout(SAPO.Pond.usernameTimeout);SAPO.Pond.usernameTimeout=false};Event.observe(h,"keydown",function(D){if(!((D.keyCode>=65&&D.keyCode<=90)||(D.keyCode>=48&&D.keyCode<=57&&D.shiftKey===false)||(D.keyCode===109)||(D.keyCode===190&&D.shiftKey===false)||D.keyCode===8||D.keyCode===9||D.keyCode===13||(D.keyCode>=35&&D.keyCode<=40)||D.keyCode===45||D.keyCode===46||(D.keyCode>=96&&D.keyCode<=105))||D.keyCode===0||(D.keyCode===0&&D.shiftKey===true)){SAPO.Pond.usernameCheck=false;D.stop()}else{SAPO.Pond.usernameCheck=true}});Event.observe(h,"keypress",function(D){if(!SAPO.Pond.usernameCheck){D.stop()}});Event.observe(h,"keyup",function(D){D.stop();if(h.value.length<2||s$css.hasClassName(h,"loading")||!SAPO.Pond.usernameCheck){if(h.value.length<2){s$css.removeClassName(h,"loading");s$css.removeClassName(h,"ok");s$css.addClassName(u,"hidden");s$css.addClassName(q,"hidden")}return false}s$css.removeClassName(h,"ok");s$css.removeClassName(h,"error");s$css.addClassName(h,"loading");if(SAPO.Pond.usernameTimeout!==false){A()}SAPO.Pond.usernameTimeout=setTimeout(function(){SAPO.Pond.ajaxRequest("/signup?action=user_exists&Username="+h.value,{onSuccess:function(E){s$css.addClassName(o,"hidden");s$css.removeClassName(h,"loading");s$css.addClassName(h,"ok");s$css.removeClassName(u,"hidden");s$css.addClassName(q,"hidden");A()},onFailure:function(E){s$css.addClassName(o,"hidden");s$css.removeClassName(h,"loading");if(E.status==409){s$css.addClassName(h,"error");s$css.addClassName(u,"hidden");s$css.removeClassName(q,"hidden")}else{s$css.removeClassName(h,"ok")}A()}})},700)}.bindAsEventListener(l));var v=s$("Email");var x=s$("EmailConf");var m=s$("emailSuccess");var a=s$("emailConfSuccess");var d=s$("emailError");var f=s$("emailConfError");var e=function(D){D.stop();if(v.value.length===0){return false}if(!SAPO.Utility.Validator.mail(v.value)){s$css.addClassName(m,"hidden");s$css.removeClassName(d,"hidden")}else{s$css.removeClassName(m,"hidden");s$css.addClassName(d,"hidden")}};var g=function(D){D.stop();if(SAPO.Pond.getLock("emailConfirmation")===false&&D.target===x){SAPO.Pond.setLock("emailConfirmation")}if(SAPO.Pond.getLock("emailConfirmation")){s$css.removeClassName(f,"hidden");if(v.value===x.value&&v.value.length>0&&x.value.length>0){s$css.addClassName(f,"hidden");s$css.removeClassName(a,"hidden");return false}s$css.addClassName(a,"hidden");s$css.removeClassName(f,"hidden");if(x.value.length===0){s$css.addClassName(a,"hidden");s$css.addClassName(f,"hidden")}}};Event.observe(v,"keyup",e);if(x){Event.observe(v,"keyup",g);Event.observe(x,"keyup",g)}var b=s$("Password");var t=s$("passwordSize");Event.observe(b,"keyup",function(D){D.stop();s$css.addClassName(t,"error");if(b.value.length<SAPO.Pond.passwordMinSize){s$css.removeClassName(t,"success");s$css.addClassName(t,"error")}else{s$css.removeClassName(t,"error");s$css.addClassName(t,"success")}});var j=s$("PasswordConfirmation");var w=s$("passwordConfirmationSuccess");var p=s$("passwordConfirmationError");var r=function(D){D.stop();if(SAPO.Pond.getLock("passwordConfirmation")===false&&D.target===j){SAPO.Pond.setLock("passwordConfirmation")}if(SAPO.Pond.getLock("passwordConfirmation")){s$css.removeClassName(p,"hidden");if(b.value===j.value&&b.value.length>0&&j.value.length>0){s$css.addClassName(p,"hidden");s$css.removeClassName(w,"hidden");return false}s$css.addClassName(w,"hidden");s$css.removeClassName(p,"hidden");if(j.value.length===0){s$css.addClassName(w,"hidden");s$css.addClassName(p,"hidden")}}};Event.observe(b,"keyup",r);Event.observe(j,"keyup",r)};SAPO.Pond.timelinePublishActions=function(f){Event.observe(f,"mouseover",function(g){if(SAPO.Pond.closePublishTimeout){clearTimeout(SAPO.Pond.closePublishTimeout);SAPO.Pond.closePublishTimeout=false}if(SAPO.Pond.openPublishTimeout){return false}SAPO.Pond.openPublishTimeout=setTimeout(function(){var h=s$("short_text_form_options");s$css.removeClassName(h,"hidden");SAPO.Pond.openPublishTimeout=false},500)}.bindAsEventListener(f));Event.observe(f,"mouseout",function(g){if(SAPO.Pond.openPublishTimeout){clearTimeout(SAPO.Pond.openPublishTimeout);SAPO.Pond.openPublishTimeout=false}if(SAPO.Pond.closePublishTimeout){return false}SAPO.Pond.closePublishTimeout=setTimeout(function(){if(SAPO.Pond.statusTextHasFocus){return false}var h=s$("short_text_form_options");s$css.addClassName(h,"hidden");SAPO.Pond.openPublishTimeout=false},500)}.bindAsEventListener(f));var e=s$("timelineStatusText");Event.observe(e,"focus",function(g){SAPO.Pond.statusTextHasFocus=true;if(SAPO.Pond.closePublishTimeout){clearTimeout(SAPO.Pond.closePublishTimeout);SAPO.Pond.closePublishTimeout=false}if(SAPO.Pond.openPublishTimeout){return false}SAPO.Pond.openPublishTimeout=setTimeout(function(){var h=s$("short_text_form_options");s$css.removeClassName(h,"hidden");SAPO.Pond.openPublishTimeout=false},500)}.bindAsEventListener(f));Event.observe(e,"blur",function(g){SAPO.Pond.statusTextHasFocus=false}.bindAsEventListener(f));var c=s$("short_text_add_image");if(c){Event.observe(c,"click",function(h){h.stop();var g=s$("short_text_form");s$css.addClassName(g,"hidden");var j=s$("timeline_add_image_form");s$css.removeClassName(j,"hidden")}.bindAsEventListener(f));var a=s$("chain_image_go_back");Event.observe(a,"click",SAPO.Pond.showTimelineShortPost)}var b=s$("short_text_add_video");if(b){Event.observe(b,"click",function(j){j.stop();var g=s$("short_text_form");s$css.addClassName(g,"hidden");var h=s$("timeline_add_video_form");s$css.removeClassName(h,"hidden")}.bindAsEventListener(f));var d=s$("chain_video_go_back");Event.observe(d,"click",SAPO.Pond.showTimelineShortPost)}};SAPO.Pond.showTimelineShortPost=function(c){if(c){c.stop()}var d=s$("timeline_add_image_form");var b=s$("timeline_add_video_form");var a=s$("short_text_form");if(!s$css.hasClassName(d,"hidden")){s$css.addClassName(d,"hidden")}if(!s$css.hasClassName(b,"hidden")){s$css.addClassName(b,"hidden")}if(s$css.hasClassName(a,"hidden")){s$css.removeClassName(a,"hidden")}};document.observe("pond:ready",function(){var b=false;s$css=SAPO.Dom.Css;b=$$(".pagination");if(!b.length){b=$$(".viewactions")}if(b.length){SAPO.Pond.viewActionsTop(b);SAPO.Pond.viewActionsBottom(b)}b=s$("userMessages");if(b!==null){Element.observe(b.getElementsByTagName("a")[0],"click",function(c){c.stop();SAPO.Pond.autoHideMessage()}.bindAsEventListener(b));var a=s$("userMessageContent");if(a.innerHTML!==""){SAPO.Pond.showDropdownPopup(a.innerHTML)}}b=s$("language_selection");if(b!==null){SAPO.Pond.autoChangeLanguage(b)}b=s$("sidebar");if(b!==null){SAPO.Pond.toggleSidebarBoxes(b)}b=s$("view_options_form");if(b!==null){SAPO.Pond.timelineFilters(b)}b=s$("add_friend");if(b!==null){SAPO.Pond.addFriends(b)}b=s$("discover_sources");if(b!==null){SAPO.Pond.discoverSourcesSection(b)}b=s$("events");if(b!==null){SAPO.Pond.setTimelineActions(b);if(SAPO.Pond.kbdShortcuts){SAPO.Pond.defaultStyle();SAPO.Pond.setEventSelection(b)}}if((b=Element.select(document,".newevents")).length){SAPO.Pond.setCheckNewEvents(b)}b=s$("short_text_form");if(b!==null){SAPO.Pond.shortTextPost(b);SAPO.Pond.enablePunyUrl(b);SAPO.Pond.saveServicePreferences(b)}b=$$(".addstuff");if(b.length>0){if(b[0]!==null){SAPO.Pond.addStuff(b[0])}}b=$$(".sombra");if(b.length>0){SAPO.Pond.setVivoShadows(b)}b=s$("entity_mosaic");if(b!==null){SAPO.Pond.dragAndDrop(b)}else{b=s$("mergeBox");if(b!==null){SAPO.Pond.setMergeBoxGeneralEvents(b)}}b=s$("link_delete_entity");if(b!==null){SAPO.Pond.confirmEntityDelete(b)}b=s$("my_stuff_accounts");if(b!==null){SAPO.Pond.confirmAccountAction(b)}b=s$("my_stuff_datasources");if(b!==null){SAPO.Pond.confirmAccountAction(b)}b=s$("entity_datasources");if(b!==null){SAPO.Pond.confirmAccountAction(b)}b=s$("entity_accounts");if(b!==null){SAPO.Pond.confirmAccountAction(b)}b=s$("notification_list");if(b!==null){SAPO.Pond.setNotifications(b)}b=s$("form_file_upload");if(b!==null){SAPO.Pond.setFileUpload(b)}b=s$("timeline_add_image_form");if(b!==null){SAPO.Pond.setChainUpload(b)}b=s$("timeline_add_video_form");if(b!==null){SAPO.Pond.setChainUpload(b)}b=s$("signup_form");if(b!==null){SAPO.Pond.signupActions(b)}b=s$("short_text_partial");if(b!==null){SAPO.Pond.timelinePublishActions(b)}SAPO.Pond.pondTokenItems=Element.select(document,'input[name="FormToken"]');SAPO.Pond.setFormToken(SAPO.Pond.pondTokenItems[0].value);Element.observe(document,"dblclick",function(c){c.stop()}.bindAsEventListener(window))});