var nativeSplit=nativeSplit||String.prototype.split;String.prototype.split=function(I,D){if(!(I instanceof RegExp)){return nativeSplit.apply(this,arguments)}if(D===undefined||+D<0){D=false}else{D=Math.floor(+D);if(!D){return[]}}var C=(I.global?"g":"")+(I.ignoreCase?"i":"")+(I.multiline?"m":""),G=new RegExp("^"+I.source+"$",C),B=[],A=0,E=0,F;if(!I.global){I=new RegExp(I.source,"g"+C)}while((!D||E++<=D)&&(F=I.exec(this))){var H=!F[0].length;if(H&&I.lastIndex>F.index){I.lastIndex=F.index}if(I.lastIndex>A){if(F.length>1){F[0].replace(G,function(){for(var J=1;J<arguments.length-2;J++){if(arguments[J]===undefined){F[J]=undefined}}})}B=B.concat(this.slice(A,F.index),(F.index===this.length?[]:F.slice(1)));A=I.lastIndex}if(H){I.lastIndex++}}return(A===this.length)?(I.test("")?B:B.concat("")):(D?B:B.concat(this.slice(A)))};Element.addMethods({removeAllChildren:function(A){while(A.lastChild){A.removeChild(A.lastChild)}},update2:function(A,B){if(B.nodeType){A.removeAllChildren();A.appendChild(B)}else{A.innerHTML=B}},$$:function(A,B){var C=A.select("."+B);return C.length!=0?C[0]:null},$$$:function(A,C){var B=A.select(C);return B.length!=0?B[0]:null},getBounds:function(B){var C=B.cumulativeOffset();var A=B.getDimensions();return new Rectangle(C.left,C.top,A.width,A.height)}});Object.extend(Event,{wheel:function(A){var B=0;if(!A){A=window.event}if(A.wheelDelta){B=A.wheelDelta/120;if(window.opera){B=-B}}else{if(A.detail){B=-A.detail/3}}return Math.round(B)}});var g_today=getToday();function parseDateTime(A){var B=A.match("([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}):([0-9]{2})");return new Date(Date.UTC(B[1],parseInt(B[2],10)-1,B[3],B[4],B[5],B[6]))}function parseDate(A){var B=A.match("([0-9]{4})-([0-9]{2})-([0-9]{2})");return new Date(B[1],parseInt(B[2],10)-1,B[3])}function formatDate(A){return A.getFullYear()+"-"+show2(A.getMonth()+1)+"-"+show2(A.getDate())}function show2(A){return("0"+A).slice(-2)}function isSameDay(A,B){if(A==null||B==null){return false}else{return A.getDate()==B.getDate()&&A.getMonth()==B.getMonth()&&A.getFullYear()==B.getFullYear()}}function getTodayDate(){return g_today}function getToday(){var A=new Date();return new Date(A.getFullYear(),A.getMonth(),A.getDate())}function getCookie(B){var C=document.cookie.split(";");for(var E=0;E<C.length;++E){var D=C[E];var A=D.indexOf("=");if(A!=-1){if(D.substring(0,A).strip()==B){return decodeURIComponent(D.substring(A+1).strip())}}}return null}function setCookie(D,E,A){var B=null;if(A){var C=new Date();C.setTime(C.getTime()+A*24*60*60*1000);B=C.toGMTString()}else{B="Tue, 1-Jan-2030 00:00:00 GMT"}document.cookie=D+"="+encodeURIComponent(E)+";expires="+B+";path=/"}function deleteCookie(A){document.cookie=A+"=;expires=Tue, 1-Jan-1990 00:00:00 GMT;path=/"}AjaxUtil=Class.create({initialize:function(){},get:function(D,C,B,A){this.request(D,"GET",C,B,A)},post:function(D,C,B,A){this.request(D,"POST",C,B,A)},request:function(D,E,C,B,A){this.requestParams(D,E,C?Form.serialize(C,true):{},B,A)},requestParams:function(C,E,D,B,A){if(!A){A=error||alert}new Ajax.Request(C,{"method":E,"parameters":D||{},"evalJSON":false,"onSuccess":function(F){if(F.getResponseHeader("Content-Type").match(/^application\/json/)){if(F.responseText.length!=0){try{var H=this.evalJSON(F.responseText);if(B){B(H)}}catch(G){A([G.toString()])}}}else{B(F.responseText)}}.bind(this),"onFailure":function(F){if(F.getResponseHeader("Content-Type").match(/^application\/json/)){A(this.evalJSON(F.responseText))}else{if(F.getResponseHeader("Content-Type").match(/^text\/plain/)){A([F.responseText])}else{A([F.status+" "+F.statusText])}}}.bind(this)})},evalJSON:function(A){if(Prototype.Browser.WebKit){return A.slice(11,-3).evalJSON(false)}else{return A.evalJSON()}}});var Point=Class.create({initialize:function(A,B){this.x=A;this.y=B},clone:function(){return new Point(this.x,this.y)}});var Line=Class.create({initialize:function(B,A){this.p1=B;this.p2=A}});function ccw(G,E,C){var F=E.x-G.x;var B=E.y-G.y;var D=C.x-G.x;var A=C.y-G.y;if(F*A>B*D){return 1}else{if(F*A<B*D){return -1}else{if(F*D<0||B*A<0){return -1}else{if(F*F+B*B<D*D+A*A){return 1}else{return 0}}}}}function intersect(B,A){return ccw(B.p1,B.p2,A.p1)*ccw(B.p1,B.p2,A.p2)<=0&&ccw(A.p1,A.p2,B.p1)*ccw(A.p1,A.p2,B.p2)<=0}function inside(G,E){var H=E.length;E[-1]=E[H-1];E[H]=E[0];var A=new Line(G.clone(),G.clone());A.p2.x=10000;var F=0;var B=-1;for(var D=0;D<H;++D){var C=new Line(E[D],E[D]);if(!intersect(C,A)){if(D==B+1){C.p2=E[B];if(intersect(C,A)){++F}}else{if(ccw(A.p1,A.p2,E[D])*ccw(A.p1,A.p2,E[B])<0){++F}}B=D}}return(F&1)!=0}var Size=Class.create({initialize:function(A,B){this.width=A;this.height=B}});var Rectangle=Class.create({initialize:function(B,C,A,D){this.left=B;this.top=C;this.width=A;this.height=D},equals:function(A){return this.left==A.left&&this.top==A.top&&this.width==A.width&&this.height==A.height},clone:function(){return new Rectangle(this.left,this.top,this.width,this.height)}});function showErrorDialog(A){alert(getErrorString(A))}function getErrorString(A){if(A==null||A.length==0){return MESSAGES["error.unspecified"]}else{return MESSAGES[A[0]]||A[0]}}function getWindowWidth(){return Prototype.Browser.IE?document.documentElement.clientWidth:window.innerWidth}function getWindowHeight(){return Prototype.Browser.IE?document.documentElement.clientHeight:window.innerHeight}function getScrollHeight(){return Prototype.Browser.WebKit?document.body.scrollHeight:document.documentElement.scrollHeight}function observeInitialization(A){Event.observe(document,"dom:loaded",A)}Prototype.Browser.IE6=navigator.userAgent.indexOf("MSIE 6.0")>-1;var IE6={addClassName:function(B,A,D,C){if(Prototype.Browser.IE6){B.addClassName(D);B.removeClassName(C)}else{B.addClassName(A)}},removeClassName:function(B,A,D,C){if(Prototype.Browser.IE6){B.addClassName(C);B.removeClassName(D)}else{B.removeClassName(A)}}};var Menu=Class.create();Object.extend(Menu.prototype,{initialize:function(A){this.elem=A},layout:function(){var B=this.elem.getDimensions();var A=this.elem.$$("menuBg");A.setStyle({"width":B.width+"px","height":B.height+"px"});A.$$("menuBgLeft").setStyle({"height":(B.height-9)+"px"});A.$$("menuBgCenter").setStyle({"width":(B.width-18)+"px","height":(B.height-9)+"px"});A.$$("menuBgRight").setStyle({"height":(B.height-9)+"px"});A.$$("menuBgBottom").setStyle({"width":(B.width-18)+"px"});if(Prototype.Browser.IE){this.elem.select(".menuSeparator").each(function(C){C.setStyle({"width":(B.width-14)+"px"})})}}});if(typeof IEPNGFIX=="undefined"){var IEPNGFIX={blank:"/image/iepngfix.gif",filter:"DXImageTransform.Microsoft.AlphaImageLoader",fixit:function(B,C,D){if(B.filters[this.filter]){var A=B.filters[this.filter];A.enabled=true;A.src=C;A.sizingMethod=D}else{B.style.filter="progid:"+this.filter+'(src="'+C+'",sizingMethod="'+D+'")'}},fixwidth:function(A){if(A.currentStyle.width=="auto"&&A.currentStyle.height=="auto"){A.style.width=A.offsetWidth+"px"}},fixchild:function(D,A){if(!/MSIE (5\.5|6\.)/.test(navigator.userAgent)){return }for(var C=0,E=D.childNodes.length;C<E;C++){var B=D.childNodes[C];if(B.style){if(B.style.position){B.style.position=B.style.position}else{B.style.position="relative"}}if(A&&B.hasChildNodes()){this.fixchild(B,A)}}},fix:function(C){if(!/MSIE (5\.5|6\.)/.test(navigator.userAgent)){return }var A=C.currentStyle.backgroundImage||C.style.backgroundImage;if(C.tagName=="IMG"){this.fixwidth(C);this.fixit(C,C.src,"scale");C.src=this.blank;C.runtimeStyle.behavior="none"}else{if(A&&A!="none"){if(A.match(/^url[("']+(.*\.png)[)"']+$/i)){var B=RegExp.$1;this.fixwidth(C);C.style.backgroundImage="none";this.fixit(C,B,"scale");if(C.tagName=="A"&&C.style){if(!C.style.cursor){C.style.cursor="pointer"}}this.fixchild(C);C.runtimeStyle.behavior="none"}}}},hover:function(C,B){var A=C.style.backgroundImage;if(!A&&C.currentStyle){A=C.currentStyle.backgroundImage}if(C.tagName=="IMG"&&B){var D=C.src;C.onmouseover=function(){C.src=B;IEPNGFIX.fix(C)};C.onmouseout=function(){C.src=D;IEPNGFIX.fix(C)}}else{if(A&&A!="none"&&B){C.onmouseover=function(){C.style.backgroundImage="url("+B+")";IEPNGFIX.fix(C)};C.onmouseout=function(){C.style.backgroundImage=A;IEPNGFIX.fix(C)}}}IEPNGFIX.fix(C)}}}var g_canvasPreferences=null;var g_globalPreferences=null;var g_savePreferenceTimer=null;function restoreLocalPreferences(){if(g_canvasPreferences){var J=g_canvasPreferences.find(function(L){return L.canvasId==g_canvasId});if(J){if(PrefUtil.valid(J.originX)&&PrefUtil.valid(J.originY)){setOrigin(J.originX,J.originY)}if(PrefUtil.valid(J.showPrivate)&&g_canvasTypeFlags&CanvasType.FLAG_PRIVATE){setShowPrivate(J.showPrivate)}}}var D=true;var K=true;var B=null;var I=true;var G=null;var H=null;var E=true;var C=true;var A=null;var F=true;if(g_globalPreferences){var J=g_globalPreferences;K=PrefUtil.maybe(J.palettePinned,true);D=K&&PrefUtil.maybe(J.paletteVisible,true);B=PrefUtil.maybe(J.paletteLastUsedColor,null);E=PrefUtil.maybe(J.dockPinned,true);I=E&&PrefUtil.maybe(J.dockVisible,true);G=PrefUtil.maybe(J.dockWidth,null);H=PrefUtil.maybe(J.dockScrollPos,null);F=PrefUtil.maybe(J.panelPinned,true);C=F&&PrefUtil.maybe(J.panelVisible,true);A=PrefUtil.maybe(J.panelWidth,null);g_fontSize=PrefUtil.maybe(J.fontSize,100);g_dashboardShowAll=PrefUtil.maybe(J.dashboardShowAll,false)}g_panel.restore(A,C,F);g_dock.restore(G,H,I,E);g_palette.restore(K,D,B)}function loadLocalPreferences(){var D=getCookie("cp");if(D){try{g_canvasPreferences=D.evalJSON();if(g_canvasPreferences&&g_canvasPreferences.length>0&&PrefUtil.valid(g_canvasPreferences[0].length)){var A=[];g_canvasPreferences.each(function(H,G){var F={};["canvasId","originX","originY","zoom","showPrivate"].each(function(J,I){F[J]=H[I]});A[G]=F});setCookie("cp",A.toJSON());g_canvasPreferences=A}}catch(C){}}var B=getCookie("gp");if(B){try{g_globalPreferences=B.evalJSON();if(g_globalPreferences&&PrefUtil.valid(g_globalPreferences.length)){var E={};["panelVisible","dockWidth","dockScrollPos","dockVisible","palettePinned","paletteVisible","panelWidth","fontSize"].each(function(G,F){E[G]=g_globalPreferences[F]});setCookie("gp",Object.toJSON(E));g_globalPreferences=E}}catch(C){}}}function saveLocalPreferences(){if(g_savePreferenceTimer){clearTimeout(g_savePreferenceTimer)}g_savePreferenceTimer=setTimeout(_saveLocalPreferences,500)}function _saveLocalPreferences(){var B=!g_canvasPreferences?new Array():g_canvasPreferences.select(function(C){return C.canvasId!=g_canvasId});B.push({"canvasId":g_canvasId,"originX":g_origin.x,"originY":g_origin.y,"zoom":g_zoom,"showPrivate":g_canvasTypeFlags&CanvasType.FLAG_PRIVATE?g_showPrivate:false});while(B.length>10){B.shift()}setCookie("cp",B.toJSON());var A={"paletteVisible":false,"palettePinned":g_palette.isPinned(),"paletteLastUsedColor":g_palette.getLastUsedColor(),"dockVisible":g_dock.isVisible(),"dockWidth":g_dock.getWidth(),"dockScrollPos":g_dock.getScrollPos(),"dockPinned":g_dock.isPinned(),"panelVisible":g_panel.isVisible(),"panelWidth":g_panel.getWidth(),"panelPinned":g_panel.isPinned(),"fontSize":g_fontSize,"dashboardShowAll":g_dashboardShowAll};if(g_palette.isExpandable()){A.paletteVisible=g_palette.isExpanded()}else{if(g_globalPreferences){A.paletteVisible=g_globalPreferences.paletteExpanded||false}}setCookie("gp",Object.toJSON(A))}var PrefUtil={valid:function(A){return !Object.isUndefined(A)},maybe:function(A,B){return PrefUtil.valid(A)?A:B}};var CANVAS_SIZE=new Size(2000,1600);var MIN_ENTRY_SIZE=new Size(150,60);var ENTRY_SIZE_MARGIN=new Size(20,35);var MAX_AUTO_ENTRY_SIZE=new Size(300,800);var DOCK_ENTRY_DRAG_OFFSET=new Point(5,5);var FIRST_LOAD_LIMIT=25;var LOAD_STEP=5;var MIN_RELOAD_DURATION=60*1000;var MAX_RELOAD_DURATION=3*60*1000;var DEFAULT_RELOAD_DURATION=60*1000;var INITIAL_RELOAD_DURATION=60*1000;var MIN_GROUP_RELOAD_DURATION=10*1000;var INITIAL_GROUP_RELOAD_DURATION=15*1000;var NEW_ENTRY_MODE_ZINDEX=10300;var CanvasType={MY:0,REFERENCE:1,INBOX:2,GROUP:3,FLAG_NEW:1,FLAG_DUE:2,FLAG_TAG:4,FLAG_SEND:8,FLAG_PRIVATE:16,FLAG_DOCK:32,FLAG_CALENDAR:64,FLAG_ZINDEX:128};var g_userId=null;var g_canvasId=null;var g_canvasType=null;var g_canvasTypeFlags=false;var g_canvasPath=null;var g_groupId=null;var g_groupName=null;var g_groupOwnerId=null;var g_hasFriends=false;var g_today=null;var g_entries=new Array();var g_embedded=false;var g_origin=new Point(0,0);var g_zoom=1;var g_loadEntriesTimer=null;var g_tags=new Array();var g_reloadDuration=INITIAL_RELOAD_DURATION;var g_reloadDurationCount=3;var g_reloadTimer=null;var g_reloading=null;var g_showPrivate=false;var g_fontSize=100;var g_hideMovie=0;var g_movieEntry=null;var g_newEntryMode=false;var g_newEntryElems=[];var g_currentNewEntryElem=null;var g_currentNewEntryHilight=false;var g_dashboardShowAll=false;var g_init=false;var g_palette=null;var g_dock=null;var g_panel=null;var g_popup=null;var g_search=null;var g_notification=null;var g_movieNotification=null;var g_dashboard=null;observeInitialization(function(){if(g_groupId){MIN_RELOAD_DURATION=MIN_GROUP_RELOAD_DURATION;INITIAL_RELOAD_DURATION=INITIAL_GROUP_RELOAD_DURATION}g_reloadDuration=INITIAL_RELOAD_DURATION;initBackground();loadLocalPreferences();g_palette=new Palette(newEntryStartDrag);g_dock=new Dock();g_panel=new Panel($("canvasView"),g_canvasTypeFlags&CanvasType.FLAG_CALENDAR);g_notification=new Notification($("notification"));g_movieNotification=new MovieNotification($("movieNotification"));if(g_embedded){initializeEntries()}else{loadEntries()}$("canvas").observe("mousedown",originStartDrag);function A(){return !g_dialogsStub.isDialogVisible()&&!g_preferenceStub.isVisible()&&(!g_dashboard||!g_dashboard.isVisible())}if(g_canvasTypeFlags&CanvasType.FLAG_NEW){Event.observe(document,"keydown",function(F){if(49<=F.keyCode&&F.keyCode<49+g_palette.PALETTE_ENTRIES.length&&A()){var E=g_palette.PALETTE_ENTRIES[F.keyCode-49];var G=new NewEntry(E.color,E.type,E.width,E.height);g_dialogsStub.bind(function(H){switch(E.type){case NewEntry.TYPE_NORMAL:H.showNewEntryDialog(G);break;case NewEntry.TYPE_IMAGE:H.showImageEntryDialog(G);break;case NewEntry.TYPE_MOVIE:H.showMovieEntryDialog(G);break}});F.stop()}},true)}Event.observe(document,"keydown",function(E){if(E.keyCode==77&&A()){toggleNewEntryMode()}else{if(g_newEntryMode&&(E.keyCode==37||E.keyCode==80||E.keyCode==75)&&A()){previousNewEntry()}else{if(g_newEntryMode&&(E.keyCode==39||E.keyCode==78||E.keyCode==74)&&A()){nextNewEntry()}else{if(g_newEntryMode&&(E.keyCode==27)&&A()){leaveNewEntryMode()}}}}},true);g_dock.load.bind(g_dock).defer();layoutCanvasView();$("main").setStyle({visibility:"visible"});restoreLocalPreferences();g_dock.adjustWidth();saveLocalPreferences();var B=$("ad");if(B){var D=$("getAdPositionForm");D.windowWidth.value=getWindowWidth();D.windowHeight.value=getWindowHeight();new AjaxUtil().get("/api/canvas/adPosition",D,function(E){B.setStyle({"left":E.left+"px","top":E.top+"px","display":"block"})},function(){})}var C=$("recommendation");if(Prototype.Browser.IE&&!$("trialBanner")&&!getCookie("ieRec")){C.show();C.remove.bind(C).delay(30);setCookie("ieRec","1",7)}else{C.remove()}g_init=true});Event.observe(window,"resize",function(){if(!g_init){return }layoutCanvasView();updateEntriesVisibility();g_dock.adjustWidth();setOrigin(g_origin.x,g_origin.y)});function initBackground(){if(window!=window.top){$(document.body).setStyle({"background":"transparent url(/image/anywherebg.png)"});$("canvas").setStyle({"background":"transparent none"})}}function showBackground(){if(window!=window.top){$(document.body).setStyle({"background":"transparent url(/image/anywherebg.png)"})}}function hideBackground(){if(window!=window.top){$(document.body).setStyle({"background":"transparent none"})}}function initializeEntries(){var A=!(g_canvasTypeFlags&CanvasType.FLAG_PRIVATE)||!g_showPrivate;g_entries.each(function(B){var C=getEntryElemFromId(B.id);B.maskStatus=0;Entry.bind(B,C);updateContentSize(C,C.getWidth(),C.getHeight());if(B.isFlag(Entry.FLAG_AUTOHIDE)){setupAutoHide(B,C)}g_panel.initializeEntry(B);if(A&&B.intimate){B.maskPrivate()}C.observe("mouseover",installHandlers)});updateEntriesVisibility();if(g_entries.length>=120){info("canvas.info.tooManyEntries")}}var MovingOrigin=Class.create({initialize:function(C,B,A,D){this.originX=C;this.originY=B;this.offsetX=A;this.offsetY=D}});var movingOrigin=null;function originStartDrag(C){if(!C.isLeftClick()){return }if(movingOrigin!=null){originEndDrag(C)}var B=C.pointerX();var E=C.pointerY();var A=$("canvas").select(".entry");for(var D=0;D<A.length;++D){if(Position.within(A[D],B,E)){return }}movingOrigin=new MovingOrigin(g_origin.x,g_origin.y,B,E);Event.observe(document,"mousemove",originDrag);Event.observe(document,"mouseup",originEndDrag);C.stop()}function originEndDrag(A){originDrag(A);Event.stopObserving(document,"mousemove",originDrag);Event.stopObserving(document,"mouseup",originEndDrag);movingOrigin=null}function originDrag(A){setOrigin(movingOrigin.originX+(movingOrigin.offsetX-A.pointerX()),movingOrigin.originY+(movingOrigin.offsetY-A.pointerY()));A.stop()}function setOrigin(A,C){var B=$("canvasView").getDimensions();g_origin.x=Math.max(0,Math.min(A,CANVAS_SIZE.width-Math.floor(B.width/g_zoom)));g_origin.y=Math.max(0,Math.min(C,CANVAS_SIZE.height-Math.floor(B.height/g_zoom)));$("canvas").setStyle({"left":-Math.floor(g_origin.x*g_zoom)+"px","top":-Math.floor(g_origin.y*g_zoom)+"px"});updateEntriesVisibility();g_panel.layout();saveLocalPreferences()}function ensureEntryElemVisible(D){var B=D.visible();if(!B){D.show()}var G=D.positionedOffset();var C=D.getDimensions();if(!B){D.hide()}var F=$("canvasView").getDimensions();var A=G.left-Math.floor((F.width-C.width)/2);var E=G.top-Math.floor((F.height-C.height)/3);if(A!=g_origin.x||E!=g_origin.y){setOrigin(A,E)}flushEntryElem(D)}function flushEntryElem(C){var B=C.getBounds();var A=new Rectangle(B.left-200,B.top-200,B.width+400,B.height+400);showEffect(A,B,Entry.getSolidColor(C.entry.color))}function showEffect(A,E,B,D){var C=new Element("div");document.body.appendChild(C);C.setStyle({"position":"absolute","left":A.left+"px","top":A.top+"px","width":A.width+"px","height":A.height+"px","zIndex":20000,"backgroundColor":B,"opacity":0.5});var G=0;var F=function(){if(G<10){C.setStyle({"left":Math.floor((A.left*(10-G)+E.left*G)/10)+"px","top":Math.floor((A.top*(10-G)+E.top*G)/10)+"px","width":Math.floor((A.width*(10-G)+E.width*G)/10)+"px","height":Math.floor((A.height*(10-G)+E.height*G)/10)+"px"});++G;F.delay(0.03)}else{C.remove();if(D){D()}}};F.defer()}function updateCanvasDragPosition(){var A=$("canvas").cumulativeOffset();$("canvasDrag").setStyle({"left":A.left+"px","top":A.top+"px"})}var NewEntry=Class.create({initialize:function(B,D,C,A){this.color=B;this.type=D;this.fontSize=100;this.left=0;this.top=0;this.width=C||280;this.height=A||200}});NewEntry.TYPE_NORMAL=0;NewEntry.TYPE_IMAGE=1;NewEntry.TYPE_MOVIE=2;var newEntry=null;function newEntryStartDrag(D,A){if(newEntry!=null){newEntryEndDrag(D)}newEntry=new NewEntry(A.color,A.type,A.width,A.height);updateCanvasDragPosition();var B=$("canvas").cumulativeOffset();var E=new Point(D.pointerX()-B.left-20,D.pointerY()-B.top-20);var C=$("newEntryDrag");C.setStyle({"left":E.x+"px","top":E.y+"px","width":ls2ps(A.width)+"px","height":ls2ps(A.height)+"px"});C.show();updateEntryBackgroundColor(C,TYPE_NORMAL,newEntry.color);updateEntryBackgroundSize(C,null);Event.observe(document,"mousemove",newEntryDrag);Event.observe(document,"mouseup",newEntryEndDrag)}function newEntryEndDrag(A){var C=$("newEntryDrag");var H=A.pointerX();var F=A.pointerY();if(Position.within($("canvasView"),H,F)&&Position.within($("canvas"),H,F)){var E=$("canvas").cumulativeOffset();var G=new Point(H-E.left-20,F-E.top-20);var I=C.getDimensions();var B=Position.within(g_palette.element(),H,F);newEntry.left=B?0:px2lx(G.x);newEntry.top=B?0:py2ly(G.y);newEntry.width=ps2ls(I.width);newEntry.height=ps2ls(I.height);var D=newEntry;g_dialogsStub.bind(function(J){switch(D.type){case NewEntry.TYPE_NORMAL:J.showNewEntryDialog(D,C);break;case NewEntry.TYPE_IMAGE:J.showImageEntryDialog(D,C);break;case NewEntry.TYPE_MOVIE:J.showMovieEntryDialog(D,C);break}if(B){C.hide()}});if(!g_palette.isPinned()){g_palette.collapse()}}else{C.hide()}newEntry=null;Event.stopObserving(document,"mousemove",newEntryDrag);Event.stopObserving(document,"mouseup",newEntryEndDrag);A.stop()}function newEntryDrag(C){var B=$("canvas").cumulativeOffset();var A=C.pointerX()-B.left-20;var D=C.pointerY()-B.top-20;$("newEntryDrag").setStyle({"left":A+"px","top":D+"px"});C.stop()}function loadEntries(){cancelReloading();var A=$("getEntriesForm");new AjaxUtil().get("/api/entry/gets",A,updateEntries,error)}function updateEntries(C){if(g_loadEntriesTimer){clearTimeout(g_loadEntriesTimer);g_loadEntriesTimer=null}clearEntries();if(C.length>=120){info("canvas.info.tooManyEntries")}C.each(function(H){Entry.prebind(H);g_entries.push(H)});var B=FIRST_LOAD_LIMIT;if(C.length>FIRST_LOAD_LIMIT){var A=new Array();var E=new Array();var G=$("canvasView").getDimensions();C.each(function(H){(isEntryInCanvasView(G,H)?A:E).push(H)});A.sort(function(I,H){return H.getUpdated().getTime()-I.getUpdated().getTime()});B=Math.min(B,A.length);C=A.concat(E)}for(var F=0;F<Math.min(B,C.length);++F){insertEntryElem(C[F],false,false)}handleQueryParams();if(F<C.length){var D=function(){if(F<C.length){var H=Math.min(F+LOAD_STEP,C.length);for(;F<H;++F){insertEntryElem(C[F],false,false)}g_loadEntriesTimer=setTimeout(D,0)}else{handleFragment();g_loadEntriesTimer=null;scheduleReloading()}};g_loadEntriesTimer=setTimeout(D,0)}else{handleFragment();scheduleReloading()}}function handleQueryParams(){var A=document.URL;var B=A.indexOf("?");if(B==-1){return }var D=A.indexOf("#",B+1);var C=D!=-1?A.substring(B+1,D):A.substring(B+1);var E=C.toQueryParams();switch(E.action){case"config":g_preferenceStub.bind(function(F){F.openConfig()});break;case"friends":g_preferenceStub.bind(function(F){F.openFriend()});break;case"newFriend":if(E.username){g_preferenceStub.bind(function(F){F.openFriend(E.username)})}break}}function handleFragment(){if(document.URL.match(/#e([0-9]+)$/)){var A=getEntryElemFromId(RegExp.$1);if(A){ensureEntryElemVisible(A);flushEntryElem(A)}}}function clearEntries(){$("canvas").select(".entry").each(Element.remove);g_entries.clear()}var Reloading=Class.create({initialize:function(){this.canceled=false},cancel:function(){this.canceled=true},process:function(A){g_reloading=null;if(!this.canceled){reupdateEntries(A)}}});function scheduleReloading(){if(g_reloadTimer){clearTimeout(g_reloadTimer)}g_reloadTimer=setTimeout(reloadEntries,g_reloadDuration)}function cancelReloading(){if(g_reloading){g_reloading.cancel();g_reloading=null}if(g_reloadTimer){clearTimeout(g_reloadTimer);g_reloadTimer=null}}function reloadEntries(){g_reloadTimer=null;if(g_newEntryMode){scheduleReloading()}else{g_reloading=new Reloading();var A=$("getEntriesForm");new AjaxUtil().get("/api/entry/gets",A,g_reloading.process.bind(g_reloading),function(){g_reloading=null;g_reloadDuration=Math.min(MAX_RELOAD_DURATION,Math.max(g_reloadDuration*2,DEFAULT_RELOAD_DURATION));g_reloadDurationCount=0;scheduleReloading()})}}function reupdateEntries(E){if(g_newEntryMode){scheduleReloading();return }if(shouldPostpondReupdate()){return postpondReupdate(0)}var J=false;var G=false;var D=false;var F=g_entries.clone();for(var B=0;B<E.length;++B){var L=E[B];var M=getEntryElemFromId(L.id);if(M){var A=M.entry;var C=F.indexOf(A);F[C]=null;if(!A.equals(L)){var I=M.getBounds();var K=replaceEntryElem(L,true);var H=K.getBounds();if(!I.equals(H)){showEffect(I,H,Entry.getSolidColor(L.color))}D=true}}else{insertEntryElem(L,true,true);J=true}}F.each(function(N){if(N){var P=getEntryElemFromId(N.id);var O=function(){removeEntryElem(N.id)};dimEntryElemFunc(P,O)();G=true}});if(G||D){ensureAllEntriesNotHidden()}if(J||G||D){g_dock.loadEntries(g_canvasId);g_panel.getCalendar().refresh()}if(J){info("canvas.info.added")}else{if(D){info("canvas.info.updated")}}if(J||G||D){g_reloadDuration=Math.max(MIN_RELOAD_DURATION,Math.min(Math.floor(g_reloadDuration/2),INITIAL_RELOAD_DURATION));g_reloadDurationCount=0}else{++g_reloadDurationCount;if(g_reloadDurationCount>5){g_reloadDuration=Math.min(g_reloadDuration*2,MAX_RELOAD_DURATION);g_reloadDurationCount=0}}scheduleReloading()}function shouldPostpondReupdate(){return Request.requestOngoing()||isMoving()||isResizing()||g_dialogsStub.isDialogVisible()}function postpondReupdate(A){if(shouldPostpondReupdate()){if(A>3){scheduleReloading()}else{postpondReupdate.curry(A+1).delay(1)}}else{reloadEntries()}}function layoutCanvasView(){var A=$("canvasView");A.setStyle({"height":calcCanvasViewHeight()+"px"});g_panel.layout()}function calcCanvasViewHeight(){return getWindowHeight()}function installZIndexHandler(C){var B=getHandleFromDraggable(C);var A=B||(Prototype.Browser.IE?C.$$("bg"):C);A.observe("mousedown",zIndexHandler);if(Prototype.Browser.IE){C.$$("base").observe("mousedown",zIndexHandler)}}function uninstallZIndexHandler(C){var B=getHandleFromDraggable(C);var A=B||(Prototype.Browser.IE?C.$$("bg"):C);A.stopObserving("mousedown",zIndexHandler);if(Prototype.Browser.IE){C.$$("base").stopObserving("mousedown",zIndexHandler)}}function zIndexHandler(A){if(!A.isLeftClick()||A.shiftKey){return }if(A.altKey){bringEntryToBottom(getEntryElemFromChild(A.element()).entry)}else{bringEntryToTop(getEntryElemFromChild(A.element()).entry)}}function bringEntryToTop(B){stopHilightCurrentNewEntryElem();var A=g_entries.clone();A.sort(Entry.compareZIndex);if(A.last()==B){return }var C=100;A.each(function(D){if(D!=B){D.setZIndex(C);++C}});B.setZIndex(C);if(g_canvasTypeFlags&CanvasType.FLAG_ZINDEX){updateEntryZIndices(A)}}function bringEntriesToTop(A){var C=g_entries.clone();C.sort(Entry.compareZIndex);var D=100;C.each(function(E){if(A.indexOf(E)==-1){E.setZIndex(D);++D}});var B=A.clone();B.sort(Entry.compareZIndex);B.each(function(E){E.setZIndex(D);++D});if(g_canvasTypeFlags&CanvasType.FLAG_ZINDEX){updateEntryZIndices(C)}}function bringEntryToBottom(B){stopHilightCurrentNewEntryElem();var A=g_entries.clone();A.sort(Entry.compareZIndex);if(A.first()==B){return }B.setZIndex(100);var C=101;A.each(function(D){if(D!=B){D.setZIndex(C);++C}});if(g_canvasTypeFlags&CanvasType.FLAG_ZINDEX){updateEntryZIndices(A)}}function getTopZIndex(){var A=100;g_entries.each(function(B){A=Math.max(A,B.zIndex)});return A}var Dragging=Class.create({initialize:function(B,A,D,C){this.draggable=B;this.offsetX=A;this.offsetY=D;this.others=C}});var dragging=null;function installDragHandler(A){var B=getHandleFromDraggable(A);B.observe("mousedown",moveStartDrag)}function uninstallDragHandler(A){var B=getHandleFromDraggable(A);B.stopObserving("mousedown",moveStartDrag)}function moveStartDrag(D){if(!D.isLeftClick()){return }if(dragging!=null){moveEndDrag(D)}if(D.altKey){return }var E=D.element();if(E.hasClassName("nodrag")||E.up(".nodrag")){return }var B=getDraggableFromHandle(E);var F=B.hasClassName("entry");var H=null;if(F&&D.shiftKey){var C=getMovableIntersectedEntries(B);if(C.length!=0){C.each(Element.show);var A=C.map(function(I){return I.entry});A.push(B.entry);bringEntriesToTop(A);H=C}}var G=B.cumulativeOffset();dragging=new Dragging(B,D.pointerX()-G.left,D.pointerY()-G.top,H);Event.observe(document,"mousemove",moveDrag);Event.observe(document,"mouseup",moveEndDrag);if(F){updateCanvasDragPosition();$("canvasDrag").appendChild(B)}D.stop()}function moveEndDrag(B){moveDrag(B);var L=B.pointerX();var J=B.pointerY();var P=dragging.draggable;var K=P.hasClassName("entry");var O=L-DOCK_ENTRY_DRAG_OFFSET.x;var N=J-DOCK_ENTRY_DRAG_OFFSET.y;var G=g_dock.getDockItemFromPosition(O,N);var I=g_panel.isInside(O,N);Event.stopObserving(document,"mousemove",moveDrag);Event.stopObserving(document,"mouseup",moveEndDrag);if(K){function E(R){if(dragging.others){var Q=dragging.others.clone();Q.push(P);Q.each(function(S){S.setStyle({"left":lx2px(R.x-P.entry.left+S.entry.left)+"px","top":ly2py(R.y-P.entry.top+S.entry.top)+"px"});S.show()});moveEntries(Q)}else{P.setStyle({"left":lx2px(R.x)+"px","top":ly2py(R.y)+"px"});moveEntry(P,R)}}var D=$("canvas");D.appendChild(P);if(G!=null){var M=P.entry;P.setStyle({"left":lx2px(M.left)+"px","top":ly2py(M.top)+"px"});if(G.hasClassName("dockMyItem")||G.hasClassName("dockWritableItem")){var C=g_dock.getCanvasIdFromDockItem(G);var H=g_dock.mapScreenDockPosToCanvasPos(G,O,N);if(C==g_canvasId){E(H)}else{if(dragging.others){var A=dragging.others.clone();A.sort(function(Q,R){return Q.entry.zIndex-R.entry.zIndex});A.push(P);var F=A.map(function(Q){return new Point(H.x-P.entry.left+Q.entry.left,H.y-P.entry.top+Q.entry.top)});transferEntries(A,C,F)}else{transferEntry(P,C,H)}}}$("dockEntryDrag").hide()}else{if(I){E(g_panel.mapScreenPanelPosToCanvasPos(O,N));$("dockEntryDrag").hide()}else{if(dragging.others){var A=dragging.others.clone();A.push(P);moveEntries(A)}else{moveEntry(P)}}}}dragging=null}function moveDrag(Q){var J=Q.pointerX();var I=Q.pointerY();var G=dragging.draggable;var H=G.hasClassName("entry");var T=J-DOCK_ENTRY_DRAG_OFFSET.x;var R=I-DOCK_ENTRY_DRAG_OFFSET.y;var K=g_dock.getDockItemFromPosition(T,R);var A=g_panel.isInside(T,R);var E=$("canvas");var M=E.cumulativeOffset();if(H&&(A||(K&&(K.hasClassName("dockMyItem")||K.hasClassName("dockWritableItem"))))){var S=$("dockEntryDrag");var L=$("dockEntryDragMain");S.setStyle({"left":(T-M.left)+"px","top":(R-M.top)+"px"});if(G.visible()){G.hide();if(dragging.others){dragging.others.each(Element.hide)}var B=G.entry;var O=A?g_panel:g_dock;var D=A?g_panel.mapCanvasToPanelX:g_dock.mapCanvasToDockX;var C=A?g_panel.mapCanvasToPanelY:g_dock.mapCanvasToDockY;L.setStyle({"width":D.call(O,B.width)+"px","height":C.call(O,B.height)+"px","backgroundColor":Entry.getSolidColor(B.color)});S.select(".dockEntryDragOther").each(Element.remove);if(dragging.others){dragging.others.each(function(U){var V=U.entry;var W=new Element("div");W.addClassName("dockEntryDrag");W.addClassName("dockEntryDragOther");W.setStyle({"left":D.call(O,V.left-B.left)+"px","top":D.call(O,V.top-B.top)+"px","width":D.call(O,V.width)+"px","height":C.call(O,V.height)+"px","backgroundColor":Entry.getSolidColor(V.color)});S.appendChild(W)})}S.show()}}else{var F=0;var N=0;if(H){F=J-M.left-dragging.offsetX;N=I-M.top-dragging.offsetY}else{F=J-dragging.offsetX;N=I-dragging.offsetY}G.setStyle({"left":F+"px","top":N+"px"});if(H&&dragging.others){dragging.others.each(function(U){U.setStyle({"left":(F-G.entry.left+U.entry.left)+"px","top":(N-G.entry.top+U.entry.top)+"px"})})}if(!G.visible()){G.show();if(dragging.others){dragging.others.each(Element.show)}$("dockEntryDrag").hide()}}function P(W){if(!W.isPinned()){var V=W.isVisible();var U=W.within(J,I);if(!V&&U){W.showAuto(Q)}else{if(V&&!U){W.hideAuto(Q)}}}}P(g_dock);P(g_panel);Q.stop()}function getHandleFromDraggable(A){return A.$$("handle")}function getDraggableFromHandle(A){return A.up(".draggable")}function isMoving(){return dragging!=null}var Resizing=Class.create({initialize:function(B,A,C){this.resizable=B;this.offsetX=A;this.offsetY=C}});var resizing=null;function installResizeHandler(B){var A=getGripFromResizable(B);A.observe("mousedown",resizeStartDrag)}function uninstallResizeHandler(B){var A=getGripFromResizable(B);A.stopObserving("mousedown",resizeStartDrag)}function resizeStartDrag(D){if(!D.isLeftClick()){return }if(resizing!=null){resizeEndDrag(D)}var A=D.element();var C=getResizableFromGrip(A);var E=C.cumulativeOffset();var B=C.getDimensions();resizing=new Resizing(C,D.pointerX()-(E.left+B.width),D.pointerY()-(E.top+B.height));Event.observe(document,"mousemove",resizeDrag);Event.observe(document,"mouseup",resizeEndDrag);if(C.hasClassName("entry")&&C.entry.isFlag(Entry.FLAG_AUTOHIDE)){C.entry.resizing=true;C.$$("action").hide()}D.stop()}function resizeEndDrag(B){var A=resizing.resizable;var D=A.hasClassName("entry");var C=Prototype.Browser.IE&&D&&A.entry.intimate&&!g_showPrivate;if(C){A.entry.unmaskPrivate()}resizeDrag(B);if(C){A.entry.maskPrivate()}Event.stopObserving(document,"mousemove",resizeDrag);Event.stopObserving(document,"mouseup",resizeEndDrag);resizing=null;if(D){A.entry.resizing=false;moveEntry(A)}}function resizeDrag(D){var B=resizing.resizable;var G=B.cumulativeOffset();var E=B.minSize||MIN_ENTRY_SIZE;var A=Math.max(E.width,D.pointerX()-G.left-resizing.offsetX);var C=Math.max(E.height,D.pointerY()-G.top-resizing.offsetY);var F=B.maxSize;if(F){A=Math.min(F.width||A,A);C=Math.min(F.height||C,C)}B.setStyle({"width":A+"px","height":C+"px"});if(B.hasClassName("entryBg")){updateEntryBackgroundSize(B,null)}if(B.resizeHandler){B.resizeHandler()}D.stop()}function getGripFromResizable(A){return A.$$("grip")}function getResizableFromGrip(A){return A.up(".resizable")}function isResizing(){return resizing!=null}function installTagHandler(A){A.select(".tag .tagItem").each(function(B){B.observe("click",function(C){toggleTag(B["tag"])})})}function uninstallTagHandler(A){A.select(".tag .tagItem").each(function(B){B.stopObserving("click")})}function toggleTag(A){var B=A.stringValue();if(g_tags.indexOf(B)!=-1){g_tags=g_tags.without(B)}else{g_tags.push(B)}updateEntriesForTag()}function clearTags(){g_tags=new Array();updateEntriesForTag()}function updateEntriesForTag(){$("canvas").select(".entry").each(function(A){A.entry.updateForTag()})}function ensureAllEntriesNotHidden(){var A=$("canvas").select(".entry");for(var C=0;C<A.length;++C){var B=A[C].entry;if(!(B.maskStatus&Entry.TAG_MASKED)){return }}clearTags()}function getMovableIntersectedEntries(A){return getIntersectedEntries(A,function(B){return B.entry.isFlag(Entry.FLAG_MOVE)})}function getIntersectedEntries(G,D){var B=$("canvas").select(".entry");var C=[G];for(var A=0;A<C.length;++A){var F=C[A];for(var H=0;H<B.length;++H){var E=B[H];if((!D||D(E))&&C.indexOf(E)==-1&&intersectEntry(E.entry,F.entry)){C.push(E)}}}C.shift();return C}function calcEntrySize(E,G,J,I,C,F){var A=$("bodySize");var D=C!=0?C-ENTRY_SIZE_MARGIN.width:0;A.setStyle({"width":D!=0?D+"px":"auto","fontSize":I+"%","padding":F?"0px 15px":"0px"});A.update2(formatBody(E.gsub(/\r/,""),G));var H=0;if(D==0){D=Math.max(A.getWidth(),MIN_ENTRY_SIZE.width-ENTRY_SIZE_MARGIN.width);if(D>MAX_AUTO_ENTRY_SIZE.width){D=MAX_AUTO_ENTRY_SIZE.width;A.setStyle({"width":D+"px"})}H=Math.max(A.getHeight(),MIN_ENTRY_SIZE.height-ENTRY_SIZE_MARGIN.height);if(D>H*1.5){D=Math.max(Math.floor(D/1.5),MIN_ENTRY_SIZE.width-ENTRY_SIZE_MARGIN.width)}A.setStyle({"width":D+"px"})}H=A.getHeight();if(J.length!=0){var B=$("tagSize");B.update2(formatTags(J,true));B.setStyle({"width":D+"px"});H+=B.getHeight()}H=Math.min(MAX_AUTO_ENTRY_SIZE.height,H);if(F){H+=F+Entry.IMAGE_FRAME_MARGIN.height-ENTRY_SIZE_MARGIN.height}else{H=Math.max(H,MIN_ENTRY_SIZE.height-ENTRY_SIZE_MARGIN.height)}return new Size(D+ENTRY_SIZE_MARGIN.width,H+ENTRY_SIZE_MARGIN.height)}function getPopup(){if(!g_popup){g_popup=new Popup($("canvasView"))}return g_popup}function getDashboard(){if(!g_dashboard){g_dashboard=new Dashboard($("dashboardContainer"))}return g_dashboard}function addNewEntry(D,E){var D=$("newEntryForm");var B=D.entryDate.value.length!=0?parseDate(D.entryDate.value):null;var A=Tag.getTags(D.entryTags?Tag.split(D.entryTags.value):[],B);var C=calcEntrySize(D.entryContent.value,D.entryIcon.value,A,D.entryFontSize.value,0,null);D.entryWidth.value=C.width;D.entryHeight.value=C.height;D.entryZIndex.value=getTopZIndex()+1;fillEntryPosition(D,E);Request.request("/api/entry/new",D,entryAdded,function(F){showErrorDialog(F);g_dialogsStub.getDialogs().enableNewEntryDialog()});g_palette.setLastUsedColor(D.entryColor.value)}function entryAdded(A){var B=null;if(A){B=insertEntryElem(A,true,true,function(){info("canvas.info.entryAdded")});g_dock.loadEntries(g_canvasId);if(A.date){g_panel.getCalendar().refresh()}}else{info("canvas.info.entrySent")}g_dialogsStub.getDialogs().hideNewEntryDialog(B)}function addImageEntry(E,F){if(E.imageType[2].checked){var A=parseInt(E.entryWidth.value,10)+Entry.IMAGE_FRAME_MARGIN.width;var C=E.entryDate.value.length!=0?parseDate(E.entryDate.value):null;var B=Tag.getTags(E.entryTags?Tag.split(E.entryTags.value):[],C);var D=calcEntrySize(E.entryContent.value,0,B,E.entryFontSize.value,A,parseInt(E.entryHeight.value,10));E.entryWidth.value=A;E.entryHeight.value=D.height}E.entryZIndex.value=getTopZIndex()+1;fillEntryPosition(E,F);Request.request("/api/entry/new",E,imageEntryAdded,function(G){showErrorDialog(G);g_dialogsStub.getDialogs().enableImageEntryDialog()})}function imageEntryAdded(A){var B=insertEntryElem(A,true,true,function(){info("canvas.info.entryAdded")});g_dialogsStub.getDialogs().hideImageEntryDialog(B);g_dock.loadEntries(g_canvasId)}function imageUploaded(A,B){g_dialogsStub.getDialogs().updateImageEntryDialog(B)}function imageUploadFailed(A,B){g_dialogsStub.getDialogs().updateImageEntryDialog(null)}function addMovieEntry(A,B){A.entryZIndex.value=getTopZIndex()+1;fillEntryPosition(A,B);Request.request("/api/entry/new",A,movieEntryAdded,function(C){showErrorDialog(C);g_dialogsStub.getDialogs().enableMovieEntryDialog()})}function fillEntryPosition(A,B){if(B.left==0&&B.top==0){B.left=Math.floor((getWindowWidth()-A.entryWidth.value)/2+g_origin.x);B.top=Math.floor((getWindowHeight()-A.entryHeight.value)/3+g_origin.y)}A.entryLeft.value=B.left;A.entryTop.value=B.top}function movieEntryAdded(A){var B=insertEntryElem(A,true,true,function(){info("canvas.info.entryAdded")});g_dialogsStub.getDialogs().hideMovieEntryDialog(B);g_dock.loadEntries(g_canvasId)}function editEntry(F,E){var C=F.entryDate.value.length!=0?parseDate(F.entryDate.value):null;var B=Tag.getTags(F.entryTags?Tag.split(F.entryTags.value):[],C);var A=E.width;if(E.image&&F.imageType[2].checked){A=E.image.width+Entry.IMAGE_FRAME_MARGIN.width}var D=calcEntrySize(F.entryContent.value,F.entryIcon?F.entryIcon.value:0,B,F.entryFontSize.value,A,E.image&&F.imageType[2].checked?E.image.height:null);F.entryLeft.value=E.left;F.entryTop.value=E.top;F.entryWidth.value=A;F.entryHeight.value=Math.max(E.height,D.height);Request.request("/api/entry/edit",F,entryEdited,function(G){showErrorDialog(G);if(E.image){g_dialogsStub.getDialogs().enableEditImageEntryDialog()}else{g_dialogsStub.getDialogs().enableEditEntryDialog()}});if(!E.image){g_palette.setLastUsedColor(F.entryColor.value)}}function entryEdited(A){var B=replaceEntryElem(A,true,function(){info("canvas.info.entryEdited")});ensureAllEntriesNotHidden();if(A.image){g_dialogsStub.getDialogs().hideEditImageEntryDialog(B)}else{g_dialogsStub.getDialogs().hideEditEntryDialog(B)}g_dock.loadEntries(g_canvasId);g_panel.getCalendar().refresh()}function moveEntry(F,G){if(!G){var E=F.positionedOffset();G=new Point(px2lx(E.left),py2ly(E.top))}var B=ps2ls(F.getWidth());var A=ps2ls(F.getHeight());var D=F.entry;if(G.x==D.left&&G.y==D.top&&B==D.width&&A==D.height){return }D.left=G.x;D.top=G.y;D.width=B;D.height=A;var C=$("moveEntryForm");C.entryId.value=F.entry.id;C.entryLeft.value=G.x;C.entryTop.value=G.y;C.entryWidth.value=B;C.entryHeight.value=A;Request.request("/api/entry/move",C,entryMoved,error)}function entryMoved(A){var B=getEntryElemFromId(A.id);var C=g_entries.indexOf(B.entry);g_entries[C]=A;Entry.rebind(A,B);A.updatePosition();B.show();A.updateBackgroundSize();A.adjustFont();g_panel.updateEntryElem(A);g_dock.loadEntries(g_canvasId)}function moveEntries(A){var B=A.map(function(D){var F=D.entry;var E=D.positionedOffset();F.left=px2lx(E.left);F.top=py2ly(E.top);F.width=ps2ls(D.getWidth());F.height=ps2ls(D.getHeight());return F.id+"="+[F.left,F.top,F.width,F.height].join(" ")}).join(",");var C=$("moveEntriesForm");C.positions.value=B;Request.request("/api/entry/moves",C,entriesMoved,error)}function entriesMoved(A){A.each(function(B){var C=getEntryElemFromId(B.id);var D=g_entries.indexOf(C.entry);g_entries[D]=B;Entry.rebind(B,C);B.updatePosition();C.show();B.updateBackgroundSize();g_panel.updateEntryElem(B)});updateEntriesVisibility();g_dock.loadEntries(g_canvasId)}function setEntryDueDate(F,D,G,A){var B=new Date(D,G,A);if(F.date!=null&&isSameDay(B,parseDate(F.date))){return }var C=calcEntrySize(F.subject+"\n"+F.body,F.icon,Tag.getTags(F.tags,B),F.fontSize,F.width,F.image&&F.isParam(Entry.PARAM_IMAGE_FRAME)?F.image.height:null);var E=$("setEntryDueDateForm");E.entryId.value=F.id;E.year.value=D;E.month.value=G+1;E.day.value=A;E.entryWidth.value=F.width;E.entryHeight.value=Math.max(F.height,C.height);Request.request("/api/entry/setDueDate",E,entryDueDateSet,error)}function clearEntryDueDate(C){var A=calcEntrySize(C.subject+"\n"+C.body,C.icon,Tag.getTags(C.tags,null),C.fontSize,C.width,C.image&&C.isParam(Entry.PARAM_IMAGE_FRAME)?C.image.height:null);var B=$("setEntryDueDateForm");B.entryId.value=C.id;B.year.value=0;B.month.value=0;B.day.value=0;B.entryWidth.value=C.width;B.entryHeight.value=Math.max(C.height,A.height);Request.request("/api/entry/setDueDate",B,entryDueDateSet,error)}function entryDueDateSet(A){var B=A.entry;replaceEntryElem(B,false);ensureAllEntriesNotHidden();info("canvas.info.entryDueDateSet",A.undoId);g_dock.loadEntries(g_canvasId);g_panel.getCalendar().refresh()}function sendEntry(B,A){var C=$("sendEntryForm");C.entryId.value=B;C.friendId.value=A;Request.request("/api/entry/send",C,entrySent,error)}function sendEntryEx(B,D,A){var C=$("sendEntryExForm");C.entryId.value=B;Request.request("/api/entry/sendEx",C,function(E){D();entrySent(E)},A)}function entrySent(A){if(A.copy){info("canvas.info.entrySent")}else{var B=function(){removeEntryElem(A.entryId);ensureAllEntriesNotHidden();info("canvas.info.entrySent")};var C=getEntryElemFromId(A.entryId);if(C.entry.isFlag(Entry.FLAG_EFFECT)){hideEntryElemWithEffect(C,flickAction,B)}else{dimEntryElemFunc(C,B).delay(0.1)}g_dock.loadEntries(g_canvasId);g_panel.getCalendar().refresh()}}function copyEntry(B,C){var A=$("copyEntryForm");A.entryId.value=B.id;A.canvasId.value=C;Request.request("/api/entry/copy",A,entryCopied,error)}function entryCopied(A){if(A.canvasId==g_canvasId){insertEntryElem(A,true,true,function(){info("canvas.info.entryCopied")})}else{info("canvas.info.entryCopied")}g_dock.loadEntries(A.canvasId)}function doneEntry(B){var A=$("doneEntryForm");A.entryId.value=B.id;Request.request("/api/entry/done",A,entryDone,error)}function entryDone(A){var B=function(){removeEntryElem(A.entryId);ensureAllEntriesNotHidden();info("canvas.info.entryDone",A.undoId)};var C=getEntryElemFromId(A.entryId);if(C.entry.isFlag(Entry.FLAG_EFFECT)){hideEntryElemWithEffect(C,screwUpAction,B)}else{dimEntryElemFunc(C,B).delay(0.1)}g_dock.loadEntries(g_canvasId);g_panel.getCalendar().refresh()}function lightEntryElem(C,A){if(Prototype.Browser.IE&&C.entry.isFlag(Entry.FLAG_SHADOW)){C.select(".bg *").each(function(D){if(!D.hasClassName("bgCenter")){D.hide()}})}C.setStyle({"opacity":0});var B=function(){var D=Math.floor(C.getStyle("opacity")*10);if(D<10){C.setStyle({"opacity":(D+1)/10});B.delay(0.1)}else{if(Prototype.Browser.IE&&C.entry.isFlag(Entry.FLAG_SHADOW)){C.select(".bg *").each(function(E){if(!E.hasClassName("bgCenter")){E.show()}})}if(A){A()}}};B()}function dimEntryElemFunc(C,A){uninstallHandlers(C);if(Prototype.Browser.IE){C.select(".bg *").each(function(D){if(!D.hasClassName("bgCenter")){D.hide()}})}var B=function(){var D=Math.floor(C.getStyle("opacity")*10);if(D>0){C.setStyle({"opacity":(D-1)/10});B.delay(0.1)}else{if(A){A()}}};return B}function hideEntryElemWithEffect(C,B,A){uninstallHandlers(C);effect(C,B,A)}function updateEntryPin(B,A){var C=$("pinEntryForm");C.entryId.value=B;C.entryPin.value=A?"1":"0";Request.request("/api/entry/pin",C,entryPinUpdated,error)}function entryPinUpdated(A){var B=replaceEntryElem(A,false);info(A.pin?"canvas.info.entryPinned":"canvas.info.entryUnpinned")}function updateEntryZIndices(A){var B=A.map(function(D,E){return D.id+"="+D.zIndex}).join(",");var C=$("updateEntryZIndicesForm");C.zIndices.value=B;Request.request("/api/entry/updateZIndices",C,zIndicesUpdated,error)}function zIndicesUpdated(){g_dock.loadEntries(g_canvasId)}function transferEntry(C,B,D){var A=$("transferEntryForm");A.canvasId.value=B;A.entryId.value=C.entry.id;A.entryLeft.value=D.x;A.entryTop.value=D.y;Request.request("/api/entry/transfer",A,entryTransferred,error)}function entryTransferred(A){removeEntryElem(A.entryId);info("canvas.info.entryTransferred",A.undoId);g_dock.loadEntries(A.canvasId);g_dock.loadEntries(g_canvasId)}function transferEntries(A,E,B){var C=A.map(function(F,H){var G=B[H];return F.entry.id+"="+[G.x,G.y].join(" ")}).join(",");var D=$("transferEntriesForm");D.canvasId.value=E;D.positions.value=C;Request.request("/api/entry/transfers",D,entriesTransferred,error)}function entriesTransferred(A){A.entryIds.each(removeEntryElem);info("canvas.info.entryTransferred");g_dock.loadEntries(A.canvasId);g_dock.loadEntries(g_canvasId)}function undo(A){var B=$("undoForm");B.undoId.value=A;Request.request("/api/entry/undo",B,undone,error)}function undone(A){loadEntries();g_dock.loadAllEntries();g_panel.getCalendar().refresh();info(A?"canvas.info.undoSucceeded":"canvas.info.undoFailed")}function updateSubscription(){var A=$("isSubscribedForm");new AjaxUtil().get("/api/canvas/subscribed",A,function(B){g_palette.setSubscribed(B)},function(B){g_palette.setSubscribed(false);error(B)});g_dock.load();g_panel.getCalendar().refresh()}function insertEntryElem(G,C,I,B){var H=insertNormalEntryElem(G);g_panel.insertEntryElem(G);var A=H.$$("pin");if(A&&G.pin){A.addClassName("pushed")}if(!G.isFlag(Entry.FLAG_SHADOW)){var E=["bgLeftTop","bgLeft","bgLeftBottom","bgRightTop","bgRight","bgRightBottom","bgBottom"];E.each(function(J){H.$$(J).remove()})}if(!G.isFlag(Entry.FLAG_LOGO)){var D=H.$$("logo");if(D){D.remove();H.$$("logoIE").remove()}}if(!G.isFlag(Entry.FLAG_GRIP)){var F=H.$$("grip");if(F){F.setStyle({"backgroundImage":"url(/image/nogrip.png)"})}}if(G.isFlag(Entry.FLAG_AUTOHIDE)){setupAutoHide(G,H)}if(C){g_entries.push(G)}if(g_tags.length!=0){G.updateForTag()}G.updateVisibility($("canvasView").getDimensions());if(I&&H.visible()){lightEntryElem(H,B)}return H}function insertNormalEntryElem(F){var B=F.image!=null;var C=F.movie!=null;F.maskStatus=0;var G=null;if(B){G=$("imageEntryTemplate").cloneNode(true)}else{if(C){G=$("movieEntryTemplate").cloneNode(true)}else{G=$("entryTemplate").cloneNode(true)}}Entry.bind(F,G);if(B&&!F.isParam(Entry.PARAM_IMAGE_FRAME)){G.select(".image, .body, .tag").each(Element.remove)}var A=F.intimate&&(!(g_canvasTypeFlags&CanvasType.FLAG_PRIVATE)||!g_showPrivate);F.fill(A);if(F.intimate){G.addClassName("privateEntry")}if(!F.isFlag(Entry.FLAG_MOVE)){G.removeClassName("draggable");G.$$("handle").removeClassName("handle")}if(!C){if(!F.isFlag(Entry.FLAG_RESIZE)){G.removeClassName("resizable");G.$$("grip").remove()}if(!F.isFlag(Entry.FLAG_EDIT)){G.$$("editEntry").remove()}if(!F.isFlag(Entry.FLAG_DUE)){G.$$("dueEntry").remove()}}if(!F.isFlag(Entry.FLAG_SEND)){G.$$("sendEntry").remove()}if(!F.isFlag(Entry.FLAG_DONE)){G.$$("doneEntry").remove()}if(!F.isFlag(Entry.FLAG_COPY)){G.$$("copyEntry").remove()}if(!F.isFlag(Entry.FLAG_PIN)){G.$$("pin").remove()}if(Prototype.Browser.IE){var I=G.$$("tag");if(I){I.setStyle({"fontFamily":'"MS PGothic",Verdana,Arial,Helvetica,sans-serif'})}}$("canvas").appendChild(G);F.updatePosition();if(F.getTags(true).length==0){var I=G.$$("tag");if(I){I.remove()}}G.show();if(Prototype.Browser.IE){var D=G.$$("action");if(D){var E=D.positionedOffset();var H=D.getOffsetParent().getDimensions();D.setStyle({"marginBottom":(E.top+16-H.height)+"px"})}}F.updateBackgroundSize();F.adjustFont();if(A){F.maskPrivate()}G.observe("mouseover",installHandlers);return G}function setupAutoHide(B,C){var A=["action","creatorIcon"].map(function(D){return C.$$(D)}).select(function(D){return D!=null});if(A.length!=0){A.each(Element.hide);C.observe("mouseover",function(){if(!C.entry.resizing){A.each(Element.show)}});C.observe("mouseout",function(){A.each(Element.hide)});B.updateBackgroundSize()}}function installHandlers(C){var J=getEntryElemFromChild(C.element());J.stopObserving("mouseover",installHandlers);var H=J.entry;H.setupHandle();if(H.isFlag(Entry.FLAG_MOVE)){installDragHandler(J)}if(H.isFlag(Entry.FLAG_RESIZE)){installResizeHandler(J)}var I=J.$$("editEntry");if(I){I.observe("click",ActionHandlers.edit)}var G=J.$$("dueEntry");if(G){G.observe("click",ActionHandlers.due)}var E=J.$$("sendEntry");if(E){E.observe("click",ActionHandlers.send)}var B=J.$$("copyEntry");if(B){B.observe("click",ActionHandlers.copy)}var F=J.$$("doneEntry");if(F){F.observe("click",ActionHandlers.done)}var D=J.$$("creatorIcon");if(D){if(H.creatorId!=0&&H.ownerId==g_userId){D.observe("click",ActionHandlers.reply)}}var A=J.$$("pin");if(A){A.observe("click",ActionHandlers.togglePin)}if(H.movie){J.$$$(".play span").observe("click",ActionHandlers.play)}if(H.isFlag(Entry.FLAG_ZINDEX)){installZIndexHandler(J)}installTagHandler(J);if(Prototype.Browser.IE6){if(I){I.observe("mouseover",ActionHandlers.hoverEntryButton);I.observe("mouseout",ActionHandlers.unhoverEntryButton)}if(G){G.observe("mouseover",ActionHandlers.hoverEntryButton);G.observe("mouseout",ActionHandlers.unhoverEntryButton)}if(E){E.observe("mouseover",ActionHandlers.hoverEntryButton);E.observe("mouseout",ActionHandlers.unhoverEntryButton)}if(B){B.observe("mouseover",ActionHandlers.hoverEntryButton);B.observe("mouseout",ActionHandlers.unhoverEntryButton)}if(F){F.observe("mouseover",ActionHandlers.hoverEntryButton);F.observe("mouseout",ActionHandlers.unhoverEntryButton)}if(A){A.observe("mouseover",ActionHandlers.hoverPin);A.observe("mouseout",ActionHandlers.unhoverPin)}}if(Prototype.Browser.Opera){if(I){I.observe("mousedown",Event.stop)}if(G){G.observe("mousedown",Event.stop)}if(E){E.observe("mousedown",Event.stop)}if(B){B.observe("mousedown",Event.stop)}if(F){F.observe("mousedown",Event.stop)}if(D){D.observe("mousedown",Event.stop)}}}function uninstallHandlers(I){var G=I.entry;if(G.isFlag(Entry.FLAG_MOVE)){uninstallDragHandler(I)}if(G.isFlag(Entry.FLAG_RESIZE)){uninstallResizeHandler(I)}var H=I.$$("editEntry");if(H){H.stopObserving("click",ActionHandlers.edit)}var F=I.$$("dueEntry");if(F){F.stopObserving("click",ActionHandlers.due)}var D=I.$$("sendEntry");if(D){D.stopObserving("click",ActionHandlers.send)}var B=I.$$("copyEntry");if(B){B.stopObserving("click",ActionHandlers.copy)}var E=I.$$("doneEntry");if(E){E.stopObserving("click",ActionHandlers.done)}var C=I.$$("creatorIcon");if(C){if(G.creatorId!=0&&G.ownerId==g_userId){C.stopObserving("click",ActionHandlers.reply)}}var A=I.$$("pin");if(A){A.stopObserving("click",ActionHandlers.togglePin)}if(G.movie){I.$$$(".play span").stopObserving("click",ActionHandlers.play)}if(G.isFlag(Entry.FLAG_ZINDEX)){uninstallZIndexHandler(I)}uninstallTagHandler(I)}var ActionHandlers={edit:function(B){var C=getEntryElemFromChild(B.element());var A=C.entry;g_dialogsStub.bind(function(D){if(A.image){D.showEditImageEntryDialog(A,C)}else{D.showEditEntryDialog(A,C)}})},due:function(C){var B=getEntryElemFromChild(C.element()).entry;var A=B.date?parseDate(B.date):null;getPopup().showDueCalendar(A,C.pointerX(),C.pointerY(),function(F,D,E){if(!Object.isUndefined(F)&&!Object.isUndefined(D)&&!Object.isUndefined(E)){setEntryDueDate(B,F,D,E)}else{clearEntryDueDate(B)}})},send:function(B){var A=getEntryElemFromChild(B.element()).entry;if(g_hasFriends){getPopup().showFriendList(A,B.pointerX(),B.pointerY())}else{g_dialogsStub.bind(function(C){C.showSendEntryDialog(A)})}},copy:function(B){var A=getEntryElemFromChild(B.element()).entry;getPopup().showCanvasList(A,B.pointerX(),B.pointerY())},done:function(A){doneEntry(getEntryElemFromChild(A.element()).entry)},reply:function(C){var B=getEntryElemFromChild(C.element()).entry;if(C.shiftKey){var A=B.canReplyInSameColor()?B.color:"blue";var D=new NewEntry(A,false);D.sendTo=B.creator;g_dialogsStub.bind(function(E){E.showNewEntryDialog(D)});C.stop()}},hoverEntryButton:function(B){var A=B.element();var C=A.classNames().grep(/.+Entry/)[0];A.addClassName(C+"Hover")},unhoverEntryButton:function(B){var A=B.element();var C=A.classNames().grep(/.+EntryHover/)[0];A.removeClassName(C)},togglePin:function(B){var A=getEntryElemFromChild(B.element()).entry;updateEntryPin(A.id,!A.pin)},hoverPin:function(A){var B=getEntryElemFromChild(A.element());B.$$("pin").addClassName(B.entry.pin?"pinPushedHover":"pinHover")},unhoverPin:function(A){var B=getEntryElemFromChild(A.element());B.$$("pin").removeClassName(B.entry.pin?"pinPushedHover":"pinHover")},play:function(A){startMovie(getEntryElemFromChild(A.element()).entry)}};function getEntryElemFromChild(A){return A.hasClassName("entry")?A:A.up(".entry")}function removeEntryElem(B,A){var C=getEntryElemFromId(B);uninstallHandlers(C);C.remove();g_panel.removeEntryElem(B);g_entries.splice(g_entries.indexOf(C.entry),1);if(g_newEntryMode&&!A){var D=g_newEntryElems.indexOf(C);if(D!=-1){if(g_currentNewEntryElem==C){nextNewEntry()}g_newEntryElems.splice(D,1)}}}function replaceEntryElem(E,B,D){var A=0;var H=-1;var F=false;if(g_newEntryMode){var C=getEntryElemFromId(E.id);A=C.entry.newIndex;H=g_newEntryElems.indexOf(C);F=C==g_currentNewEntryElem}removeEntryElem(E.id,true);var G=insertEntryElem(E,true,B,D);if(A){E.markNew(A);g_newEntryElems[H]=G;if(F){g_currentNewEntryElem=G}}return G}function stopEventHandler(A){A.stopPropagation()}function startMovie(A){leaveNewEntryMode();var B=$("movie");if(!B){B=new Element("iframe",{"id":"movie","frameBorder":"0"});$("movieContainer").appendChild(B)}B.src="/entry/movie/"+A.movie.id;layoutMovie(A);B.show();g_movieNotification.showInformation();g_movieEntry=A}function stopMovie(){if(!g_movieEntry){return }var A=$("movie");A.hide();A.src="about:blank";g_movieNotification.hide();g_movieEntry=null}function showMovie(){--g_hideMovie;if(g_hideMovie==0){if(g_movieEntry){layoutMovie(g_movieEntry)}$("movieContainer").setStyle({"visibility":"visible"})}}function hideMovie(){if(g_hideMovie==0){$("movieContainer").setStyle({"visibility":"hidden"})}++g_hideMovie}function layoutMovie(A){var B=$("movie");B.setStyle({"left":(A.left+6)+"px","top":A.top+"px","width":(A.width-14)+"px","height":(A.height-8)+"px"})}function toggleShowPrivate(){setShowPrivate(!g_showPrivate)}function setShowPrivate(A){g_showPrivate=A;$("canvas").select(".privateEntry").each(function(B){if(g_showPrivate){B.entry.unmaskPrivate()}else{B.entry.maskPrivate()}});saveLocalPreferences();g_palette.updateShowPrivate()}function toggleNewEntryMode(){if(g_newEntryMode){leaveNewEntryMode()}else{enterNewEntryMode()}}function enterNewEntryMode(){if(g_newEntryMode){return }g_newEntryMode=true;stopMovie();var A=g_entries.clone();A.sort(function(H,G){var F=H.getUpdated().getTime();var E=G.getUpdated().getTime();return F<E?1:F>E?-1:G.id-H.id});var B=[];for(var D=0;D<Math.min(10,A.length);++D){var C=A[D];B.push(C.elem);C.markNew(D+1)}for(;D<A.length;++D){A[D].markNew()}g_newEntryElems=B;$("newEntryShadow").show();if(B.length!=0){setCurrentNewEntryElem(B[0])}g_palette.updateNewEntryMode()}function leaveNewEntryMode(){if(!g_newEntryMode){return }g_newEntryMode=false;g_newEntryElems=[];setCurrentNewEntryElem(null);g_entries.each(function(A){A.unmarkNew()});$("newEntryShadow").hide();g_palette.updateNewEntryMode()}function nextNewEntry(){var A=g_newEntryElems.indexOf(g_currentNewEntryElem);if(A!=-1&&A+1<g_newEntryElems.length){setCurrentNewEntryElem(g_newEntryElems[A+1])}else{leaveNewEntryMode()}}function previousNewEntry(){var A=g_newEntryElems.indexOf(g_currentNewEntryElem);if(A!=-1&&A!=0){setCurrentNewEntryElem(g_newEntryElems[A-1])}else{leaveNewEntryMode()}}function setCurrentNewEntryElem(B){var A=g_currentNewEntryHilight?g_currentNewEntryElem.entry:null;g_currentNewEntryElem=B;g_currentNewEntryHilight=B!=null;if(A){A.updateZIndex()}if(B){ensureEntryElemVisible(B);B.entry.updateZIndex()}}function stopHilightCurrentNewEntryElem(){if(g_newEntryMode&&g_currentNewEntryHilight){g_currentNewEntryHilight=false;g_currentNewEntryElem.entry.updateZIndex()}}function getSearch(){if(!g_search){g_search=new Search($("canvasView"))}return g_search}function getEntryElemFromId(A){return $("entry"+A)}function isEntryInCanvasView(F,C){var E=lx2px(C.left)-g_origin.x;var D=ly2py(C.top)-g_origin.y;var B=E+ls2ps(C.width);var A=D+ls2ps(C.height);return !(D>F.height||A<0||E>F.width||B<0)}function updateEntriesVisibility(){var A=$("canvasView").getDimensions();$("canvas").select(".entry").each(function(B){B.entry.updateVisibility(A)})}function lx2px(A){return Math.floor(A*g_zoom)}function ly2py(A){return Math.floor(A*g_zoom)}function px2lx(A){return Math.floor(A/g_zoom)}function py2ly(A){return Math.floor(A/g_zoom)}function ls2ps(A){return g_zoom<1?Math.floor(A*g_zoom):A}function ps2ls(A){return g_zoom<1?Math.floor(A/g_zoom):A}function formatUpdated(A){return formatYearMonthDate(A.getFullYear(),A.getMonth(),A.getDate())+" "+format2(A.getHours())+":"+format2(A.getMinutes())}function format2(B){var A=B.toString();if(A.length==1){A="0"+A}return A}function formatTags(A,B){if(B){var C=document.createDocumentFragment();A.each(function(D){var F=new Element("span");var H="tagItem";var E=D.flag;if(E&TF_TODAY){H+=" tagItemToday"}else{if(E&TF_TOMORROW){H+=" tagItemTomorrow"}else{if(E&TF_OVERDUE){H+=" tagItemOverDue"}else{if(E&TF_DUE){H+=" tagItemDue"}}}}F.addClassName(H);F.appendChild(document.createTextNode("["));if(E&TF_DUE){var G=new Element("img",{"src":"/image/duetag.png"});G.addClassName("dueTag");F.appendChild(G)}F.appendChild(document.createTextNode(D.tag+"]"));F["tag"]=D;C.appendChild(F);C.appendChild(document.createTextNode(" "))});return C}else{return A.map(function(D){return D.tag}).join(" ")}}function formatBody(A,E){var D="";if(E!=0){D+='<div class="icon" style="background-position:-'+Entry.getIconIndex(E)*32+'px 0px;"></div>'}var C=A.split("\n");var B=C.length;for(;B>0;--B){if(C[B-1].length!=0){break}}for(var F=0;F<B;++F){D+=formatLine(C[F])}return D}function formatLine(A){if(A.match(/^\s*$/)){return'<p><span class="nodrag">&nbsp;</span></p>'}else{var B='<p><span class="nodrag">';var D=0;while(D<A.length&&A.charAt(D)==" "){B+="&nbsp;";++D}if(D!=0){A=A.substring(D)}var C=A.split(/((?:http:\/\/(?:.+\.)?linoit.com\/(?:canvas|group)\/[^\/]+\/?[^ <>\"]*)|(?:https?:\/\/[-_.!~*\'()a-zA-Z0-9;\/?:@&=+$,%#]+[A-Za-z0-9_\/]))/);for(var D=0;D<C.length;D+=2){B+=C[D].escapeHTML();if(D+1<C.length){B+=formatLink(C[D+1])}}B+="</span></p>";return B}}function formatLink(A){var H=A.escapeHTML();var F=A.startsWith("http://linoit.com/");var I=H;var E=false;if(A.match(/^http:\/\/(?:.+\.)?linoit.com\//)){if(A.match(/^(http:\/\/(?:.+\.)?linoit.com\/(?:canvas|group)\/)([^\/]+)\/([^ ?#<>\"]+)([?#][^ <>\"]*)?$/)){var C=RegExp.$1;var G=RegExp.$2;var B=RegExp.$3;var D=RegExp.$4;if(B=="inbox"){I=MESSAGES["canvas.inbox"]}else{I=decodeURIComponent(B).escapeHTML()}H=(C+escapeName(G)+"/"+escapeName(B)+D).escapeHTML();E=true}else{if(A.match(/^(http:\/\/(?:.+\.)?linoit.com\/(?:canvas|group)\/)([^\/]+)\/?$/)){var C=RegExp.$1;var B=RegExp.$2;I=decodeURIComponent(B).escapeHTML();H=(C+escapeName(B)).escapeHTML();E=true}else{if(A.match(/^http:\/\/(?:.+\.)?linoit.com\/user\/newFriend\?username=(.+)$/)){I=MESSAGES["url.newFriend"]}else{if(A.match(/^http:\/\/(?:.+\.)?linoit.com\/grouphelper\/userInvitation\//)){I=MESSAGES["url.groupInvitation"];F=false}else{if(A.match(/^http:\/\/(?:.+\.)?linoit.com\/grouphelper\/application\//)){I=MESSAGES["url.groupApplication"];F=false}}}}}}var J='<a href="'+H+'"'+(F?"":' target="_blank"')+">"+I+"</a>";if(E){J+='<a href="'+H+'"'+(F?"":' target="_blank"')+' class="canvasLink"><img src="/image/link.png" /></a>'}return J}function escapeName(A){return A.split("%").map(encodeURIComponent).join("%")}function canvasPath(A){if(A.group){return"/group/"+encodeURIComponent(A.group)+"/"+encodeURIComponent(A.name)}else{return"/canvas/"+A.owner+"/"+encodeURIComponent(A.name)}}var Request={ongoingRequest:0,request:function(D,C,B,A){++this.ongoingRequest;new AjaxUtil().post(D,C,function(E){B(E);--this.ongoingRequest}.bind(this),function(E){A(E);--this.ongoingRequest}.bind(this))},requestOngoing:function(){return this.ongoingRequest!=0}};function info(B,A){g_notification.showInformation(MESSAGES[B],A)}function error(A){g_notification.showError(getErrorString(A))}var Entry={PRIVATE_MASKED:1,TAG_MASKED:2,PARAM_IMAGE_NOSHADOW:1,PARAM_IMAGE_FRAME:2,FLAG_DUE:1,FLAG_TAG:2,FLAG_SEND:4,FLAG_MOVE:8,FLAG_RESIZE:16,FLAG_ZINDEX:32,FLAG_EDIT:64,FLAG_EDITMOBILE:128,FLAG_DONE:256,FLAG_COPY:512,FLAG_FONT:1024,FLAG_ICON:2048,FLAG_PRIVATE:4096,FLAG_DOCK:8192,FLAG_PANEL:16384,FLAG_AUTOHIDE:32768,FLAG_GRIP:65536,FLAG_LOGO:131072,FLAG_SHADOW:262144,FLAG_CREATOR:524288,FLAG_EFFECT:1048576,FLAG_PIN:2097152,FLAG_ADJUSTFONT:4194304,IMAGE_FRAME_MARGIN:new Size(52,60),IMAGE_FRAME_PADDING:15,prebind:function(A){Object.extend(A,Entry.Methods)},bind:function(B,C){Object.extend(B,Entry.Methods);B.elem=C;C.entry=B;B.setId();if(B.image&&B.isParam(Entry.PARAM_IMAGE_FRAME)){var A=B.image.width+Entry.IMAGE_FRAME_MARGIN.width;C.minSize=new Size(A,B.image.height+Entry.IMAGE_FRAME_MARGIN.height);C.maxSize=new Size(A,null)}},rebind:function(B,C){var A=C.entry;B.maskStatus=A.maskStatus;B.newIndex=A.newIndex;Entry.bind(B,C)},compareZIndex:function(A,B){return A.zIndex-B.zIndex},getSolidColor:function(A){switch(A){case"blue":return"#a6dbff";case"yellow":return"#fff293";case"green":return"#c4ffd8";case"purple":return"#d3cdfc";case"red":return"#ffa09b";case"grass":return"#eafc86";case"gray":return"#e4e4e4";case"orange":return"#ffdb9b";case"peach":return"#ffc7c4";case"pink":return"#edbbff";case"white":return"#ffffff";case"black":return"#111111";default:return"white"}},getIconIndex:function(A){if(A==1){return 0}else{if(100<=A&&A<110){return A-99}else{if(201<=A){return A-190}}}}};Entry.Methods={getContent:function(){return this.body.length!=0?this.subject+"\n"+this.body:this.subject},fill:function(G,H){H=H||this.elem;if(this.image&&this.isParam(Entry.PARAM_IMAGE_FRAME)){H.$$("image").setStyle({"width":this.image.width+"px","height":this.image.height+"px","backgroundImage":"url(/entry/image/"+this.image.id+")"})}var B=H.$$("body");if(B){B.setStyle({"fontSize":this.fontSize+"%","color":this.fontColor});B.update2(formatBody(this.subject+"\n"+this.body,this.icon))}var E=H.$$("tag");if(E){E.$$("value").update2(formatTags(this.getTags(true),true))}if(this.movie){var D=H.$$$(".thumbnail img");D.src=this.movie.thumbnail;D.setStyle({"width":this.movie.thumbnailWidth+"px","height":this.movie.thumbnailHeight+"px"});D.up().setStyle({"height":this.movie.thumbnailHeight+"px"});H.$$("information").innerHTML="<div>"+(this.movie.title?this.movie.title.escapeHTML():"")+"</div><div>"+(this.movie.duration?"("+Math.floor(this.movie.duration/60)+":"+show2(this.movie.duration%60)+")":"")+"</div>"}var A=H.$$("creatorIcon");if(A){if(this.isFlag(Entry.FLAG_CREATOR)){if(this.creatorId==g_groupOwnerId){A.href="/group/"+g_groupName}else{if(this.creatorId!=0){A.href="/canvas/"+this.creator}}var F=null;var C=null;if(this.creatorId==g_groupOwnerId){F="/grouphelper/icon/"+g_groupId;C=g_groupName}else{F="/user/icon/"+this.creatorId;C=this.creator}A.setStyle({"backgroundImage":"url("+F+"?size=small)"});A.title=C+" ("+formatUpdated(this.getUpdated())+")"}else{A.remove()}}this.updateBackgroundColor(G?TYPE_MASKED:TYPE_NORMAL,H)},updatePosition:function(){this.elem.setStyle({"left":lx2px(this.left)+"px","top":ly2py(this.top)+"px","width":ls2ps(this.width)+"px","height":ls2ps(this.height)+"px","zIndex":this.getActualZIndex()})},canReplyInSameColor:function(){return !this.image&&!this.movie&&this.color!="transparent"},setupHandle:function(){if(Prototype.Browser.IE){var A=this.elem.$$("handle");if(A){A.removeClassName("handle");this.elem.$$("bg").addClassName("handle")}}},updateBackgroundColor:function(A,B){B=B||this.elem;if(this.image&&!this.isParam(Entry.PARAM_IMAGE_FRAME)&&A!=TYPE_MASKED){B.$$("bgCenter").src="/entry/image/"+this.image.id}else{updateEntryBackgroundColor(B,A,this.color)}},updateBackgroundSize:function(A){updateEntryBackgroundSize(A||this.elem,this)},setZIndex:function(A){this.zIndex=A;if(this.elem){this.elem.setStyle({"zIndex":this.getActualZIndex()})}g_panel.setZIndex(this.id,A)},updateZIndex:function(){this.setZIndex(this.zIndex)},maskPrivate:function(){this.maskFlag(Entry.PRIVATE_MASKED)},unmaskPrivate:function(){this.unmaskFlag(Entry.PRIVATE_MASKED)},markNew:function(B){if(B){this.newIndex=B;var A=new Element("div");A.setStyle({"backgroundPosition":-((B-1)*32)+"px 0px"});A.addClassName("newEntryIcon");this.elem.appendChild(A);this.updateZIndex()}else{this.newIndex=0;g_panel.hideEntryElem(this.id)}},unmarkNew:function(){var A=this.newIndex;this.newIndex=null;if(A){this.elem.$$("newEntryIcon").remove();this.updateZIndex()}else{g_panel.showEntryElem(this.id)}},maskFlag:function(A){var B=this.maskStatus!=0;this.maskStatus|=A;if(!B){this.mask()}},unmaskFlag:function(A){var B=this.maskStatus!=0;this.maskStatus&=~A;if(B&&this.maskStatus==0){this.unmask()}},mask:function(){this.elem.select(".content, .grip, .footer").each(Element.hide);this.updateBackgroundColor(TYPE_MASKED);g_panel.maskEntryElem(this.id)},unmask:function(){this.elem.select(".content, .grip"+(g_zoom>=1?", .footer":"")).each(Element.show);this.updateBackgroundColor(TYPE_NORMAL);g_panel.unmaskEntryElem(this.id)},getTags:function(A){return Tag.getTags(this.tags,A?this.date?parseDate(this.date):null:null)},isParam:function(A){return(this.params&A)!=0},isFlag:function(A){return(this.flags&A)!=0},updateForTag:function(){var A=true;var B=this.getTags(true).map(function(D){return D.stringValue()});if(B.length!=0){for(var C=0;C<g_tags.length&&A;++C){A=B.indexOf(g_tags[C])!=-1}}else{A=g_tags.length==0}if(A){this.unmaskFlag(Entry.TAG_MASKED);this.elem.select(".tag .tagItem").each(function(D){var E=g_tags.indexOf(D["tag"].stringValue())!=-1;if(E){D.addClassName("selected")}else{D.removeClassName("selected")}})}else{this.maskFlag(Entry.TAG_MASKED)}},updateVisibility:function(B){var A=this.elem.visible();if(isEntryInCanvasView(B,this)){if(!A){this.elem.show()}}else{if(A){this.elem.hide()}}},adjustFont:function(){if(this.isFlag(Entry.FLAG_ADJUSTFONT)){var C=this.elem;var A=C.$$("body");A.setStyle({"fontSize":this.fontSize+"%"});var B=function(J){var G=C.$$("content");var I=A.getHeight();var F=G.getHeight();if(A.positionedOffset().top+I>G.positionedOffset().top+F){if(this.image){F-=this.image.height+Entry.IMAGE_FRAME_PADDING*2}var D=parseInt(A.getStyle("fontSize"),10);var E=Math.sqrt(F/I)*0.95;var H=Math.max(50,Math.floor(D*E/10)*10);A.setStyle({"fontSize":H+"%"})}if(!J){C.show()}}.bind(this);if(Prototype.Browser.IE){this.elem.hide();B.defer()}else{B(true)}}},getUpdated:function(){if(!this.updatedDate){this.updatedDate=parseDateTime(this.updated)}return this.updatedDate},getActualZIndex:function(){var A=this.zIndex;if(this.newIndex){A+=NEW_ENTRY_MODE_ZINDEX;if(g_currentNewEntryHilight&&g_currentNewEntryElem==this.elem){A+=200}}return A},setId:function(){this.elem.setAttribute("id","entry"+this.id)},equals:function(A){return this.id==A.id&&this.updated==A.updated&&this.pin==A.pin&&this.left==A.left&&this.top==A.top&&this.width==A.width&&this.height==A.height}};var TF_NORMAL=0;var TF_DUE=1;var TF_TODAY=2;var TF_TOMORROW=4;var TF_YESTERDAY=8;var TF_OVERDUE=16;var Tag=Class.create({initialize:function(A,B){this.tag=A;this.flag=B},equals:function(A){return this.tag==A.tag&&this.flag==A.flag},stringValue:function(){return this.tag+"$$$"+this.flag}});Tag.split=function(A){A=A.strip();return A.length!=0?A.split(/\s/):[]};Tag.parse=function(A){return Tag.split(A).map(function(B){return new Tag(B,TF_NORMAL)})};Tag.getTags=function(C,B){var A=new Array();if(B){A.push(Tag.getDateTag(B))}if(C){A=A.concat(C.map(function(D){return new Tag(D,TF_NORMAL)}))}return A};Tag.getDateTag=function(D){var A=formatMonthDateDay(D.getMonth(),D.getDate(),D.getDay());var B=TF_DUE;var C=getTodayDate();if(isSameDay(D,C)){A=new Template(MESSAGES["canvas.tag.today"]).evaluate({"day":formatDay(D.getDay())});B|=TF_TODAY}else{if(isSameDay(D,new Date(C.getTime()+24*60*60*1000))){A=new Template(MESSAGES["canvas.tag.tomorrow"]).evaluate({"day":formatDay(D.getDay())});B|=TF_TOMORROW}else{if(isSameDay(D,new Date(C.getTime()-24*60*60*1000))){A=new Template(MESSAGES["canvas.tag.yesterday"]).evaluate({"day":formatDay(D.getDay())});B|=TF_YESTERDAY;B|=TF_OVERDUE}else{if(D.getTime()<C.getTime()){B|=TF_OVERDUE}}}}return new Tag(A,B)};var TYPE_NORMAL="normal";var TYPE_MASKED="masked";var TYPE_DIALOG="dialog";function updateEntryBackgroundColor(D,B,A){var C=B!=TYPE_DIALOG?B:TYPE_NORMAL;D.$$("bgCenter").src="/image/entry/"+C+"/"+A+".png";if(Prototype.Browser.IE6){if(A=="transparent"){D.$$("bgCenter").setOpacity(B==TYPE_DIALOG?0.2:0.1)}}}var LEFTSHADOW_WIDTH=6;var RIGHTSHADOW_WIDTH=8;var TOPSHADOW_HIGHT=8;var BOTTOMSHADOW_HIGHT=8;function updateEntryBackgroundSize(G,F){var B=F?ls2ps(F.width):G.getWidth();var I=F?ls2ps(F.height):G.getHeight();if(B==0||I==0){return }G.$$("bgCenter").setStyle({"width":(B-LEFTSHADOW_WIDTH-RIGHTSHADOW_WIDTH)+"px","height":(I-BOTTOMSHADOW_HIGHT)+"px"});var A=G.$$("bgBottom");if(A){A.setStyle({"width":(B-LEFTSHADOW_WIDTH-RIGHTSHADOW_WIDTH)+"px"})}var C=G.$$("bgLeft");if(C){C.setStyle({"height":(I-TOPSHADOW_HIGHT-BOTTOMSHADOW_HIGHT)+"px"})}var H=G.$$("bgRight");if(H){H.setStyle({"height":(I-TOPSHADOW_HIGHT-BOTTOMSHADOW_HIGHT)+"px"})}updateContentSize(G,B,I);if(Prototype.Browser.IE){var E=G.$$("logoIE");if(E){E.setStyle({"width":(B-LEFTSHADOW_WIDTH-RIGHTSHADOW_WIDTH)+"px","height":(I-BOTTOMSHADOW_HIGHT)+"px"});if(!E.visible()){E.show()}var D=G.$$("logo");if(D.visible()){D.hide()}}}else{var D=G.$$("logo");if(D){D.setStyle({"width":(B-LEFTSHADOW_WIDTH-RIGHTSHADOW_WIDTH)+"px","height":(I-BOTTOMSHADOW_HIGHT)+"px"})}}}var CONTENT_MARGIN=22;function updateContentSize(E,B,A){var C=E.$$("content");var F=C?C.next(".footer"):E.$$("footer");var D=0;if(F){F.setStyle({"width":(B-CONTENT_MARGIN)+"px"});if(F.visible()&&(!E.entry||!E.entry.isFlag(Entry.FLAG_AUTOHIDE))){D=F.getHeight()+5}}if(C){C.setStyle({"height":Math.max(0,(A-D-13))+"px"})}}function intersectEntry(I,G){var D=I.left+LEFTSHADOW_WIDTH;var F=I.top;var B=I.left+I.width-RIGHTSHADOW_WIDTH;var J=I.top+I.height-BOTTOMSHADOW_HIGHT;var C=G.left+LEFTSHADOW_WIDTH;var E=G.top;var A=G.left+G.width-RIGHTSHADOW_WIDTH;var H=G.top+G.height-BOTTOMSHADOW_HIGHT;return !(B<C||A<D||J<E||H<F)}var MiniCalendar=Class.create({initialize:function(D,A,B){this.elem=D;this.clickFunc=A;this.dayFunc=B;this.current=null;var C=D.$$("miniCalendarBar");if(Prototype.Browser.IE){var E=D.$$("miniCalendar");E.observe("resize",function(){C.setStyle({"width":(E.getWidth())+"px"})})}C.$$("miniCalendarPrev").observe("click",function(){var F=this.year;var G=this.month;if(G==0){--F;G=11}else{--G}this.refresh(F,G)}.bindAsEventListener(this));C.$$("miniCalendarNext").observe("click",function(){var F=this.year;var G=this.month;if(G==11){++F;G=0}else{++G}this.refresh(F,G)}.bindAsEventListener(this));C.$$("miniCalendarCurrent").observe("click",function(){this.setDate(getTodayDate(),this.current)}.bindAsEventListener(this));this.setDate(getTodayDate(),null)},element:function(){return this.elem},refresh:function(E,G){this.year=E;this.month=G;this.elem.$$("miniCalendarTitle").update(formatYearMonth(E,G));var B=this.elem.$$("miniCalendar");B.select(".miniCalendarWeek").each(Element.remove);var A=B.$$$("tbody");var C=getTodayDate();var D=new Date(E,G,1);D.setDate(D.getDate()-D.getDay());do{var F=new Element("tr");F.addClassName("miniCalendarWeek");F.appendChild(this.createMarginCell());for(var H=0;H<7;++H){F.appendChild(this.createDay(D,C,D.getMonth()==G));D.setDate(D.getDate()+1)}F.appendChild(this.createMarginCell());A.appendChild(F)}while(D.getMonth()==G);this.layoutBackground()},setDate:function(A,B){this.current=B;this.refresh(A.getFullYear(),A.getMonth())},layoutBackground:function(){var A=this.elem.getDimensions();var C=this.elem.$$("miniCalendarHeader");var B=C.cumulativeOffset().top+C.getHeight()-this.elem.cumulativeOffset().top;this.elem.$$("miniCalendarBgTop").setStyle({"width":Math.max(A.width-7*2,0)+"px","height":B+"px"});this.elem.$$("miniCalendarBgBody").setStyle({"width":Math.max(A.width-7*2,0)+"px","height":Math.max(A.height-B-7,0)+"px"});this.elem.$$("miniCalendarBgLeft").setStyle({"height":Math.max(A.height-7,0)+"px"});this.elem.$$("miniCalendarBgRight").setStyle({"height":Math.max(A.height-7,0)+"px"});this.elem.$$("miniCalendarBgBottom").setStyle({"width":Math.max(A.width-7*2,0)+"px"})},createDay:function(C,B,E){var H=new Element("td");if(C!=null){var G=C.getFullYear();var A=C.getMonth();var F=C.getDate();H.appendChild(document.createTextNode(F));if(this.clickFunc){H.observe("click",this.clickFunc.bind(this,G,A,F))}H.addClassName("miniCalendarDay");if(E){switch(C.getDay()){case 0:H.addClassName("miniCalendarSunday");break;case 6:H.addClassName("miniCalendarSaturday");break}if(isSameDay(B,C)){H.addClassName("miniCalendarToday")}if(isSameDay(this.current,C)){H.addClassName("miniCalendarSelection")}var D=getHolidayName(C);if(D){H.addClassName("miniCalendarHoliday");H.setAttribute("title",D)}}else{H.addClassName("miniCalendarOtherMonth")}if(this.dayFunc){this.dayFunc(H,C)}H.observe("mouseover",this.overDay);H.observe("mouseout",this.outDay)}return H},createMarginCell:function(){var A=new Element("td");A.addClassName("miniCalendarMarginCell");return A},overDay:function(A){Event.element(A).addClassName("hilighted")},outDay:function(A){Event.element(A).removeClassName("hilighted")}});var NotificationBase=Class.create({initialize:function(A){this.elem=A;this.messageElem=this.elem.$$("notificationMessage");this.height=this.elem.getHeight()+16;this.message="";this.delay=-1;this.timer=null;this.elem.setStyle({"top":-this.height+"px","height":this.height+"px"})},showNotification:function(B,C,A){if(this.timer!=null){clearTimeout(this.timer)}this.elem.setStyle({"left":Math.floor((getWindowWidth()-this.elem.getWidth())/2)+"px","backgroundImage":"url(/image/notification/"+(C||"information")+".png)"});this.message=B;this.delay=A||-1;if(this.message){this.messageElem.innerHTML=""}this.elem.setStyle({"top":-this.height+"px"});this.show()},show:function(){var A=this.elem.positionedOffset().top;if(A<0){A=Math.min(0,A+10);this.elem.setStyle({"top":A+"px"});this.timer=setTimeout(this.show.bind(this),100)}else{if(this.message){this.messageElem.update2(this.message)}if(this.delay!=-1){this.timer=setTimeout(this.hide.bind(this),this.delay)}}},hide:function(){var A=this.elem.positionedOffset().top;if(this.message){this.messageElem.innerHTML=""}if(A>-this.height){A=Math.max(-this.height,A-10);this.elem.setStyle({"top":A+"px"});this.timer=setTimeout(this.hide.bind(this),100)}}});var Notification=Class.create(NotificationBase,{DELAY_INFORMATION:3000,DELAY_ERROR:10000,DELAY_UNDO:20000,initialize:function(A){NotificationBase.prototype.initialize.apply(this,arguments);this.elem.$$("notificationClose").observe("click",function(){if(this.timer){clearTimeout(this.timer)}this.hide()}.bindAsEventListener(this))},showInformation:function(D,B){var A=D.escapeHTML();var C=this.DELAY_INFORMATION;if(B){A+=' (<a href="javascript:undo('+B+')" class="undo">'+MESSAGES["canvas.undo"].escapeHTML()+"</a>)";C=this.DELAY_UNDO}this.showNotification(A,"information",C)},showError:function(A){this.showNotification(A.escapeHTML(),"error",this.DELAY_ERROR)}});var MovieNotification=Class.create(NotificationBase,{initialize:function(A){NotificationBase.prototype.initialize.apply(this,arguments);this.elem.$$("stopMovie").observe("click",function(){stopMovie()})},showInformation:function(){this.showNotification()}});var PaletteEntry=Class.create({initialize:function(C,F,A,B,E,D){this.name=C;this.width=F;this.height=A;this.color=B;this.type=E;this.points=D}});var Palette=Class.create({MIN_PALETTE_HEIGHT:52,MAX_MY_PALETTE_HEIGHT:188,MAX_READWRITE_PALETTE_HEIGHT:188,MAX_READONLY_PALETTE_HEIGHT:77,MAX_PALETTE_ENTRIES:7,PALETTE_ENTRIES:[new PaletteEntry("yellow",280,200,"yellow",NewEntry.TYPE_NORMAL,[new Point(19,45),new Point(19,101),new Point(80,101),new Point(80,45)]),new PaletteEntry("green",280,200,"green",NewEntry.TYPE_NORMAL,[new Point(92,45),new Point(92,101),new Point(153,101),new Point(153,45)]),new PaletteEntry("blue",280,200,"blue",NewEntry.TYPE_NORMAL,[new Point(165,45),new Point(165,101),new Point(226,101),new Point(226,45)]),new PaletteEntry("peach",280,200,"peach",NewEntry.TYPE_NORMAL,[new Point(238,45),new Point(238,101),new Point(298,101),new Point(298,45)]),new PaletteEntry("image",280,200,"white",NewEntry.TYPE_IMAGE,[new Point(169,110),new Point(169,149),new Point(210,149),new Point(210,110)]),new PaletteEntry("movie",280,200,"black",NewEntry.TYPE_MOVIE,[new Point(213,110),new Point(213,149),new Point(254,149),new Point(254,110)]),new PaletteEntry("transparent",280,200,"transparent",NewEntry.TYPE_NORMAL,[new Point(257,110),new Point(257,149),new Point(298,149),new Point(298,110)])],LAST_USED_INDEX:3,initialize:function(E){this.palette=$("palette");this.body=$("paletteBody");this.header=$("paletteHeader");this.footer=$("paletteFooter");this.dashboard=$("paletteDashboard");this.newEntryMode=$("newEntryMode");this.newEntryNext=$("newEntryNext");this.showPrivate=$("showPrivate");this.expandElem=$("paletteExpand");this.pinElem=$("palettePin");this.imgBody=$("paletteImgBody");this.pinned=true;this.expandingTimer=null;this.preHideTimer=null;if(g_canvasTypeFlags&CanvasType.FLAG_NEW){for(var D=0;D<this.MAX_PALETTE_ENTRIES;++D){var H=this.PALETTE_ENTRIES[D];$("paletteItem"+D).setStyle({"backgroundImage":"url(/image/palette/entry/"+H.name+".png)"})}}if(this.body){this.palette.observe("mousedown",function(O){if(!O.isLeftClick()){return }if(!this.isExpanded()){return }var N=this.getPaletteEntryFromScreenPos(O.pointerX(),O.pointerY());if(N){E(O,N)}O.stop()}.bindAsEventListener(this))}if(this.expandElem){this.palette.observe("mouseover",this.expandAuto.bindAsEventListener(this));this.palette.observe("mouseout",this.collapseAuto.bindAsEventListener(this))}if(this.dashboard){this.dashboard.observe("click",function(){getDashboard().show()}.bindAsEventListener(this))}var K=function(O){var N=O.element();if(Prototype.Browser.IE6){var P=N.classNames().grep(/action.+/)[0];N.addClassName(P+"Hover");N.removeClassName(P)}else{N.setStyle({"backgroundPosition":N.getStyle("backgroundPosition").split(" ")[0]+" -22px"})}};var F=function(O){var N=O.element();if(Prototype.Browser.IE6){var P=N.classNames().grep(/action.+/)[0];N.addClassName(P.slice(0,-5));N.removeClassName(P)}else{N.setStyle({"backgroundPosition":N.getStyle("backgroundPosition").split(" ")[0]+" 0px"})}};this.palette.select(".action").each(function(N){N.observe("mouseover",K);N.observe("mouseout",F)}.bind(this));this.newEntryMode.observe("click",toggleNewEntryMode);this.newEntryNext.observe("click",function(N){if(g_newEntryMode){nextNewEntry();N.stop()}});if(Prototype.Browser.IE6){var B=function(){if(!g_newEntryMode){IE6.addClassName(this.newEntryMode,"","newEntryButtonHover","newEntryButton")}}.bindAsEventListener(this);var G=function(){if(!g_newEntryMode){IE6.removeClassName(this.newEntryMode,"","newEntryButtonHover","newEntryButton")}}.bindAsEventListener(this);this.newEntryMode.observe("mouseover",B);this.newEntryMode.observe("mouseout",G)}if(this.showPrivate){this.showPrivate.observe("click",toggleShowPrivate);if(Prototype.Browser.IE6){var C=function(){if(!g_showPrivate){IE6.addClassName(this.showPrivate,"","showPrivateButtonHover","showPrivateButton")}}.bindAsEventListener(this);var I=function(){if(!g_showPrivate){IE6.removeClassName(this.showPrivate,"","showPrivateButtonHover","showPrivateButton")}}.bindAsEventListener(this);this.showPrivate.observe("mouseover",C);this.showPrivate.observe("mouseout",I)}}var A=this.palette.$$$(".canvasName .canvasNameValue");if(A){A.observe("click",function(){g_preferenceStub.bind(function(N){N.openCanvas(g_groupId,g_canvasId)})}.bindAsEventListener(this))}var L=function(N){IE6.addClassName(N.element(),"pushed","subscriptionPushed","")};var M=function(N){IE6.removeClassName(N.element(),"pushed","subscriptionPushed","")};var J=function(){g_preferenceStub.bind(function(N){N.openFavorite(g_canvasId)})};this.palette.select(".subscription").each(function(N){N.observe("mousedown",L);N.observe("mouseup",M);N.observe("mouseout",M);N.observe("click",J)});if(this.expandElem){this.expandElem.observe("click",function(){if(this.isExpanded()){this.collapse()}else{this.expand()}}.bindAsEventListener(this))}if(this.pinElem){this.pinElem.observe("click",function(){this.setPinned(!this.isPinned())}.bindAsEventListener(this))}},restore:function(B,C,A){if(!B){this.setPinned(B)}if(!C&&this.expandElem){if(this.body){this.body.hide()}this.footer.hide();this.setHeight(this.MIN_PALETTE_HEIGHT);this.expandElem.addClassName("collapsed");if(this.pinElem){this.pinElem.hide()}}if(A){this.setLastUsedColor(A)}},element:function(){return this.palette},expand:function(){if(this.expandingTimer){clearTimeout(this.expandingTimer);this.expandingTimer=null}var B=this.getMaxHeight();var A=this.palette.getHeight();var C=function(){A=Math.min(A+10,B);this.setHeight(A);if(A!=B){this.expandingTimer=setTimeout(C,20)}else{if(this.body){this.body.show()}this.footer.show();this.expandElem.removeClassName("collapsed");if(this.pinElem){this.pinElem.show()}saveLocalPreferences();this.expandingTimer=null}}.bind(this);this.expandingTimer=setTimeout(C,0)},collapse:function(){if(this.expandingTimer){clearTimeout(this.expandingTimer);this.expandingTimer=null}if(this.body){this.body.hide()}this.footer.hide();var A=this.palette.getHeight();var B=function(){A=Math.max(A-10,this.MIN_PALETTE_HEIGHT);this.setHeight(A);if(A!=this.MIN_PALETTE_HEIGHT){this.expandingTimer=setTimeout(B,20)}else{this.expandElem.addClassName("collapsed");if(this.pinElem){this.pinElem.hide()}saveLocalPreferences();this.expandingTimer=null}}.bind(this);this.expandingTimer=setTimeout(B,0)},setHeight:function(A){this.palette.setStyle({"height":A+"px"});this.imgBody.setStyle({"height":(A-(this.MIN_PALETTE_HEIGHT-4))+"px"})},getMaxHeight:function(){return g_canvasType==CanvasType.MY?this.MAX_MY_PALETTE_HEIGHT:g_canvasTypeFlags&CanvasType.FLAG_NEW?this.MAX_READWRITE_PALETTE_HEIGHT:this.MAX_READONLY_PALETTE_HEIGHT},isExpanded:function(){return this.expandElem&&!this.expandElem.hasClassName("collapsed")},isExpandable:function(){return this.expandElem},isPinned:function(){return this.pinned},setPinned:function(A){this.pinned=A;if(A){this.pinElem.addClassName("pinned")}else{this.pinElem.removeClassName("pinned")}if(this.expandElem){if(A){this.expandElem.show()}else{this.expandElem.hide()}}saveLocalPreferences()},expandAuto:function(A){if(!this.pinned){if(this.preHideTimer){clearTimeout(this.preHideTimer);this.preHideTimer=null}this.expand()}},collapseAuto:function(A){if(Position.within(this.palette,A.pointerX(),A.pointerY())){return }if(!this.pinned){if(!this.preHideTimer){this.preHideTimer=setTimeout(this.collapse.bind(this),500)}}},getLastUsedColor:function(){return this.PALETTE_ENTRIES[this.LAST_USED_INDEX].color},setLastUsedColor:function(A){if(!(g_canvasTypeFlags&CanvasType.FLAG_NEW)){return }if(this.PALETTE_ENTRIES.find(function(E){return E.color==A})){return }var D=this.LAST_USED_INDEX;var C=this.PALETTE_ENTRIES[D];C.name=A;C.color=A;var B=$("paletteItem"+D);B.setStyle({"backgroundImage":"url(/image/palette/entry/"+C.name+".png)"});IEPNGFIX.fix(B);saveLocalPreferences()},getPaletteEntryFromScreenPos:function(B,F){var E=this.palette.cumulativeOffset();var A=new Point(B-E.left,F-E.top);for(var D=0;D<this.PALETTE_ENTRIES.length;++D){var C=this.PALETTE_ENTRIES[D];if(inside(A,C.points)){return C}}return null},updateNewEntryMode:function(){if(g_newEntryMode){var A=this.newEntryMode.classNames().grep(/newEntryButton.*/)[0];IE6.addClassName(this.newEntryMode,"pushed","newEntryButtonPushed",A);this.newEntryNext.show()}else{IE6.removeClassName(this.newEntryMode,"pushed","newEntryButtonPushed","newEntryButton");this.newEntryNext.hide()}},updateShowPrivate:function(){if(g_showPrivate){IE6.addClassName(this.showPrivate,"pushed","showPrivateButtonPushed","showPrivateButtonHover")}else{IE6.removeClassName(this.showPrivate,"pushed","showPrivateButtonPushed","showPrivateButton")}},setSubscribed:function(A){(A?Element.addClassName:Element.removeClassName)(this.header,"subscribed");(A?Element.removeClassName:Element.addClassName)(this.header,"unsubscribed")}});var Dock=Class.create({DEFAULT_DOCK_WIDTH:605,MIN_DOCK_WIDTH:27,DOCK_ITEM_WIDTH:130,DOCK_VIEW_SIZE:new Size(78,58),DOCK_GRIP_WIDTH:27,DOCK_ITEM_TEMPLATE:new Template('<div id="dockItem#{id}" class="dockItem #{classNames}">  <div class="dockName"><nobr><a href="#{path}" title="#{name}">#{name}</a></nobr></div>  <img class="dockItemImg" src="/dock/#{id}" />  <a class="dockView" href="#{path}" title="#{name}"></a></div>'),initialize:function(){this.dock=$("dock");this.view=$("dockView");this.bg=$("dockBg");this.body=$("dockBody");this.grip=$("dockGrip");this.close=$("dockClose");this.pin=$("dockPin");this.preference=$("dockPreference");this.leftArrow=$("dockLeft");this.rightArrow=$("dockRight");this.visible=true;this.width=this.DEFAULT_DOCK_WIDTH;this.scrollPos=0;this.restoredScrollPos=0;this.resizing=null;this.showingTimer=null;this.pinned=true;this.preHideTimer=null;this.items=this.dock.select(".dockItem");var A=function(B){if(B.isLeftClick()){B.stop()}};this.grip.observe("mousedown",this.resizeStartDrag.bindAsEventListener(this));this.close.observe("click",this.toggleShow.bindAsEventListener(this));this.close.observe("mousedown",A);this.pin.observe("click",this.togglePin.bindAsEventListener(this));this.pin.observe("mousedown",A);this.bg.observe("mouseover",this.showAuto.bindAsEventListener(this));this.bg.observe("mouseout",this.hideAuto.bindAsEventListener(this));this.preference.observe("click",this.openPreference.bindAsEventListener(this));this.leftArrow.observe("click",this.scrollLeft.bindAsEventListener(this));this.rightArrow.observe("click",this.scrollRight.bindAsEventListener(this))},restore:function(B,D,C,A){if(B){this.width=B}if(D){this.restoredScrollPos=D}this.setVisible(C);this.setWidth(C?this.width:this.MIN_DOCK_WIDTH);this.setPinned(A)},load:function(){if(!(g_canvasTypeFlags&CanvasType.FLAG_DOCK)){return }if(this.restoredScrollPos==-1){this.restoredScrollPos=this.getScrollPos()}new AjaxUtil().get("/api/canvas/docks",null,this.update.bindAsEventListener(this),error)},update:function(A){var B=this.DOCK_ITEM_TEMPLATE;this.dock.innerHTML=$A(A).map(function(C){C.name=C.name.escapeHTML();C.path=C.path.escapeHTML();var D=[];if(C.id==g_canvasId){D.push("dockSelfItem")}if(C.my){D.push("dockMyItem")}if(C.writable){D.push("dockWritableItem")}C.classNames=D.join(" ");return B.evaluate(C)}).join("");this.items=this.dock.select(".dockItem");this.bg.show();if(Prototype.Browser.WebKit){this.fixupScrollPos.curry(this.restoredScrollPos).bind(this).defer()}else{this.fixupScrollPos(this.restoredScrollPos)}this.restoredScrollPos=-1;this.adjustScrollPos();this.updateArrows()},loadAllEntries:function(){this.items.each(this.loadEntriesByDockItem.bind(this))},loadEntries:function(A){var B=this.getDockItemFromCanvasId(A);if(B){return this.loadEntriesByDockItem(B)}},loadEntriesByDockItem:function(B){var A=B.$$("dockItemImg");A.src="/dock/"+this.getCanvasIdFromDockItem(B)+"?"+new Date().getTime();if(Prototype.Browser.IE){IEPNGFIX.fix(A)}},getWidth:function(){return this.width},setWidth:function(A){this.bg.setStyle({"width":A+"px"});this.body.setStyle({"width":Math.max(0,A-this.DOCK_GRIP_WIDTH)+"px"});this.view.setStyle({"width":Math.max(0,A-85)+"px"})},adjustWidth:function(){if(!this.visible){return }var B=Math.min(this.bg.getWidth(),getWindowWidth()-$("panelBg").getWidth()-50);var A=29;var C=Math.floor((B-(this.DOCK_GRIP_WIDTH+A*2))/(this.DOCK_ITEM_WIDTH)+0.5);if(C<=0){B=this.MIN_DOCK_WIDTH}else{B=this.DOCK_GRIP_WIDTH+A*2+(this.DOCK_ITEM_WIDTH)*C}this.setWidth(B);this.width=B;this.adjustScrollPos();this.updateArrows();saveLocalPreferences()},isVisible:function(){return this.visible},setVisible:function(A){this.visible=A;if(A){IE6.removeClassName(this.close,"closed","dockOpenButton","dockCloseButton")}else{IE6.addClassName(this.close,"closed","dockOpenButton","dockCloseButton")}saveLocalPreferences()},resizeStartDrag:function(D){if(!D.isLeftClick()){return }if(this.resizing){this.resizeEndDrag(D)}var E=this.grip.cumulativeOffset();var C=this.grip.getDimensions();var B=this.resizeDrag.bindAsEventListener(this);var A=this.resizeEndDrag.bindAsEventListener(this);this.resizing=new DockResizing(D.pointerX()-(E.left+C.width),B,A);Event.observe(document,"mousemove",B);Event.observe(document,"mouseup",A);D.stop()},resizeEndDrag:function(A){this.resizeDrag(A);this.setVisible(true);this.adjustWidth();Event.stopObserving(document,"mousemove",this.resizing.move);Event.stopObserving(document,"mouseup",this.resizing.up);this.resizing=null},resizeDrag:function(B){var A=Math.max(this.MIN_DOCK_WIDTH,B.pointerX()-this.resizing.offsetX);this.setWidth(A);B.stop()},toggleShow:function(A){if(this.visible){this.hide()}else{this.show()}saveLocalPreferences()},show:function(){if(this.visible){return }this.changeWidth(this.MIN_DOCK_WIDTH,function(A){return A>=this.width?null:Math.min(A+50,this.width)}.bind(this));this.setVisible(true)},hide:function(){if(!this.visible){return }this.changeWidth(this.width,function(A){return A<=this.MIN_DOCK_WIDTH?null:Math.max(A-50,this.MIN_DOCK_WIDTH)}.bind(this));this.setVisible(false)},changeWidth:function(B,A){if(this.showingTimer!=null){clearTimeout(this.showingTimer)}var C=function(){this.setWidth(B);B=A(B);if(B){this.showingTimer=setTimeout(C,10)}else{this.adjustWidth();this.showingTimer=null}}.bind(this);this.showingTimer=setTimeout(C,10)},togglePin:function(A){this.setPinned(!this.pinned)},setPinned:function(A){this.pinned=A;if(A){IE6.addClassName(this.pin,"pinned","dockPinButton","dockPinnedButton");this.close.show()}else{IE6.removeClassName(this.pin,"pinned","dockPinButton","dockPinnedButton");this.close.hide()}saveLocalPreferences()},isPinned:function(){return this.pinned},showAuto:function(A){if(!this.pinned&&!this.showingTimer){if(this.preHideTimer){clearTimeout(this.preHideTimer);this.preHideTimer=null}this.show()}},hideAuto:function(A){if(Position.within(this.bg,A.pointerX(),A.pointerY())){return }if(!this.pinned&&!this.resizing){if(!this.preHideTimer){this.preHideTimer=setTimeout(this.hide.bind(this),800)}}},within:function(A,B){return Position.within(this.bg,A,B)},openPreference:function(){g_preferenceStub.bind(function(A){A.openCanvas()})},scrollLeft:function(B){var C=this.getScrollPos();if(C>=0){return }var A=this.view.getWidth();this.setScrollPos(Math.min(0,C+Math.max(1,Math.floor(A/this.DOCK_ITEM_WIDTH-1))*this.DOCK_ITEM_WIDTH))},scrollRight:function(D){var A=this.dock.getDimensions();var C=this.items.length;if(A.width>=C*this.DOCK_ITEM_WIDTH){return }var E=this.getScrollPos();var B=this.view.getWidth();this.setScrollPos(Math.max(-(this.DOCK_ITEM_WIDTH*C-B),E-Math.max(1,Math.floor(B/this.DOCK_ITEM_WIDTH-1))*this.DOCK_ITEM_WIDTH))},getScrollPos:function(){return this.scrollPos},setScrollPos:function(C){var A=this.getScrollPos();var B=function(){if(A<C){A=Math.min(A+(this.DOCK_ITEM_WIDTH),C)}else{if(A>C){A=Math.max(A-(this.DOCK_ITEM_WIDTH),C)}}if(A!=C){this.dock.setStyle({"left":A+"px"});B.delay(0.1)}else{this.fixupScrollPos(A)}}.bind(this);B.defer()},adjustScrollPos:function(){var B=this.view.getWidth();var D=this.dock.positionedOffset();var A=this.dock.getDimensions();if(D.left+A.width<B){var C=Math.floor((B-(D.left+A.width))/this.DOCK_ITEM_WIDTH);this.fixupScrollPos(Math.min(0,D.left+C*this.DOCK_ITEM_WIDTH))}},fixupScrollPos:function(A){this.scrollPos=Math.floor(A/this.DOCK_ITEM_WIDTH)*this.DOCK_ITEM_WIDTH;this.dock.setStyle({"left":this.scrollPos+"px"});this.updateArrows();saveLocalPreferences()},updateArrows:function(){var C=this.getScrollPos();if(C==0){this.leftArrow.addClassName("disabled")}else{this.leftArrow.removeClassName("disabled")}var A=this.view.getWidth();var B=this.items.length;if(C<=-(this.DOCK_ITEM_WIDTH*B-A)){this.rightArrow.addClassName("disabled")}else{this.rightArrow.removeClassName("disabled")}},getCanvasIdFromDockItem:function(A){return A.id.substring(8)},getDockItemFromCanvasId:function(A){return $("dockItem"+A)},getDockItemFromPosition:function(A,C){if(this.isVisible()){for(var B=0;B<this.items.length;++B){if(Position.within(this.items[B].$$("dockView"),A,C)){return this.items[B]}}}return null},mapScreenDockPosToCanvasPos:function(D,A,C){var B=D.$$("dockView").cumulativeOffset();return new Point(this.mapDockToCanvasX(A-B.left),this.mapDockToCanvasY(C-B.top))},mapDockToCanvasX:function(A){return Math.floor(A*CANVAS_SIZE.width/this.DOCK_VIEW_SIZE.width)},mapDockToCanvasY:function(A){return Math.floor(A*CANVAS_SIZE.height/this.DOCK_VIEW_SIZE.height)},mapCanvasToDockX:function(A){return Math.floor(A*this.DOCK_VIEW_SIZE.width/CANVAS_SIZE.width)},mapCanvasToDockY:function(A){return Math.floor(A*this.DOCK_VIEW_SIZE.height/CANVAS_SIZE.height)}});var DockResizing=Class.create({initialize:function(B,C,A){this.offsetX=B;this.move=C;this.up=A}});var Panel=Class.create({PANEL_SIZE:new Size(106,79),MIN_PANEL_WIDTH:27,MAX_PANEL_WITH_CALENDAR_WIDTH:308,MAX_PANEL_WITHOUT_CALENDAR_WIDTH:158,MAX_PANEL_WIDTH:0,initialize:function(C,B){this.MAX_PANEL_WIDTH=B?this.MAX_PANEL_WITH_CALENDAR_WIDTH:this.MAX_PANEL_WITHOUT_CALENDAR_WIDTH;this.panel=$("panel");this.view=$("panelView");this.grip=$("panelGrip");this.movingView=$("panelViewMoving");this.bg=$("panelBg");this.close=$("panelClose");this.pin=$("panelPin");this.canvasView=C;this.calendar=new PanelCalendar($("panelCalendar"),B);this.viewSize=this.view.getDimensions();this.parentSize=this.view.getOffsetParent().getDimensions();this.visible=true;this.width=this.MAX_PANEL_WIDTH;this.resizing=null;this.moving=null;this.movingTimer=null;this.showingTimer=null;this.pinned=true;this.preHideTimer=null;var A=function(D){if(D.isLeftClick()){D.stop()}};this.grip.observe("mousedown",this.resizeStartDrag.bindAsEventListener(this));this.close.observe("click",this.toggleShow.bindAsEventListener(this));this.close.observe("mousedown",A);this.pin.observe("click",this.togglePin.bindAsEventListener(this));this.pin.observe("mousedown",A);this.bg.observe("mouseover",this.showAuto.bindAsEventListener(this));this.bg.observe("mouseout",this.hideAuto.bindAsEventListener(this));this.view.observe("mousedown",this.moveStartDrag.bindAsEventListener(this))},restore:function(B,C,A){if(B){this.width=Math.min(B,this.MAX_PANEL_WIDTH)}this.setVisible(C);this.setWidth(C?this.width:this.MIN_PANEL_WIDTH);this.setPinned(A)},layout:function(){var A=this.canvasView.getDimensions();this.view.setStyle({"left":this.mapCanvasToPanelX(g_origin.x)+"px","top":this.mapCanvasToPanelY(g_origin.y)+"px","width":(this.mapCanvasToPanelX(A.width)+1)+"px","height":(this.mapCanvasToPanelY(A.height)+1)+"px"});this.viewSize=this.view.getDimensions()},adjustWidth:function(){if(!this.visible){return }var A=this.bg.getWidth();if(A>(this.MAX_PANEL_WITH_CALENDAR_WIDTH+this.MAX_PANEL_WITHOUT_CALENDAR_WIDTH)/2){A=this.MAX_PANEL_WITH_CALENDAR_WIDTH}else{if(A>(this.MAX_PANEL_WITHOUT_CALENDAR_WIDTH+this.MIN_PANEL_WIDTH)/2){A=this.MAX_PANEL_WITHOUT_CALENDAR_WIDTH}else{A=this.MIN_PANEL_WIDTH}}A=Math.min(this.MAX_PANEL_WIDTH,A);this.setWidth(A);this.width=A;saveLocalPreferences()},resizeStartDrag:function(C){if(!C.isLeftClick()){return }if(this.resizing){this.resizeEndDrag(C)}var D=this.grip.cumulativeOffset();var B=this.resizeDrag.bindAsEventListener(this);var A=this.resizeEndDrag.bindAsEventListener(this);this.resizing=new PanelResizing(C.pointerX()-D.left,B,A);Event.observe(document,"mousemove",B);Event.observe(document,"mouseup",A);C.stop()},resizeEndDrag:function(A){this.resizeDrag(A);this.setVisible(true);this.adjustWidth();g_dock.adjustWidth();Event.stopObserving(document,"mousemove",this.resizing.move);Event.stopObserving(document,"mouseup",this.resizing.up);this.resizing=null},resizeDrag:function(B){var A=Math.min(this.MAX_PANEL_WIDTH,Math.max(this.MIN_PANEL_WIDTH,getWindowWidth()-(B.pointerX()-this.resizing.offsetX)));this.setWidth(A);B.stop()},toggleShow:function(){if(this.visible){this.hide()}else{this.show()}saveLocalPreferences()},show:function(){if(this.visible){return }this.changeWidth(this.MIN_PANEL_WIDTH,function(A){return A>=this.width?null:Math.min(A+20,this.width)}.bind(this));this.setVisible(true)},hide:function(){if(!this.visible){return }this.changeWidth(this.width,function(A){return A<=this.MIN_PANEL_WIDTH?null:Math.max(A-20,this.MIN_PANEL_WIDTH)}.bind(this));this.setVisible(false)},changeWidth:function(B,A){if(this.showingTimer){clearTimeout(this.showingTimer)}var C=function(){this.setWidth(B);B=A(B);if(B){this.showingTimer=setTimeout(C,10)}else{g_dock.adjustWidth();this.showingTimer=null}}.bind(this);this.showingTimer=setTimeout(C,10)},togglePin:function(){this.setPinned(!this.pinned)},setPinned:function(A){this.pinned=A;if(A){IE6.addClassName(this.pin,"pinned","panelPinButton","panelPinnedButton");this.close.show()}else{IE6.removeClassName(this.pin,"pinned","panelPinButton","panelPinnedButton");this.close.hide()}saveLocalPreferences()},isPinned:function(){return this.pinned},getWidth:function(){return this.width},setWidth:function(A){this.bg.setStyle({"width":A+"px"});if(A>this.MAX_PANEL_WITHOUT_CALENDAR_WIDTH){this.calendar.show()}else{this.calendar.hide()}},isVisible:function(){return this.visible},setVisible:function(A){this.visible=A;if(A){IE6.removeClassName(this.close,"closed","panelOpenButton","panelCloseButton")}else{IE6.addClassName(this.close,"closed","panelOpenButton","panelCloseButton")}saveLocalPreferences()},showAuto:function(A){if(!this.pinned&&!this.showingTimer){if(this.preHideTimer){clearTimeout(this.preHideTimer);this.preHideTimer=null}this.show()}},hideAuto:function(A){if(Position.within(this.bg,A.pointerX(),A.pointerY())){return }if(!this.pinned&&!this.resizing){if(!this.preHideTimer){this.preHideTimer=setTimeout(this.hide.bind(this),500)}}},within:function(A,B){return Position.within(this.bg,A,B)},moveStartDrag:function(E){if(!E.isLeftClick()){return }if(this.moving){moveEndDrag(E)}var F=this.view.cumulativeOffset();var B=this.moveDrag.bindAsEventListener(this);var A=this.moveEndDrag.bindAsEventListener(this);this.moving=new PanelMoving(E.pointerX()-F.left,E.pointerY()-F.top,B,A);var D=this.view.positionedOffset();var C=this.view.getDimensions();this.movingView.setStyle({"left":D.left+"px","top":D.top+"px","width":C.width+"px","height":C.height+"px"});this.movingView.show();Event.observe(document,"mousemove",B);Event.observe(document,"mouseup",A);E.stop()},moveEndDrag:function(A){var G=this.movingView.getOffsetParent().cumulativeOffset();var C=Math.max(0,Math.min(this.parentSize.width-this.viewSize.width,A.pointerX()-G.left-this.moving.offsetX));var I=Math.max(0,Math.min(this.parentSize.height-this.viewSize.height,A.pointerY()-G.top-this.moving.offsetY));var K=C*CANVAS_SIZE.width/this.PANEL_SIZE.width;var H=I*CANVAS_SIZE.height/this.PANEL_SIZE.height;var J=new Array(10);var M=K-g_origin.x;var L=H-g_origin.y;var F=Math.max(1,Math.min(10,Math.floor(Math.log(Math.sqrt(M*M+L*L)))));for(var B=1;B<F;++B){J[B-1]={"x":g_origin.x+Math.floor((K-g_origin.x)*B/F),"y":g_origin.y+Math.floor((H-g_origin.y)*B/F)}}J[F-1]={"x":K,"y":H};var E=0;var D=function(){setOrigin(J[E]["x"],J[E]["y"]);if(E<F-1){++E;this.movingTimer=window.setTimeout(D,0)}else{this.movingView.hide();this.movingTimer=null}}.bind(this);if(this.movingTimer){window.clearTimeout(this.movingTimer)}this.movingTimer=window.setTimeout(D,0);Event.stopObserving(document,"mousemove",this.moving.move);Event.stopObserving(document,"mouseup",this.moving.up);this.moving=null},moveDrag:function(A){var D=this.movingView.getOffsetParent().cumulativeOffset();var C=Math.max(0,Math.min(this.parentSize.width-this.viewSize.width,A.pointerX()-D.left-this.moving.offsetX));var B=Math.max(0,Math.min(this.parentSize.height-this.viewSize.height,A.pointerY()-D.top-this.moving.offsetY));this.movingView.setStyle({"left":C+"px","top":B+"px"});A.stop()},getCalendar:function(){return this.calendar},initializeEntry:function(A){var B=this.getEntryElemFromId(A.id);B.entry=A},insertEntryElem:function(A){var B=$("panelEntryTemplate").cloneNode(true);this.setEntryId(B,A.id);this.panel.appendChild(B);this.fillEntryElem(B,A);if(A.maskStatus!=0){B.setStyle({"opacity":0.3})}else{if(A.image||A.movie){B.setStyle({"opacity":0.5})}}B.show()},updateEntryElem:function(A){this.fillEntryElem(this.getEntryElemFromId(A.id),A)},removeEntryElem:function(A){this.getEntryElemFromId(A).remove()},showEntryElem:function(A){var B=this.getEntryElemFromId(A);if(B){B.show()}},hideEntryElem:function(A){var B=this.getEntryElemFromId(A);if(B){B.hide()}},maskEntryElem:function(A){var B=this.getEntryElemFromId(A);if(B){B.setStyle({"opacity":0.3})}},unmaskEntryElem:function(A){var C=this.getEntryElemFromId(A);var B=C.entry;C.setStyle({"opacity":(B.image||B.movie)?0.5:1})},fillEntryElem:function(B,A){B.entry=A;B.setStyle({"left":this.mapCanvasToPanelX(A.left)+"px","top":this.mapCanvasToPanelY(A.top)+"px","width":this.mapCanvasToPanelX(A.width)+"px","height":this.mapCanvasToPanelY(A.height)+"px","zIndex":A.zIndex,"backgroundColor":A.isFlag(Entry.FLAG_PANEL)?Entry.getSolidColor(A.color):"transparent"})},setZIndex:function(A,C){var B=this.getEntryElemFromId(A);if(B){B.setStyle({"zIndex":C})}},setEntryId:function(B,A){B.setAttribute("id","pentry"+A)},getEntryElemFromId:function(A){return $("pentry"+A)},isInside:function(A,B){if(this.isVisible()){if(Position.within(this.panel,A,B)){return true}}return false},mapScreenPanelPosToCanvasPos:function(A,C){var B=this.panel.cumulativeOffset();return new Point(this.mapPanelToCanvasX(A-B.left),this.mapPanelToCanvasY(C-B.top))},mapPanelToCanvasX:function(A){return Math.floor(A*CANVAS_SIZE.width/this.PANEL_SIZE.width)},mapPanelToCanvasY:function(A){return Math.floor(A*CANVAS_SIZE.height/this.PANEL_SIZE.height)},mapCanvasToPanelX:function(A){return Math.floor(A*this.PANEL_SIZE.width/CANVAS_SIZE.width)},mapCanvasToPanelY:function(A){return Math.floor(A*this.PANEL_SIZE.height/CANVAS_SIZE.height)}});var PanelMoving=Class.create({initialize:function(B,D,C,A){this.offsetX=B;this.offsetY=D;this.move=C;this.up=A}});var PanelCalendar=Class.create({initialize:function(A,B){this.elem=A;this.date=null;this.visible=B;if(this.visible){this.build(getTodayDate());this.elem.$$$(".nav .prev").observe("click",function(){var C=this.date;C.setDate(C.getDate()-3*7);this.build(C)}.bindAsEventListener(this));this.elem.$$$(".nav .next").observe("click",function(){var C=this.date;C.setDate(C.getDate()+3*7);this.build(C)}.bindAsEventListener(this));this.elem.$$$(".nav .today").observe("click",function(){this.build(getTodayDate())}.bindAsEventListener(this))}else{this.elem.hide()}},show:function(){this.elem.show()},hide:function(){this.elem.hide()},build:function(B){this.date=new Date(B.getTime());var H=B.getFullYear();var E=B.getMonth();B=this.getStartDate(B);this.elem.$$("title").update2(formatYearMonth(H,E));var K=this.elem.$$$("tbody");K.removeAllChildren();var I=getTodayDate();for(var J=0;J<4;++J){var G=new Element("tr");for(var F=0;F<7;++F){var C=new Element("td");var A=new Element("div");C.appendChild(A);A.appendChild(document.createTextNode(B.getDate()));C.addClassName("day");A.addClassName("day"+formatDate(B));if(B.getMonth()==E){C.addClassName("thisMonth")}switch(B.getDay()){case 0:C.addClassName("sunday");break;case 6:C.addClassName("saturday");break}if(isSameDay(B,I)){C.addClassName("today")}var D=getHolidayName(B);if(D){C.addClassName("holiday");C.setAttribute("title",D)}G.appendChild(C);B.setDate(B.getDate()+1)}K.appendChild(G)}this.refresh.bind(this).delay(0.1)},mark:function(A){if(!this.visible){return }var B=$("dueEntriesForm");B.year.value=A.getFullYear();B.month.value=A.getMonth()+1;B.day.value=A.getDate();B.days.value=4*7;new AjaxUtil().get("/api/entry/dueEntries",B,this.update.bind(this,A),error)},update:function(D,B){if(!isSameDay(this.getStartDate(this.date),D)){return }this.elem.select(".day").each(function(E){var F=E.$$$("div");F.removeClassName("due");F.removeClassName("overdue");F.removeClassName("todaydue");F.stopObserving("click");F.title=F.up("td").getAttribute("title")});var A=getTodayDate().getTime();var C=null;B.each(function(H){var E=H.date;var G=this.elem.$$("day"+E);var F=parseDate(E).getTime();G.addClassName(F==A?"todaydue":F<A?"overdue":"due");G.title+=(G.title.length!=0?" ":"")+H.subject;if(E!=C){G.observe("click",this.handler.bindAsEventListener(this))}C=E}.bind(this))},handler:function(B){var A=B.element();A.classNames().find(function(D){return D.match(/day(\d+)-(\d+)-(\d+)/)});var C=g_userId==0?g_canvasId:null;getSearch().searchByDueDate(RegExp.$1,RegExp.$2-1,RegExp.$3,C)},refresh:function(){if(this.visible){this.mark(this.getStartDate(this.date))}},getStartDate:function(A){var B=new Date(A.getTime());while(B.getDay()!=0){B.setDate(B.getDate()-1)}B.setDate(B.getDate()-7);return B}});var PanelResizing=Class.create({initialize:function(B,C,A){this.offsetX=B;this.move=C;this.up=A}});var DialogsStub=Class.create({initialize:function(){this.dialogs=null;this.elem=null;this.func=null},isDialogVisible:function(){return this.dialogs&&this.dialogs.isDialogVisible()},bind:function(A){if(this.dialogs){A(this.dialogs)}else{this.func=A;if(!this.elem){this.elem=new Element("div");document.body.appendChild(this.elem);new Ajax.Request("/canvashelper/dialogs",{"method":"get","parameters":{"canvasId":g_canvasId},"onSuccess":function(C){this.elem.innerHTML=C.responseText;var B=new Element("script",{"type":"text/javascript","src":"/script/canvas/dialog.js.4036"});document.body.appendChild(B)}.bind(this)})}}},getDialogs:function(){return this.dialogs},loadDialogs:function(){this.dialogs=new Dialogs();this.func(this.dialogs);this.func=null}});var g_dialogsStub=new DialogsStub();var Popup=Class.create({initialize:function(A){this.canvasView=A;this.elem=$("popupBg");this.dueCalendar=null;this.friendList=null;this.canvasList=null;this.iconList=null;this.settings=null;this.elem.observe("click",function(D){var B=D.pointerX();var F=D.pointerY();var C=this.elem.select(".popup");for(var E=0;E<C.length;++E){if(C[E].visible()&&Position.within(C[E],B,F)){return }}C.each(Element.hide);this.hide()}.bindAsEventListener(this));Event.observe(window,"resize",this.adjustBgSize.bindAsEventListener(this))},showDueCalendar:function(C,B,D,A){if(!this.dueCalendar){this.dueCalendar=new DueCalendar(this,$("dueCalendar"))}return this.dueCalendar.show(C,B,D,A)},showFriendList:function(B,A,C){return this.showFriendList2(A,C,function(E,D){sendEntry(B.id,E)},function(){g_dialogsStub.bind(function(D){D.showSendEntryDialog(B)})})},showFriendList2:function(A,D,B,C){if(!this.friendList){this.friendList=new FriendList(this,$("friendList"))}return this.friendList.show(A,D,B,C)},showCanvasList:function(B,A,C){if(!this.canvasList){this.canvasList=new CanvasList(this,$("canvasList"))}return this.canvasList.show(B,A,C)},showIconList:function(A,C,B){if(!this.iconList){this.iconList=new IconList(this,$("iconList"))}return this.iconList.show(A,C,B)},show:function(){this.adjustBgSize();this.elem.show();if(Prototype.Browser.IE6){$(document.body).select("select").each(function(A){A.setStyle({"visibility":"hidden"})})}},hide:function(){this.elem.hide();if(Prototype.Browser.IE6){$(document.body).select("select").each(function(A){A.setStyle({"visibility":"visible"})})}},adjustPosition:function(D,A,F){if(this.canvasView){var B=D.getDimensions();var C=this.canvasView.getDimensions();var E=new Point(Math.min(A,C.width-B.width-10),Math.min(F,C.height-B.height-10));D.setStyle({"left":E.x+"px","top":E.y+"px"})}else{D.setStyle({"left":A+"px","top":F+"px"})}},adjustBgSize:function(){this.elem.setStyle({"width":getWindowWidth()+"px","height":getWindowHeight()+"px"})}});var DueCalendar=Class.create(MiniCalendar,{initialize:function(B,D){this.popup=B;var A=function(H,F,G){this.setFunc(H,F,G);this.hide()}.bind(this);MiniCalendar.prototype.initialize.apply(this,[D,A,null]);var E=D.$$("miniCalendarFooter");E.innerHTML='<span class="none">'+MESSAGES["canvas.dueCalendar.none"]+"</span>";var C=E.$$("none");C.observe("mouseover",function(){C.addClassName("selected")});C.observe("mouseout",function(){C.removeClassName("selected")});C.observe("click",function(){this.setFunc();this.hide()}.bindAsEventListener(this))},show:function(C,B,E,A){C=C||getTodayDate();this.setDate(C,C);this.setFunc=A;var D=this.element();D.show();this.popup.show();this.popup.adjustPosition(D,B,E);this.layoutBackground()},hide:function(){this.element().hide();this.popup.hide()}});var FriendList=Class.create({initialize:function(B,C){this.popup=B;this.elem=C;this.menu=new Menu(C);if(Prototype.Browser.IE6){var A=this.elem.$$("otherFriends");A.observe("mouseover",function(){A.addClassName("otherFriendsHover")});A.observe("mouseout",function(){A.removeClassName("otherFriendsHover")})}},show:function(B,F,C,E){var D=this.elem.$$("friends");new AjaxUtil().get("/api/user/friends",null,function(H){D.innerHTML="";H.each(function(J,L){if(L!=0){var I=new Element("div");I.addClassName("menuSeparator");D.appendChild(I)}var K=new Element("div");K.addClassName("friend");K.innerHTML='<img class="icon" src="/user/icon/'+J.id+'" /><img src="/image/iconseparator.png" />'+J.name.escapeHTML();D.appendChild(K);K.observe("click",function(){C(J.id,J.name);this.hide()}.bindAsEventListener(this));if(Prototype.Browser.IE6){K.observe("mouseover",function(){K.addClassName("friendHover")});K.observe("mouseout",function(){K.removeClassName("friendHover")})}},this);if(Prototype.Browser.IE6){var G=this.elem.$$("friendsScroll");if(G.getHeight()>300){G.setStyle({"height":"300px"})}}this.popup.adjustPosition(this.elem,B,F);this.menu.layout()}.bind(this),function(){});D.innerHTML="Loading ...";var A=this.elem.$$("otherFriends");if(E){A.stopObserving("click");A.observe("click",function(){this.hide();E()}.bindAsEventListener(this));A.show()}else{A.hide()}if(Prototype.Browser.IE6){this.elem.$$("friendsScroll").setStyle({"height":"auto"})}this.elem.show();this.popup.show();this.popup.adjustPosition(this.elem,B,F);this.menu.layout()},hide:function(){this.elem.hide();this.popup.hide()}});var CanvasList=Class.create({initialize:function(A,B){this.popup=A;this.elem=B;this.menu=new Menu(B)},show:function(C,A,D){var B=this.elem.$$("canvases");new AjaxUtil().get("/api/canvas/getWritables",null,function(F){B.innerHTML="";F.each(function(H,K){if(K!=0){var G=new Element("div");G.addClassName("menuSeparator");B.appendChild(G)}var J=new Element("div");J.addClassName("canvas");var I="<div>"+H.name.escapeHTML()+"</div>";if(H.groupId){I+='<div class="group">at '+H.group.escapeHTML()+"</div>"}else{if(H.ownerId!=g_userId){I+='<div class="owner">by '+H.owner.escapeHTML()+"</div>"}}J.innerHTML=I;B.appendChild(J);J.observe("click",function(){copyEntry(C,H.id);this.hide()}.bindAsEventListener(this));if(Prototype.Browser.IE6){J.observe("mouseover",function(){J.addClassName("canvasHover")});J.observe("mouseout",function(){J.removeClassName("canvasHover")})}},this);if(Prototype.Browser.IE6){var E=this.elem.$$("canvasesScroll");if(E.getHeight()>300){E.setStyle({"height":"300px"})}}this.popup.adjustPosition(this.elem,A,D);this.menu.layout()}.bind(this),function(){});B.innerHTML="Loading ...";if(Prototype.Browser.IE6){this.elem.$$("canvasesScroll").setStyle({"height":"auto"})}this.elem.show();this.popup.show();this.popup.adjustPosition(this.elem,A,D);this.menu.layout()},hide:function(){this.elem.hide();this.popup.hide()}});var IconList=Class.create({initialize:function(A,D){this.popup=A;this.elem=D;this.func=null;var F=function(H){var G=H.element().classNames().grep(/icon[0-9]+/)[0].substring(4);this.func(parseInt(G,10));this.hide()}.bindAsEventListener(this);var E=function(H){var G=H.element();G.setStyle({"backgroundPosition":G.getStyle("backgroundPosition").split(" ")[0]+" -24px"})}.bindAsEventListener(this);var C=function(H){var G=H.element();G.setStyle({"backgroundPosition":G.getStyle("backgroundPosition").split(" ")[0]+" -0px"})}.bindAsEventListener(this);this.elem.select(".icon").each(function(G){G.observe("click",F);G.observe("mouseover",E);G.observe("mouseout",C)});var B=this.elem.$$("iconNone");B.observe("click",function(){this.func(0);this.hide()}.bindAsEventListener(this));if(Prototype.Browser.IE6){B.observe("mouseover",function(){B.addClassName("iconNoneHover")});B.observe("mouseout",function(){B.removeClassName("iconNoneHover")})}},show:function(A,C,B){this.func=B;this.elem.show();this.popup.show();this.popup.adjustPosition(this.elem,A,C);this.layoutBackground()},hide:function(){this.elem.hide();this.popup.hide()},layoutBackground:function(){var A=this.elem.getDimensions();this.elem.$$("iconListBgBody").setStyle({"width":Math.max(A.width-7*2,0)+"px","height":Math.max(A.height-7,0)+"px"});this.elem.$$("iconListBgLeft").setStyle({"height":Math.max(A.height-7,0)+"px"});this.elem.$$("iconListBgRight").setStyle({"height":Math.max(A.height-7,0)+"px"});this.elem.$$("iconListBgBottom").setStyle({"width":Math.max(A.width-7*2,0)+"px"})}});var Search=Class.create({initialize:function(A){this.canvasView=A;this.result=$("searchResult");this.result.observe("click",function(){this.hide()}.bindAsEventListener(this))},searchByDueDate:function(C,D,A,E){var B="due:"+formatDate(new Date(C,D,A));if(E){B+=" canvasId:"+E}return this.search(B)},search:function(C){var B=$("searchForm");B.condition.value=C;var A=this.canvasView.getDimensions();B.width.value=A.width;B.height.value=A.height;new AjaxUtil().get("/api/entry/search",B,this.searched.bind(this),error)},searched:function(A){leaveNewEntryMode();hideMovie();this.result.show();A.entries.each(function(B){B.canvas=A.canvases.find(function(D){return D.id==B.canvasId});var C=$("searchEntryTemplate").cloneNode(true);if(B.image){C.$$("body").setStyle({"padding":"0px 15px"})}else{C.$$("image").remove()}this.result.appendChild(C);Entry.bind(B,C);C.removeAttribute("id");B.fill();B.updatePosition();C.observe("click",this.showEntry.bindAsEventListener(this));C.show();B.updateBackgroundSize()}.bind(this))},hide:function(){this.result.innerHTML="";this.result.hide();showMovie()},showEntry:function(B){var A=getEntryElemFromChild(B.element()).entry;if(A.canvasId==g_canvasId){var C=getEntryElemFromId(A.id);if(C){ensureEntryElemVisible(C)}}else{if(A.canvas){document.location.href=canvasPath(A.canvas)+"#e"+A.id}}this.hide()}});var PrefereceStub=Class.create({initialize:function(){this.preference=null;this.elem=null;this.func=null},isVisible:function(){return this.preference&&this.preference.isVisible()},bind:function(A){if(this.preference){A(this.preference)}else{this.func=A;if(!this.elem){this.elem=new Element("script",{"type":"text/javascript","src":"/script/canvas/preference.js.4239"});document.body.appendChild(this.elem)}}},getPreference:function(){return this.preference},loadPreference:function(){this.preference=new Preference();this.func(this.preference);this.func=null}});var g_preferenceStub=new PrefereceStub();var Mark=Class.create({initialize:function(D,C,B,A){this.image=D;this.left=C;this.top=B;this.delay=A}});var EffectAction=Class.create({initialize:function(A,B){this.name=A;this.marks=B}});var screwUpAction=new EffectAction("screwup",[new Mark(1,0,0,80),new Mark(2,0,0,80),new Mark(3,0,0,80)]);var flickAction=new EffectAction("flick",[new Mark(1,-30,0,80),new Mark(2,-35,0,80),new Mark(3,-80,-45,80),new Mark(3,-150,-50,80),new Mark(3,-250,-50,80)]);function effect(F,B,A){var G=$("effect").cloneNode(true);$("canvas").appendChild(G);var D=F.positionedOffset();var I=F.getDimensions();var H=Math.min(I.width,I.height);D.left=Math.floor(D.left+(I.width-H)/2);D.top=Math.floor(D.top+(I.height-H)/2);G.setStyle({"left":D.left+"px","top":D.top+"px","width":H+"px","height":H+"px","opacity":1});function E(J){return function(){var K=B.marks[J];G.src="/image/entry/"+B.name+"/"+F.entry.color+"/"+K.image+".png";G.setStyle({"left":(D.left+K.left)+"px","top":(D.top+K.top)+"px"});if(J<B.marks.length-1){E(J+1).delay(K.delay/1000)}else{C(10)()}if(J==0){if(Prototype.Browser.IE){F.select(".bg *").each(function(L){if(!L.hasClassName("bgCenter")){L.hide()}})}F.setStyle({"opacity":0.5})}else{if(J==1){F.hide()}}}}function C(J){return function(){$("effect").setStyle({"opacity":J/10});if(J!=0){C(J-1).delay(0.05)}else{G.remove();A()}}}G.show();E(0)()}var Dashboard=Class.create({EFFECT_MINWIDTH:4,EFFECT_STEP:200,initialize:function(A){this.elem=A;this.frame=null;this.changed=false;this.backPath=false},show:function(){var F=this.prepareFrame();F.hide();hideMovie();var D=getWindowWidth();var G=getWindowHeight();var A=this.EFFECT_MINWIDTH;var E=this.EFFECT_MINWIDTH;this.elem.setStyle({"left":Math.floor((D-A)/2)+"px","top":Math.floor((G-E)/2)+"px","width":A+"px","height":E+"px"});var B=function(){A=Math.min(A+this.EFFECT_STEP,D);this.elem.setStyle({"left":Math.floor((D-A)/2)+"px","width":A+"px"});if(A==D){C.delay(0.1)}else{B.delay(0.01)}}.bind(this);var C=function(){E=Math.min(E+this.EFFECT_STEP,G);this.elem.setStyle({"top":Math.floor((G-E)/2)+"px","height":E+"px"});if(E==G){F.show()}else{C.delay(0.01)}}.bind(this);this.elem.show();B.delay(0.1)},hide:function(){if(this.backPath){document.location.href=this.backPath}else{if(this.changed){document.location.href=g_canvasPath}else{this.frame.hide();var B=getWindowWidth();var F=getWindowHeight();var A=this.elem.getWidth();var C=this.elem.getHeight();var E=function(){A=Math.max(A-this.EFFECT_STEP,this.EFFECT_MINWIDTH);this.elem.setStyle({"left":Math.floor((B-A)/2)+"px","width":A+"px"});if(A==this.EFFECT_MINWIDTH){D.delay(0.1)}else{E.delay(0.01)}}.bind(this);var D=function(){C=Math.max(C-this.EFFECT_STEP,this.EFFECT_MINWIDTH);this.elem.setStyle({"top":Math.floor((F-C)/2)+"px","height":C+"px"});if(C==this.EFFECT_MINWIDTH){(function(){this.elem.hide();showMovie()}).bind(this).delay(0.1)}else{D.delay(0.01)}}.bind(this);E()}}},isVisible:function(){return this.frame&&this.frame.visible()},setChanged:function(B,A){this.changed=true;if(B){this.backPath="/user/inbox"}else{if(A){this.backPath=A}}this.frame.contentWindow.document.location.reload(true)},prepareFrame:function(){if(!this.frame){var A=getCookie("dashboard")||"top";if(["top","favorites","friends","groups","public"].indexOf(A)==-1){A="top"}if(A=="public"){var B=getCookie("dashboardPublicPage");if(B){A+="?page="+B}}A="/dashboard/"+A;var C=new Element("iframe",{"src":A,"frameBorder":"0","allowTransparency":"true"});this.elem.appendChild(C);this.frame=C;Event.observe(window,"resize",function(){this.adjustFrameSize()}.bindAsEventListener(this));this.adjustFrameSize()}return this.frame},adjustFrameSize:function(){var A=getWindowWidth();var B=getWindowHeight();this.elem.setStyle({"width":A+"px","height":B+"px"});this.frame.setStyle({"width":A+"px","height":B+"px"})}})