if(!top.LF){top.LF={}}LF.WebPartController=function(A,B){this.RepositoryMetadata={};this.Actions=new LF.WPActionRegistry(this);this._context=new LF.WebPartContext(A,B);this._browseObjName=B;this.ContextMenu=new LF.MainContextMenu()};LF.WebPartController.prototype={set_quickbar:function(A){this._quickbar=A},subscribe:function(B,C,A){},getContextMenuItems:function(B,A){if(B==top.TYPE_GRID_HEADER){return this.ContextMenu.getItems(B,A,this)}return[]},doAction:function(A){this.Actions.getActionPropertiesByID(A).func(this._context)},setFocusControl:function(A){this._context.focusedControl=A},getFocusControl:function(){return this._context._getFocusControl()},selectCurrentFolder:function(A){this.getFocusControl().set_entry(A.id,A.repositoryName)},openDocument:function(A){OpenEntryInWebAccess(A)},openEntry:function(A){OpenEntryInWebAccess({id:A,type:"Document"})},set_repository:function(){},selectedEntryChanged:function(){},GetModeFunc:function(B,A){return function(){}},loadMetadata:function(F,B){var A=this;var C=this._context.repository;var E=function(H){top.unescapeRepositoryMetadata(H);var G=[];dojo.forEach(H.templates,function(I){G.push(I.name)});H["templateNameList"]=G;A.RepositoryMetadata[C]=H;if(F){F()}};var D=function(G){alert(G.get_message());if(B){B()}};Laserfiche.WebAccess.MetadataService.GetRepositoryMetadata(C,1,E,D)}};LF.WebPartContext=function(A,B){this.setRepository(A);this._browseObjName=B;this.user=""};LF.WebPartContext.prototype={_defineEntryFromData:function(E,F){var C=this;var D=E.id+":"+C.repository.toUpperCase();var B=function(G){if(G.id!=D){return }E.name=G.name;E.flags=G.flags;E.path=G.path;C.loaded=true;if(F){setTimeout(F,1)}};var A=function(){};if(!E.name||!E.flags||!E.path){C.loaded=false;Laserfiche.WebAccess.DocumentService.GetEntryInfo(E.id,C.repository,B,A)}else{C.loaded=true;if(F){setTimeout(F,1)}}return E},setFocusControl:function(A){this.focusedControl=A},_getFocusControl:function(){if(!this.focusedControl){this.focusedControl=eval(this._browseObjName)}return this.focusedControl},getSelectedItems:function(){return(this._getFocusControl()&&this.focusedControl.getSelectedItems&&this.focusedControl.getSelectedItems())},setRepository:function(A){this.repository=A}};LF.WPActionRegistry=function(A){this.registerAction=LF.ActionRegistry.prototype.registerAction;this.GetActionsList=LF.ActionRegistry.prototype.GetActionsList;this.getActionProperties=LF.ActionRegistry.prototype.getActionProperties;this.getActionPropertiesByID=LF.ActionRegistry.prototype.getActionPropertiesByID;this._controller=A;var B=this;this.initialize=function(){B._actions=new Array();var I=function(Q,P,O){return B.registerAction(Q,P,function(R){alert(P)},null,O)};var K=function(O){return O?true:false};var N=function(O){return O&&O.AllDocuments&&O.HasPage};var F=function(O){return !!O.LoggedIn};var D=function(O){return !!O.AllowCut};var E=function(O){return !!O.AllowCopy};var M=function(O){return !!O.AllowPaste};var C=function(P,O){return !!P.AllowPasteSC};var G=function(O){return !!O.AllowDelete};var J=function(O){return !!O.AllowRename};var H=function(O){var Q=new RightsStringClass(O.Rights);var P=Q.hasRight("ACCESS_READ_ACL");return P};OpenEntry=function(){OpenInWebAccess(B._controller._context)};B.registerAction("NoAction",null,function(){},null);B.registerAction("Open","Open",OpenEntry,K,"OpenIcon",null,1);B.registerAction("NEWFOL","New Folder",LF.NewFolder,F,"NewFolIcon",null,1);B.registerAction("SCAN","Scan",LaunchScanning,F,"ScanIcon",null,1);B.registerAction("IMPORT","Import",ImportButtonClick,function(O){return O.CreateDoc},"ImportIcon");function L(){return true}B.registerAction("COLUMNS","Customize Columns...",ColumnButtonClick,L,null,null,1);B.registerAction("SORTASC","Sort Ascending",LF.Actions.SortAscending,L,null,null,1);B.registerAction("SORTDESC","Sort Descending",LF.Actions.SortDescending,L,null,null,1)};this.initialize()};LF.NewFolder=function(){var A=prompt("Please enter a name for the folder","");if(A){CreateNewFolder(A)}};if(!top.LF){top.LF={}}LF.LayoutManager=function(){this.slots={};this.controls={};this._pendingControls={}};LF.LayoutManager.prototype={Initialize:function(B){var E=B.slots;for(var C=0;C<E.length;C++){var G=E[C];var A=G.controlname;var D=G.name;var F=G.active;this.slots[D]={name:D,div:G.div,tenant:A,active:F};this.controls[A]={name:A,control:G.control,location:D}}},RegisterSlot:function(A,C,B){this.slots[A]={name:A,div:C,active:B}},RegisterControl:function(B,E){this.controls[B]={name:B,control:E};if(this._pendingControls[B]){var D=this._pendingControls[B].location;if(D){var F=this.slots[D];var C=parseInt(F.div.style.width);if(isNaN(C)){C=F.div.offsetWidth}var A=parseInt(F.div.style.height);if(isNaN(A)){A=F.div.offsetHeight}F.div.appendChild(E.get_DOMelement());E.resize(C,A);if(F.active){E.activate()}this.controls[B].location=D}delete this._pendingControls[B]}},GetRegisteredControl:function(A){var B=(this.controls[A]);return(B)?B.control:null},IsControlRegistered:function(A){return !!(this.controls[A])},ActivateSlot:function(A){this.slots[A].active=true;var B=this.slots[A].tenant;if(B){if(this.IsControlRegistered(B)){this.controls[B].control.activate()}}},ResizeSlot:function(D,C,A){var E=C>0?C:1;var B=A>0?A:1;var G=this.slots[D];if(!G){return }G.div.style.width=E+"px";G.div.style.height=B+"px";var F=G.tenant;if(F){if(this.IsControlRegistered(F)){this.controls[F].control.resize(E,B)}}},DeactivateSlot:function(A){this.slots[A].active=false;var B=this.slots[A].tenant;if(B){if(this.IsControlRegistered(B)){this.controls[B].control.deactivate()}}},EmptySlot:function(B){var D=this.slots[B];if(D.tenant){if(this.IsControlRegistered(D.tenant)){var A=this.controls[D.tenant];var C=A.control;C.deactivate();D.div.removeChild(C.get_DOMelement());A.location=null}else{this._setPendingProperty(D.tenant,"location",null)}D.tenant=null}},MoveToSlot:function(E,B){this.EmptySlot(E);var G=this.slots[E];if(this.IsControlRegistered(B)){var D=parseInt(G.div.style.width);if(isNaN(D)){D=G.div.offsetWidth}var A=parseInt(G.div.style.height);if(isNaN(A)){A=G.div.offsetHeight}var C=this.controls[B];var F=C.control;if(C.location){this.EmptySlot(C.location)}G.div.appendChild(F.get_DOMelement());F.resize(D,A);if(G.active){F.activate()}C.location=E}else{this._setPendingProperty(B,"location",E)}G.tenant=B},_setPendingProperty:function(A,C,B){if(!this._pendingControls[A]){this._pendingControls[A]={}}this._pendingControls[A][C]=B}};if(!top.LF){top.LF={}}LF.Notifier={};LF.Notifier.InterfaceMembers={initializeEvents:function(){this.events={};this.eventsFirstClass={}},registerEventType:function(A){if(!this.events[A]){this.events[A]={};this.eventsFirstClass[A]={}}},hasEventType:function(A){if(this.events[A]){return true}return false},getEventTypes:function(){var B=new Array();var A=0;for(name in this.events){B[A]=name;A++}return B},subscribe:function(C,E,B){var A=E.id;var D=B?this.eventsFirstClass:this.events;var F=D[C];if(F){if(!F[A]){F[A]=E}}},unsubscribe:function(C,E,B){var A=E.id;var D=B?this.eventsFirstClass:this.events;var F=D[C];if(F){if(F[A]){delete F[A]}}},_notify:function(C,A){var B={type:C,src:this,args:A};var D=this.eventsFirstClass[C];for(listenerid in D){D[listenerid].notify(B)}D=this.events[C];for(listenerid in D){D[listenerid].notify(B)}}};LF.Notifier.applyInterface=function(B){var A=LF.Notifier.InterfaceMembers;for(member in A){B.prototype[member]=A[member]}};LF.Listener=function(A){this.id=A;this.handlers={};this._active=true};LF.Listener.prototype={setHandler:function(A,B){this.handlers[A]=B},notify:function(B){if(!this._active){return }var A=this.handlers[B.type];if(A){A(B)}},turnOff:function(){this._active=false},turnOn:function(){this._active=true}};if(typeof (top.UTILS_LOADED)=="undefined"){top.UTILS_LOADED={};$=function(A){return document.getElementById(A)};top.SetOver=function(C){var A=C.className;var B=A.indexOf(" Over");if(B<0){C.className=A+" Over"}};top.SetOut=function(B,D){var A=B.className;var C=A.replace(" Over","");if(!D){C=C.replace(" Down","")}B.className=C};top.SetDown=function(C){var A=C.className;var B=A.indexOf(" Down");if(B<0){C.className=A+" Down"}};top.SetUp=function(B){var A=B.className;B.className=A.replace(" Down","")};top.IgnoreNextBlur=function(A){var C=A.onblur;var B=function(){A.focus()};A.onblur=function(){A.onblur=C;setTimeout(B,10)}};top.KillPendingCallbacks=function(C){if(typeof (__pendingCallbacks)=="undefined"||!__pendingCallbacks){return }for(var B in __pendingCallbacks){var A=__pendingCallbacks[B];if(A&&(!C||(A.context&&A.context.callee==C))){var D=A.xmlRequest;D.abort();__pendingCallbacks[B]=null;A.errorCallback("Request cancelled",A.context,true)}}};top.ObjToQueryString=function(C){var E=[];for(var D in C){if(C.hasOwnProperty(D)){var B=C[D];if(dojo.isArray(B)){B=(new Array()).concat(B)}var A=Sys.Serialization.JavaScriptSerializer.serialize(B);E.push(String.format("{0}={1}",D,A))}}return("?"+E.join("&"))};top._escapeHtml=function(A){return A.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;").replace(/\n/gm,"<br>").replace(/  /gm," &nbsp;")};top.addStatusMsg=function(A){window.status+=A;if(window.status.length>120){window.status=window.status.substring(window.status.length-120-1)}};top.entriesSame=function(C,B){var A=true;if(!C!=!B){A=false}else{if(C.length!=B.length){A=false}else{for(var D=0;D<B.length;D++){if(B[D]!=B[D]){A=false;break}}}}return A};RightsStringClass=function(A){this.RightsString=A};RightsStringClass.prototype={validEntryRights:{ENTRY_BROWSE:1,ENTRY_READ:2,ENTRY_WRITE_CONTENT:3,ENTRY_ADD_PAGE:4,ACCESS_DELETE:5,ENTRY_RENAME:6,ENTRY_REMOVE_PAGE:7,ENTRY_SEE_ANNOTATIONS:8,ENTRY_ANNOTATE:9,ENTRY_SEE_THROUGH_REDACTIONS:10,ENTRY_WRITE_PROP:11,ENTRY_CREATE_DOC:12,ENTRY_CREATE_FOLDER:13,ACCESS_READ_ACL:14,ACCESS_WRITE_ACL:15,ACCESS_WRITE_OWNER:16,ENTRY_SET_REVIEW_DATE:17,ENTRY_FREEZE:18,ENTRY_SET_EVENT_DATE:19,ENTRY_CLOSE:20},validEntryRightsLength:20,hasRight:function(C){var A=this.validEntryRights[C];if(!A){return false}if(this.RightsString.length!=this.validEntryRightsLength*3){return false}var B=(this.validEntryRights[C]-1)*3;var D=this.RightsString.substring(B,B+3);if(D=="---"){return false}return true}};top.unescapeHTML=function(A){var B=document.createElement("DIV");B.innerHTML=A;if(B.innerText){return B.innerText}return B.textContent};top.unescapeFieldDefArray=function(A){dojo.forEach(A,function(B){B.name=top.unescapeHTML(B.name);if(dojo.isString(B.defaultValue)){B.defaultValue=top.unescapeHTML(B.defaultValue)}B.regex=top.unescapeHTML(B.regex);B.regexErrorMsg=top.unescapeHTML(B.regexErrorMsg);if(dojo.exists("listValues",B)){dojo.forEach(B.listValues,function(C){C=top.unescapeHTML(C)})}})};top.unescapeRepositoryMetadata=function(A){if(dojo.exists("fields",A)){top.unescapeFieldDefArray(A.fields)}if(dojo.exists("templateNameList",A)){dojo.forEach(A.templateNameList,function(B){B=top.unescapeHTML(B)})}if(dojo.exists("templates",A)){dojo.forEach(A.templates,function(B){B.name=top.unescapeHTML(B.name)})}};top.unescapeAllTemplateInfo=function(A){if(dojo.exists("fields",A)){top.unescapeFieldDefArray(A.fields)}if(dojo.exists("template.name",A)){A.template.name=top.unescapeHTML(A.template.name)}};top.getAvailableDlg=function(K){var H=[top.Dialogs,top.Dialogs2,top.Dialogs3];var E=null;var I=null;var C=0;var F=0;var A=0;for(var D=0;D<H.length;D++){var G=H[D];if(G.get_isShowing()||G.get_isWaitingForShow()){var J=G.GetStackPosition();C=Math.max(C,J);if(!K&&G.IsCentered()&&(!I||J>I.GetStackPosition())){I=G}}else{if(!E){E=G}}}if(E){E.Center();E.SetStackPosition(C+1);if(I){var B=I.GetRelativeOffset();E.SetRelativeOffset(0,B.y+40)}else{E.SetRelativeOffset(0,0)}}return E};top.getAvailableLoginDlg=function(){if(top.CurrentLoginDlg){return null}top.CurrentLoginDlg=top.getAvailableDlg(true);return top.CurrentLoginDlg};top.isLoggedIn=function(A){if(!A){return false}var C=top.myFolderTree;if(!C){return false}var B=C._store._getItemByIdentity("1:"+A);if(!B){return false}return(!!C._store.getValue(B,"connected"))};top.hasFeature=function(B,A){if(!B||!A){return false}var C=top&&top.myAppController&&top.myAppController.loginInfo&&top.myAppController.loginInfo[B];if(C&&C[A]){return true}return false};top.Hasher=function(){var L=1;var B="=";var K=8;function A(O){return N(G(C(O),O.length*K))}function G(Y,T){Y[T>>5]|=128<<(T%32);Y[(((T+64)>>>9)<<4)+14]=T;var X=1732584193;var W=-271733879;var V=-1732584194;var U=271733878;for(var Q=0;Q<Y.length;Q+=16){var S=X;var R=W;var P=V;var O=U;X=M(X,W,V,U,Y[Q+0],3);U=M(U,X,W,V,Y[Q+1],7);V=M(V,U,X,W,Y[Q+2],11);W=M(W,V,U,X,Y[Q+3],19);X=M(X,W,V,U,Y[Q+4],3);U=M(U,X,W,V,Y[Q+5],7);V=M(V,U,X,W,Y[Q+6],11);W=M(W,V,U,X,Y[Q+7],19);X=M(X,W,V,U,Y[Q+8],3);U=M(U,X,W,V,Y[Q+9],7);V=M(V,U,X,W,Y[Q+10],11);W=M(W,V,U,X,Y[Q+11],19);X=M(X,W,V,U,Y[Q+12],3);U=M(U,X,W,V,Y[Q+13],7);V=M(V,U,X,W,Y[Q+14],11);W=M(W,V,U,X,Y[Q+15],19);X=I(X,W,V,U,Y[Q+0],3);U=I(U,X,W,V,Y[Q+4],5);V=I(V,U,X,W,Y[Q+8],9);W=I(W,V,U,X,Y[Q+12],13);X=I(X,W,V,U,Y[Q+1],3);U=I(U,X,W,V,Y[Q+5],5);V=I(V,U,X,W,Y[Q+9],9);W=I(W,V,U,X,Y[Q+13],13);X=I(X,W,V,U,Y[Q+2],3);U=I(U,X,W,V,Y[Q+6],5);V=I(V,U,X,W,Y[Q+10],9);W=I(W,V,U,X,Y[Q+14],13);X=I(X,W,V,U,Y[Q+3],3);U=I(U,X,W,V,Y[Q+7],5);V=I(V,U,X,W,Y[Q+11],9);W=I(W,V,U,X,Y[Q+15],13);X=D(X,W,V,U,Y[Q+0],3);U=D(U,X,W,V,Y[Q+8],9);V=D(V,U,X,W,Y[Q+4],11);W=D(W,V,U,X,Y[Q+12],15);X=D(X,W,V,U,Y[Q+2],3);U=D(U,X,W,V,Y[Q+10],9);V=D(V,U,X,W,Y[Q+6],11);W=D(W,V,U,X,Y[Q+14],15);X=D(X,W,V,U,Y[Q+1],3);U=D(U,X,W,V,Y[Q+9],9);V=D(V,U,X,W,Y[Q+5],11);W=D(W,V,U,X,Y[Q+13],15);X=D(X,W,V,U,Y[Q+3],3);U=D(U,X,W,V,Y[Q+11],9);V=D(V,U,X,W,Y[Q+7],11);W=D(W,V,U,X,Y[Q+15],15);X=J(X,S);W=J(W,R);V=J(V,P);U=J(U,O)}return Array(X,W,V,U)}function F(T,Q,P,O,S,R){return J(H(J(J(Q,T),J(O,R)),S),P)}function M(Q,P,T,S,O,R){return F((P&T)|((~P)&S),Q,0,O,R,0)}function I(Q,P,T,S,O,R){return F((P&T)|(P&S)|(T&S),Q,0,O,R,1518500249)}function D(Q,P,T,S,O,R){return F(P^T^S,Q,0,O,R,1859775393)}function E(Q,T){var S=C(Q);if(S.length>16){S=G(S,Q.length*K)}var O=Array(16),R=Array(16);for(var P=0;P<16;P++){O[P]=S[P]^909522486;R[P]=S[P]^1549556828}var U=G(O.concat(C(T)),512+T.length*K);return G(R.concat(U),512+128)}function J(O,R){var Q=(O&65535)+(R&65535);var P=(O>>16)+(R>>16)+(Q>>16);return(P<<16)|(Q&65535)}function H(O,P){return(O<<P)|(O>>>(32-P))}function C(R){var Q=Array();var O=(1<<K)-1;for(var P=0;P<R.length*K;P+=K){Q[P>>5]|=(R.charCodeAt(P/K)&O)<<(P%32)}return Q}function N(R){var Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var T="";for(var P=0;P<R.length*4;P+=3){var S=(((R[P>>2]>>8*(P%4))&255)<<16)|(((R[P+1>>2]>>8*((P+1)%4))&255)<<8)|((R[P+2>>2]>>8*((P+2)%4))&255);for(var O=0;O<4;O++){if(P*8+O*6>R.length*32){T+=B}else{T+=Q.charAt((S>>6*(3-O))&63)}}}return T}return{getHashValue:function(O){return A(O)}}}()}function getExportIFrame(){var A=$get("exportIFrame");if(!A){A=document.createElement("iframe");A.style.height="1px";A.style.width="1px";A.style.visibility="hidden";A.style.position="absolute";document.body.appendChild(A);A.id="exportIFrame"}return A}dojo.require("dojox.gfx");Type.registerNamespace("Laserfiche");Laserfiche.AnnotationControl=function(C,B){var A=this;A._pageid=0;A._saveRequested=false;A._saveRequestCount=0;A._statusMessage="";A._eventHandler=new Sys.EventHandlerList();A.annSaveSuccessfulStub=function(E,D){A.SaveSuccessfulHandler(E,D)};A.annSaveFailedStub=function(E,D){A.SaveFailedHandler(E,D)};A.addOnSaveSuccessful(function(){this._hasBlockChanges=false});A._reponame=C;A._docid=B;A.initialize();A._mode=Laserfiche.Modes.MODE_PAN;A._editor=null;A._editorLoaded=false;A.applyLinkRetryCnt=0;A.applyLinkRetryInterval=200;A.applyLinkRetryCntMax=25;A.changed=false;A.keySpeed=1;A.OneOff=true;A.ContextMenu=new LF.AnnPageContextMenu();A._changesPending=false;A._changeRequestCount=0;A._readonly=true;A._readonlyBlockAnn=false;A._isTextEditing=false;A._hasBlockChanges=false;A._rotationchanged=false};Laserfiche.AnnotationControl.MAX_ZOOM=20;Laserfiche.AnnotationControl.prototype={STATE_IDLE:0,STATE_WAIT:1,STATE_DRAWING:2,STATE_DRAGGING:3,ZOOM_INCREMENT:2,MARGIN:0,HasBlockAnnChanges:function(){return !!this._hasBlockChanges},ChangesPending:function(){return !!this._changesPending},increment_changeRequestCount:function(){this._changeRequestCount++;if(this._changesPending!=true){this.set_changesPending(true)}},decrement_changeRequestCount:function(){this._changeRequestCount=Math.max(this._changeRequestCount-1,0);if(this._changeRequestCount==0&&this._changesPending!=false){this.set_changesPending(false)}},set_changesPending:function(A){this._changesPending=A;if(A){this.set_statusMessage("Storing changes...")}else{this.set_statusMessage("Ready")}if(!A&&this.onChangesSent){this.onChangesSent()}},set_pageviewCtrl:function(A){this._pageViewCtrl=A},initialize:function(){var A=this;A._timeoutDuration=1250;A._timeout=null;A._waittimer=null;A._annotations=new Object();A._removedannotations=new Object();A._currentAnnotation;A._newcounter=0;A._state=A.STATE_IDLE;A._ismousedown=false;A._lastposition=null;A._dragAction=null;A._dragReleaseAction=null;A._scale=1;A._surfacetranslate={x:0,y:0};A._rotation=0;A._xoffset=0;A._yoffset=0;A._imageviewHeight=600;A._imageviewWidth=600;A._searchresults=null;A._hasBlockChanges=false},set_appController:function(A){this._appController=A;this._initializeStatusBar()},isDirty:function(){return !!(this.changed||(this._editor&&this._editor.hasTextChanged()))},setClean:function(){if(this.changed){Laserfiche.WebAccess.AnnotationsService.DiscardAnnotationChanges(this._reponame,this._docid,this._pageid)}this.changed=false;this._readonlyBlockAnn=false;this._isTextEditing=false;this._hasBlockChanges=false},setDirty:function(){if(this._readonly){return }if(!this.changed){var B=function(){};var A=function(C){if(Laserfiche.Exception.IsConnectionLost(C)){Laserfiche.Exception.DocViewConnectionLostFunc()}else{alert(C.get_message())}};Laserfiche.WebAccess.DocumentService.LockEntry(this._docid,this._reponame,B,A)}this.changed=true},StoreAnnotation:function(A){var B=this;B._annotations[A.id]=A;if(B._panel){B._panel.addAnnotation(A)}if((A._type!=Laserfiche.AnnotationTypes.ANN_STRIKEOUT)&&(A._type!=Laserfiche.AnnotationTypes.ANN_UNDERLINE)){A.makeMoveable()}A.sync(true)},GetAnnotation:function(A){return this._annotations[A]},GetNextAnnotationID:function(){return"ann_"+this._newcounter++},GetNumberAnnotations:function(){var A=0;for(id in this._annotations){A++}return A},set_surface:function(A,B,D,C){this._initializeSurface(A,B,D,C)},get_page:function(){return this._pageid},clearState:function(){var A=this;if(A._rotationchanged){A._rotationchanged=false}A.ClearSelection();A._state=A.STATE_IDLE;for(id in A._annotations){try{A._annotations[id].remove()}catch(B){}delete A._annotations[id]}if(A._panel){A._panel.initialize()}A._annotations=new Object();A._removedannotations=new Object();A.selectMode(Laserfiche.Modes.MODE_SELECTION);A.setClean()},refreshTextContextHits:function(C){var D=this;if(D._editor){var A=function(F){var E=dojo.map(F,function(G){return{start:G.offsetlineonpage,end:G.offsetlineonpage+G.wordlength-1}});D._editor.renderContextHits(E)};var B=function(E){D._contextHitsTextLoc=[]};D._contextHitsTextLoc=null;D._searchresults={};D._searchresults.searchhandle=C;D._editor.clearContextHits();Laserfiche.WebAccess.DocumentService.GetTextContextHitsByPage(D._reponame,D._searchresults.searchhandle,D._docid,D._pageid,A,B)}},set_page:function(A){var E=this;var D=E._pageid;E["annLoaded"]=false;E.clearState();E._pageid=A;E.LoadAnnotations();if(E._editor){var F=function(G){E.InitText(G)};var B=function(G){E._contextHitsTextLoc=G};var C=function(G){E._contextHitsTextLoc=[]};Laserfiche.WebAccess.DocumentService.GetTextByID(E._reponame,E._docid,A,0,F,E.SetTextError);if(E._searchresults){E._contextHitsTextLoc=null;Laserfiche.WebAccess.DocumentService.GetTextContextHitsByPage(E._reponame,E._searchresults.searchhandle,E._docid,A,B,C)}}E.set_offset(0,0)},set_scale:function(F,B){if(F==0){F=0.01}var D=this;var E=Math.min(parseInt(F*100)/100,Laserfiche.AnnotationControl.MAX_ZOOM);var L=D._scale;if(isNaN(E)){E=1}var K=E/D._scale;D._scale=E;D._surface.applyTransform(dojox.gfx.matrix.translate(-D._surfacetranslate.x,-D._surfacetranslate.y));D._surface.applyTransform(dojox.gfx.matrix.scale(K,K));D._container.style.width=parseInt(D._surfaceWidth*E)+"px";D._container.style.height=parseInt(D._surfaceHeight*E)+"px";D._realsurface.setDimensions(D._surfaceWidth*E,D._surfaceHeight*E);var I=0;var H=0;switch(D._rotation){case 0:break;case 90:H=-D._imagecontrol.ImageWidth;break;case 180:I=-D._imagecontrol.ImageWidth;H=-D._imagecontrol.ImageHeight;break;case 270:I=-D._imagecontrol.ImageHeight;break}D._surface.applyTransform(dojox.gfx.matrix.translate(I,H));D._surfacetranslate={x:I,y:H};if(D._imagecontrol.Scale!=parseInt(D._scale*100)){D._imagecontrol.Rescale(parseInt(D._scale*100))}if(D.onscale){D.onscale()}var N=0;var M=0;if(B){N=B.x;M=B.y}else{N=parseInt((D._imagecontrol.Width/2)/L-D._xoffset);M=parseInt((D._imagecontrol.Height/2)/L-D._yoffset)}if(B||D._xoffset!=0||D._yoffset!=0){var J=-(N-parseInt((D._imagecontrol.Width/2)/E));var C=-(M-parseInt((D._imagecontrol.Height/2)/E));D.set_offset(J,C)}for(id in D._annotations){var A=D._annotations[id];if(A.HandleRescale){A.HandleRescale(D._scale)}}if(D._guideimage){D._guideimage.height=parseInt(D._guideimage.height*K);D._guideimage.width=parseInt(D._guideimage.width*K)}var G=parseInt(D._scale*100)+"%";switch(Laserfiche.ZoomMode.ZoomType){case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_WIDTH:G=G+" ("+GetString("FIT_TO_WIDTH")+")";break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_HEIGHT:G=G+" ("+GetString("FIT_TO_HEIGHT")+")";break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_PAGE:G=G+" ("+GetString("FIT_TO_WINDOW")+")";break;case Laserfiche.ZoomTypes.ZOOM_TYPE_USE_SCALE:G=G+" ("+GetString("SCALE")+")";break}D._scaleinfoSpan.innerHTML=G},get_scale:function(){return this._scale},set_rotation:function(J,D){var B=this;var C=J%360;if(C<0){C+=360}var F=B._rotation;var H=J-F;H=H%360;if(H<0){H+=360}B._rotationchanged=(H!=0);if(B._rotationchanged&&!D){B.setDirty()}B._rotation=C;if(H%180!=0){var E=B._imagecontrol.ImageHeight;var G=B._imagecontrol.ImageWidth;B.set_dimensions(E,G)}B._surface.applyTransform(dojox.gfx.matrix.translate(-B._surfacetranslate.x,-B._surfacetranslate.y));B._surface.applyTransform(dojox.gfx.matrix.rotateg(H));var K=0;var I=0;switch(C){case 0:break;case 90:I=-B._imagecontrol.ImageWidth;break;case 180:K=-B._imagecontrol.ImageWidth;I=-B._imagecontrol.ImageHeight;break;case 270:K=-B._imagecontrol.ImageHeight;break}B._surface.applyTransform(dojox.gfx.matrix.translate(K,I));B._surfacetranslate={x:K,y:I};B._imagecontrol.SetRotation(C);if(B.onrotate){B.onrotate()}B.set_offset(0,0);for(id in B._annotations){var A=B._annotations[id];if(A.HandleRotate){A.HandleRotate(B._rotation)}}if(Laserfiche.ZoomMode.ZoomType==Laserfiche.ZoomTypes.ZOOM_TYPE_USE_SCALE){B.set_scale(B._scale)}B.RefreshImageInfo();B.set_offset(0,0)},get_rotation:function(){return this._rotation},set_xoffset:function(A,B){var C=this;if(isNaN(A)){return }C.set_offset(A,C._yoffset,B)},set_yoffset:function(C,A){var B=this;if(isNaN(C)){return }B.set_offset(B._xoffset,C,A)},set_offset:function(K,J,U){var B=this;var T=B._imagecontrol.ImageHeight;var I=B._imagecontrol.ImageWidth;var L=B._imagecontrol.Height;var N=B._imagecontrol.Width;var V=T>L;var R=I>N;if(V){N=N-17;if(!R){R=I>N}if(R){adjustedheight=L-17}}else{if(R){L=L-17;V=T>L;if(V){N=N-17}}}var M=B.MARGIN/B._scale;var A=B.MARGIN/B._scale;var H=I+(B.MARGIN-N)/B._scale;var O=T+(B.MARGIN-L)/B._scale;if(I<parseInt(N/B._scale)){M=parseInt(((N/B._scale)-I)/2)}if(T<parseInt(L/B._scale)){A=parseInt(((L/B._scale)-T)/2)}var F=Math.min(M,Math.max(K,-H));var E=Math.min(A,Math.max(J,-O));var P=false;var G=false;if(B._xoffset!=F){B._xoffset=F;P=true}if(B._yoffset!=E){B._yoffset=E;G=true}var S=parseInt(B._xoffset*B._scale);var Q=parseInt(B._yoffset*B._scale);B._container.style.left=S+"px";B._container.style.top=Q+"px";var D=parseInt((-S+B._imagecontrol.Width)/B._scale);var C=parseInt((-Q+B._imagecontrol.Height)/B._scale);if(D>B._surfaceWidth||C>B._surfaceHeight){B.set_dimensions(Math.max(D,B._surfaceWidth),Math.max(C,B._surfaceHeight))}B._imagecontrol.setPosition(S,Q);if(!U&&B.onmove){B.onmove(S,Q,P,G)}},set_fullDimensions:function(B,A){},set_imageviewDimensions:function(C,B){var E=this;var D=parseInt(C/E._scale);var A=parseInt(B/E._scale);E._imageviewHeight=B;E._imageviewWidth=C;var G=-E._xoffset+A;var F=-E._yoffset+D;if(G>E._surfaceWidth||F>E._surfaceHeight){E.set_dimensions(Math.max(G,E._surfaceWidth),Math.max(F,E._surfaceHeight))}},set_dimensions:function(B,A){var C=this;var E=parseInt(B*C._scale);var D=parseInt(A*C._scale);C._container.style.width=E+"px";C._container.style.height=D+"px";C._surfaceWidth=B;C._surfaceHeight=A;C._realsurface.setDimensions(B*C._scale,A*C._scale)},set_panel:function(A){var B=this;if(A){B._panel=new Laserfiche.AnnotationPanel(A,B)}else{B._panel=null}},set_textEditor:function(A){this._textNodeContainer=A;this._initializeTextEditor(A)},set_timeoutDuration:function(A){this._timeoutDuration=A},set_hold:function(A){if(A){if(this._state==this.STATE_IDLE){this._state=this.STATE_WAIT}}else{if(this._state==this.STATE_WAIT){this._state=this.STATE_IDLE}}},selectMode:function(G){var E=this;var F=Laserfiche.Modes.GetModeObject(G);var D=F.cursorclass;E._container.className=D;E._mode=G;if(G==Laserfiche.Modes.MODE_STAMP){F.RepositoryName=E._reponame}if(G==Laserfiche.Modes.MODE_BITMAP||G==Laserfiche.Modes.MODE_ATTACHMENT){F.onDrawable=function(){E._container.className=F.cursorclass};if(G==Laserfiche.Modes.MODE_BITMAP){var C="Dialogs/Annotations/UploadBitmapForm.aspx";var B=String.format("{0}?{1}",C,dojo.objectToQuery({RepositoryName:E._reponame,id:E.docid||-1,page:-1}));var A=top.getAvailableDlg();if(A){A.OpenDialog(B,250,300,true);A.onclose=function(H){if(H!=null){F.SetDrawable(H.token,H.width,H.height)}else{E.selectMode(Laserfiche.Modes.MODE_SELECTION)}}}else{alert("Error: DialogWrapper not found.  Unable to display UploadBitmapForm")}}else{if(G==Laserfiche.Modes.MODE_ATTACHMENT){var C="Dialogs/Annotations/UploadAttachmentForm.aspx";var B=String.format("{0}?{1}",C,dojo.objectToQuery({RepositoryName:E._reponame,id:E.docid||-1,page:-1}));var A=top.getAvailableDlg();if(A){A.OpenDialog(B,100,300,true);A.onclose=function(H){if(H!=null){F.SetDrawable(H.token,H.filename,H.mime)}else{E.selectMode(Laserfiche.Modes.MODE_SELECTION)}}}else{alert("Error: DialogWrapper not found.  Unable to display UploadAttachmentForm")}}}}else{if(G==Laserfiche.Modes.MODE_STAMP){F.onDrawable=function(){E._container.className=F.cursorclass};var C="Dialogs/Annotations/StampManager.aspx";var B=String.format("{0}?{1}",C,dojo.objectToQuery({RepositoryName:E._reponame,id:E.docid||-1,page:-1}));var A=top.getAvailableDlg();if(A){A.OpenDialog(B,305,525);A.onclose=function(H){if(H!=null){F.SetDrawable(H.StampID,H.StampName,H.Color,H.Height,H.Width,H.Common,H.Personal);E._container.className=F.cursorclass}else{E.selectMode(Laserfiche.Modes.MODE_SELECTION)}}}else{alert("Error: DialogWrapper not found.  Unable to display dialog")}}else{if(G==Laserfiche.Modes.MODE_HIGHLIGHT||G==Laserfiche.Modes.MODE_BLACKOUT||G==Laserfiche.Modes.MODE_UNDERLINE||G==Laserfiche.Modes.MODE_STRIKEOUT){if(E._pageViewCtrl&&E._pageViewCtrl._textvisible){E._editor.onModeSet(G)}}else{if(G==Laserfiche.Modes.MODE_ZOOM){F.oncursorchange=function(){E._container.className=F.cursorclass}}}}}if(G!=Laserfiche.Modes.MODE_SELECTION){E.ClearSelection()}},SelectAnnotation:function(A,B){var C=this;C.ClearSelection();C._currentAnnotation=A;if(A){A.highlight(B)}},SelectNextAnnotation:function(B){var E=this;var D=E._currentAnnotation;if(D==null||E.GetNumberAnnotations()>1){var F=false;var C=-1;if(B){for(id in E._annotations){if(C==-1){C=id}if(F||D==null){C=id;break}if(D.id==id){F=true}}}else{for(id in E._annotations){if(D.id==id&&C!=-1){break}C=id}}E.ClearSelection();var A=E.GetAnnotation(C);E.SelectAnnotation(A);return true}else{return false}},ClearSelection:function(){var A=this;if(A._currentAnnotation){A._currentAnnotation.unhighlight()}A._currentAnnotation=null;A._dragReleaseAction=null;A._dragAction=null;A._state=A.STATE_IDLE},ClickAnnotation:function(A,L,M,K){var C=this;if(A){var H=C._mode;switch(H){case Laserfiche.Modes.MODE_ERASER:C.RemoveAnnotation(A);break;case Laserfiche.Modes.MODE_SELECTION:var F=C.GetAnnotation(A);if(F){C.SelectAnnotation(F);C._state=C.STATE_DRAGGING;var I=C._currentAnnotation;var B=K?K.getAttribute("IsHandle")==1:null;if(B){var J=K.getAttribute("N")==1;var G=K.getAttribute("S")==1;var D=K.getAttribute("W")==1;var O=K.getAttribute("E")==1;C._dragAction=function(R,P){var N;var W;switch(C._rotation){case 0:N=R;W=P;break;case 90:N=P;W=-R;break;case 180:N=-R;W=-P;break;case 270:N=-P;W=R;break}C._currentAnnotation.unhighlight();var V=K.getAttribute("PT")==1;if(V){var T,S,Q,E;T=Q=I._focus.x;S=E=I._focus.y;if(T+N>I._control._imagecontrol.ImageWidth){N=I._control._imagecontrol.ImageWidth-T}if(S+W>I._control._imagecontrol.ImageHeight){W=I._control._imagecontrol.ImageHeight-S}if(Q+N<0){N=-Q}if(E+W<0){W=-E}}else{var U=I.getBoundingBox();if(U){if(U.x+U.width+N>I._control._imagecontrol.ImageWidth){N=I._control._imagecontrol.ImageWidth-(U.x+U.width)}if(U.y+U.height+W>I._control._imagecontrol.ImageHeight){W=I._control._imagecontrol.ImageHeight-(U.y+U.height)}if(U.x+N<0){N=-U.x}if(U.y+W<0){W=-U.y}}else{return }}C._currentAnnotation.stretch(J?W:0,G?W:0,D?N:0,O?N:0,L,V);C._currentAnnotation.highlight(L)}}else{C._dragAction=function(Q,N){var P;var E;switch(C._rotation){case 0:P=Q;E=N;break;case 90:P=N;E=-Q;break;case 180:P=-Q;E=-N;break;case 270:P=-N;E=Q;break}C._currentAnnotation.unhighlight();var R=I.getBoundingBox();if(R){if(R.x+R.width+P>I._control._imagecontrol.ImageWidth){P=I._control._imagecontrol.ImageWidth-(R.x+R.width)}if(R.y+R.height+E>I._control._imagecontrol.ImageHeight){E=I._control._imagecontrol.ImageHeight-(R.y+R.height)}if(R.x+P<0){P=-R.x}if(R.y+E<0){E=-R.y}C._currentAnnotation.move(P,E,L)}}}C._lastposition={x:M.mx,y:M.my}}break}}},GetCurrentXY:function(I){if(!I){I=window.event}var H=I.clientX;var F=I.clientY;var A=this;var D=dojo.coords(A._container);var C=H-D.x;var B=F-D.y;var E;var G;switch(A._rotation){case 0:E=C;G=B;break;case 90:E=B;G=A._imagecontrol.ImageWidth*A._scale-C;break;case 180:E=A._imagecontrol.ImageWidth*A._scale-C;G=A._imagecontrol.ImageHeight*A._scale-B;break;case 270:E=A._imagecontrol.ImageHeight*A._scale-B;G=C;break}return{x:parseInt(E/A._scale),y:parseInt(G/A._scale),cx:C,cy:B,mx:H,my:F}},GetDblClickHandler:function(){var A=this;return function(C){var D=C.target.getAttribute("id");var B=A.GetAnnotation(D);if(B){B.HandleDblClick()}}},GetContextMenuHandler:function(){var A=this;return function(C){var D=C.target.getAttribute("id");var B=A.GetAnnotation(D);if(B){dojo.stopEvent(C);B.HandleContextMenu(C)}}},StopDrawing:function(A,C){var B=this;if(B._timeout){B.clearTimeout()}B._currentAnnotation.HandleMouseDown(A,C)},GetMouseDownHandler:function(){var A=this;return function(C){if(!C){C=window.event}if(A._state==A.STATE_WAIT){return }A._ismousedown=true;var H=A.GetCurrentXY(C);var B=H.x;var G=H.y;if(C.button==2){if(A._state==A.STATE_DRAWING){A.StopDrawing(B,G)}A.selectMode(Laserfiche.Modes.MODE_SELECTION);return }if(A._state==A.STATE_DRAWING){A.StopDrawing(B,G)}else{if(A._state==A.STATE_DRAGGING){}else{A.ClearSelection();if(A._mode==Laserfiche.Modes.MODE_PAN){A._lastposition={x:H.mx,y:H.my}}else{if(A._mode==Laserfiche.Modes.MODE_ZOOM){A._lastposition={x:H.cx,y:H.cy}}else{var F=C.target.getAttribute("id");var D=C.target.getAttribute("args");A.ClickAnnotation(F,D,H,C.target)}}var E=Laserfiche.Modes.GetModeObject(A._mode);E.HandleMouseDown(B,G,A)}}dojo.stopEvent(C)}},GetMouseMoveHandler:function(){var A=this;return function(M){if(!M){M=window.event}if(A._currentMouseMoveHandler){A._currentMouseMoveHandler(M);return }var J=A.GetCurrentXY(M);A._mouseinfoSpan.innerHTML=J.x+", "+J.y;if(A._state==A.STATE_WAIT){return }var L=false;if(A._state==A.STATE_DRAWING){A._currentAnnotation.HandleMouseMove(J.x,J.y,A._ismousedown)}else{if((A._state==A.STATE_DRAGGING)&&((A._currentAnnotation==null)||A._currentAnnotation.moveable)){var E=parseInt((J.mx-A._lastposition.x)/A._scale);var B=parseInt((J.my-A._lastposition.y)/A._scale);if(A._dragAction&&(E!=0||B!=0)){A._dragAction(E,B);A._lastposition={x:J.mx,y:J.my}}}else{if(A._mode==Laserfiche.Modes.MODE_ZOOM){if(A._ismousedown){var F=A._lastposition.x;var K=A._lastposition.y;var C=J.cx;var I=J.cy;var H=Math.min(K,I);var G=Math.min(F,C);var N=Math.max(Math.abs(K-I),1);var D=Math.max(Math.abs(F-C),1);if(!A._guiderectangle){A._guiderectangle=document.createElement("div");A._guiderectangle.style.zIndex=5;A._guiderectangle.style.position="absolute";A._guiderectangle.style.border="1px dashed blue";A._container.appendChild(A._guiderectangle)}A._guiderectangle.style.top=parseInt(H)+"px";A._guiderectangle.style.left=parseInt(G)+"px";A._guiderectangle.style.height=parseInt(N)+"px";A._guiderectangle.style.width=parseInt(D)+"px"}else{A._lastposition={x:J.x,y:J.y}}}}}if(!L&&A._guideimage){A._container.removeChild(A._guideimage);A._guideimage=null}dojo.stopEvent(M)}},GetMouseOutHandler:function(){var A=this;return function(B){if(!B){B=window.event}if(A._guideimage){if(A._mode!=Laserfiche.Modes.MODE_BITMAP){A._container.removeChild(A._guideimage);A._guideimage=null}}if(A._mode==Laserfiche.Modes.MODE_ZOOM){Laserfiche.ZoomMode.SetZoomIn(true)}}},GetMouseUpHandler:function(){var A=this;return function(I){if(!A._ismousedown){return }if(!I){I=window.event}if(A._currentMouseUpHandler){A._currentMouseUpHandler(I);return }if(A._state==A.STATE_WAIT){return }var E=A.GetCurrentXY(I);var G=E.x;var F=E.y;A._ismousedown=false;if(A._state==A.STATE_DRAWING){A._currentAnnotation.HandleMouseUp(G,F)}else{if(A._state==A.STATE_DRAGGING){if(A._currentAnnotation){A._currentAnnotation.sync();A._currentAnnotation.highlight()}if(A._dragReleaseAction){A._dragReleaseAction();A._dragReleaseAction=null}A._state=A.STATE_IDLE;A._dragAction=null}else{if(A._mode==Laserfiche.Modes.MODE_ZOOM){if(I.button>1){return }if(A._guiderectangle){var J=parseInt(A._guiderectangle.style.height);var C=parseInt(A._guiderectangle.style.width);if(J>5&&C>5){var L=parseInt((C/2+parseInt(A._guiderectangle.style.left))/A._scale);var K=parseInt((J/2+parseInt(A._guiderectangle.style.top))/A._scale);var H;var D=A._imagecontrol.Height/A._imagecontrol.Width;var B=J/C;if(B>D){H=A._imagecontrol.Height/parseInt(J/A._scale)}else{H=A._imagecontrol.Width/parseInt(parseInt(A._guiderectangle.style.width)/A._scale)}if(H>Laserfiche.AnnotationControl.MAX_ZOOM){H=Laserfiche.AnnotationControl.MAX_ZOOM}Laserfiche.ZoomMode.ZoomType=Laserfiche.ZoomTypes.ZOOM_TYPE_USE_SCALE;A.set_scale(H,{x:L,y:K})}else{A._lastposition={x:E.x,y:E.y};if(Laserfiche.ZoomMode.ZoomIn){A.ZoomIn()}else{A.ZoomOut()}}A._container.removeChild(A._guiderectangle);A._guiderectangle=null}else{A._lastposition={x:E.x,y:E.y};if(Laserfiche.ZoomMode.ZoomIn){A.ZoomIn()}else{A.ZoomOut()}}}}}dojo.stopEvent(I)}},HandleScroll:function(B){var C=this;var A=false;if(C._mode==Laserfiche.Modes.MODE_ZOOM){var D=C.get_scale();if(B>0){C.ZoomOut(B)}else{C.ZoomIn(-B)}A=(C.get_scale()!=D)}return A},HandleKeyDown:function(I,H,C,A){var D=this;if(!(I==dojo.keys.UP_ARROW||I==dojo.keys.DOWN_ARROW||I==dojo.keys.RIGHT_ARROW||I==dojo.keys.LEFT_ARROW)){return true}if(D._mode==Laserfiche.Modes.MODE_ZOOM){if(I==dojo.keys.SHIFT){Laserfiche.ZoomMode.SetZoomIn(false);return false}}var B=0;var J=0;var F=D._currentAnnotation;var E=true;switch(I){case dojo.keys.UP_ARROW:F.unhighlight();B=0;J=-(D.keySpeed);if(!D.speeduptimer){D.speeduptimer=setTimeout(function(){D.keySpeed+=5;D.speeduptimer=null},1000)}break;case dojo.keys.DOWN_ARROW:F.unhighlight();B=0;J=D.keySpeed;if(!D.speeduptimer){D.speeduptimer=setTimeout(function(){D.keySpeed+=5;D.speeduptimer=null},1000)}break;case dojo.keys.RIGHT_ARROW:F.unhighlight();B=D.keySpeed;J=0;if(!D.speeduptimer){D.speeduptimer=setTimeout(function(){D.keySpeed+=5;D.speeduptimer=null},1000)}break;case dojo.keys.LEFT_ARROW:F.unhighlight();B=-((D.keySpeed));J=0;if(!D.speeduptimer){D.speeduptimer=setTimeout(function(){D.keySpeed+=5;D.speeduptimer=null},1000)}break}var G=F.getBoundingBox();if(G){if(G.x+G.width+B>F._control._imagecontrol.ImageWidth){B=F._control._imagecontrol.ImageWidth-(G.x+G.width)}if(G.y+G.height+J>F._control._imagecontrol.ImageHeight){J=F._control._imagecontrol.ImageHeight-(G.y+G.height)}if(G.x+B<0){B=-G.x}if(G.y+J<0){J=-G.y}F.move(B,J,E)}return true},HandleKeyUp:function(B,A,E,D){var C=this;if(C._mode==Laserfiche.Modes.MODE_ZOOM){Laserfiche.ZoomMode.SetZoomIn(true);return false}if(B==dojo.keys.DELETE){if(C._currentAnnotation){C.RemoveAnnotation(C._currentAnnotation.id)}}if(C.speeduptimer){C._currentAnnotation.highlight();C.keySpeed=1;clearTimeout(C.speeduptimer);C.speeduptimer=null}return true},ZoomIn:function(A){if(!A){A=1}var C=this;var D=C.get_scale();var B=D*A*C.ZOOM_INCREMENT;if(B>Laserfiche.AnnotationControl.MAX_ZOOM){B=Laserfiche.AnnotationControl.MAX_ZOOM}Laserfiche.ZoomMode.ZoomType=Laserfiche.ZoomTypes.ZOOM_TYPE_USE_SCALE;C.set_scale(B,(this._mode==Laserfiche.Modes.MODE_ZOOM)?C._lastposition:null)},ZoomOut:function(A){if(!A){A=1}var D=this;var E=D.get_scale();var B=E/(A*D.ZOOM_INCREMENT);var C=D._imagecontrol.Height/D._imagecontrol.Width;if(D._imagecontrol.Ratio>C){D._fitScale=D._imagecontrol.Height/D._imagecontrol.ImageHeight}else{D._fitScale=D._imagecontrol.Width/D._imagecontrol.ImageWidth}if(B<D._fitScale){D.FitToPage()}else{Laserfiche.ZoomMode.ZoomType=Laserfiche.ZoomTypes.ZOOM_TYPE_USE_SCALE;D.set_scale(B,(this._mode==Laserfiche.Modes.MODE_ZOOM)?D._lastposition:null)}},FitToPage:function(){var B=this;Laserfiche.ZoomMode.ZoomType=Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_PAGE;var A=B._imagecontrol.Height/B._imagecontrol.Width;if(B._imagecontrol.Ratio>A){B._fitScale=B._imagecontrol.Height/B._imagecontrol.ImageHeight}else{B._fitScale=B._imagecontrol.Width/B._imagecontrol.ImageWidth}B.set_scale(B._fitScale)},FitToWidth:function(){var E=this;Laserfiche.ZoomMode.ZoomType=Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_WIDTH;var C=E._imagecontrol.Ratio;var D=E._imagecontrol.Width;var A=parseInt(C*D);if(A>E._imagecontrol.Height){D=D-17}var B=D/E._imagecontrol.ImageWidth;E.set_scale(B)},FitToHeight:function(){var E=this;Laserfiche.ZoomMode.ZoomType=Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_HEIGHT;var B=E._imagecontrol.Ratio;var A=E._imagecontrol.Height;var D=parseInt(A/B);if(D>E._imagecontrol.Width){A=A-17}var C=A/E._imagecontrol.ImageHeight;E.set_scale(C)},addTimeout:function(B){var A=this;A._timeoutFunc=B;A._timeout=top.setTimeout(B,A._timeoutDuration)},clearTimeout:function(){var A=this;if(A._timeout){top.clearTimeout(A._timeout);A._timeoutFunc=null;A._timeout=null}},forceTimeout:function(){var A=this;if(A._timeout){top.clearTimeout(A._timeout);A._timeoutFunc();A._timeoutFunc=null;A._timeout=null}if(A._waittimer){top.clearTimeout(A._waittimer);A._state=A.STATE_IDLE}},wait:function(B){var A=this;this._state=this.STATE_WAIT;if(A._waittimer){top.clearTimeout(A._waittimer)}var C=function(){A._state=A.STATE_IDLE};A._waittimer=top.setTimeout(C,B)},finishDrawing:function(){if(this.OneOff){this._state=this.STATE_IDLE;this.selectMode(Laserfiche.Modes.MODE_SELECTION)}},RemoveTextAnnOnly:function(C){var B=this;var A=B.GetAnnotation(C);if(dojo.exists("_startChar",A)||dojo.exists("_endChar",A)){A.setChangeRecording(true);A._startChar=-1;A._endChar=-1;A.recordChange("TextSection","-1;-1",null)}B._editor.removeAnnotation(C,true);A.makeMoveable();A.highlight()},RemoveImageAnnOnly:function(C){var B=this;var A=B.GetAnnotation(C);A.setChangeRecording(true);A.recordChange("ClearRectangles","",null);if(A.removeAllRectangles){A.removeAllRectangles()}},RemoveAnnotation:function(E,B){var D=this;if(D._readonly){return }var C=D.GetAnnotation(E);var A=Laserfiche.IsBlockAnnotation(C._type);if(A){if(D._isTextEditing){alert(Laserfiche.GetBlockAnnErrMsg("Remove",true,false));return }if(D._readonlyBlockAnn){alert(Laserfiche.GetBlockAnnErrMsg("Remove",false,true));return }}if(!B){C.highlight();if(!confirm(GetString("DELETE_ANNOTATION_CONFIRM"))){C.unhighlight();return false}}if(D._panel){D._panel.removeAnnotation(C)}C.remove();C=null;D._removedannotations[E]=D._annotations[E];D._removedannotations[E].setChangeRecording(true);D._removedannotations[E].recordChange("Remove","1",false);delete D._annotations[E];D._dragReleaseAction=null;D._dragAction=null;D._state=D.STATE_IDLE;D._editor.removeAnnotation(E,true)},SaveChanges:function(A){var B=this;this._saveRequested=false;this._saveRequestCount=0;B.setClean();B.SaveChangesOnPage(B,B._pageid,B._annotations,B._removedannotations,A);if(!this._saveRequested&&!this._saveRequestCount){B.annSaveSuccessfulStub(B,null)}},SaveChangesOnPage:function(E,A,F,B,D){E.set_statusMessage(String.format(GetString("SAVING_ANNOTATION_PAGE"),A));var C=[];if(A){this._saveRequested=true;E._saveRequestCount++;Laserfiche.WebAccess.AnnotationsService.SaveAnnotationsChanges(E._reponame,E._docid,A,E.GetAnnotationsSavedFunc(D),E.GetAnnotationsSavedErrorFunc(),{curpage:A})}},GetAnnotationsSavedFunc:function(A){var B=this;return function(D,C){B._saveRequestCount--;if(B._saveRequestCount==0&&B._saveRequested==true){B._saveRequested=false;B.set_statusMessage("Annotations Saved.");B.setClean();if(A){B.LoadAnnotations();if(B._editor){var E=function(F){B.InitText(F)};Laserfiche.WebAccess.DocumentService.GetTextByID(B._reponame,B._docid,C.curpage,0,E,B.SetTextError)}}B.annSaveSuccessfulStub(B,null)}}},GetAnnotationsSavedErrorFunc:function(){var A=this;return function(B){var D=GetString("ERR_SAVE_ANNOTATIONS")+": "+B.get_message();A.set_statusMessage(D);alert(D);var C=new Sys.EventArgs();C["error"]=B.get_message();C.get_message=function(){return B.get_message()};C.get_exceptionType=function(){return B.get_exceptionType()};A.annSaveFailedStub(A,C)}},LoadAnnotations:function(){var A=this;A.setClean();A.ClearSelection();A.set_statusMessage(GetString("LOADING_ANNOTATIONS"));A["annLoaded"]=false;for(id in A._annotations){A._annotations[id].remove();A._annotations[id]=null;delete A._annotations[id]}for(id in A._removedannotations){delete A._removedannotations[id]}if(A._panel){A._panel.initialize()}Laserfiche.WebAccess.AnnotationsService.GetAnnotations(A._reponame,A._docid,A._pageid,A.GetAnnotationsLoadedFunc(),A.GetAnnotationsErrorFunc(),{_pageid:A._pageid})},GetAnnotationsLoadedFunc:function(){var A=this;return function(D,C){if(C._pageid!=A._pageid){return }A.setClean();A.ClearSelection();A["annLoaded"]=false;for(id in A._annotations){A._annotations[id].remove();A._annotations[id]=null;delete A._annotations[id]}for(id in A._removedannotations){delete A._removedannotations[id]}if(A._panel){A._panel.initialize()}for(var B=0;B<D.Annotations.length;B++){annInfo=D.Annotations[B];switch(annInfo.Type){case Laserfiche.AnnotationTypes.ANN_RECTANGLE:A._annotations[annInfo.ID]=Laserfiche.BoxAnnotation.CreateFromInfo(A,A._surface,annInfo);break;case Laserfiche.AnnotationTypes.ANN_TEXTBOX:case Laserfiche.AnnotationTypes.ANN_CALLOUT:A._annotations[annInfo.ID]=Laserfiche.TextBoxAnnotation.CreateFromInfo(A,A._surface,annInfo);break;case Laserfiche.AnnotationTypes.ANN_FREEHAND:A._annotations[annInfo.ID]=Laserfiche.VectorAnnotation.CreateFromInfo(A,A._surface,annInfo);break;case Laserfiche.AnnotationTypes.ANN_LINE:A._annotations[annInfo.ID]=Laserfiche.LineAnnotation.CreateFromInfo(A,A._surface,annInfo);break;case Laserfiche.AnnotationTypes.ANN_HIGHLIGHT:case Laserfiche.AnnotationTypes.ANN_BLACKOUT:case Laserfiche.AnnotationTypes.ANN_STRIKEOUT:case Laserfiche.AnnotationTypes.ANN_UNDERLINE:A._annotations[annInfo.ID]=Laserfiche.BlockAnnotation.CreateFromInfo(A,A._surface,annInfo);break;case Laserfiche.AnnotationTypes.ANN_ATTACHMENT:A._annotations[annInfo.ID]=Laserfiche.AttachmentAnnotation.CreateFromInfo(A,A._surface,annInfo);break;case Laserfiche.AnnotationTypes.ANN_BITMAP:A._annotations[annInfo.ID]=Laserfiche.BitmapAnnotation.CreateFromInfo(A,A._surface,annInfo);break;case Laserfiche.AnnotationTypes.ANN_STAMP:A._annotations[annInfo.ID]=Laserfiche.StampAnnotation.CreateFromInfo(A,A._surface,annInfo);break;case Laserfiche.AnnotationTypes.ANN_STICKYNOTE:A._annotations[annInfo.ID]=Laserfiche.StickyNoteAnnotation.CreateFromInfo(A,A._surface,annInfo);break;case Laserfiche.AnnotationTypes.ANN_UNKNOWN:break}if(A._panel&&A._annotations[annInfo.ID]){A._panel.addAnnotation(A._annotations[annInfo.ID])}if(A._readonly){A._annotations[annInfo.ID].makeReadOnly()}}if(A._statusMessage==GetString("LOADING_ANNOTATIONS")){A.set_statusMessage("")}A["annLoaded"]=true;if(A._searchresults){A.DisplaySearchResults()}}},GetAnnotationsErrorFunc:function(){var A=this;return function(B){if(Laserfiche.Exception.IsConnectionLost(B)){top.lostConnectionHandler.onLostConnection(A._reponame,null,null)}else{var C=B.get_message();A.set_statusMessage(C)}}},PopulateSearchResults:function(A){var B=this;B._searchresults=A},DisplaySearchResults:function(){var B=this;if(B._searchresults){if(B._searchresults.annid>0){var A=B.GetAnnotation(B._searchresults.annid);if(A){B.CenterOnAnnotation(B._searchresults.annid,B._searchresults)}}else{}}},addOnChange:function(A){this._eventHandler.addHandler("annChanged",A)},removeOnChange:function(A){this._eventHandler.removeHandler("annChanged",A)},addOnSaveSuccessful:function(A){this._eventHandler.addHandler("SaveSuccessful",A)},removeOnSaveSuccessful:function(A){this._eventHandler.removeHandler("SaveSuccessful",A)},addOnSaveFailed:function(A){this._eventHandler.addHandler("SaveFailed",A)},removeOnSaveFailed:function(A){this._eventHandler.removeHandler("SaveFailed",A)},SaveSuccessfulHandler:function(C,B){var D=this;var A=D._eventHandler.getHandler("SaveSuccessful");if(A){A(D,B)}},SaveFailedHandler:function(C,B){var D=this;var A=D._eventHandler.getHandler("SaveFailed");if(A){A(D,B)}},_initializeTextEditor:function(A){var C=this;var D=document.createElement("div");A.appendChild(D);D.innerHTML="";var B=new LinkedAnnotation.LinkedAnnotationBox({name:"field",width:"200px",height:"100%",plugins:[],events:["onKeyPress"],updateInterval:"500"},D,1);B.editNode.innerHTML="";B.setAnnotationsControl(C);B.registerContextHandlers(C);C._editor=B;top.annotationBox=B;C._editorLoaded=true},ApplyLinkedAnnotationsToEditor:function(){var F=this;if(!dojo.exists("annLoaded",F)||!dojo.exists("_editorLoaded",F)||!F.annLoaded||!F._editorLoaded||(dojo.exists("_searchresults",F)&&!!F._searchresults.searchhandle&&!dojo.exists("_contextHitsTextLoc",F))){F.applyLinkRetryCnt++;if(F.applyLinkRetryCnt<F.applyLinkRetryCntMax){setTimeout(dojo.hitch(F,F.ApplyLinkedAnnotationsToEditor),F.applyLinkRetryInterval)}else{F._editor.unhideText();F.applyLinkRetryCnt=0}return }F.applyLinkRetryCnt=0;var B=F._editor.startVisibilityWorkaround();F._editor.hideText();for(id in F._annotations){var E=F._annotations[id];var A=E._type;if(A==Laserfiche.AnnotationTypes.ANN_HIGHLIGHT||A==Laserfiche.AnnotationTypes.ANN_BLACKOUT||A==Laserfiche.AnnotationTypes.ANN_STRIKEOUT||A==Laserfiche.AnnotationTypes.ANN_UNDERLINE){var C=E.get_startIndex();var G=E.get_endIndex();if(C>=0&&G>=0){F._editor.addAnnotation({start:C,end:G,annType:A,color:E.get_color(),id:id.toString()})}}}if(F._searchresults&&F._contextHitsTextLoc){dojo.forEach(F._contextHitsTextLoc,function(H){F._editor.addContextHits({start:H.offsetlineonpage,end:H.offsetlineonpage+H.wordlength-1})})}var D=function(){if(B){F._editor.endVisibilityWorkaround()}F._editor.unhideText();F._editor.setRecordChanges(true);F._editor.setCurrentHashValue(top.Hasher.getHashValue(F._editor.getText()))};F._editor.renderAnnotations(D)},InitText:function(E){var D=this;var C=D._editor;if(C){while(this._textNodeContainer.firstChild){this._textNodeContainer.removeChild(this._textNodeContainer.firstChild)}this._initializeTextEditor(this._textNodeContainer);C=D._editor}if(C){var B=new RegExp(" ","g");var A=E.replace(B,"&nbsp;");B=new RegExp("\\r\\n","g");A=A.replace(B,"<br />");B=new RegExp("\\t","g");A=A.replace(B,"&nbsp;");C.hideText();C.editNode.innerHTML="";C.editNode._originalInnerHTML=A;C.editNode.innerHTML=A;D._editorLoaded=true;C._textValueChanged=false;C.setCurrentHashValue(top.Hasher.getHashValue(E));if(A){D.ApplyLinkedAnnotationsToEditor();setTimeout(function(){D._editor.editNode.scrollTop=0;D._editor.editNode.scrollLeft=0},100)}else{D._editor.unhideText()}}},SetTextError:function(A){if(Laserfiche.Exception.IsConnectionLost(A)){top.lostConnectionHandler.onLostConnection(this._reponame,null,null)}else{}},CenterOnAnnotation:function(D,F){var E=this;var N=0;var M=0;var A=E._annotations[D];switch(A._type){case Laserfiche.AnnotationTypes.ANN_RECTANGLE:case Laserfiche.AnnotationTypes.ANN_TEXTBOX:case Laserfiche.AnnotationTypes.ANN_CALLOUT:case Laserfiche.AnnotationTypes.ANN_FREEHAND:case Laserfiche.AnnotationTypes.ANN_LINE:case Laserfiche.AnnotationTypes.ANN_HIGHLIGHT:case Laserfiche.AnnotationTypes.ANN_BLACKOUT:case Laserfiche.AnnotationTypes.ANN_STRIKEOUT:case Laserfiche.AnnotationTypes.ANN_UNDERLINE:case Laserfiche.AnnotationTypes.ANN_STAMP:var L=A.getBoundingBox();N=L.x+L.width/2;M=L.y+L.height/2;break;case Laserfiche.AnnotationTypes.ANN_ATTACHMENT:case Laserfiche.AnnotationTypes.ANN_BITMAP:case Laserfiche.AnnotationTypes.ANN_STICKYNOTE:var J=A.get_position();N=J.x;M=J.y;break;case Laserfiche.AnnotationTypes.ANN_UNKNOWN:break}var H=N;var G=M;var C=E._imagecontrol.ImageWidth;var K=E._imagecontrol.ImageHeight;switch(E._rotation){case 0:break;case 90:N=C-G;M=H;break;case 180:N=C-H;M=K-G;break;case 270:N=G;M=K-H;break}var I=-Math.abs(N-parseInt(E._imagecontrol.Width/E.get_scale()/2));var B=-Math.abs(M-parseInt(E._imagecontrol.Height/E.get_scale()/2));E.set_offset(I,B);E.SelectAnnotation(A,F)},_initializeSurface:function(A,B,E,C){var D=this;D._container=A;A.style.width=B+"px";A.style.height=E+"px";D._imageviewHeight=E;D._imageviewWidth=B;D._surfaceWidth=parseInt(B/D._scale);D._surfaceHeight=parseInt(E/D._scale);D._realsurface=dojox.gfx.createSurface(D._container,D._surfaceWidth,D._surfaceHeight);D._surface=D._realsurface.createGroup();D._surface.applyTransform(dojox.gfx.matrix.scale({x:D._scale,y:D._scale}));D._imagecontrol=C;dojo.connect(D._container,"onmousedown",D.GetMouseDownHandler());dojo.connect(D._container,"onmousemove",D.GetMouseMoveHandler());dojo.connect(D._container,"onmouseup",D.GetMouseUpHandler());dojo.connect(D._container,"onmouseout",D.GetMouseOutHandler());dojo.connect(D._container,"ondblclick",D.GetDblClickHandler());dojo.connect(D._container,"oncontextmenu",D.GetContextMenuHandler())},RefreshImageInfo:function(){var C=this;var B=C._imagecontrol.ImageWidth;var A=C._imagecontrol.ImageHeight;C._imageinfoSpan.innerHTML=(GetString("IMAGE")+": ")+((B==0&&A==0)?"None":(B+" x "+A));switch(Laserfiche.ZoomMode.ZoomType){case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_WIDTH:C.FitToWidth();break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_HEIGHT:C.FitToHeight();break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_PAGE:C.FitToPage();break}},set_statusMessage:function(A){this._statusMessage=A;this._appController.updateStatusBar(A)},get_statusMessage:function(){return this._statusMessage},_initializeStatusBar:function(){var A=this._appController._rightStatusBar;while(A.firstChild){A.removeChild(A.firstChild)}this._mouseinfoSpan=document.createElement("span");A.appendChild(this._mouseinfoSpan);A.appendChild(document.createTextNode("  |  "));this._scaleinfoSpan=document.createElement("span");A.appendChild(this._scaleinfoSpan);A.appendChild(document.createTextNode("  |  "));this._imageinfoSpan=document.createElement("span");A.appendChild(this._imageinfoSpan)},getSelectedItems:function(){var B=new Array();if(this._currentAnnotation){B.push(this._currentAnnotation)}var A="ANNOTATIONS";return({items:B,type:A})},getLastSelectedItem:function(){var A="ANNOTATIONS";return({item:this._currentAnnotation,type:A})},getType:function(){return"ANNOTATION_CONTROL"},getId:function(){return"AnnotationControl"}};Laserfiche.AnnotationControl.registerClass("Laserfiche.AnnotationControl");if(!top.Laserfiche){top.Laserfice={}}if(!top.dojo.exists("Laserfiche.AnnotationTypes")){Laserfiche.AnnotationTypes={ANN_HIGHLIGHT:0,ANN_BLACKOUT:2,ANN_STRIKEOUT:4,ANN_UNDERLINE:6,ANN_STICKYNOTE:8,ANN_ATTACHMENT:9,ANN_TEXTBOX:10,ANN_BITMAP:11,ANN_LINE:12,ANN_RECTANGLE:13,ANN_POLYGON:14,ANN_CALLOUT:15,ANN_STAMP:16,ANN_FREEHAND:17,ANN_UNKNOWN:18}}Laserfiche.BoxStyles={BOXSTYLE_RECTANGLE:0,BOXSTYLE_ELLIPSE:1,BOXSTYLE_ROUNDEDRECT:2};Laserfiche.LineStyles={LINE_STYLE_SOLID:0,LINE_STYLE_DASHED_1:1,LINE_STYLE_DASHED_2:2,LINE_STYLE_DASHED_3:3,LINE_STYLE_DASHED_4:4,LINE_STYLE_DASHED_5:5,LINE_STYLE_DASHED_6:6,LINE_STYLE_CLOUD_1:7,LINE_STYLE_CLOUD_2:8,GetDojoLineStyle:function(A){if(!A){return"solid"}switch(A){case Laserfiche.LineStyles.LINE_STYLE_SOLID:return"solid";break;case Laserfiche.LineStyles.LINE_STYLE_DASHED_1:return"shortdash";break;case Laserfiche.LineStyles.LINE_STYLE_DASHED_2:return"dot";break;case Laserfiche.LineStyles.LINE_STYLE_DASHED_3:return"shortdashdot";break;case Laserfiche.LineStyles.LINE_STYLE_DASHED_4:return"shortdashdotdot";break;default:return"longdash";break}}};Laserfiche.LineEndings={LINE_ENDING_NONE:0,LINE_ENDING_OPEN:1,LINE_ENDING_CLOSED:2,LINE_ENDING_ROPEN:3,LINE_ENDING_RCLOSED:4,LINE_ENDING_BUTT:5,LINE_ENDING_DIAMOND:6,LINE_ENDING_ROUND:7,LINE_ENDING_SQUARE:8,LINE_ENDING_SLASH:9};Laserfiche.ZoomTypes={ZOOM_TYPE_USE_SCALE:0,ZOOM_TYPE_FIT_TO_PAGE:1,ZOOM_TYPE_FIT_TO_WIDTH:2,ZOOM_TYPE_FIT_TO_HEIGHT:3};Laserfiche.GetAnnotationTypeName=function(A){switch(A){case Laserfiche.AnnotationTypes.ANN_HIGHLIGHT:return"Highlight";case Laserfiche.AnnotationTypes.ANN_BLACKOUT:return"Redaction";case Laserfiche.AnnotationTypes.ANN_STRIKEOUT:return"Strike-through";case Laserfiche.AnnotationTypes.ANN_UNDERLINE:return"Underline";case Laserfiche.AnnotationTypes.ANN_STICKYNOTE:return"Sticky Note";case Laserfiche.AnnotationTypes.ANN_ATTACHMENT:return"Attachment";case Laserfiche.AnnotationTypes.ANN_TEXTBOX:return"Textbox";case Laserfiche.AnnotationTypes.ANN_BITMAP:return"Image";case Laserfiche.AnnotationTypes.ANN_LINE:return"Line";case Laserfiche.AnnotationTypes.ANN_RECTANGLE:return"Rectangle";case Laserfiche.AnnotationTypes.ANN_FREEHAND:return"Freehand";case Laserfiche.AnnotationTypes.ANN_CALLOUT:return"Callout";case Laserfiche.AnnotationTypes.ANN_STAMP:return"Stamp"}return"Unknown"};Laserfiche.Modes={};Laserfiche.ModeObjects={};Laserfiche.Modes.GetModeObject=function(B){var A=Laserfiche.ModeObjects[B];return A?A:Laserfiche.NoneMode};Laserfiche.Modes.RegisterMode=function(A,C,B){Laserfiche.Modes[A]=C;Laserfiche.ModeObjects[C]=B};Laserfiche.BlockAnnTypes=[Laserfiche.AnnotationTypes.ANN_HIGHLIGHT,Laserfiche.AnnotationTypes.ANN_BLACKOUT,Laserfiche.AnnotationTypes.ANN_STRIKEOUT,Laserfiche.AnnotationTypes.ANN_UNDERLINE];Laserfiche.IsBlockAnnotation=function(A){return(!!(dojo.indexOf(Laserfiche.BlockAnnTypes,A)!=-1))};Laserfiche.GetBlockAnnErrMsg=function(B,C,A){switch(B){case"Add":if(C){return"You cannot add annotations while text editing is enabled."}if(A){return"You must save your text changes before adding block annotations."}break;case"Remove":if(C){return"You cannot delete annotations while text editing is enabled."}if(A){return"You must save your text changes before deleting block annotations."}break;case"Modify":if(C){return"You cannot modify annotations while text editing is enabled."}if(A){return"You must save your text changes before modifying block annotations."}break}return""};top.TYPE_DOCUMENT_PAGE_IMAGE=18;top.TYPE_LINKED_ANNOTATIONS=19;top.TYPE_IMAGED_ANNOTATIONS=20;top.TYPE_FREEHAND_LINE_ANNOTATIONS=21;top.TYPE_ATTACHMENT_ANNOTATIONS=22;top.TYPE_LINKEDBOX_ANNOTATIONS=23;top.AnnCommands={DELETE:1,PROPERTIES:2,OPEN:3,ROTATE:4,TOGGLE_LINK:5};top.LinkedAnnCommands={HILITE:100,REDACT:101,UNDERLINE:102,STRIKETHROUGH:103};if(!top.LF){top.LF={}}LF.AnnPageContextMenu=function(){};LF.AnnPageContextMenu.prototype={GetContextMenuType:function(A){var B=-1;switch(A){case Laserfiche.AnnotationTypes.ANN_HIGHLIGHT:case Laserfiche.AnnotationTypes.ANN_BLACKOUT:case Laserfiche.AnnotationTypes.ANN_STRIKEOUT:case Laserfiche.AnnotationTypes.ANN_UNDERLINE:B=top.TYPE_LINKED_ANNOTATIONS;break;case Laserfiche.AnnotationTypes.ANN_STAMP:case Laserfiche.AnnotationTypes.ANN_BITMAP:B=top.TYPE_IMAGED_ANNOTATIONS;break;case Laserfiche.AnnotationTypes.ANN_RECTANGLE:case Laserfiche.AnnotationTypes.ANN_FREEHAND:case Laserfiche.AnnotationTypes.ANN_LINE:case Laserfiche.AnnotationTypes.ANN_STICKYNOTE:case Laserfiche.AnnotationTypes.ANN_TEXTBOX:case Laserfiche.AnnotationTypes.ANN_CALLOUT:B=top.TYPE_FREEHAND_LINE_ANNOTATIONS;break;case Laserfiche.AnnotationTypes.ANN_ATTACHMENT:B=top.TYPE_ATTACHMENT_ANNOTATIONS;break;default:B=-1}return B},getItems:function(G,B){var A=B._lastSecParams;var D=false;if(A){D=A.Rights.indexOf("Ann")!=-1&&!A.VolReadOnly}var C=new Array();var E="";var F=dojo.isObject(G)?this.GetContextMenuType(G._type):G;switch(F){case top.TYPE_LINKED_ANNOTATIONS:var H=(G._startChar>=0||G._endChar>=0)?"Unlink":"Link";C.push({title:"Properties",id:top.AnnCommands.PROPERTIES,iconClass:"AnnPropsIcon"});if(D){C.push({title:H,id:top.AnnCommands.TOGGLE_LINK,iconClass:""});C.push({title:"Delete",id:top.AnnCommands.DELETE,iconClass:"DeleteIcon"})}break;case top.TYPE_IMAGED_ANNOTATIONS:C.push({title:"Properties",id:top.AnnCommands.PROPERTIES,iconClass:"AnnPropsIcon"});if(D){C.push({title:"Rotate",id:top.AnnCommands.ROTATE,iconClass:"RotateIcon"});C.push({title:"Delete",id:top.AnnCommands.DELETE,iconClass:"DeleteIcon"})}break;case top.TYPE_FREEHAND_LINE_ANNOTATIONS:C.push({title:"Properties",id:top.AnnCommands.PROPERTIES,iconClass:"AnnPropsIcon"});if(D){C.push({title:"Delete",id:top.AnnCommands.DELETE,iconClass:"DeleteIcon"})}break;case top.TYPE_ATTACHMENT_ANNOTATIONS:C.push({title:"Open File",id:top.AnnCommands.OPEN,iconClass:""});C.push({title:"Properties",id:top.AnnCommands.PROPERTIES,iconClass:"AnnPropsIcon"});if(D){C.push({title:"Delete",id:top.AnnCommands.DELETE,iconClass:"DeleteIcon"})}break;case top.TYPE_LINKEDBOX_ANNOTATIONS:if(D){C=[{title:"Highlight",id:top.LinkedAnnCommands.HILITE,iconClass:"HighlightIcon"},{title:"Redaction",id:top.LinkedAnnCommands.REDACT,iconClass:"RedactionIcon"},{title:"Underline",id:top.LinkedAnnCommands.UNDERLINE,iconClass:"UnderlineIcon"},{title:"Strike-Through",id:top.LinkedAnnCommands.STRIKETHROUGH,iconClass:"StrikeoutIcon"}]}break}return C}};Laserfiche.AttachmentMode={cursorclass:"NotAllowedCursor",CurrentToken:null,CurrentFileName:null,CurrentMimeType:null,CurrentIconToken:null,IsDrawable:function(){return(this.CurrentToken!=null)},SetDrawable:function(B,A,C){this.CurrentToken=B;this.CurrentFileName=A;this.CurrentMimeType=C;this.cursorclass="CrosshairCursor";if(this.onDrawable){this.onDrawable()}},HandleMouseDown:function(A,C,B){if(Laserfiche.AttachmentMode.IsDrawable()){B._currentAnnotation=new Laserfiche.AttachmentAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_ATTACHMENT,true);B._currentAnnotation.set_position(A,C);B._currentAnnotation.set_filename(Laserfiche.AttachmentMode.CurrentFileName);B._currentAnnotation.set_mimetype(Laserfiche.AttachmentMode.CurrentMimeType);B._currentAnnotation.set_token(Laserfiche.AttachmentMode.CurrentToken);B._currentAnnotation.endDrawing();B.selectMode(Laserfiche.Modes.MODE_SELECTION)}else{alert(GetString("SELECT_FILE"))}}};Laserfiche.Modes.RegisterMode("MODE_ATTACHMENT",6,Laserfiche.AttachmentMode);Laserfiche.BitmapMode={cursorclass:"CrosshairCursor",CurrentToken:null,BitmapWidth:0,BitmapHeight:0,Opacity:100,IsDrawable:function(){return(this.CurrentToken!=null)},SetDrawable:function(B,C,A){this.CurrentToken=B;this.cursorclass=Laserfiche.BitmapMode.cursorclass;this.BitmapWidth=C;this.BitmapHeight=A;if(this.onDrawable){this.onDrawable()}},HandleMouseDown:function(A,C,B){if(Laserfiche.BitmapMode.IsDrawable()){B._currentAnnotation=new Laserfiche.BitmapAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_BITMAP,true);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_end(A+this.BitmapWidth,C+this.BitmapHeight);B._currentAnnotation.set_token(Laserfiche.BitmapMode.CurrentToken);B._currentAnnotation.set_rotation(0);B._currentAnnotation.set_opacity(Laserfiche.BitmapMode.Opacity);B._currentAnnotation.endDrawing();B.selectMode(Laserfiche.Modes.MODE_SELECTION)}else{alert(GetString("SELECT_IMAGE"))}}};Laserfiche.Modes.RegisterMode("MODE_BITMAP",8,Laserfiche.BitmapMode);Laserfiche.BlackoutMode={cursorclass:"RedactionCursor",FillColor:0,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.BlockAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_BLACKOUT,true);B._currentAnnotation.set_nextstart(A,C);B._currentAnnotation.set_color(D.Color);B._state=B.STATE_DRAWING}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.BlockAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_BLACKOUT,true);B._currentAnnotation.set_nextstart(A,C);B._currentAnnotation.set_color(Laserfiche.BlackoutMode.FillColor);B._state=B.STATE_DRAWING}},HandleMouseDown:function(A,D,C){var B=this;if(C._isTextEditing){alert(Laserfiche.GetBlockAnnErrMsg("Add",true,false));return }if(C._readonlyBlockAnn){alert(Laserfiche.GetBlockAnnErrMsg("Add",false,true));return }Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_BLACKOUT,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_BLACKOUT",3,Laserfiche.BlackoutMode);Laserfiche.CalloutMode={cursorclass:"CrosshairCursor",Opacity:100,Thickness:4,TextSize:48,LineColor:0,FillColor:65535,LineStyle:Laserfiche.LineStyles.LINE_ENDING_OPEN,FocusStyle:Laserfiche.LineEndings.LINE_ENDING_NONE,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.TextBoxAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_CALLOUT,true);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_textSize(Laserfiche.CalloutMode.TextSize);B._currentAnnotation.set_opacity(D.Opacity);B._currentAnnotation.set_color(D.LineColor);B._currentAnnotation.set_fill(D.FillColor);B._currentAnnotation.set_linestyle(D.LineStyle);B._currentAnnotation.set_thickness(D.Thickness);B._currentAnnotation.set_focusStyle(D.FocusStyle);B._state=B.STATE_DRAWING}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.TextBoxAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_CALLOUT,true);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_textSize(Laserfiche.CalloutMode.TextSize);B._currentAnnotation.set_opacity(Laserfiche.CalloutMode.Opacity);B._currentAnnotation.set_color(Laserfiche.CalloutMode.LineColor);B._currentAnnotation.set_fill(Laserfiche.CalloutMode.FillColor);B._currentAnnotation.set_linestyle(Laserfiche.CalloutMode.LineStyle);B._currentAnnotation.set_thickness(Laserfiche.CalloutMode.Thickness);B._currentAnnotation.set_focusStyle(Laserfiche.LineEndings.LINE_ENDING_OPEN);B._state=B.STATE_DRAWING}},HandleMouseDown:function(A,D,C){var B=this;Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_CALLOUT,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C));C.selectMode(Laserfiche.Modes.MODE_SELECTION)}};Laserfiche.Modes.RegisterMode("MODE_CALLOUT",16,Laserfiche.CalloutMode);Laserfiche.EraserMode={cursorclass:"EraserCursor",drawPropertyMenu:null};Laserfiche.Modes.RegisterMode("MODE_ERASER",21,Laserfiche.EraserMode);Laserfiche.HighlightMode={cursorclass:"HighlightCursor",FillColor:65535,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.BlockAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_HIGHLIGHT,true);B._currentAnnotation.set_nextstart(A,C);B._currentAnnotation.set_color(D.Color);B._state=B.STATE_DRAWING}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.BlockAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_HIGHLIGHT,true);B._currentAnnotation.set_nextstart(A,C);B._currentAnnotation.set_color(Laserfiche.HighlightMode.FillColor);B._state=B.STATE_DRAWING}},HandleMouseDown:function(A,D,C){var B=this;if(C._isTextEditing){alert(Laserfiche.GetBlockAnnErrMsg("Add",true,false));return }if(C._readonlyBlockAnn){alert(Laserfiche.GetBlockAnnErrMsg("Add",false,true));return }Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_HIGHLIGHT,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_HIGHLIGHT",2,Laserfiche.HighlightMode);Laserfiche.LineMode={cursorclass:"CrosshairCursor",Opacity:100,Thickness:4,FillColor:0,LineColor:0,LineStyle:Laserfiche.LineStyles.LINE_STYLE_SOLID,BeginStyle:Laserfiche.LineEndings.LINE_ENDING_NONE,EndStyle:Laserfiche.LineEndings.LINE_ENDING_CLOSED,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.LineAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_LINE,true);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_startStyle(D.BeginStyle);B._currentAnnotation.set_endStyle(D.EndStyle);B._currentAnnotation.set_opacity(D.Opacity);B._currentAnnotation.set_thickness(D.Thickness);B._currentAnnotation.set_color(D.Color);B._currentAnnotation.set_fillcolor(D.FillColor);B._currentAnnotation.set_linestyle(D.LineStyle);B._state=B.STATE_DRAWING}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.LineAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_LINE,true);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_startStyle(Laserfiche.LineMode.BeginStyle);B._currentAnnotation.set_endStyle(Laserfiche.LineMode.EndStyle);B._currentAnnotation.set_opacity(Laserfiche.LineMode.Opacity);B._currentAnnotation.set_thickness(Laserfiche.LineMode.Thickness);B._currentAnnotation.set_color(Laserfiche.LineMode.LineColor);B._currentAnnotation.set_fillcolor(Laserfiche.LineMode.FillColor);B._currentAnnotation.set_linestyle(Laserfiche.LineMode.LineStyle);B._state=B.STATE_DRAWING}},HandleMouseDown:function(A,D,C){var B=this;Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_LINE,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_LINE",9,Laserfiche.LineMode);Laserfiche.PanMode={cursorclass:"HandopenCursor",HandleMouseDown:function(A,C,B){B._state=B.STATE_DRAGGING;B._container.className="HandcloseCursor";B._dragAction=function(E,D){B.set_offset(B._xoffset+E,B._yoffset+D)};B._dragReleaseAction=function(){B._container.className="HandopenCursor"}}};Laserfiche.Modes.RegisterMode("MODE_PAN",1,Laserfiche.PanMode);Laserfiche.RectangleMode={cursorclass:"CrosshairCursor",Opacity:80,Thickness:4,LineColor:0,FillColor:65535,LineStyle:Laserfiche.LineStyles.LINE_STYLE_SOLID,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.BoxAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_RECTANGLE,true);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_opacity(D.Opacity);B._currentAnnotation.set_thickness(D.Thickness);B._currentAnnotation.set_color(D.LineColor);B._currentAnnotation.set_fill(D.FillColor);B._currentAnnotation.set_linestyle(D.LineStyle);B._state=B.STATE_DRAWING}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.BoxAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_RECTANGLE,true);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_opacity(Laserfiche.RectangleMode.Opacity);B._currentAnnotation.set_thickness(Laserfiche.RectangleMode.Thickness);B._currentAnnotation.set_color(Laserfiche.RectangleMode.LineColor);B._currentAnnotation.set_fill(Laserfiche.RectangleMode.FillColor);B._currentAnnotation.set_linestyle(Laserfiche.RectangleMode.LineStyle);B._state=B.STATE_DRAWING}},HandleMouseDown:function(A,D,C){var B=this;Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_RECTANGLE,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_RECTANGLE",10,Laserfiche.RectangleMode);Laserfiche.SelectionMode={cursorclass:"Selectable DefaultCursor",HandleMouseDown:function(A,C,B){},drawPropertyMenu:null};Laserfiche.Modes.RegisterMode("MODE_SELECTION",19,Laserfiche.SelectionMode);Laserfiche.StampMode={cursorclass:"NotAllowedCursor",StampID:null,StampName:null,RepositoryName:null,FillColor:0,StampWidth:0,StampHeight:0,Common:false,Personal:false,IsDrawable:function(){return(this.StampID!=null)},SetDrawable:function(E,B,G,F,A,C,D){this.StampID=E;this.StampName=B;this.cursorclass="StampCursor";this.fillcolor=G;this.StampHeight=F;this.StampWidth=A;this.Common=C;this.Personal=D;if(this.onDrawable){this.onDrawable()}},SetDrawableFromFile:function(B,A,C){this.CurrentToken=B;this.CurrentFileName=A;this.CurrentMimeType=C;this.cursorclass="CrosshairCursor";if(this.onDrawable){this.onDrawable()}},HandleMouseDown:function(A,C,B){if(Laserfiche.StampMode.IsDrawable()){B._currentAnnotation=new Laserfiche.StampAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_STAMP,true,Laserfiche.StampMode.StampID,Laserfiche.StampMode.StampName,true,this.Personal);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_end(A+this.StampWidth,C+this.StampHeight);B._currentAnnotation.draw();B._currentAnnotation.set_rotation((360-B._rotation)%360);B._currentAnnotation.set_color(this.fillcolor);B._currentAnnotation.endDrawing();B.selectMode(Laserfiche.Modes.MODE_SELECTION)}else{alert(GetString("SELECT_STAMP"))}}};Laserfiche.Modes.RegisterMode("MODE_STAMP",17,Laserfiche.StampMode);Laserfiche.StickyNoteMode={cursorclass:"StickyCursor",FillColor:65535,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.StickyNoteAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_STICKYNOTE,true);B._currentAnnotation.set_fill(D.Color);B._currentAnnotation.set_position(A,C);B._currentAnnotation.endDrawing();B.selectMode(Laserfiche.Modes.MODE_SELECTION)}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.StickyNoteAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_STICKYNOTE,true);B._currentAnnotation.set_fill(Laserfiche.StickyNoteMode.FillColor);B._currentAnnotation.set_position(A,C);B._currentAnnotation.endDrawing();B.selectMode(Laserfiche.Modes.MODE_SELECTION)}},HandleMouseDown:function(A,D,C){var B=this;Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_STICKYNOTE,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_STICKYNOTE",18,Laserfiche.StickyNoteMode);Laserfiche.StrikeoutMode={cursorclass:"CrosshairCursor",LineColor:0,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.BlockAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_STRIKEOUT,true);B._currentAnnotation.set_nextstart(A,C);B._currentAnnotation.set_color(D.Color);B._state=B.STATE_DRAWING}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.BlockAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_STRIKEOUT,true);B._currentAnnotation.set_nextstart(A,C);B._currentAnnotation.set_color(Laserfiche.StrikeoutMode.LineColor);B._state=B.STATE_DRAWING}},HandleMouseDown:function(A,D,C){var B=this;if(C._isTextEditing){alert(Laserfiche.GetBlockAnnErrMsg("Add",true,false));return }if(C._readonlyBlockAnn){alert(Laserfiche.GetBlockAnnErrMsg("Add",false,true));return }Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_STRIKEOUT,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_STRIKEOUT",4,Laserfiche.StrikeoutMode);Laserfiche.TextboxMode={cursorclass:"CrosshairCursor",Opacity:80,Thickness:4,LineColor:0,LineStyle:Laserfiche.LineStyles.LINE_STYLE_SOLID,TextSize:48,FillColor:65535,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.TextBoxAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_TEXTBOX,true);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_opacity(D.Opacity);B._currentAnnotation.set_thickness(D.Thickness);B._currentAnnotation.set_color(D.LineColor);B._currentAnnotation.set_fill(D.FillColor);B._currentAnnotation.set_linestyle(D.LineStyle);B._currentAnnotation.set_textSize(Laserfiche.TextboxMode.TextSize);B._state=B.STATE_DRAWING;B.selectMode(Laserfiche.Modes.MODE_SELECTION)}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.TextBoxAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_TEXTBOX,true);B._currentAnnotation.set_start(A,C);B._currentAnnotation.set_opacity(Laserfiche.TextboxMode.Opacity);B._currentAnnotation.set_thickness(Laserfiche.TextboxMode.Thickness);B._currentAnnotation.set_color(Laserfiche.TextboxMode.LineColor);B._currentAnnotation.set_fill(Laserfiche.TextboxMode.FillColor);B._currentAnnotation.set_linestyle(Laserfiche.TextboxMode.LineStyle);B._currentAnnotation.set_textSize(Laserfiche.TextboxMode.TextSize);B._state=B.STATE_DRAWING;B.selectMode(Laserfiche.Modes.MODE_SELECTION)}},HandleMouseDown:function(A,D,C){var B=this;Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_TEXTBOX,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_TEXTBOX",7,Laserfiche.TextboxMode);Laserfiche.UnderlineMode={cursorclass:"CrosshairCursor",LineColor:0,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.BlockAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_UNDERLINE,true);B._currentAnnotation.set_nextstart(A,C);B._currentAnnotation.set_color(D.Color);B._state=B.STATE_DRAWING}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.BlockAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_UNDERLINE,true);B._currentAnnotation.set_nextstart(A,C);B._currentAnnotation.set_color(Laserfiche.UnderlineMode.LineColor);B._state=B.STATE_DRAWING}},HandleMouseDown:function(A,D,C){var B=this;if(C._isTextEditing){alert(Laserfiche.GetBlockAnnErrMsg("Add",true,false));return }if(C._readonlyBlockAnn){alert(Laserfiche.GetBlockAnnErrMsg("Add",false,true));return }Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_UNDERLINE,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_UNDERLINE",5,Laserfiche.UnderlineMode);Laserfiche.VectorMode={cursorclass:"CrosshairCursor",Opacity:100,Thickness:1,LineColor:0,LineStyle:Laserfiche.LineStyles.LINE_STYLE_SOLID,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.VectorAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_VECTOR,true);B._currentAnnotation.addPoint(A,C);B._currentAnnotation.set_opacity(D.Opacity);B._currentAnnotation.set_color(D.Color);B._currentAnnotation.set_thickness(D.Thickness);B._currentAnnotation.set_linestyle(D.LineStyle);B._state=B.STATE_DRAWING}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.VectorAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_VECTOR,true);B._currentAnnotation.addPoint(A,C);B._currentAnnotation.set_opacity(Laserfiche.VectorMode.Opacity);B._currentAnnotation.set_color(Laserfiche.VectorMode.LineColor);B._currentAnnotation.set_thickness(Laserfiche.VectorMode.Thickness);B._currentAnnotation.set_linestyle(Laserfiche.VectorMode.LineStyle);B._state=B.STATE_DRAWING}},HandleMouseDown:function(A,D,C){var B=this;Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_FREEHAND,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_VECTOR",14,Laserfiche.VectorMode);Laserfiche.VFreehandMode={cursorclass:"PencilCursor",Opacity:100,Thickness:1,LineColor:0,LineStyle:Laserfiche.LineStyles.LINE_STYLE_SOLID,RetrievedValues:function(A,C,B){return function(D){B._currentAnnotation=new Laserfiche.VectorAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_VFREEHAND,true);B._currentAnnotation.addPoint(A,C);B._currentAnnotation.set_opacity(D.Opacity);B._currentAnnotation.set_color(D.Color);B._currentAnnotation.set_thickness(D.Thickness);B._currentAnnotation.set_linestyle(D.LineStyle);B._state=B.STATE_DRAWING}},UseDefaults:function(A,C,B){return function(D){if(Laserfiche.Exception.IsConnectionLost(D)){Laserfiche.Exception.DocViewConnectionLostFunc();return }B._currentAnnotation=new Laserfiche.VectorAnnotation(B,B._surface,B.GetNextAnnotationID(),Laserfiche.Modes.MODE_VFREEHAND,true);B._currentAnnotation.addPoint(A,C);B._currentAnnotation.set_opacity(Laserfiche.VectorMode.Opacity);B._currentAnnotation.set_color(Laserfiche.VectorMode.LineColor);B._currentAnnotation.set_thickness(Laserfiche.VectorMode.Thickness);B._currentAnnotation.set_linestyle(Laserfiche.VectorMode.LineStyle);B._state=B.STATE_DRAWING}},HandleMouseDown:function(A,D,C){var B=this;Laserfiche.WebAccess.AnnotationsService.GetAnnotationDefaults(C._reponame,Laserfiche.AnnotationTypes.ANN_FREEHAND,B.RetrievedValues(A,D,C),B.UseDefaults(A,D,C))}};Laserfiche.Modes.RegisterMode("MODE_VFREEHAND",15,Laserfiche.VFreehandMode);Laserfiche.ZoomMode={cursorclass:"ZoomInCursor",ZoomType:Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_WIDTH,ZoomIn:true,ToggleMode:function(){var A=this;if(A.ZoomIn){A.ZoomIn=false;A.cursorclass="ZoomOutCursor"}else{A.ZoomIn=true;A.cursorclass="ZoomInCursor"}if(A.oncursorchange){A.oncursorchange()}},SetZoomIn:function(A){var B=this;if(B.ZoomIn!=A){B.ToggleMode()}},HandleMouseDown:function(A,C,B){}};Laserfiche.Modes.RegisterMode("MODE_ZOOM",20,Laserfiche.ZoomMode);Laserfiche.BaseAnnotation=function(){};Laserfiche.BaseAnnotation.prototype={setChangeRecording:function(B){var A=this;A._recordChanges=B;if(B){if(!A._changedProps){A._changedProps=new Object();A._commands=new Array()}}},recordChange:function(D,C,E){var A=this;if(A._recordChanges){A._control.setDirty();if(E){var E={};E.ID=A.id;E.Property=D;E.Value=C;A._commands.push(E)}else{A._changedProps[D]=C}if(this.registerChangesTimeout){clearTimeout(this.registerChangesTimeout);this.registerChangesTimeout=null}var B=function(){A.registerChangesTimeout=null;var G=A.getAnnotationChanges();var F=Laserfiche.IsBlockAnnotation(A._type);if(F&&A._control._isTextEditing){alert(Laserfiche.GetBlockAnnErrMsg("Modify",true,false));return }if(F&&A._control._readonlyBlockAnn){alert(Laserfiche.GetBlockAnnErrMsg("Modify",false,true));return }A._control.increment_changeRequestCount();Laserfiche.WebAccess.AnnotationsService.RegisterChanges(A._control._reponame,A._control._docid,A._control._pageid,G,function(){A._control.decrement_changeRequestCount();A._control._hasBlockChanges|=F},function(H){if(Laserfiche.Exception.IsConnectionLost(H)){top.lostConnectionHandler.onLostConnection(A._control._reponame,B,function(){})}else{alert(H.get_message())}A._control.decrement_changeRequestCount()});A._control.set_changesPending(true);A.clearAnnotationChanges()};this.registerChangesTimeout=setTimeout(B,100)}},getAnnotationChanges:function(){var A=this;var C=new Array();if(A._isnew){var D={};D.ID=A.id;D.Property="Create";D.Value=A._type;C.push(D);A._isnew=false}if(A._changedProps){for(var B in A._commands){C.push(A._commands[B])}for(prop in A._changedProps){var D={};D.ID=A.id;D.Property=prop;D.Value=A._changedProps[prop];C.push(D)}}return C},clearAnnotationChanges:function(){var A=this;A._commands=new Array();A._changedProps=new Array()},HandleDblClick:function(){this.showProperties()},HandleContextMenu:function(A){function E(I){switch(I){case top.AnnCommands.DELETE:C._control.RemoveAnnotation(C.id,false);break;case top.AnnCommands.PROPERTIES:C.showProperties();break;case top.AnnCommands.OPEN:if(C.OpenFile){C.OpenFile()}break;case top.AnnCommands.ROTATE:if(C.set_rotation&&C.get_rotation){var H=((C.get_rotation()-0)+90)%360;C.set_rotation(H)}break;case top.AnnCommands.TOGGLE_LINK:if(C._startChar>=0||C._startChar>=0){C._control.RemoveTextAnnOnly(C.id)}else{var G=C.getBoundingBox();C.RenderLinkedAnnotationOnEditor(G.y,G.x,G.y+G.height,G.x+G.width,true)}break}}var C=this;C._control.SelectAnnotation(C);C._menuscontainer=document.createElement("div");C._menuscontainer.style.position="relative";document.body.appendChild(C._menuscontainer);var B=C._control.ContextMenu.getItems(C,top.myAppController);if(B.length>0){var D=top.SimpleMenu.CreateMenu(B,C._menuscontainer);var F=dojo.coords(C._menuscontainer);D.Show(A.clientX-F.x,A.clientY-F.y);D.onselect=function(){E(D.value);D.Hide()};D.onhide=function(){D.DeleteMenu()}}},showProperties:function(){var B=this;var C=top.getAvailableDlg();var A=top.myAppController._lastSecParams;C.OpenDialog("Dialogs/AnnotationProperties.aspx?r="+this._control._reponame+"&d="+this._control._docid+"&p="+this._control._pageid+"&i="+this.id+"&ro="+(A.Rights.indexOf("Ann")==-1)||A.VolReadOnly,398,480,false);if(B.ProcessChanges){C.onclose=function(D){if(D){if(D.MadeChange){B._control.setDirty()}B.ProcessChanges(D)}}}},unhighlight:function(){var A=this;if(A._box){var B=A._box;A._surface.remove(B);A._box=null}while(A._handles.length>0){var C=A._handles.pop();if(C!=0){A._surface.remove(C)}}},highlight:function(){this.unhighlight();this.drawHandles(5/this._control._scale)},drawPanel:function(F){var B=this;var E="";if(B.get_title){E=B.get_title()}if(E.length==0){E=Laserfiche.GetAnnotationTypeName(B._type)}var A=document.createElement("div");A.innerHTML="<b>"+Laserfiche.BaseAnnotation._escapeHtml(E)+"</b>";F.appendChild(A);var D="";if(B.get_text){D=B.get_text()}else{if(B.get_comment){D=B.get_comment();if(D.length>0){D="Comment: "+D}}}var C=document.createElement("div");C.innerHTML=Laserfiche.BaseAnnotation._escapeHtml(D);F.appendChild(C)},getArrowStroke:function(){var A=this;var B=A.get_thickness();if(dojox.gfx.renderer=="svg"){}else{B=Math.max(parseInt(B*A._control.get_scale()),1)}var C={type:"stroke",color:[A._color.r,A._color.g,A._color.b,1],width:B,join:10};return C},getStroke:function(B){var A=this;var D=B?A._opacity*B:A._opacity;var C=A.get_thickness();if(dojox.gfx.renderer=="svg"){}else{C=Math.max(parseInt(C*A._control.get_scale()),1)}var E={type:"stroke",style:Laserfiche.LineStyles.GetDojoLineStyle(A._linestyle),color:[A._color.r,A._color.g,A._color.b,D],width:C};return E},getFill:function(B){var A=this;var C=B?A._opacity*B:A._opacity;var D=[A._fill.r,A._fill.g,A._fill.b,C];return D},drawHandles:function(H){var I=this;var G=I.getBoundingBox();if(G==null){return }var E=G.x;var D=G.y;var F=G.width;var B=G.height;if(I._type==Laserfiche.AnnotationTypes.ANN_LINE){var A=G.dir;if(((I._start.y>I._end.y)&&(A=="left"))||((I._start.y<I._end.y)&&(A=="right"))){if(A=="left"){I._handles.push(I.drawHandle(E,D,H,"CrosshairCursor",false,true,false,true,I._canStretch));I._handles.push(I.drawHandle(E+F,D+B,H,"CrosshairCursor",true,false,true,false,I._canStretch))}else{I._handles.push(I.drawHandle(E,D,H,"CrosshairCursor",true,false,true,false,I._canStretch));I._handles.push(I.drawHandle(E+F,D+B,H,"CrosshairCursor",false,true,false,true,I._canStretch))}}else{if(A=="left"){I._handles.push(I.drawHandle(E+F,D,H,"CrosshairCursor",true,false,true,false,I._canStretch));I._handles.push(I.drawHandle(E,D+B,H,"CrosshairCursor",false,true,false,true,I._canStretch))}else{I._handles.push(I.drawHandle(E+F,D,H,"CrosshairCursor",false,true,false,true,I._canStretch));I._handles.push(I.drawHandle(E,D+B,H,"CrosshairCursor",true,false,true,false,I._canStretch))}}}else{var C=I._surface.createRect(G).setStroke({color:[49,106,197,1],width:1});I._box=C;I._handles.push(I.drawHandle(E,D,H,"nwhandle",true,false,true,false,I._canStretch));I._handles.push(I.drawHandle(E+F/2,D,H,"nhandle",true,false,false,false,I._canStretch));I._handles.push(I.drawHandle(E+F,D,H,"nehandle",true,false,false,true,I._canStretch));I._handles.push(I.drawHandle(E,D+B/2,H,"whandle",false,false,true,false,I._canStretch));I._handles.push(I.drawHandle(E+F,D+B/2,H,"ehandle",false,false,false,true,I._canStretch));I._handles.push(I.drawHandle(E,D+B,H,"swhandle",false,true,true,false,I._canStretch));I._handles.push(I.drawHandle(E+F/2,D+B,H,"shandle",false,true,false,false,I._canStretch));I._handles.push(I.drawHandle(E+F,D+B,H,"sehandle",false,true,false,true,I._canStretch));if(I._type==Laserfiche.AnnotationTypes.ANN_CALLOUT){I._handles.push(I.drawHandle(I._focus.x,I._focus.y,H,"CrosshairCursor",true,true,true,true,I._canStretch))}}},drawHandle:function(H,G,K,B,C,E,J,F,A){var L=this;var D=L._surface.createRect({x:H-K/2,y:G-K/2,width:K,height:K}).setFill([A?49:255,A?106:255,A?197:255,1]).setStroke({color:[49,106,197,1],width:1});if(A){var I=D.getEventSource();if(I.getAttribute("className")==null){I.setAttribute("class",B)}else{dojox.gfx._addClass(I,B)}}D.getEventSource().setAttribute("id",L.id);D.getEventSource().setAttribute("IsHandle",A?"1":"0");D.getEventSource().setAttribute("N",C?"1":"0");D.getEventSource().setAttribute("S",E?"1":"0");D.getEventSource().setAttribute("W",J?"1":"0");D.getEventSource().setAttribute("E",F?"1":"0");D.getEventSource().setAttribute("PT",C&&E&&J&&F?"1":"0");return D;return 0},headDimensions:function(L,O,M,E,K,A){var N=this;var D=30*Math.PI/180;if(A==Laserfiche.LineEndings.LINE_ENDING_NONE||A==Laserfiche.LineEndings.LINE_ENDING_OPEN){return{x:0,y:0}}var J={x:0,y:0};var I={x:0,y:0};var G={x:0,y:0};var F={x:0,y:0};if(O==0){var C=M<0?-1:1;J={x:K,y:0};I={x:0,y:C*E/2};G={x:Math.cos(D)*K,y:0};F={x:0,y:-Math.sin(D)*K}}else{if(M==0){var C=O<0?-1:1;J={x:0,y:K};I={x:C*E/2,y:0};G={x:0,y:Math.cos(D)*K};F={x:Math.sin(D)*K,y:0}}else{var B=1*M/O;var C=B*M<0?-1:1;var H=Math.sqrt(1/(1+B*B));J={x:-B*K*H,y:K*H};I={x:C*E*H/2,y:C*B*E*H/2};G={x:-B*Math.cos(D)*K*H,y:Math.cos(D)*K*H};F={x:-Math.sin(D)*K*H,y:-B*Math.sin(D)*K*H}}}return{x:I.x*2,y:I.y*2}},drawHead:function(J,F,D,L,E,M,V){var G=this;var P=30*Math.PI/180;if(M==Laserfiche.LineEndings.LINE_ENDING_NONE){return null}var Y={x:0,y:0};var X={x:0,y:0};var U={x:0,y:0};var S={x:0,y:0};if(F==0){var H=D<0?-1:1;Y={x:E,y:0};X={x:0,y:H*L/2};U={x:Math.cos(P)*E,y:0};S={x:0,y:-Math.sin(P)*E}}else{if(D==0){var H=F<0?-1:1;Y={x:0,y:E};X={x:H*L/2,y:0};U={x:0,y:Math.cos(P)*E};S={x:Math.sin(P)*E,y:0}}else{var I=1*D/F;var H=I*D<0?-1:1;var K=Math.sqrt(1/(1+I*I));Y={x:-I*E*K,y:E*K};X={x:H*L*K/2,y:H*I*L*K/2};U={x:-I*Math.cos(P)*E*K,y:Math.cos(P)*E*K};S={x:-Math.sin(P)*E*K,y:-I*Math.sin(P)*E*K}}}var B;var C=G.getArrowStroke();switch(M){case Laserfiche.LineEndings.LINE_ENDING_OPEN:B=G._surface.createPath({}).setStroke(C);B.rawNode.id=G.id;var T={x:J.x+2*X.x+Y.x,y:J.y+2*X.y+Y.y};var R={x:J.x+2*X.x-Y.x,y:J.y+2*X.y-Y.y};B.moveTo(T.x,T.y);B.lineTo(J.x,J.y);B.lineTo(R.x,R.y);break;case Laserfiche.LineEndings.LINE_ENDING_CLOSED:var T={x:J.x+2*X.x,y:J.y+2*X.y};var R={x:J.x+2*X.x+Y.x,y:J.y+2*X.y+Y.y};var Q=J;var O={x:J.x+2*X.x-Y.x,y:J.y+2*X.y-Y.y};B=G._surface.createPolyline([T.x,T.y,R.x,R.y,Q.x,Q.y,O.x,O.y,T.x,T.y]).setStroke(C).setFill([G._fill.r,G._fill.g,G._fill.b,G._opacity]);B.rawNode.id=G.id;break;case Laserfiche.LineEndings.LINE_ENDING_ROPEN:B=G._surface.createPath({}).setStroke(C);B.rawNode.id=G.id;var T={x:J.x+Y.x,y:J.y+Y.y};var R={x:J.x+2*X.x,y:J.y+2*X.y};var Q={x:J.x+-Y.x,y:J.y-Y.y};B.moveTo(T.x,T.y);B.lineTo(R.x,R.y);B.lineTo(Q.x,Q.y);V(R.x,R.y);break;case Laserfiche.LineEndings.LINE_ENDING_RCLOSED:var T={x:J.x+2*X.x,y:J.y+2*X.y};var R={x:J.x+Y.x,y:J.y+Y.y};var Q={x:J.x+-Y.x,y:J.y-Y.y};B=G._surface.createPolyline([T.x,T.y,R.x,R.y,Q.x,Q.y,T.x,T.y]).setStroke(C).setFill([G._fill.r,G._fill.g,G._fill.b,G._opacity]);B.rawNode.id=G.id;break;case Laserfiche.LineEndings.LINE_ENDING_BUTT:B=G._surface.createPath({}).setStroke(C);B.rawNode.id=G.id;var T={x:J.x+Y.x,y:J.y+Y.y};var R={x:J.x-Y.x,y:J.y-Y.y};B.moveTo(T.x,T.y);B.lineTo(R.x,R.y);break;case Laserfiche.LineEndings.LINE_ENDING_DIAMOND:var T={x:J.x+2*X.x,y:J.y+2*X.y};var R={x:J.x+X.x-Y.x,y:J.y+X.y-Y.y};var Q=J;var O={x:J.x+X.x+Y.x,y:J.y+X.y+Y.y};B=G._surface.createPolyline([T.x,T.y,R.x,R.y,Q.x,Q.y,O.x,O.y,T.x,T.y]).setStroke(C).setFill([G._fill.r,G._fill.g,G._fill.b,G._opacity]);B.rawNode.id=G.id;break;case Laserfiche.LineEndings.LINE_ENDING_ROUND:var W={x:J.x+X.x,y:J.y+X.y};B=G._surface.createCircle({cx:W.x,cy:W.y,r:E}).setStroke(C).setFill([G._fill.r,G._fill.g,G._fill.b,G._opacity]);B.rawNode.id=G.id;break;case Laserfiche.LineEndings.LINE_ENDING_SQUARE:var T={x:J.x+2*X.x,y:J.y+2*X.y};var R={x:J.x+2*X.x-Y.x,y:J.y+2*X.y-Y.y};var Q={x:J.x-Y.x,y:J.y-Y.y};var O={x:J.x+Y.x,y:J.y+Y.y};var N={x:J.x+2*X.x+Y.x,y:J.y+2*X.y+Y.y};B=G._surface.createPath({}).setStroke(C);B=G._surface.createPolyline([T.x,T.y,R.x,R.y,Q.x,Q.y,O.x,O.y,N.x,N.y,T.x,T.y]).setStroke(C).setFill([G._fill.r,G._fill.g,G._fill.b,G._opacity]);B.rawNode.id=G.id;break;case Laserfiche.LineEndings.LINE_ENDING_SLASH:var A={x:J.x+2*X.x,y:J.y+2*X.y};var T={x:A.x-U.x-S.x,y:A.y-U.y-S.y};var R={x:A.x+U.x+S.x,y:A.y+U.y+S.y};B=G._surface.createPath({}).setStroke(C);B.moveTo(T.x,T.y);B.lineTo(R.x,R.y);B.rawNode.id=G.id;V(A.x,A.y);break}return B},makeMoveable:function(){var A=this;A.moveable=true;A._canStretch=false;switch(A._type){case Laserfiche.AnnotationTypes.ANN_HIGHLIGHT:case Laserfiche.AnnotationTypes.ANN_BLACKOUT:case Laserfiche.AnnotationTypes.ANN_TEXTBOX:case Laserfiche.AnnotationTypes.ANN_BITMAP:case Laserfiche.AnnotationTypes.ANN_LINE:case Laserfiche.AnnotationTypes.ANN_RECTANGLE:case Laserfiche.AnnotationTypes.ANN_FREEHAND:case Laserfiche.AnnotationTypes.ANN_CALLOUT:case Laserfiche.AnnotationTypes.ANN_STAMP:A._canStretch=true}var B=A._shape.getEventSource();if(B.getAttribute("className")==null){B.setAttribute("class","moveable")}else{dojox.gfx._addClass(B,"moveable")}},makeReadOnly:function(){var A=this;A.readonly=true;this._canStretch=false;this.moveable=false;if(A._shape){var B=A._shape.getEventSource();if(B.getAttribute("className")==null){B.setAttribute("class","")}else{dojox.gfx._addClass(B,"")}}},add:function(){var A=this;if(A._shape){A._surface.add(A._shape)}},remove:function(){var A=this;A.unhighlight();if(A._shape){A._surface.remove(A._shape)}},endDrawing:function(){var A=this;A._control.StoreAnnotation(A);A._control.SelectAnnotation(A);A._control.finishDrawing()}};Laserfiche.BaseAnnotation._escapeHtml=function(A){return A.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;").replace(/\n/gm,"<br>").replace(/  /gm," &nbsp;")};Laserfiche.BaseAnnotation._getAdjustedDimensions=function(H,G,I,F,A){var D;var B;var C;var E;switch(A.get_rotation()){case 0:D=H;B=G;C=F;E=I;break;case 90:D=A._imagecontrol.ImageWidth-G;B=H;C=I;E=F;D=D-E;break;case 180:D=A._imagecontrol.ImageWidth-H;B=A._imagecontrol.ImageHeight-G;C=F;E=I;D=D-E;B=B-C;break;case 270:D=G;B=A._imagecontrol.ImageHeight-H;C=I;E=F;B=B-C;break}return{x:D,y:B,w:E,h:C}};Laserfiche.AttachmentAnnotation=function(D,A,F,E,C){this._eventHandler=new Sys.EventHandlerList();var B=this;B.id=F;B._control=D;B._surface=A;B._box=null;B._handles=new Array();B._mode=E;B._image=null;B._position={x:0,y:0};B._canStretch=false;B._isnew=C;B._token=null;B._filename=null;B._mimetype=null;B._loaded=false;B._highlighted=false;if(C){B.setChangeRecording(true)}B._type=Laserfiche.AnnotationTypes.ANN_ATTACHMENT};Laserfiche.AttachmentAnnotation.prototype={setChangeRecording:Laserfiche.BaseAnnotation.prototype.setChangeRecording,recordChange:Laserfiche.BaseAnnotation.prototype.recordChange,getAnnotationChanges:Laserfiche.BaseAnnotation.prototype.getAnnotationChanges,makeReadOnly:Laserfiche.BaseAnnotation.prototype.makeReadOnly,clearAnnotationChanges:Laserfiche.BaseAnnotation.prototype.clearAnnotationChanges,unhighlight:function(){var A=this;if(A._image){if(A._icontoken){A._image.border=""}else{A._image.src="Assets/images/icons/attach.gif"}}},highlight:function(){var A=this;if(A._icontoken){A._image.border="1px solid red"}else{A._image.src="Assets/images/icons/attach_sel.gif"}},drawHandles:Laserfiche.BaseAnnotation.prototype.drawHandles,drawHandle:Laserfiche.BaseAnnotation.prototype.drawHandle,makeMoveable:function(){var A=this;this.moveable=true;A._image.className="moveable";A._canStretch=false},baseAdd:Laserfiche.BaseAnnotation.prototype.add,baseRemove:Laserfiche.BaseAnnotation.prototype.remove,baseendDrawing:Laserfiche.BaseAnnotation.prototype.endDrawing,drawPanel:Laserfiche.BaseAnnotation.prototype.drawPanel,showProperties:Laserfiche.BaseAnnotation.prototype.showProperties,HandleDblClick:function(){this.OpenFile()},HandleContextMenu:Laserfiche.BaseAnnotation.prototype.HandleContextMenu,drawIcon:function(B){var A=document.createElement("img");A.src="Assets/images/annotations/attach.gif";B.appendChild(A)},endDrawing:function(){var A=this;A.baseendDrawing()},add:function(){var A=this;A.baseAdd();A.draw()},remove:function(){var A=this;if(A._image){A._control._container.removeChild(A._image);A._image=null}A.baseRemove()},getBoundingBox:function(){var A=this;var B={x:A._position.x,y:A._position.y,width:A._width,height:A._height};return B},set_token:function(B){var A=this;A._token=B;A.recordChange("Token",B)},get_token:function(){return annobj._token},set_filename:function(B){var A=this;A._filename=B;A.recordChange("Filename",B);A.draw()},get_filename:function(){return annobj._filename},set_mimetype:function(B){var A=this;A._mimetype=B;A.recordChange("MimeType",B);A.draw()},get_mimetype:function(){return annobj._mimetype},set_icontoken:function(B){var A=this;A._icontoken=B;A.recordChange("IconToken",B);A.draw()},get_icontoken:function(){return annobj._icontoken},set_position:function(A,C){var B=this;B._position={x:A,y:C};if(!B._image){B.draw()}B.recordChange("X",A);B.recordChange("Y",C)},get_position:function(){var A=this;return A._position},draw:function(){var A=this;if(!A._image){A._image=document.createElement("img");A._image.style.zIndex=5;A._image.style.position="absolute";var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(A._position.x,A._position.y,0,0,A._control);A._image.style.left=parseInt(B.x*A._control.get_scale())+"px";A._image.style.top=parseInt(B.y*A._control.get_scale())+"px";A._control._container.appendChild(A._image);dojo.connect(A._image,"onmousedown",function(C){if(!C){C=window.event}A._control.ClickAnnotation(A.id,null,A._control.GetCurrentXY(C))});dojo.connect(A._image,"ondblclick",function(C){A.HandleDblClick()});dojo.connect(A._image,"oncontextmenu",function(C){dojo.stopEvent(C);A.HandleContextMenu(C)})}A._image.onload=function(){A._image.style.marginTop=-parseInt(A._image.height)/2+"px";A._image.style.marginLeft=-parseInt(A._image.width)/2+"px";A._image.onload=null};if(A._icontoken){A._image.src="Helper/BitmapAnnotation.aspx?token="+A._icontoken}else{A._image.src="Assets/images/icons/attach.gif"}A._image.alt=A._filename;A._image.title=A._filename},move:function(D,B){var A=this;A.set_position(D+A._position.x,B+A._position.y);var C=Laserfiche.BaseAnnotation._getAdjustedDimensions(A._position.x,A._position.y,0,0,A._control);A._image.style.left=parseInt(C.x*A._control.get_scale())+"px";A._image.style.top=parseInt(C.y*A._control.get_scale())+"px"},stretch:function(D,A,C,E,B){},OpenFile:function(){var A=this;if(A._token){window.location="Helper/AttachmentFile.aspx?token="+A._token+"&filename="+A._filename+"&mime="+A._mimetype}else{window.location="Helper/AttachmentFile.aspx?r="+A._control._reponame+"&d="+A._control._docid+"&p="+A._control._pageid+"&i="+A.id}},sync:function(B){var A=this;if(B){}else{A._displacement={x:0,y:0}}},HandleMouseDown:function(A,B){},HandleMouseMove:function(A,C,B){},HandleMouseUp:function(A,B){},HandleRescale:function(C){var A=this;var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(A._position.x,A._position.y,0,0,A._control);A._image.style.left=parseInt(B.x*C)+"px";A._image.style.top=parseInt(B.y*C)+"px"},HandleRotate:function(C){var A=this;var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(A._position.x,A._position.y,0,0,A._control);A._image.style.left=parseInt(B.x*A._control.get_scale())+"px";A._image.style.top=parseInt(B.y*A._control.get_scale())+"px"}};Laserfiche.AttachmentAnnotation.CreateFromInfo=function(D,B,C){var E=Laserfiche.Modes.MODE_ATTACHMENT;var A=new Laserfiche.AttachmentAnnotation(D,B,C.ID,E);A.set_position(C.MoreInfo.Position.X,C.MoreInfo.Position.Y);A.set_filename(C.MoreInfo.Filename);A.set_mimetype(C.MoreInfo.Mimetype);A.makeMoveable();A.setChangeRecording(true);return A};Laserfiche.AttachmentAnnotation.registerClass("Laserfiche.AttachmentAnnotation");Laserfiche.BitmapAnnotation=function(D,A,F,E,C){this._eventHandler=new Sys.EventHandlerList();var B=this;B.id=F;B._control=D;B._surface=A;B._box=null;B._handles=new Array();B._mode=E;B._image=null;B._start=null;B._end=null;B._isnew=C;B._token=null;B._loaded=false;B._opacity=100;B._highlighted=false;if(C){B.setChangeRecording(true)}B._type=Laserfiche.AnnotationTypes.ANN_BITMAP};Laserfiche.BitmapAnnotation.prototype={setChangeRecording:Laserfiche.BaseAnnotation.prototype.setChangeRecording,recordChange:Laserfiche.BaseAnnotation.prototype.recordChange,getAnnotationChanges:Laserfiche.BaseAnnotation.prototype.getAnnotationChanges,clearAnnotationChanges:Laserfiche.BaseAnnotation.prototype.clearAnnotationChanges,baseunhighlight:Laserfiche.BaseAnnotation.prototype.unhighlight,unhighlight:function(){var A=this;A._highlighted=false;A.baseunhighlight()},basehighlight:Laserfiche.BaseAnnotation.prototype.highlight,highlight:function(){var A=this;A._highlighted=true;if(A._loaded){A.basehighlight()}},drawHandles:Laserfiche.BaseAnnotation.prototype.drawHandles,drawHandle:Laserfiche.BaseAnnotation.prototype.drawHandle,makeMoveable:function(){var A=this;this.moveable=true;A._image.className="moveable";A._canStretch=true},makeReadOnly:function(){var A=this;this.moveable=false;A._image.className="";A._canStretch=false},baseAdd:Laserfiche.BaseAnnotation.prototype.add,baseRemove:Laserfiche.BaseAnnotation.prototype.remove,baseendDrawing:Laserfiche.BaseAnnotation.prototype.endDrawing,drawPanel:Laserfiche.BaseAnnotation.prototype.drawPanel,showProperties:Laserfiche.BaseAnnotation.prototype.showProperties,HandleDblClick:Laserfiche.BaseAnnotation.prototype.HandleDblClick,HandleContextMenu:Laserfiche.BaseAnnotation.prototype.HandleContextMenu,drawIcon:function(C){var A=this;var B=document.createElement("img");A.onimageloaded=function(){if(A._height>A._width){B.height=30;B.width=A._width*30/A._height}else{B.height=A._height*30/A._width;B.width=30}A.onimageloaded=null};B.src=A._image.src;C.appendChild(B)},endDrawing:function(){var A=this;A.baseendDrawing()},add:function(){var A=this;A.baseAdd();A.draw()},remove:function(){var A=this;if(A._image){A._control._container.removeChild(A._image);A._image=null}A.baseRemove()},getBoundingBox:function(){var C=this;var A=Math.min(C._start.x,C._end.x);var B=Math.abs(C._end.x-C._start.x);var E=Math.min(C._start.y,C._end.y);var D=Math.abs(C._end.y-C._start.y);return{x:A,y:E,width:B,height:D}},set_rotation:function(B){var A=this;var C=0;if(B>=A._rotation){C=(B-A._rotation)/90}else{C=(360-A._rotation+B)/90}for(i=0;i<C;i++){A._rotation=(A._rotation+90)%360;this.rotate90(true)}A.draw()},rotate90:function(E){var C=this;var A=Math.min(C._start.x,C._end.x);var B=Math.abs(C._end.x-C._start.x);var F=Math.min(C._start.y,C._end.y);var D=Math.abs(C._end.y-C._start.y);C._end.x=C._start.x+D;C._end.y=C._start.y+B;C._image.style.height=parseInt(B*C._control.get_scale())+"px";C._image.style.width=parseInt(D*C._control.get_scale())+"px";if(E){C.recordChange("Rotation",C._rotation);C._notePositionChange()}},get_rotation:function(){return this._rotation},set_token:function(B){var A=this;A._token=B;A.recordChange("Token",B);A.draw()},get_token:function(){return annobj._token},set_start:function(A,C){var B=this;B._start={x:A,y:C};B._notePositionChange();B.updateShape()},set_end:function(A,C){var B=this;B._end={x:A,y:C};B._notePositionChange();B.updateShape()},_notePositionChange:function(){var A=this;if(!A._start||!A._end){return }if(A._start.x>A._end.x){A.recordChange("Left",A._end.x);A.recordChange("Right",A._start.x)}else{A.recordChange("Left",A._start.x);A.recordChange("Right",A._end.x)}if(A._start.y>A._end.y){A.recordChange("Top",A._end.y);A.recordChange("Bottom",A._start.y)}else{A.recordChange("Top",A._start.y);A.recordChange("Bottom",A._end.y)}},draw:function(){var A=this;if(!A._image){A._image=document.createElement("img");A._image.style.zIndex=5;A._image.style.position="absolute";var C=A.getBoundingBox();var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(C.x,C.y,C.width,C.height,A._control);A._image.style.left=parseInt(B.x*A._control.get_scale())+"px";A._image.style.top=parseInt(B.y*A._control.get_scale())+"px";A._image.style.width=parseInt(B.w*A._control.get_scale())+"px";A._image.style.height=parseInt(B.h*A._control.get_scale())+"px";A._image.style.opacity=(A._opacity/100).toString();A._image.style.filter="alpha(opacity="+A._opacity+")";A._control._container.appendChild(A._image);dojo.connect(A._image,"onmousedown",function(D){if(!D){D=window.event}A._control.ClickAnnotation(A.id,null,A._control.GetCurrentXY(D))});dojo.connect(A._image,"ondblclick",function(D){A.HandleDblClick()});dojo.connect(A._image,"oncontextmenu",function(D){dojo.stopEvent(D);A.HandleContextMenu(D)})}A._image.onload=function(){A._height=A._image.height;A._width=A._image.width;A._image.height=parseInt(A._height*A._control.get_scale());A._image.width=parseInt(A._width*A._control.get_scale());A._loaded=true;A._image.onload=null;if(A._highlighted){A.highlight()}if(A.onimageloaded){A.onimageloaded()}};A._loaded=false;if(A._token){A._image.src="Helper/BitmapAnnotation.aspx?token="+A._token}else{A._image.src="Helper/BitmapAnnotation.aspx?r="+A._control._reponame+"&ro="+((A._rotation+A._control.get_rotation())%360)+"&d="+A._control._docid+"&p="+A._control._pageid+"&i="+A.id}A._image.title="Bitmap"},move:function(C,B){var A=this;A._start.x=A._start.x+C;A._start.y=A._start.y+B;A._end.x=A._end.x+C;A._end.y=A._end.y+B;A._notePositionChange();A.updateShape()},updateShape:function(){var A=this;if((A._start==null)||(A._end==null)||(A._image==null)){return }var C=A.getBoundingBox();var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(C.x,C.y,C.width,C.height,A._control);A._image.style.left=parseInt(B.x*A._control.get_scale())+"px";A._image.style.top=parseInt(B.y*A._control.get_scale())+"px";A._image.style.width=parseInt(B.w*A._control.get_scale())+"px";A._image.style.height=parseInt(B.h*A._control.get_scale())+"px";A._image.style.opacity=(A._opacity/100).toString();A._image.style.filter="alpha(opacity="+A._opacity+")"},stretch:function(C,J,F,D,G){var K=this;var I=K._control.get_rotation();var H=(I==0||I==180)?K._width:K._height;var E=(I==0||I==180)?K._height:K._width;var A=Math.abs(D-F);var B=Math.abs(C-J);if(A*H/E>B*E/H){if(Math.abs(D)>Math.abs(F)){J=parseInt(D*E/H)}else{J=parseInt(-F*E/H)}C=0}else{if(Math.abs(J)>Math.abs(C)){D=parseInt(J*H/E)}else{D=parseInt(-C*H/E)}F=0}if(K._start.y<=K._end.y){K._start.y=K._start.y+C;K._end.y=K._end.y+J}else{K._end.y=K._end.y+C;K._start.y=K._start.y+J}if(K._start.x<=K._end.x){K._start.x=K._start.x+F;K._end.x=K._end.x+D}else{K._end.x=K._end.x+F;K._start.x=K._start.x+D}K._notePositionChange();K.updateShape()},sync:function(B){var A=this;if(B){}else{A._displacement={x:0,y:0}}},HandleMouseDown:function(A,B){},HandleMouseMove:function(A,C,B){},HandleMouseUp:function(A,B){},HandleRescale:function(B){var A=this;A.updateShape()},set_opacity:function(B){var A=this;A._opacity=B;A.updateShape();A.recordChange("Opacity",B)},ProcessChanges:function(A){if(typeof (A.Opacity)!="undefined"){this.set_opacity(A.Opacity)}},HandleRotate:function(B){var A=this;var D=(B+A._rotation)%360;var C=0;if(D>=A._rotation){C=(D-A._rotation)/90}else{C=(360-A._rotation+D)/90}for(i=0;i<C;i++){this.rotate90(false)}A.draw()}};Laserfiche.BitmapAnnotation.CreateFromInfo=function(D,B,C){var E=Laserfiche.Modes.MODE_BITMAP;var A=new Laserfiche.BitmapAnnotation(D,B,C.ID,E);A.set_start(C.MoreInfo.Rectangle.Left,C.MoreInfo.Rectangle.Top);A.set_end(C.MoreInfo.Rectangle.Right,C.MoreInfo.Rectangle.Bottom);A.set_opacity(C.MoreInfo.Opacity);A._rotation=C.MoreInfo.Rotation;A.draw();A.makeMoveable();A.setChangeRecording(true);return A};Laserfiche.BitmapAnnotation.registerClass("Laserfiche.BitmapAnnotation");Laserfiche.BlockAnnotation=function(D,A,F,E,C){this._eventHandler=new Sys.EventHandlerList();var B=this;B.id=F;B._control=D;B._surface=A;B._shape=B._surface.createGroup();B._box=null;B._handles=new Array();B._mode=E;B._guidebox=null;B._rectangles=new Array();B._wordlines=new Array();B._startChar=-1;B._endChar=-1;B._hasTextPos=false;B._isnew=C;B._thickness=3;if(C){B.setChangeRecording(true)}switch(B._mode){case Laserfiche.Modes.MODE_HIGHLIGHT:B._type=Laserfiche.AnnotationTypes.ANN_HIGHLIGHT;B._color={r:255,g:255,b:0};B._opacity=0.5;break;case Laserfiche.Modes.MODE_BLACKOUT:B._type=Laserfiche.AnnotationTypes.ANN_BLACKOUT;B._color={r:0,g:0,b:0};B._opacity=0.5;break;case Laserfiche.Modes.MODE_STRIKEOUT:B._type=Laserfiche.AnnotationTypes.ANN_STRIKEOUT;B._color={r:255,g:0,b:0};B._opacity=1;break;case Laserfiche.Modes.MODE_UNDERLINE:B._type=Laserfiche.AnnotationTypes.ANN_UNDERLINE;B._color={r:0,g:255,b:0};B._opacity=1;break}B._fill=B._color};Laserfiche.BlockAnnotation.prototype={setChangeRecording:Laserfiche.BaseAnnotation.prototype.setChangeRecording,recordChange:Laserfiche.BaseAnnotation.prototype.recordChange,getAnnotationChanges:Laserfiche.BaseAnnotation.prototype.getAnnotationChanges,clearAnnotationChanges:Laserfiche.BaseAnnotation.prototype.clearAnnotationChanges,unhighlight:Laserfiche.BaseAnnotation.prototype.unhighlight,highlight:Laserfiche.BaseAnnotation.prototype.highlight,drawHandles:Laserfiche.BaseAnnotation.prototype.drawHandles,drawHandle:Laserfiche.BaseAnnotation.prototype.drawHandle,makeMoveable:Laserfiche.BaseAnnotation.prototype.makeMoveable,makeReadOnly:Laserfiche.BaseAnnotation.prototype.makeReadOnly,add:Laserfiche.BaseAnnotation.prototype.add,remove:Laserfiche.BaseAnnotation.prototype.remove,baseendDrawing:Laserfiche.BaseAnnotation.prototype.endDrawing,getStroke:Laserfiche.BaseAnnotation.prototype.getStroke,base_getFill:Laserfiche.BaseAnnotation.prototype.getFill,getFill:function(B){var A=this;if(A._type==Laserfiche.AnnotationTypes.ANN_BLACKOUT&&A._color.r==255&&A._color.g==255&&A._color.b==255){var C=B?A._opacity*B:A._opacity;var D=[192,192,192,C];return D}return this.base_getFill(B)},drawPanel:Laserfiche.BaseAnnotation.prototype.drawPanel,showProperties:Laserfiche.BaseAnnotation.prototype.showProperties,HandleDblClick:Laserfiche.BaseAnnotation.prototype.HandleDblClick,HandleContextMenu:Laserfiche.BaseAnnotation.prototype.HandleContextMenu,drawIcon:function(C){var A=this;var B=document.createElement("img");switch(A._type){case Laserfiche.AnnotationTypes.ANN_HIGHLIGHT:B.src="Assets/images/annotations/highlight.gif";break;case Laserfiche.AnnotationTypes.ANN_BLACKOUT:B.src="Assets/images/annotations/redact.gif";break;case Laserfiche.AnnotationTypes.ANN_STRIKEOUT:B.src="Assets/images/annotations/strike.gif";break;case Laserfiche.AnnotationTypes.ANN_UNDERLINE:B.src="Assets/images/annotations/underline.gif";break}C.appendChild(B)},endDrawing:function(){var A=this;if(A._guidebox){A._surface.remove(A._guidebox);A._guidebox=null}A.baseendDrawing()},getBoundingBox:function(){var K=this;if(K._rectangles.length==0){return null}if(K._type==Laserfiche.Modes.MODE_HIGHLIGHT||K._type==Laserfiche.Modes.MODE_BLACKOUT){return K._rectangles[0].getShape()}else{var F=K._rectangles[0].getShape();var E=F.x;var D=F.y;var H=E+F.width;var G=D+F.height;for(var C=1;C<K._rectangles.length;C++){F=K._rectangles[C].getShape();var B=F.x;var A=F.y;var J=B+F.width;var I=A+F.height;if(E>B){E=B}if(D>A){D=A}if(H<J){H=J}if(G<I){G=I}}return{x:E,y:D,width:H-E,height:G-D}}},set_color:function(D){var A=this;var C;if(D.r==undefined){C=D;var B=C;A._color.r=B%256;B=(B-A._color.r)/256;A._color.g=B%256;B=(B-A._color.g)/256;A._color.b=B}else{A._color.r=D.r;A._color.g=D.g;A._color.b=D.b;C=r+g*256+b*65536}A._fill=A._color;for(var E=0;E<A._rectangles.length;E++){A._rectangles[E].setFill(A.getFill())}A.recordChange("FillColor",C)},get_color:function(){return this._color.r+this._color.g*256+this._color.b*65536},set_startEndIndex:function(D,B,C){var A=this;if(A._startChar!=D||A._endChar!=B){A._startChar=D;A._endChar=B;A._hasTextPos=true;if(!!C){A.recordChange("TextSection",String.format("{0};{1}",D,B))}}},get_startIndex:function(){return this._startChar},get_endIndex:function(){return this._endChar},set_thickness:function(B){var A=this;A._thickness=B;A._shape.setStroke(A.getStroke());A.recordChange("Thickness",B)},get_thickness:function(){return this._thickness},set_nextstart:function(A,C){var B=this;B._nextstart={x:A,y:C}},set_nextend:function(G,E){var I=this;if(I._nextstart){var B=E<I._nextstart.y;var H=B?E:I._nextstart.y;var F=B?I._nextstart.y:E;var C=G<I._nextstart.x;var D=C?G:I._nextstart.x;var A=C?I._nextstart.x:G;I.addRectangle(H,D,F,A);if(I._guidebox){I._surface.remove(I._guidebox);I._guidebox=null}I._nextstart=null}},addRectangle:function(D,C,A,E){var B=this;if((E-C==0)||(A-D)==0){return }B.drawRectangle(D,C,A,E,null,true);if(B._control._appController.Settings.LinkNewAnnotations){B.RenderLinkedAnnotationOnEditor(D,C,A,E,true)}},drawRectangle:function(I,B,F,A,D,H){var J=this;var C=D==null?J._rectangles.length:parseInt(D);if(J._mode==Laserfiche.Modes.MODE_STRIKEOUT||J._mode==Laserfiche.Modes.MODE_UNDERLINE){var E=J._shape.createRect({x:B,y:I,width:(A-B),height:(F-I)});E.setFill(J.getFill(0.01));E.getEventSource().setAttribute("id",J.id);E.getEventSource().setAttribute("args",C);J._rectangles[C]=E;Laserfiche.WebAccess.AnnotationsService.GetCoveredWords(J._control._reponame,J._control._docid,J._control._pageid,I,B,F,A,J.GetCoveredWordsLoadedFunc(H),J.GetCoveredWordsErrorFunc())}else{var E=J._shape.createRect({x:B,y:I,width:(A-B),height:(F-I)});E.setFill(J.getFill());E.getEventSource().setAttribute("id",J.id);E.getEventSource().setAttribute("args",C);J._rectangles[C]=E;if(H){var G=[I,F,B,A];if(!dojo.every(G,function(K){return(K==0)})){J.recordChange("AddRectangle",G.join(";"),true)}}}},RenderLinkedAnnotationOnImage:function(B){var A=this;if(A._mode==Laserfiche.Modes.MODE_STRIKEOUT||A._mode==Laserfiche.Modes.MODE_UNDERLINE){return A.GetCoveredWordsLoadedFunc(B)}else{if(A._mode==Laserfiche.Modes.MODE_HIGHLIGHT||A._mode==Laserfiche.Modes.MODE_BLACKOUT){return function(J){for(var F=0;F<J.length;F++){var D=J[F].Left;var E=J[F].Top;var H=J[F].Right;var C=J[F].Bottom;var G=A._shape.createRect({x:D,y:E,width:(H-D),height:(C-E)}).setFill(A.getFill());var I=[E,C,D,H];if(!dojo.every(I,function(K){return(K==0)})){A._rectangles.push(G);A.setChangeRecording(B);A.recordChange("AddRectangle",I.join(";"),true)}}}}}},GetCoveredWordsLoadedFunc:function(B){var A=this;if(A._mode==Laserfiche.Modes.MODE_STRIKEOUT){return function(F){for(var D=0;D<F.length;D++){var G=(F[D].Top+F[D].Bottom)/2;var C=A._shape.createLine({x1:F[D].Left,y1:G,x2:F[D].Right,y2:G}).setStroke(A.getStroke());var E=[F[D].Top,F[D].Bottom,F[D].Left,F[D].Right];if(!dojo.every(E,function(H){return(H==0)})){A._wordlines.push(C);if(B){A.recordChange("AddRectangle",E.join(";"),true)}}}}}else{if(A._mode==Laserfiche.Modes.MODE_UNDERLINE){return function(F){for(var D=0;D<F.length;D++){var G=F[D].Bottom;var C=A._shape.createLine({x1:F[D].Left,y1:G,x2:F[D].Right,y2:G}).setStroke(A.getStroke());var E=[F[D].Top,F[D].Bottom,F[D].Left,F[D].Right];if(!dojo.every(E,function(H){return(H==0)})){A._wordlines.push(C);if(B){A.recordChange("AddRectangle",E.join(";"),true)}}}}}}return function(){}},GetCoveredWordsErrorFunc:function(){return function(A){alert(A.get_message())}},updateShape:function(){},move:function(E,D,C){var A=this;if(!A.moveable){return }if((C!=null)&&(!isNaN(parseInt(C)))){A.moveRectangle(E,D,C)}else{for(var B in A._rectangles){A.moveRectangle(E,D,B)}}},removeAllRectangles:function(){var A=this;dojo.forEach(A._rectangles,function(B){A._shape.remove(B)});A._rectangles=[];dojo.forEach(A._wordlines,function(B){A._shape.remove(B)});A._wordlines=[]},moveRectangle:function(D,C,G){var K=this;if(!K.moveable){return }var F=parseInt(G);if(K._rectangles[F]){var H=K._rectangles[F].getShape();var B=K._rectangles[F];var J=H.y+C;var E=H.x+D;var I=J+H.height;var A=E+H.width;K.drawRectangle(J,E,I,A,F);K._shape.remove(B);H=K._rectangles[G].getShape();K.recordChange("EditRectangle",(parseInt(G)+1)+";"+H.y+";"+(H.y+H.height)+";"+H.x+";"+(H.x+H.width),true)}},stretch:function(F,B,E,G,D){var A=this;if(!A.moveable){return }if(D){A.stretchRectangle(D)}else{for(var C in A._rectangles){A.stretchRectangle(F,B,E,G,C)}}},stretchRectangle:function(C,L,G,D,H){var F=parseInt(H);var M=this;if(!M.moveable){return }if(M._rectangles[F]){var I=M._rectangles[F].getShape();var B=M._rectangles[F];var K=I.y+C;var E=I.x+G;var J=K+I.height+(L-C);var A=E+I.width+(D-G);M.drawRectangle(K,E,J,A,F);M._shape.remove(B);I=M._rectangles[H].getShape();M.recordChange("EditRectangle",(parseInt(H)+1)+";"+I.y+";"+(I.y+I.height)+";"+I.x+";"+(I.x+I.width),true)}},sync:function(B){var A=this;if(B){}else{A._displacement={x:0,y:0}}},HandleMouseDown:function(A,C){var B=this;switch(B._mode){case Laserfiche.Modes.MODE_HIGHLIGHT:case Laserfiche.Modes.MODE_BLACKOUT:case Laserfiche.Modes.MODE_STRIKEOUT:case Laserfiche.Modes.MODE_UNDERLINE:B.set_nextend(A,C);B.endDrawing();break}},HandleMouseMove:function(B,H,D){var C=this;switch(C._mode){case Laserfiche.Modes.MODE_HIGHLIGHT:case Laserfiche.Modes.MODE_BLACKOUT:case Laserfiche.Modes.MODE_STRIKEOUT:case Laserfiche.Modes.MODE_UNDERLINE:var G=Math.min(C._nextstart.x,B);var A=Math.abs(B-C._nextstart.x);var F=Math.min(C._nextstart.y,H);var E=Math.abs(H-C._nextstart.y);A=A>0?A:1;E=E>0?E:1;if(C._guidebox){C._surface.remove(C._guidebox)}C._guidebox=C._surface.createRect({x:G,y:F,width:A,height:E}).setFill(C.getFill(0.25));break}},HandleMouseUp:function(A,B){},RenderLinkedAnnotationOnEditor:function(E,D,B,F,A){var C=this;if(true){if(C._control._editor.hasText()){C.makeReadOnly();C.highlight();Laserfiche.WebAccess.AnnotationsService.GetStartEndPos(C._control._reponame,C._control._docid,C._control._pageid,E,D,B,F,C.GetStartEndPosLoadedFunc(A),C.GetStartEndPosErrorFunc())}}},GetStartEndPosLoadedFunc:function(A){var B=this;return function(C){if(C.textStartPos>=0&&C.textEndPos>=0){B.set_startEndIndex(C.textStartPos,C.textEndPos,!!A);B._control._editor.addAnnotation({start:C.textStartPos,end:C.textEndPos,annType:B._type,color:B.get_color(),id:B.id},true)}}},GetStartEndPosErrorFunc:function(){return function(A){alert(A.get_message())}},ProcessChanges:function(A){if(typeof (A.FillColor)!="undefined"){this.set_color(A.FillColor)}else{if(typeof (A.LineColor)!="undefined"){this.set_color(A.LineColor)}}},JoinRects:function(G,B,I,H){var C=new Array();if(G.length==0){return C}var D=0;while(G[D].Top-G[D].Bottom==0||G[D].Left-G[D].Right==0){D++}if(D<G.length){C.push(G[D])}var A=D;for(D++;D<G.length;D++){var E=G[D];if((E.Top-E.Bottom)==0||(E.Right-E.Left)==0){continue}var F=C[A];if(((Math.abs(E.Left-F.Right)<=B)||((E.Left>F.Left+B)&&(E.Left<F.Right+B))||((E.Right<F.Right+B)&&(E.Right>F.Left+B)))&&((Math.abs(E.Top-F.Top)<=I)||(Math.abs(E.Bottom-F.Bottom)<=I))){if(F.Left>E.Left){F.Left=E.Left}if(F.Right<E.Right){F.Right=E.Right}if(H){if(E.Top<F.Top){F.Top=E.Top}if(E.Bottom>F.Bottom){F.Bottom=E.Bottom}}continue}A++;C.push(G[D])}return C}};Laserfiche.BlockAnnotation.CreateFromInfo=function(G,A,F){var H=Laserfiche.Modes.MODE_HIGHLIGHT;switch(F.Type){case Laserfiche.AnnotationTypes.ANN_HIGHLIGHT:H=Laserfiche.Modes.MODE_HIGHLIGHT;break;case Laserfiche.AnnotationTypes.ANN_BLACKOUT:H=Laserfiche.Modes.MODE_BLACKOUT;break;case Laserfiche.AnnotationTypes.ANN_STRIKEOUT:H=Laserfiche.Modes.MODE_STRIKEOUT;break;case Laserfiche.AnnotationTypes.ANN_UNDERLINE:H=Laserfiche.Modes.MODE_UNDERLINE;break}var E=new Laserfiche.BlockAnnotation(G,A,F.ID,H);E.set_color(F.MoreInfo.Color);var B=E.JoinRects(F.MoreInfo.Rectangles,31,11,true);for(var C=0;C<B.length;C++){var D=B[C];E.drawRectangle(D.Top,D.Left,D.Bottom,D.Right,null,false)}E.set_startEndIndex(F.MoreInfo.textStartPos,F.MoreInfo.textEndPos);if(!F.MoreInfo.hasTextPos&&(H==Laserfiche.Modes.MODE_HIGHLIGHT||H==Laserfiche.Modes.MODE_BLACKOUT)){E.makeMoveable()}else{E.makeReadOnly()}E.setChangeRecording(true);return E};Laserfiche.BlockAnnotation.registerClass("Laserfiche.BlockAnnotation");Laserfiche.BoxAnnotation=function(D,A,F,E,C){this._eventHandler=new Sys.EventHandlerList();var B=this;B.id=F;B._control=D;B._surface=A;B._shape=null;B._displacement={x:0,y:0};B._box=null;B._handles=new Array();B._mode=E;B._guidebox=null;B._start=null;B._end=null;B._boxstyle=Laserfiche.BoxStyles.BOXSTYLE_RECTANGE;B._opacity=1;B._thickness=1;B._color={r:0,g:0,b:0};B._fill={r:255,g:255,b:255};B._linestyle=Laserfiche.LineStyles.LINE_STYLE_SOLID;B._isnew=C;B._fillcolor=0;if(C){B.setChangeRecording(true)}B._type=Laserfiche.AnnotationTypes.ANN_RECTANGLE;if(E==Laserfiche.Modes.MODE_ROUNDEDRECT){B._boxstyle=Laserfiche.BoxStyles.BOXSTYLE_ROUNDEDRECT}else{if(E==Laserfiche.Modes.MODE_ELLIPSE){B._boxstyle=Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE}}};Laserfiche.BoxAnnotation.prototype={roundness:10,setChangeRecording:Laserfiche.BaseAnnotation.prototype.setChangeRecording,recordChange:Laserfiche.BaseAnnotation.prototype.recordChange,getAnnotationChanges:Laserfiche.BaseAnnotation.prototype.getAnnotationChanges,clearAnnotationChanges:Laserfiche.BaseAnnotation.prototype.clearAnnotationChanges,unhighlight:Laserfiche.BaseAnnotation.prototype.unhighlight,highlight:Laserfiche.BaseAnnotation.prototype.highlight,drawHandles:Laserfiche.BaseAnnotation.prototype.drawHandles,drawHandle:Laserfiche.BaseAnnotation.prototype.drawHandle,drawHead:Laserfiche.BaseAnnotation.prototype.drawHead,makeMoveable:Laserfiche.BaseAnnotation.prototype.makeMoveable,add:Laserfiche.BaseAnnotation.prototype.add,remove:Laserfiche.BaseAnnotation.prototype.remove,baseendDrawing:Laserfiche.BaseAnnotation.prototype.endDrawing,getStroke:Laserfiche.BaseAnnotation.prototype.getStroke,getFill:Laserfiche.BaseAnnotation.prototype.getFill,drawPanel:Laserfiche.BaseAnnotation.prototype.drawPanel,showProperties:Laserfiche.BaseAnnotation.prototype.showProperties,HandleDblClick:Laserfiche.BaseAnnotation.prototype.HandleDblClick,HandleContextMenu:Laserfiche.BaseAnnotation.prototype.HandleContextMenu,makeReadOnly:Laserfiche.BaseAnnotation.prototype.makeReadOnly,drawIcon:function(B){var A=document.createElement("img");A.src="Assets/images/annotations/rect.gif";B.appendChild(A)},endDrawing:function(){var A=this;if(A._guidebox){A._surface.remove(A._guidebox);A._guidebox=null}A.baseendDrawing()},getBoundingBox:function(){var C=this;if(C._boxstyle!=Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE){return C._shape.getShape()}var A=Math.min(C._start.x,C._end.x);var B=Math.abs(C._end.x-C._start.x);var E=Math.min(C._start.y,C._end.y);var D=Math.abs(C._end.y-C._start.y);return{x:A,y:E,width:B,height:D}},set_boxstyle:function(B){var A=this;A._boxstyle=B;A.updateShape();A.recordChange("BoxStyle",B)},get_boxstyle:function(){return this._boxstyle},set_rounded:function(A){this.set_boxstyle(Laserfiche.BoxStyles.BOXSTYLE_ROUNDEDRECT)},set_ellipse:function(A){this.set_boxstyle(Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE)},set_color:function(D){var A=this;var C;if(D.r==undefined){C=D;var B=C;A._color.r=B%256;B=(B-A._color.r)/256;A._color.g=B%256;B=(B-A._color.g)/256;A._color.b=B}else{A._color.r=D.r;A._color.g=D.g;A._color.b=D.b;C=r+g*256+b*65536}A.updateShape();A.recordChange("LineColor",C)},get_color:function(){return this._color.r+this._color.g*256+this._color.b*65536},set_fill:function(D){var A=this;var C;A._fillcolor=D;if(D.r==undefined){C=D;var B=C;A._fill.r=B%256;B=(B-A._fill.r)/256;A._fill.g=B%256;B=(B-A._fill.g)/256;A._fill.b=B}else{A._fill.r=D.r;A._fill.g=D.g;A._fill.b=D.b;C=r+g*256+b*65536}A.updateShape();A.recordChange("FillColor",C)},get_fill:function(){return this._fill.r+this._fill.g*256+this._fill.b*65536},set_opacity:function(B){var A=this;A._opacity=B/100;A.updateShape();A.recordChange("Opacity",B)},get_opacity:function(){return this._opacity*100},set_linestyle:function(B){var A=this;A._linestyle=B;A.updateShape();A.recordChange("LineStyle",B)},get_linestyle:function(){return this._linestyle},set_thickness:function(B){var A=this;A._thickness=B;A.updateShape();A.recordChange("Thickness",B)},get_thickness:function(){return this._thickness},set_start:function(A,C){var B=this;B._start={x:A,y:C};B._notePositionChange();B.updateShape()},set_end:function(A,C){var B=this;B._end={x:A,y:C};B._notePositionChange();B.updateShape()},_notePositionChange:function(){var A=this;if(!A._start||!A._end){return }if(A._start.x>A._end.x){A.recordChange("Left",A._end.x);A.recordChange("Right",A._start.x)}else{A.recordChange("Left",A._start.x);A.recordChange("Right",A._end.x)}if(A._start.y>A._end.y){A.recordChange("Top",A._end.y);A.recordChange("Bottom",A._start.y)}else{A.recordChange("Top",A._start.y);A.recordChange("Bottom",A._end.y)}},updateShape:function(){var L=this;if(!L._start||!L._end){return }var J=L.getStroke();var K=L.getFill(L._fillcolor==-1?0.01:L._opacity);if(L._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE){var E=(L._start.x+L._end.x)/2;var D=(L._start.y+L._end.y)/2;var C=Math.abs(L._end.x-L._start.x)/2;var B=Math.abs(L._end.y-L._start.y)/2;C=C>0?C:1;B=B>0?B:1;if(L._shape){L._surface.remove(L._shape)}L._shape=L._surface.createEllipse({cx:E,cy:D,rx:C,ry:B}).setStroke(J).setFill(K);L._shape.getEventSource().setAttribute("id",L.id)}else{var H=Math.min(L._start.x,L._end.x);var I=Math.abs(L._end.x-L._start.x);var G=Math.min(L._start.y,L._end.y);var F=Math.abs(L._end.y-L._start.y);var A=L._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ROUNDEDRECT?L.roundness:0;if(L._shape){L._surface.remove(L._shape)}if((I!=0)&&(F!=0)){L._shape=L._surface.createRect({x:H,y:G,width:I,height:F,r:A}).setStroke(J).setFill(K)}L._shape.getEventSource().setAttribute("id",L.id);if(L.moveable){L.makeMoveable()}}},move:function(C,B){var A=this;A._start.x=A._start.x+C;A._start.y=A._start.y+B;A._end.x=A._end.x+C;A._end.y=A._end.y+B;A._notePositionChange();A.updateShape();A._displacement.x=A._displacement.x+C;A._displacement.y=A._displacement.y+B},stretch:function(D,B,C,E){var A=this;if(A._start.y<=A._end.y){A._start.y=A._start.y+D;A._end.y=A._end.y+B}else{A._end.y=A._end.y+D;A._start.y=A._start.y+B}if(A._start.x<=A._end.x){A._start.x=A._start.x+C;A._end.x=A._end.x+E}else{A._end.x=A._end.x+C;A._start.x=A._start.x+E}A._notePositionChange();A.updateShape()},sync:function(B){var A=this;if(B){}else{A._displacement={x:0,y:0}}},HandleMouseDown:function(A,C){var B=this;switch(B._mode){case Laserfiche.Modes.MODE_RECTANGLE:case Laserfiche.Modes.MODE_ROUNDEDRECT:case Laserfiche.Modes.MODE_ELLIPSE:B.set_end(A,C);B.endDrawing();break}},HandleMouseMove:function(L,K,D){var M=this;switch(M._mode){case Laserfiche.Modes.MODE_RECTANGLE:case Laserfiche.Modes.MODE_ROUNDEDRECT:var I=Math.min(M._start.x,L);var J=Math.abs(L-M._start.x);var H=Math.min(M._start.y,K);var G=Math.abs(K-M._start.y);var A=M._rounded?M.roundness:0;J=J>0?J:1;G=G>0?G:1;if(M._guidebox){M._surface.remove(M._guidebox)}if((J!=0)&&(G!=0)){M._guidebox=M._surface.createRect({x:I,y:H,width:J,height:G,r:A}).setStroke(M.getStroke(0.25)).setFill(M.getFill(0.25))}break;case Laserfiche.Modes.MODE_ELLIPSE:var F=(M._start.x+L)/2;var E=(M._start.y+K)/2;var C=Math.abs(L-M._start.x)/2;var B=Math.abs(K-M._start.y)/2;C=C>0?C:1;B=B>0?B:1;if(M._guidebox){M._guidebox.setShape({cx:F,cy:E,rx:C,ry:B})}else{M._guidebox=M._surface.createEllipse({cx:F,cy:E,rx:C,ry:B}).setStroke(M.getStroke(0.25)).setFill(M.getFill(0.25))}break}},HandleMouseUp:function(A,B){},HandleRescale:function(B){if(!(dojox.gfx.renderer=="svg")){var A=this;A.updateShape()}},ProcessChanges:function(A){if(typeof (A.Opacity)!="undefined"){this.set_opacity(A.Opacity)}if(typeof (A.FillColor)!="undefined"){this.set_fill(A.FillColor)}if(typeof (A.LineColor)!="undefined"){this.set_color(A.LineColor)}if(typeof (A.LineStyle)!="undefined"){this.set_linestyle(A.LineStyle)}if(typeof (A.Thickness)!="undefined"){this.set_thickness(A.Thickness)}if(typeof (A.BoxStyle)!="undefined"){this.set_boxstyle(A.BoxStyle)}}};Laserfiche.BoxAnnotation.CreateFromInfo=function(D,A,C){var E=Laserfiche.Modes.MODE_RECTANGLE;var B=new Laserfiche.BoxAnnotation(D,A,C.ID,E);B.set_color(C.MoreInfo.LineColor);B.set_boxstyle(C.MoreInfo.BoxStyle);B.set_fill(C.MoreInfo.FillColor);B.set_opacity(C.MoreInfo.Opacity);B.set_linestyle(C.MoreInfo.LineStyle);B.set_thickness(C.MoreInfo.Thickness);B.set_start(C.MoreInfo.Rectangle.Left,C.MoreInfo.Rectangle.Top);B.set_end(C.MoreInfo.Rectangle.Right,C.MoreInfo.Rectangle.Bottom);B.makeMoveable();B.setChangeRecording(true);return B};Laserfiche.BoxAnnotation.registerClass("Laserfiche.BoxAnnotation");Laserfiche.LineAnnotation=function(D,A,F,E,C){this._eventHandler=new Sys.EventHandlerList();var B=this;B.id=F;B._control=D;B._surface=A;B._shape=null;B._displacement={x:0,y:0};B._box=null;B._handles=new Array();B._mode=E;B._guideline=null;B._start=null;B._end=null;B._startStyle=Laserfiche.LineEndings.LINE_ENDING_NONE;B._endStyle=Laserfiche.LineEndings.LINE_ENDING_NONE;B._opacity=1;B._thickness=1;B._color={r:0,g:0,b:0};B._isnew=C;B._fill={r:0,g:0,b:0};if(C){B.setChangeRecording(true)}B._type=Laserfiche.AnnotationTypes.ANN_LINE;B._linestyle=Laserfiche.LineStyles.LINE_STYLE_SOLID};Laserfiche.LineAnnotation.prototype={setChangeRecording:Laserfiche.BaseAnnotation.prototype.setChangeRecording,recordChange:Laserfiche.BaseAnnotation.prototype.recordChange,getAnnotationChanges:Laserfiche.BaseAnnotation.prototype.getAnnotationChanges,clearAnnotationChanges:Laserfiche.BaseAnnotation.prototype.clearAnnotationChanges,unhighlight:Laserfiche.BaseAnnotation.prototype.unhighlight,highlight:Laserfiche.BaseAnnotation.prototype.highlight,drawHandles:Laserfiche.BaseAnnotation.prototype.drawHandles,drawHandle:Laserfiche.BaseAnnotation.prototype.drawHandle,drawHead:Laserfiche.BaseAnnotation.prototype.drawHead,headDimensions:Laserfiche.BaseAnnotation.prototype.headDimensions,makeMoveable:Laserfiche.BaseAnnotation.prototype.makeMoveable,makeReadOnly:Laserfiche.BaseAnnotation.prototype.makeReadOnly,add:Laserfiche.BaseAnnotation.prototype.add,baseRemove:Laserfiche.BaseAnnotation.prototype.remove,baseendDrawing:Laserfiche.BaseAnnotation.prototype.endDrawing,getStroke:Laserfiche.BaseAnnotation.prototype.getStroke,getArrowStroke:Laserfiche.BaseAnnotation.prototype.getArrowStroke,drawPanel:Laserfiche.BaseAnnotation.prototype.drawPanel,showProperties:Laserfiche.BaseAnnotation.prototype.showProperties,HandleDblClick:Laserfiche.BaseAnnotation.prototype.HandleDblClick,HandleContextMenu:Laserfiche.BaseAnnotation.prototype.HandleContextMenu,drawIcon:function(B){var A=document.createElement("img");A.src="Assets/images/annotations/line.gif";B.appendChild(A)},endDrawing:function(){var A=this;if(A._guideline){A._surface.remove(A._guideline);A._guideline=null}A.baseendDrawing()},remove:function(){var A=this;if(A._beginHead){A._surface.remove(A._beginHead)}if(A._endHead){A._surface.remove(A._endHead)}A.baseRemove()},getBoundingBox:function(){var C=this;var A=Math.min(C._start.x,C._end.x);var E=Math.min(C._start.y,C._end.y);var B=Math.abs(C._start.x-C._end.x);var D=Math.abs(C._start.y-C._end.y);return{x:A,y:E,width:B>0?B:1,height:D>0?D:1,dir:C._start.x>C._end.x?"left":"right"}},set_color:function(D){var A=this;var C;if(D.r==undefined){C=D;var B=C;A._color.r=B%256;B=(B-A._color.r)/256;A._color.g=B%256;B=parseInt((B-A._color.g)/256);A._color.b=B}else{A._color.r=D.r;A._color.g=D.g;A._color.b=D.b;C=r+g*256+b*65536}A.updateShape();A.recordChange("Color",C)},get_color:function(){return this._color.r+this._color.g*256+this._color.b*65536},set_fillcolor:function(D){var A=this;var C;if(D.r==undefined){C=D;var B=C;A._fill.r=B%256;B=(B-A._fill.r)/256;A._fill.g=B%256;B=parseInt((B-A._fill.g)/256);A._fill.b=B}else{A._fill.r=D.r;A._fill.g=D.g;A._fill.b=D.b;C=r+g*256+b*65536}A.updateShape();A.recordChange("FillColor",C)},get_fillcolor:function(){return this._fill.r+this._fill.g*256+this._fill.b*65536},set_opacity:function(B){var A=this;A._opacity=B/100;A.updateShape();A.recordChange("Opacity",B)},get_opacity:function(){return this._opacity*100},set_linestyle:function(B){var A=this;A._linestyle=B;A.updateShape();A.recordChange("LineStyle",B)},get_linestyle:function(){return this._linestyle},set_thickness:function(B){var A=this;A._thickness=B;A.updateShape();A.recordChange("Thickness",B)},get_thickness:function(){return this._thickness},set_start:function(A,C){var B=this;B._start={x:A,y:C};B.recordChange("BeginX",A);B.recordChange("BeginY",C);B.updateShape()},set_end:function(A,C){var B=this;B._end={x:A,y:C};B.recordChange("EndX",A);B.recordChange("EndY",C);B.updateShape()},get_startStyle:function(){return this._startStyle},set_startStyle:function(B){var A=this;A._startStyle=B;A.recordChange("BeginStyle",B);A.updateShape()},get_endStyle:function(){return this._endStyle},set_endStyle:function(B){var A=this;A._endStyle=B;A.recordChange("EndStyle",B);A.updateShape()},updateShape:function(){var M=this;if(!M._start||!M._end){return }var L=M.getStroke();var B=M._start.x;var A=M._start.y;var G=M._end.x;var F=M._end.y;if(M._startStyle!=Laserfiche.LineEndings.LINE_ENDING_NONE){}var E=10*M._thickness;var J=5*M._thickness;var N=M._end.x-M._start.x;var K=M._end.y-M._start.y;var D=M.headDimensions(M._end,N,K,E,J,M._endStyle);var H=M.headDimensions(M._start,N,K,E,J,M._startStyle);if(M._shape){M._shape.setShape({x1:B+H.x,y1:A+H.y,x2:G-D.x,y2:F-D.y});M._shape.setStroke(L)}else{M._shape=M._surface.createLine({x1:B+H.x,y1:A+H.y,x2:G-D.x,y2:F-D.y}).setStroke(L);M._shape.getEventSource().setAttribute("id",M.id)}if(M._beginHead){M._surface.remove(M._beginHead)}if(M._endHead){M._surface.remove(M._endHead)}var C=function(O,P){M._shape.setShape({x1:O,y1:P,x2:M._shape.getShape().x2,y2:M._shape.getShape().y2})};var I=function(O,P){M._shape.setShape({x1:M._shape.getShape().x1,y1:M._shape.getShape().y1,x2:O,y2:P})};M._beginHead=M.drawHead(M._start,N,K,E,J,M._startStyle,C);M._endHead=M.drawHead(M._end,-N,-K,E,J,M._endStyle,I)},move:function(C,B){var A=this;A.set_start(A._start.x+C,A._start.y+B);A.set_end(A._end.x+C,A._end.y+B);A.updateShape();A._displacement.x=A._displacement.x+C;A._displacement.y=A._displacement.y+B},stretch:function(E,B,D,F,C){var A=this;A.set_start(A._start.x+D,A._start.y+E);A.set_end(A._end.x+F,A._end.y+B)},sync:function(B){var A=this;if(B){}else{A._displacement={x:0,y:0}}},HandleMouseDown:function(A,C){var B=this;switch(B._mode){case Laserfiche.Modes.MODE_LINE:B.set_end(A,C);B.endDrawing();break}},HandleMouseMove:function(A,F,D){var B=this;switch(B._mode){case Laserfiche.Modes.MODE_LINE:if(B._guideline){var C=B._guideline.getShape().x1;var E=B._guideline.getShape().y1;B._guideline.setShape({x1:C,y1:E,x2:A,y2:F})}else{B._guideline=B._surface.createLine({x1:B._start.x,y1:B._start.y,x2:A,y2:F}).setStroke(B.getStroke(0.25))}break}},HandleMouseUp:function(A,B){},HandleRescale:function(B){if(!(dojox.gfx.renderer=="svg")){var A=this;A.updateShape()}},ProcessChanges:function(A){if(typeof (A.Opacity)!="undefined"){this.set_opacity(A.Opacity)}if(A.FillColor){this.set_fillcolor(A.FillColor)}if(typeof (A.LineColor)!="undefined"){this.set_color(A.LineColor)}if(typeof (A.LineStyle)!="undefined"){this.set_linestyle(A.LineStyle)}if(typeof (A.Thickness)!="undefined"){this.set_thickness(A.Thickness)}if(typeof (A.BeginArrow)!="undefined"){this.set_startStyle(A.BeginArrow)}if(typeof (A.EndArrow)!="undefined"){this.set_endStyle(A.EndArrow)}}};Laserfiche.LineAnnotation.CreateFromInfo=function(E,B,D){var C=new Laserfiche.LineAnnotation(E,B,D.ID);var A=D.MoreInfo.BeginPosition;C.set_start(A.X,A.Y);C.set_startStyle(D.MoreInfo.BeginStyle);A=D.MoreInfo.EndPosition;C.set_color(D.MoreInfo.Color);C.set_fillcolor(D.MoreInfo.FillColor);C.set_end(A.X,A.Y);C.set_endStyle(D.MoreInfo.EndStyle);C.set_opacity(D.MoreInfo.Opacity);C.set_linestyle(D.MoreInfo.LineStyle);C.set_thickness(D.MoreInfo.Thickness);C.makeMoveable();C.setChangeRecording(true);return C};Laserfiche.LineAnnotation.registerClass("Laserfiche.LineAnnotation");Laserfiche.StampAnnotation=function(E,B,A,G,C,H,D,F,J){this._eventHandler=new Sys.EventHandlerList();var I=this;I.id=A;I._control=E;I._surface=B;I._box=null;I._handles=new Array();I._mode=G;I._image=null;I._rotation=0;I._colornum=0;I._start=null;I._end=null;I._iscommon=C;I._ispersonal=J;I._stampid=H;I._stampname=D;I._isnew=F;I._loaded=false;I._highlighted=false;if(F){I.setChangeRecording(true);I.recordChange("StampID",I._ispersonal?"P"+H:H)}I._type=Laserfiche.AnnotationTypes.ANN_STAMP};Laserfiche.StampAnnotation.prototype={setChangeRecording:Laserfiche.BaseAnnotation.prototype.setChangeRecording,recordChange:Laserfiche.BaseAnnotation.prototype.recordChange,getAnnotationChanges:Laserfiche.BaseAnnotation.prototype.getAnnotationChanges,clearAnnotationChanges:Laserfiche.BaseAnnotation.prototype.clearAnnotationChanges,baseunhighlight:Laserfiche.BaseAnnotation.prototype.unhighlight,unhighlight:function(){var A=this;A._highlighted=false;A.baseunhighlight()},basehighlight:Laserfiche.BaseAnnotation.prototype.highlight,highlight:function(){var A=this;A._highlighted=true;if(A._loaded){A.basehighlight()}},drawHandles:Laserfiche.BaseAnnotation.prototype.drawHandles,drawHandle:Laserfiche.BaseAnnotation.prototype.drawHandle,makeMoveable:function(){var A=this;this.moveable=true;A._image.className="moveable";A._canStretch=true},makeReadOnly:function(){var A=this;this.moveable=false;A._image.className="";A._canStretch=false},baseAdd:Laserfiche.BaseAnnotation.prototype.add,baseRemove:Laserfiche.BaseAnnotation.prototype.remove,baseendDrawing:Laserfiche.BaseAnnotation.prototype.endDrawing,drawPanel:Laserfiche.BaseAnnotation.prototype.drawPanel,showProperties:Laserfiche.BaseAnnotation.prototype.showProperties,HandleDblClick:Laserfiche.BaseAnnotation.prototype.HandleDblClick,HandleContextMenu:Laserfiche.BaseAnnotation.prototype.HandleContextMenu,drawIcon:function(C){var A=this;var B=document.createElement("img");A.onimageloaded=function(){if(A._height>A._width){B.height=30;B.width=A._width*30/A._height}else{B.height=A._height*30/A._width;B.width=30}A.onimageloaded=null};B.src=A._image.src;C.appendChild(B)},set_start:function(A,C){var B=this;B._start={x:A,y:C};B._notePositionChange();B.updateShape()},set_end:function(A,C){var B=this;B._end={x:A,y:C};B._notePositionChange();B.updateShape()},set_position:function(A,C){var B=this;B._start={x:A,y:C};B._end={x:A,y:C};B._notePositionChange();B.updateShape()},_notePositionChange:function(){var A=this;if(!A._start||!A._end){return }if(A._start.x>A._end.x){A.recordChange("Left",A._end.x);A.recordChange("Right",A._start.x)}else{A.recordChange("Left",A._start.x);A.recordChange("Right",A._end.x)}if(A._start.y>A._end.y){A.recordChange("Top",A._end.y);A.recordChange("Bottom",A._start.y)}else{A.recordChange("Top",A._start.y);A.recordChange("Bottom",A._end.y)}},endDrawing:function(){var A=this;A.baseendDrawing()},add:function(){var A=this;A.baseAdd();A.draw()},remove:function(){var A=this;if(A._image){A._control._container.removeChild(A._image);A._image=null}A.baseRemove()},getBoundingBox:function(){var C=this;var A=Math.min(C._start.x,C._end.x);var B=Math.abs(C._end.x-C._start.x);var E=Math.min(C._start.y,C._end.y);var D=Math.abs(C._end.y-C._start.y);return{x:A,y:E,width:B,height:D}},get_title:function(){return this._stampname?"Stamp: "+this._stampname:""},set_color:function(B){var A=this;colornum=B;if(B.r!=undefined){colornum=B.r+B.g*256+B.b*65536}A._colornum=colornum;A.recordChange("Color",colornum);A.draw()},get_color:function(){return this._colornum},set_rotation:function(B){var A=this;var C=0;if(B>=A._rotation){C=(B-A._rotation)/90}else{C=(360-A._rotation+B)/90}for(i=0;i<C;i++){A._rotation=(A._rotation+90)%360;this.rotate90(true)}A.draw()},rotate90:function(E){var C=this;var A=Math.min(C._start.x,C._end.x);var B=Math.abs(C._end.x-C._start.x);var F=Math.min(C._start.y,C._end.y);var D=Math.abs(C._end.y-C._start.y);C._end.x=C._start.x+D;C._end.y=C._start.y+B;C._image.style.height=parseInt(B*C._control.get_scale())+"px";C._image.style.width=parseInt(D*C._control.get_scale())+"px";if(E){C.recordChange("Rotation",C._rotation);C._notePositionChange()}},get_rotation:function(){var A=this;return A._rotation},draw:function(){var A=this;if(!A._image){A._image=document.createElement("img");A._image.style.zIndex=5;A._image.style.position="absolute";var C=A.getBoundingBox();var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(C.x,C.y,C.width,C.height,A._control);A._image.style.left=parseInt(B.x*A._control.get_scale())+"px";A._image.style.top=parseInt(B.y*A._control.get_scale())+"px";A._image.style.width=parseInt(B.w*A._control.get_scale())+"px";A._image.style.height=parseInt(B.h*A._control.get_scale())+"px";A._control._container.appendChild(A._image);dojo.connect(A._image,"onmousedown",function(D){if(!D){D=window.event}A._control.ClickAnnotation(A.id,null,A._control.GetCurrentXY(D))});dojo.connect(A._image,"ondblclick",function(D){A.HandleDblClick()});dojo.connect(A._image,"oncontextmenu",function(D){dojo.stopEvent(D);A.HandleContextMenu(D)})}A._image.onload=function(){var D=Laserfiche.BaseAnnotation._getAdjustedDimensions(A._start.x,A._start.y,0,0,A._control);A._image.style.left=parseInt(D.x*A._control.get_scale())+"px";A._image.style.top=parseInt(D.y*A._control.get_scale())+"px";A._height=parseInt(A._image.height);A._width=parseInt(A._image.width);A._image.height=parseInt(A._height*A._control.get_scale());A._image.width=parseInt(A._width*A._control.get_scale());var E=A._control.get_rotation()+A._rotation;E=E%360;A._loaded=true;if(A.onimageloaded){A.onimageloaded()}if(A._highlighted){A.highlight()}A._image.onload=null};A._loaded=false;A._image.src="Helper/StampImage.aspx?r="+A._control._reponame+"&ro="+((A._rotation+A._control.get_rotation())%360)+"&color="+A._colornum+(A._iscommon?"&c=1"+(A._ispersonal?"&i=P":"&i=")+A._stampid:"&c=0"+(A._ispersonal?"&i=P":"&i=")+A.id+"&d="+A._control._docid+"&p="+A._control._pageid)},move:function(C,B){var A=this;A._start.x=A._start.x+C;A._start.y=A._start.y+B;A._end.x=A._end.x+C;A._end.y=A._end.y+B;A._notePositionChange();A.updateShape()},updateShape:function(){var A=this;if((A._start==null)||(A._end==null)||(A._image==null)){return }var C=A.getBoundingBox();var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(C.x,C.y,C.width,C.height,A._control);A._image.style.left=parseInt(B.x*A._control.get_scale())+"px";A._image.style.top=parseInt(B.y*A._control.get_scale())+"px";A._image.style.width=parseInt(B.w*A._control.get_scale())+"px";A._image.style.height=parseInt(B.h*A._control.get_scale())+"px"},stretch:function(C,J,F,D,G){var K=this;var I=K._control.get_rotation();var H=(I==0||I==180)?K._width:K._height;var E=(I==0||I==180)?K._height:K._width;var A=Math.abs(D-F);var B=Math.abs(C-J);if(A*H/E>B*E/H){if(Math.abs(D)>Math.abs(F)){J=parseInt(D*E/H)}else{J=parseInt(-F*E/H)}C=0}else{if(Math.abs(J)>Math.abs(C)){D=parseInt(J*H/E)}else{D=parseInt(-C*H/E)}F=0}if(K._start.y<=K._end.y){K._start.y=K._start.y+C;K._end.y=K._end.y+J}else{K._end.y=K._end.y+C;K._start.y=K._start.y+J}if(K._start.x<=K._end.x){K._start.x=K._start.x+F;K._end.x=K._end.x+D}else{K._end.x=K._end.x+F;K._start.x=K._start.x+D}K._notePositionChange();K.updateShape()},sync:function(B){var A=this;if(B){}else{A._displacement={x:0,y:0}}},HandleMouseDown:function(A,B){},HandleMouseMove:function(A,C,B){},HandleMouseUp:function(A,B){},HandleRescale:function(B){var A=this;A.updateShape()},HandleRotate:function(B){var A=this;var D=(B+A._rotation)%360;var C=0;if(D>=A._rotation){C=(D-A._rotation)/90}else{C=(360-A._rotation+D)/90}for(i=0;i<C;i++){this.rotate90(false)}A.draw()},ProcessChanges:function(A){if(typeof (A.FillColor)!="undefined"){this.set_color(A.FillColor)}}};Laserfiche.StampAnnotation.CreateFromInfo=function(D,A,C){var E=Laserfiche.Modes.MODE_STAMP;var B=new Laserfiche.StampAnnotation(D,A,C.ID,E,C.MoreInfo.IsCommon,C.MoreInfo.StampID,C.MoreInfo.StampName);B.set_start(C.MoreInfo.Rectangle.Left,C.MoreInfo.Rectangle.Top);B.set_end(C.MoreInfo.Rectangle.Right,C.MoreInfo.Rectangle.Bottom);B._rotation=C.MoreInfo.Rotation;B.set_color(C.MoreInfo.Color);B.draw();B.makeMoveable();B.setChangeRecording(true);return B};Laserfiche.StampAnnotation.registerClass("Laserfiche.StampAnnotation");Laserfiche.StickyNoteAnnotation=function(D,A,F,E,C){this._eventHandler=new Sys.EventHandlerList();var B=this;B.id=F;B._control=D;B._surface=A;B._mode=E;B._image=null;B._colornum=0;B._position={x:0,y:0};B._isnew=C;B._notediv=null;B._readonly=false;B._contrastColor="#000000";if(C){B.setChangeRecording(true)}B._type=Laserfiche.AnnotationTypes.ANN_STICKYNOTE};Laserfiche.StickyNoteAnnotation.prototype={setChangeRecording:Laserfiche.BaseAnnotation.prototype.setChangeRecording,recordChange:Laserfiche.BaseAnnotation.prototype.recordChange,getAnnotationChanges:Laserfiche.BaseAnnotation.prototype.getAnnotationChanges,clearAnnotationChanges:Laserfiche.BaseAnnotation.prototype.clearAnnotationChanges,baseAdd:Laserfiche.BaseAnnotation.prototype.add,baseRemove:Laserfiche.BaseAnnotation.prototype.remove,baseendDrawing:Laserfiche.BaseAnnotation.prototype.endDrawing,drawPanel:Laserfiche.BaseAnnotation.prototype.drawPanel,showProperties:Laserfiche.BaseAnnotation.prototype.showProperties,HandleDblClick:Laserfiche.BaseAnnotation.prototype.HandleDblClick,HandleContextMenu:Laserfiche.BaseAnnotation.prototype.HandleContextMenu,drawIcon:function(C){var A=this;var B=document.createElement("img");B.src="Assets/images/stickies/"+A._getHexColor()+".gif";B.height=16;B.width=16;C.appendChild(B)},unhighlight:function(){var A=this;if(A._image){A._image.src="Assets/images/stickies/"+A._getHexColor()+".gif"}A.CloseStickyNote()},highlight:function(B){var A=this;A._image.src="Assets/images/stickies/selected.gif";A.OpenStickyNote(B)},makeMoveable:function(){var A=this;A.moveable=true;A._image.className="moveable";A._canStretch=false},makeReadOnly:function(){var A=this;A.moveable=false;A._image.className="";A._canStretch=false;A._readonly=true},endDrawing:function(){var A=this;A.baseendDrawing()},add:function(){var A=this;A.baseAdd();A.draw()},remove:function(){var A=this;A.CloseStickyNote();if(A._image){A._control._container.removeChild(A._image);A._image=null}A.baseRemove()},set_fill:function(C){var A=this;colornum=C;if(C.r!=undefined){colornum=C.r+C.g*256+C.b*65536}A._colornum=colornum;A.recordChange("FillColor",colornum);if(A._image){A._image.src="Assets/images/stickies/"+A._getHexColor()+".gif"}var B=colornum;var G=B%256;B=(B-G)/256;var E=B%256;B=(B-E)/256;var D=B;var F=(Math.max(D,Math.max(E,G))+Math.min(D,Math.min(E,G)))/2;A._contrastColor=(F<120)?"#FFFFFF":"#000000";if(A._notediv){A.CloseStickyNote();A.OpenStickyNote()}},get_fill:function(){var A=this;return A._colornum},set_position:function(A,C){var B=this;B._position={x:A,y:C};if(!B._image){B.draw()}B.recordChange("X",A);B.recordChange("Y",C)},get_position:function(){var A=this;return A._position},set_text:function(B){var A=this;A._text=B;if(A._image){A._image.title=A.get_text()}A.recordChange("Text",A._text)},get_text:function(){var A=this;return A._text?A._text:""},_getHexColor:function(){return Laserfiche.Color.Util.IntToHex(this._colornum)},_getColorName:function(){var A=this;switch(A._colornum){case 33535:return"orange";break;case 16745215:return"pink";break;case 255:return"red";break;case 65280:return"green";break;case 16777088:return"ltblue";break;case 16744448:return"blue";break;case 16728192:return"purple";break;default:return"yellow";break}return"yellow"},draw:function(){var A=this;if(!A._image){A._image=document.createElement("img");A._image.style.zIndex=5;A._image.style.position="absolute";var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(A._position.x,A._position.y,0,0,A._control);A._image.style.left=parseInt(B.x*A._control.get_scale())+"px";A._image.style.top=parseInt(B.y*A._control.get_scale())+"px";A._image.style.marginLeft="0px";A._image.style.marginTop="0px";A._control._container.appendChild(A._image);dojo.connect(A._image,"onmousedown",function(C){if(!C){C=window.event}A._control.ClickAnnotation(A.id,null,A._control.GetCurrentXY(C))});dojo.connect(A._image,"ondblclick",function(C){A.HandleDblClick()});dojo.connect(A._image,"oncontextmenu",function(C){dojo.stopEvent(C);A.HandleContextMenu(C)})}A._image.onerror=function(){var C="Helper/StickyNoteImage.aspx?color="+A._getHexColor();if(A._image.src!=C){A._image.src=C}};A._image.onload=function(){A._image.style.marginTop=-parseInt(A._image.height)/2+"px";A._image.style.marginLeft=-parseInt(A._image.width)/2+"px";if(A._notediv){A._notediv.style.left=parseInt(A._image.style.left)-parseInt(A._image.style.marginLeft)+1+"px";A._notediv.style.top=parseInt(A._image.style.top)+parseInt(A._image.style.marginTop)+5+"px"}A._image.onload=null};A._image.src="Assets/images/stickies/"+A._getHexColor()+".gif";A._image.title=A.get_text()},OpenStickyNote:function(C){var A=this;if(!A._notediv){var G=document.createElement("div");G.style.zIndex=5;G.style.position="absolute";G.style.left=parseInt(A._image.style.left)-parseInt(A._image.style.marginLeft)+1+"px";G.style.top=parseInt(A._image.style.top)+parseInt(A._image.style.marginTop)+5+"px";var D=document.createElement("img");D.src="Assets/images/stickies/stickyedge_"+A._getColorName()+".gif";D.style.position="absolute";D.style.top="0px";D.style.left="0px";D.style.zIndex=1;G.appendChild(D);var F=document.createElement("div");F.style.position="absolute";F.style.top="0px";F.style.left="19px";F.style.border="1px solid black";if(A._colornum==0){F.style.backgroundColor="65535"}else{F.style.backgroundColor="#"+Laserfiche.Color.Util.IntToHex(A._colornum)}F.style.width="200px";F.style.height="105px";var B=document.createElement("div");B.className="StickyNoteText";B.style.position="absolute";B.style.top="5px";B.style.left="5px";B.style.height="90px";B.style.width="190px";B.style.overflow="auto";B.style.display="";B.style.color=A._contrastColor;B.innerHTML=A._linkify(A.get_text());var E=document.createElement("textarea");E.className="StickyNoteText";E.style.position="absolute";E.style.top="5px";E.style.left="5px";E.style.height="90px";E.style.width="190px";E.style.overflow="auto";E.style.display="none";E.value=A.get_text();E.readOnly=A._readonly;B.onmousedown=function(H){if(!H){H=window.event}dojo.stopEvent(H)};B.onclick=function(){B.style.display="none";E.style.display="";E.focus()};E.onmousedown=function(H){if(!H){H=window.event}dojo.stopEvent(H)};E.onkeyup=function(){A.set_text(E.value)};E.onblur=function(){B.innerHTML=A._linkify(A.get_text());E.style.display="none";B.style.display=""};B.onscroll=function(H){if(!H){H=window.event}dojo.stopEvent(H)};E.onscroll=function(H){if(!H){H=window.event}dojo.stopEvent(H)};F.appendChild(B);F.appendChild(E);G.appendChild(F);A._control._container.appendChild(G);A._notediv=G;if(A.get_text()==""){B.style.display="none";E.style.display="";E.focus()}}},CloseStickyNote:function(){var A=this;if(A._notediv){A._control._container.removeChild(A._notediv);A._notediv=null}},_linkify:function(H){var D="";var G="http(s)?:(\\/)(\\/)\\S+|www\\S+|ftp:\\S+|ftp\\.\\S+|mailto:\\S+|file:\\S+";var C=new RegExp(G,"ig");var B=0;var F;while((F=C.exec(H))!=null){var E=Laserfiche.BaseAnnotation._escapeHtml(H.substr(B,F.index-B));D=D+E;var J=F[0];var A=J;if(A.substr(0,3).toUpperCase()=="WWW"){A="http://"+A}else{if(A.substr(0,4).toUpperCase()=="FTP."){A="ftp://"+A}}var I='<a href="'+A+'" target="_blank">'+J+"</a>";D=D+I;B=F.index+F[0].length}var E=Laserfiche.BaseAnnotation._escapeHtml(H.substr(B));D=D+E;return D},getBoundingBox:function(){var A=this;return{x:A._position.x,y:A._position.y,width:A._image.width,height:A._image.height}},move:function(D,B){var A=this;A.set_position(D+A._position.x,B+A._position.y);var C=Laserfiche.BaseAnnotation._getAdjustedDimensions(A._position.x,A._position.y,0,0,A._control);A._image.style.left=parseInt(C.x*A._control.get_scale())+"px";A._image.style.top=parseInt(C.y*A._control.get_scale())+"px"},stretch:function(D,A,C,E,B){},sync:function(B){var A=this;if(B){}else{A._displacement={x:0,y:0}}},HandleMouseDown:function(A,B){},HandleMouseMove:function(A,C,B){},HandleMouseUp:function(A,B){},HandleRescale:function(C){var A=this;var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(A._position.x,A._position.y,0,0,A._control);A._image.style.left=parseInt(B.x*C)+"px";A._image.style.top=parseInt(B.y*C)+"px";if(A._notediv){A._notediv.style.left=parseInt(A._image.style.left)-parseInt(A._image.style.marginLeft)+1+"px";A._notediv.style.top=parseInt(A._image.style.top)+parseInt(A._image.style.marginTop)+5+"px"}},HandleRotate:function(C){var A=this;var B=Laserfiche.BaseAnnotation._getAdjustedDimensions(A._position.x,A._position.y,0,0,A._control);A._image.style.left=parseInt(B.x*A._control.get_scale())+"px";A._image.style.top=parseInt(B.y*A._control.get_scale())+"px";if(A._notediv){A._notediv.style.left=parseInt(A._image.style.left)-parseInt(A._image.style.marginLeft)+1+"px";A._notediv.style.top=parseInt(A._image.style.top)+parseInt(A._image.style.marginTop)+5+"px"}},ProcessChanges:function(A){if(typeof (A.FillColor)!="undefined"){this.set_fill(A.FillColor)}if(typeof (A.Text)!="undefined"){this.set_text(A.Text);this.set_fill(this._colornum)}}};Laserfiche.StickyNoteAnnotation.CreateFromInfo=function(D,B,C){var E=Laserfiche.Modes.MODE_STICKYNOTE;var A=new Laserfiche.StickyNoteAnnotation(D,B,C.ID,E);A.set_position(C.MoreInfo.Position.X,C.MoreInfo.Position.Y);A.set_fill(C.MoreInfo.Color);A.set_text(C.MoreInfo.Text);A.draw();A.makeMoveable();A.setChangeRecording(true);return A};Laserfiche.StickyNoteAnnotation.registerClass("Laserfiche.StickyNoteAnnotation");Laserfiche.TextBoxAnnotation=function(D,A,F,E,C){this._eventHandler=new Sys.EventHandlerList();var B=this;B.id=F;B._control=D;B._surface=A;B._boxshape=null;B._lineshape=null;B._textarea=null;B._displacement={x:0,y:0};B._box=null;B._handles=new Array();B._mode=E;B._guidebox=null;B._guideline=null;B._start=null;B._end=null;B._boxstyle=Laserfiche.BoxStyles.BOXSTYLE_RECTANGLE;B._callout=E==Laserfiche.Modes.MODE_CALLOUT;B._focus=null;B._focusStyle=Laserfiche.CalloutMode.FocusStyle;B._focusHead=null;B._opacity=1;B._thickness=1;B._textSize=48;B._color={r:0,g:0,b:0};B._textcolor="#00000";B._fill={r:255,g:255,b:255};B._linestyle=Laserfiche.LineStyles.LINE_STYLE_SOLID;B._shape=B._surface.createGroup();B._isnew=C;B._fillcolor=0;if(C){B.setChangeRecording(true)}if(E==Laserfiche.Modes.MODE_CALLOUT){B._type=Laserfiche.AnnotationTypes.ANN_CALLOUT}else{B._type=Laserfiche.AnnotationTypes.ANN_TEXTBOX}};Laserfiche.TextBoxAnnotation.prototype={roundness:10,setChangeRecording:Laserfiche.BaseAnnotation.prototype.setChangeRecording,recordChange:Laserfiche.BaseAnnotation.prototype.recordChange,getAnnotationChanges:Laserfiche.BaseAnnotation.prototype.getAnnotationChanges,clearAnnotationChanges:Laserfiche.BaseAnnotation.prototype.clearAnnotationChanges,unhighlight:Laserfiche.BaseAnnotation.prototype.unhighlight,baseHighlight:Laserfiche.BaseAnnotation.prototype.highlight,drawHandles:Laserfiche.BaseAnnotation.prototype.drawHandles,drawHandle:Laserfiche.BaseAnnotation.prototype.drawHandle,drawHead:Laserfiche.BaseAnnotation.prototype.drawHead,makeMoveable:Laserfiche.BaseAnnotation.prototype.makeMoveable,baseAdd:Laserfiche.BaseAnnotation.prototype.add,baseRemove:Laserfiche.BaseAnnotation.prototype.remove,baseendDrawing:Laserfiche.BaseAnnotation.prototype.endDrawing,getStroke:Laserfiche.BaseAnnotation.prototype.getStroke,getFill:Laserfiche.BaseAnnotation.prototype.getFill,getArrowStroke:Laserfiche.BaseAnnotation.prototype.getArrowStroke,drawPanel:Laserfiche.BaseAnnotation.prototype.drawPanel,showProperties:Laserfiche.BaseAnnotation.prototype.showProperties,HandleDblClick:Laserfiche.BaseAnnotation.prototype.HandleDblClick,HandleContextMenu:Laserfiche.BaseAnnotation.prototype.HandleContextMenu,drawIcon:function(C){var A=this;var B=document.createElement("img");if(A._callout){B.src="Assets/images/annotations/callout.gif"}else{B.src="Assets/images/annotations/text.gif"}C.appendChild(B)},highlight:function(B){var A=this;A.baseHighlight();if(A._textarea){if(A.get_text().length==0){A._textarea.focus()}else{if(B){}}}},endDrawing:function(){var A=this;if(A._guidebox){A._surface.remove(A._guidebox);A._guidebox=null}if(A._guideline){A._surface.remove(A._guideline);A._guideline=null}A.baseendDrawing()},add:function(){var A=this;A.baseAdd();A.updateShape()},remove:function(){var A=this;if(A._textarea){A._control._container.removeChild(A._textarea);A._textarea=null}if(A._type==Laserfiche.AnnotationTypes.ANN_CALLOUT&&A._focusHead){A._surface.remove(A._focusHead)}A.baseRemove()},getBoundingBox:function(){var C=this;if(!C._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE){return C._boxshape.getShape()}var A=Math.min(C._start.x,C._end.x);var B=Math.abs(C._end.x-C._start.x);var E=Math.min(C._start.y,C._end.y);var D=Math.abs(C._end.y-C._start.y);return{x:A,y:E,width:B,height:D}},set_boxstyle:function(A){this._boxstyle=A},set_color:function(D){var A=this;var C;if(D.r==undefined){C=D;var B=C;A._color.r=B%256;B=(B-A._color.r)/256;A._color.g=B%256;B=(B-A._color.g)/256;A._color.b=B}else{A._color.r=D.r;A._color.g=D.g;A._color.b=D.b;C=r+g*256+b*65536}A.updateShape();A.recordChange("LineColor",C)},get_color:function(){return this._color.r+this._color.g*256+this._color.b*65536},set_fill:function(D){var A=this;var C;A._fillcolor=D;if(D.r==undefined){C=D;var B=C;A._fill.r=B%256;B=(B-A._fill.r)/256;A._fill.g=B%256;B=(B-A._fill.g)/256;A._fill.b=B}else{A._fill.r=D.r;A._fill.g=D.g;A._fill.b=D.b;C=r+g*256+b*65536}var B=C;var H=B%256;B=(B-H)/256;var F=B%256;B=(B-F)/256;var E=B;var G=(Math.max(E,Math.max(F,H))+Math.min(E,Math.min(F,H)))/2;A._textcolor=(G<120)?"#FFFFFF":"#000000";A.updateShape();A.recordChange("FillColor",C)},get_fill:function(){return this._fill.r+this._fill.g*256+this._fill.b*65536},set_opacity:function(B){var A=this;A._opacity=B/100;A.updateShape();A.recordChange("Opacity",B)},get_opacity:function(){return this._opacity*100},set_linestyle:function(B){var A=this;A._linestyle=B;A.updateShape();A.recordChange("LineStyle",B)},get_linestyle:function(){return this._linestyle},set_thickness:function(B){var A=this;A._thickness=B;A.updateShape();A.recordChange("Thickness",B)},get_thickness:function(){return this._thickness},set_textSize:function(B){var A=this;A._textSize=B;A.updateShape();A.recordChange("TextSize",B)},get_textSize:function(){return this._textSize},set_start:function(A,C){var B=this;B._start={x:A,y:C};B._notePositionChange();B.updateShape()},set_end:function(A,C){var B=this;B._end={x:A,y:C};B._notePositionChange();B.updateShape()},set_focus:function(A,C){var B=this;B._focus={x:A,y:C};B._notePositionChange();B.updateShape()},set_focusStyle:function(B){var A=this;A._focusStyle=B;A.updateShape();A.recordChange("FocusStyle",A._focusStyle)},get_focusStyle:function(){var A=this;return A._focusStyle},set_text:function(B){var A=this;if(!A.readonly){A._text=B;A.recordChange("Text",A._text);if(A._textarea&&B!=A._textarea.value){A._textarea.value=A._text?A._text:""}}},get_text:function(){var A=this;return A._text?A._text:""},_findClosestConnectionPoint:function(G,F){var L=this;var P=Math.min(L._start.x,L._end.x);var I=Math.abs(L._end.x-L._start.x);var A=Math.min(L._start.y,L._end.y);var O=Math.abs(L._end.y-L._start.y);var M=new Array();M[0]={x:P+I/2,y:A};M[1]={x:P,y:A+O/2};M[2]={x:P+I,y:A+O/2};M[3]={x:P+I/2,y:A+O};switch(L._boxstyle){case Laserfiche.BoxStyles.BOXSTYLE_RECTANGLE:M[4]={x:P,y:A};M[5]={x:P+I,y:A};M[6]={x:P,y:A+O};M[7]={x:P+I,y:A+O};break;case Laserfiche.BoxStyles.BOXSTYLE_ROUNDEDRECT:var K=L.roundness*(1-Math.SQRT1_2);M[4]={x:P+K,y:A+K};M[5]={x:P+I-K,y:A+K};M[6]={x:P+K,y:A+O-K};M[7]={x:P+I-K,y:A+O-K};break;case Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE:var C=(L._start.x+L._end.x)/2;var B=(L._start.y+L._end.y)/2;var Q=I*Math.SQRT1_2;var R=O*Math.SQRT1_2;M[4]={x:C-Q/2,y:B-R/2};M[5]={x:C+Q/2,y:B-R/2};M[6]={x:C-Q/2,y:B+R/2};M[7]={x:C+Q/2,y:B+R/2};break}var S=-1;var E=0;for(var N=0;N<M.length;N++){var J=G-M[N].x;var H=F-M[N].y;var D=Math.sqrt(J*J+H*H);if(N==0||D<S){E=N;S=D}}return M[E]},_notePositionChange:function(){var A=this;if(!A._start||!A._end||(A._callout&&!A._focus)){return }if(A._start.x>A._end.x){A.recordChange("Left",A._end.x);A.recordChange("Right",A._start.x)}else{A.recordChange("Left",A._start.x);A.recordChange("Right",A._end.x)}if(A._start.y>A._end.y){A.recordChange("Top",A._end.y);A.recordChange("Bottom",A._start.y)}else{A.recordChange("Top",A._start.y);A.recordChange("Bottom",A._end.y)}if(A._callout){A.recordChange("FocusX",A._focus.x);A.recordChange("FocusY",A._focus.y);A.recordChange("FocusStyle",A._focusStyle)}},updateShape:function(){var R=this;if(!R._start||!R._end||(R._callout&&!R._focus)){return }var E=Math.min(R._start.x,R._end.x);var D=Math.min(R._start.y,R._end.y);var P=0;var V=0;var I=R.getStroke();var S=R.getFill(R._fillcolor==-1?0.01:R._opacity);if(R._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE){var C=(R._start.x+R._end.x)/2;var B=(R._start.y+R._end.y)/2;var G=Math.abs(R._end.x-R._start.x)/2;var F=Math.abs(R._end.y-R._start.y)/2;E=C-G*Math.SQRT1_2;D=B-F*Math.SQRT1_2;P=F*Math.SQRT2;V=G*Math.SQRT2;G=G>0?G:1;F=F>0?F:1;if(R._boxshape){R._boxshape.setShape({cx:C,cy:B,rx:G,ry:F})}else{R._boxshape=R._shape.createEllipse({cx:C,cy:B,rx:G,ry:F}).setStroke(I).setFill(S);R._boxshape.getEventSource().setAttribute("id",R.id)}}else{var L=Math.min(R._start.x,R._end.x);var N=Math.abs(R._end.x-R._start.x);var K=Math.min(R._start.y,R._end.y);var T=Math.abs(R._end.y-R._start.y);var Q=(R._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ROUNDEDRECT)?R.roundness:0;P=T;V=N;if(R._boxshape){R._shape.remove(R._boxshape)}R._boxshape=R._shape.createRect({x:L,y:K,width:N,height:T,r:Q}).setStroke(I).setFill(S);R._boxshape.getEventSource().setAttribute("id",R.id);if(R.moveable){R.makeMoveable()}}if(R._callout){var J=R._findClosestConnectionPoint(R._focus.x,R._focus.y);if(R._lineshape){R._lineshape.setShape({x1:J.x,y1:J.y,x2:R._focus.x,y2:R._focus.y}).setStroke(I)}else{R._lineshape=R._shape.createLine({x1:J.x,y1:J.y,x2:R._focus.x,y2:R._focus.y}).setStroke(I);R._lineshape.getEventSource().setAttribute("id",R.id)}if(R._focusHead){R._surface.remove(R._focusHead)}var T=10*R._thickness;var N=5*R._thickness;var O=R._focus.x-J.x;var M=R._focus.y-J.y;var U=function(W,X){R._shape.setShape({x1:R._lineshape.getShape().x1,y1:R._lineshape.getShape().y1,x2:W,y2:X})};R._focusHead=R.drawHead(R._focus,-O,-M,T,N,R._focusStyle,U)}var A=2;if(!R._textarea){R._textarea=document.createElement("textarea");R._textarea.value=R._text?R._text:"";R._textarea.style.zIndex=5;R._textarea.style.paddingTop=A;R._textarea.style.paddingLeft=A;R._textarea.style.position="absolute";R._textarea.style.backgroundColor="transparent";R._textarea.style.backgroundImage="url(transparent.gif)";R._textarea.style.overflow="auto";R._textarea.style.border="0";R._textarea.style.left=0;R._textarea.style.top=0;R._textarea.style.zIndex=4;R._textarea.style.fontFamily="arial";R._control._container.appendChild(R._textarea);R._textarea.focus();R._textarea.onkeyup=function(){R.set_text(R._textarea.value)};dojo.connect(R._textarea,"onmousedown",function(W){if(!W){W=window.event}R._control.ClickAnnotation(R.id,null,R._control.GetCurrentXY(W))});dojo.connect(R._textarea,"ondblclick",function(W){R.HandleDblClick()});dojo.connect(R._textarea,"oncontextmenu",function(W){dojo.stopEvent(W);R.HandleContextMenu(W)})}var H=Laserfiche.BaseAnnotation._getAdjustedDimensions(E,D,V,P,R._control);R._textarea.style.left=parseInt(H.x*R._control.get_scale())+"px";R._textarea.style.top=parseInt(H.y*R._control.get_scale())+"px";R._textarea.style.height=parseInt(H.h*R._control.get_scale()-A)+"px";R._textarea.style.width=parseInt(H.w*R._control.get_scale()-A)+"px";R._textarea.style.fontSize=Math.max(1,parseInt(R._textSize*R._control.get_scale()))+"px";R._textarea.style.color=R._textcolor},move:function(D,B,C){var A=this;A._start.x=A._start.x+D;A._start.y=A._start.y+B;A._end.x=A._end.x+D;A._end.y=A._end.y+B;if(A._callout&&C){A._focus.x=A._focus.x+D;A._focus.y=A._focus.y+B}A._notePositionChange();A.updateShape();A._displacement.x=A._displacement.x+D;A._displacement.y=A._displacement.y+B},makeReadOnly:function(){var A=this;A.readonly=true;this._canStretch=false;this.moveable=false;var B=A._shape.getEventSource();if(B.getAttribute("className")==null){B.setAttribute("class","")}else{dojox.gfx._addClass(B,"")}if(A._textarea){A._textarea.readOnly=true}},stretch:function(F,C,E,G,D,B){var A=this;if(B&&A._type==Laserfiche.AnnotationTypes.ANN_CALLOUT){A._focus.x+=G;A._focus.y+=F}else{if(A._start.y<=A._end.y){A._start.y=A._start.y+F;A._end.y=A._end.y+C}else{A._end.y=A._end.y+F;A._start.y=A._start.y+C}if(A._start.x<=A._end.x){A._start.x=A._start.x+E;A._end.x=A._end.x+G}else{A._end.x=A._end.x+E;A._start.x=A._start.x+G}}A._notePositionChange();A.updateShape()},sync:function(B){var A=this;if(B){}else{A._displacement={x:0,y:0}}},HandleMouseDown:function(A,C){var B=this;if(!B._end){B.set_end(A,C);if(!B._callout){B.endDrawing()}}else{B.set_focus(A,C);B.endDrawing()}},HandleMouseMove:function(L,K,D){var P=this;if(!P._end){var N=P.getStroke(0.25);var O=P.getFill(0.25);if(P._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE){var G=(P._start.x+L)/2;var E=(P._start.y+K)/2;var C=Math.abs(L-P._start.x)/2;var B=Math.abs(K-P._start.y)/2;C=C>0?C:1;B=B>0?B:1;if(P._guidebox){P._guidebox.setShape({cx:G,cy:E,rx:C,ry:B})}else{P._guidebox=P._surface.createEllipse({cx:G,cy:E,rx:C,ry:B}).setStroke(N).setFill(O)}}else{var I=Math.min(P._start.x,L);var J=Math.abs(L-P._start.x);var H=Math.min(P._start.y,K);var F=Math.abs(K-P._start.y);var A=P._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ROUNDEDRECT?P.roundness:0;J=J>0?J:1;F=F>0?F:1;if(P._guidebox){P._surface.remove(P._guidebox)}P._guidebox=P._surface.createRect({x:I,y:H,width:J,height:F,r:A}).setStroke(N).setFill(O)}}else{if(P._callout){var N=P.getStroke(0.25);var M=P._findClosestConnectionPoint(L,K);if(P._guideline){P._guideline.setShape({x1:M.x,y1:M.y,x2:L,y2:K})}else{P._guideline=P._surface.createLine({x1:M.x,y1:M.y,x2:L,y2:K}).setStroke(N)}}}},HandleMouseUp:function(A,B){},HandleRescale:function(E){var Q=this;var K=3;var O=Math.min(Q._start.x,Q._end.x);var N=Math.min(Q._start.y,Q._end.y);var I=0;var M=0;if(Q._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE){var F=(Q._start.x+Q._end.x)/2;var D=(Q._start.y+Q._end.y)/2;var C=Math.abs(Q._end.x-Q._start.x)/2;var B=Math.abs(Q._end.y-Q._start.y)/2;O=F-C*Math.SQRT1_2;N=D-B*Math.SQRT1_2;I=B*Math.SQRT2;M=C*Math.SQRT2}else{var J=Math.min(Q._start.x,Q._end.x);var L=Math.abs(Q._end.x-Q._start.x);var H=Math.min(Q._start.y,Q._end.y);var G=Math.abs(Q._end.y-Q._start.y);var A=(Q._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ROUNDEDRECT)?Q.roundness:0;I=G;M=L}var P=Laserfiche.BaseAnnotation._getAdjustedDimensions(O,N,M,I,Q._control);Q._textarea.style.left=parseInt((P.x+K)*E)+"px";Q._textarea.style.top=parseInt((P.y+K)*E)+"px";Q._textarea.style.height=parseInt((P.h-2)*E)+"px";Q._textarea.style.width=parseInt((P.w-2*K)*E)+"px";Q._textarea.style.fontSize=Math.max(1,parseInt(Q._textSize*Q._control.get_scale()))+"px";if(!(dojox.gfx.renderer=="svg")){Q.updateShape()}},HandleRotate:function(O){var N=this;var A=3;var R=N._control.get_scale();var E=Math.min(N._start.x,N._end.x);var D=Math.min(N._start.y,N._end.y);var L=0;var Q=0;if(N._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ELLIPSE){var C=(N._start.x+N._end.x)/2;var B=(N._start.y+N._end.y)/2;var G=Math.abs(N._end.x-N._start.x)/2;var F=Math.abs(N._end.y-N._start.y)/2;E=C-G*Math.SQRT1_2;D=B-F*Math.SQRT1_2;L=F*Math.SQRT2;Q=G*Math.SQRT2}else{var J=Math.min(N._start.x,N._end.x);var K=Math.abs(N._end.x-N._start.x);var I=Math.min(N._start.y,N._end.y);var P=Math.abs(N._end.y-N._start.y);var M=(N._boxstyle==Laserfiche.BoxStyles.BOXSTYLE_ROUNDEDRECT)?N.roundness:0;L=P;Q=K}var H=Laserfiche.BaseAnnotation._getAdjustedDimensions(E,D,Q,L,N._control);N._textarea.style.left=parseInt((H.x+A)*R)+"px";N._textarea.style.top=parseInt((H.y+A)*R)+"px";N._textarea.style.height=parseInt((H.h-2)*R)+"px";N._textarea.style.width=parseInt((H.w-2*A)*R)+"px";N._textarea.style.fontSize=Math.max(1,parseInt(N._textSize*N._control.get_scale()))+"px"},ProcessChanges:function(A){if(typeof (A.Opacity)!="undefined"){this.set_opacity(A.Opacity)}if(typeof (A.FillColor)!="undefined"){this.set_fill(A.FillColor)}if(typeof (A.LineColor)!="undefined"){this.set_color(A.LineColor)}if(typeof (A.LineStyle)!="undefined"){this.set_linestyle(A.LineStyle)}if(typeof (A.Thickness)!="undefined"){this.set_thickness(A.Thickness)}if(typeof (A.FocusArrow)!="undefined"){this.set_focusStyle(A.FocusArrow)}if(typeof (A.Text)!="undefined"){this.set_text(A.Text)}}};Laserfiche.TextBoxAnnotation.CreateFromInfo=function(D,A,C){var E=Laserfiche.Modes.MODE_TEXTBOX;switch(C.Type){case Laserfiche.AnnotationTypes.ANN_CALLOUT:E=Laserfiche.Modes.MODE_CALLOUT;break;case Laserfiche.AnnotationTypes.ANN_TEXTBOX:E=Laserfiche.Modes.MODE_TEXTBOX;break}var B=new Laserfiche.TextBoxAnnotation(D,A,C.ID,E);B.set_text(C.MoreInfo.Text);B.set_textSize(C.MoreInfo.TextSize);B.set_color(C.MoreInfo.LineColor);B.set_fill(C.MoreInfo.FillColor);B.set_opacity(C.MoreInfo.Opacity);B.set_linestyle(C.MoreInfo.LineStyle);B.set_thickness(C.MoreInfo.Thickness);B.set_start(C.MoreInfo.Rectangle.Left,C.MoreInfo.Rectangle.Top);B.set_end(C.MoreInfo.Rectangle.Right,C.MoreInfo.Rectangle.Bottom);if(B._callout){B.set_focus(C.MoreInfo.FocusPosition.X,C.MoreInfo.FocusPosition.Y);B.set_focusStyle(C.MoreInfo.FocusStyle)}B.makeMoveable();B.setChangeRecording(true);return B};Laserfiche.TextBoxAnnotation.registerClass("Laserfiche.TextBoxAnnotation");Laserfiche.VectorAnnotation=function(D,A,F,E,C){this._eventHandler=new Sys.EventHandlerList();var B=this;B.id=F;B._control=D;B._surface=A;B._points=new Array();B._connectNext=false;B._displacement={x:0,y:0};B._scale={x:1,y:1};B._box=null;B._handles=new Array();B._bbox={t:-1,b:-1,l:-1,r:-1};B._mode=E;B._guideline=null;B._opacity=1;B._thickness=1;B._color={r:0,g:0,b:0};B._shape=A.createPath({});B._shape.setStroke({color:[B._color.r,B._color.g,B._color.b,B._opacity],width:B._thickness});B._shape.getEventSource().setAttribute("id",F);B._linestyle=Laserfiche.LineStyles.LINE_STYLE_SOLID;B._isnew=C;if(C){B.setChangeRecording(true)}B._type=Laserfiche.AnnotationTypes.ANN_FREEHAND};Laserfiche.VectorAnnotation.prototype={tolerance:5,setChangeRecording:Laserfiche.BaseAnnotation.prototype.setChangeRecording,recordChange:Laserfiche.BaseAnnotation.prototype.recordChange,getAnnotationChanges:Laserfiche.BaseAnnotation.prototype.getAnnotationChanges,clearAnnotationChanges:Laserfiche.BaseAnnotation.prototype.clearAnnotationChanges,unhighlight:Laserfiche.BaseAnnotation.prototype.unhighlight,highlight:Laserfiche.BaseAnnotation.prototype.highlight,drawHandles:Laserfiche.BaseAnnotation.prototype.drawHandles,drawHandle:Laserfiche.BaseAnnotation.prototype.drawHandle,makeMoveable:Laserfiche.BaseAnnotation.prototype.makeMoveable,add:Laserfiche.BaseAnnotation.prototype.add,remove:Laserfiche.BaseAnnotation.prototype.remove,baseendDrawing:Laserfiche.BaseAnnotation.prototype.endDrawing,getStroke:Laserfiche.BaseAnnotation.prototype.getStroke,drawPanel:Laserfiche.BaseAnnotation.prototype.drawPanel,showProperties:Laserfiche.BaseAnnotation.prototype.showProperties,HandleDblClick:Laserfiche.BaseAnnotation.prototype.HandleDblClick,HandleContextMenu:Laserfiche.BaseAnnotation.prototype.HandleContextMenu,makeReadOnly:Laserfiche.BaseAnnotation.prototype.makeReadOnly,drawIcon:function(B){var A=document.createElement("img");A.src="Assets/images/annotations/polyline.gif";B.appendChild(A)},endDrawing:function(){var B=this;if(B._guideline){B._surface.remove(B._guideline);B._guideline=null}for(var C in B._points){var A=B._points[C];if(A.isBreak){B.recordChange("AddBreak",null,true)}else{B.recordChange("AddPoint",A.x+";"+A.y,true)}}B.baseendDrawing()},getBoundingBox:function(){var C=this;var A=C._bbox.l;var E=C._bbox.t;var B=C._bbox.r-C._bbox.l;var D=C._bbox.b-C._bbox.t;return{x:A,y:E,width:B,height:D}},set_color:function(D){var A=this;var C;if(D.r==undefined){C=D;var B=C;A._color.r=B%256;B=(B-A._color.r)/256;A._color.g=B%256;B=(B-A._color.g)/256;A._color.b=B}else{A._color.r=D.r;A._color.g=D.g;A._color.b=D.b;C=r+g*256+b*65536}A._shape.setStroke(A.getStroke());A.recordChange("Color",C)},get_color:function(){return this._color.r+this._color.g*256+this._color.b*65536},set_opacity:function(B){var A=this;A._opacity=B/100;A._shape.setStroke(A.getStroke());A.recordChange("Opacity",B)},get_opacity:function(){return this._opacity*100},set_linestyle:function(B){var A=this;A._linestyle=B;A._shape.setStroke(A.getStroke());A.recordChange("LineStyle",B)},get_linestyle:function(){return this._linestyle},set_thickness:function(B){var A=this;A._thickness=B;A._shape.setStroke(A.getStroke());A.recordChange("Thickness",B)},get_thickness:function(){return this._thickness},addPoint:function(A,C){var B=this;B._isempty=false;if(B._bbox.t<0){B._bbox.t=C;B._bbox.b=C;B._bbox.l=A;B._bbox.r=A}else{if(C<B._bbox.t){B._bbox.t=C}if(C>B._bbox.b){B._bbox.b=C}if(A<B._bbox.l){B._bbox.l=A}if(A>B._bbox.r){B._bbox.r=A}}if(B._connectNext){B._shape.lineTo(A,C)}else{B._shape.moveTo(A,C);B._connectNext=true}B._points.push({x:A,y:C,isBreak:false})},addBreak:function(){var A=this;A._points.push({x:0,y:0,isBreak:true});A._connectNext=false},move:function(C,B){var A=this;A._shape.applyTransform({dx:C,dy:B});A._bbox.t=A._bbox.t+B;A._bbox.b=A._bbox.b+B;A._bbox.l=A._bbox.l+C;A._bbox.r=A._bbox.r+C;A._displacement.x=A._displacement.x+C;A._displacement.y=A._displacement.y+B;A.recordChange("Translate",A._displacement.x+";"+A._displacement.y)},stretch:function(A,H,C,B){var I=this;var K=C;var J=A;var G=1+(B-C)/(I._bbox.r-I._bbox.l);var F=1+(H-A)/(I._bbox.b-I._bbox.t);var E=I._scale.x*G;var D=I._scale.y*F;I._shape.applyRightTransform(dojox.gfx.matrix.scale({x:G,y:F}));I._shape.applyLeftTransform({dx:(1-G)*(I._bbox.l+C)/E,dy:(1-F)*(I._bbox.t+A)/D});I._displacement.x=I._displacement.x+K;I._displacement.y=I._displacement.y+J;I._scale.x=E;I._scale.y=D;I._bbox={t:I._bbox.t+A,b:I._bbox.b+H,l:I._bbox.l+C,r:I._bbox.r+B}},sync:function(D){var B=this;if(D){}else{for(var C in B._points){var A=B._points[C];A.x=A.x+B._displacement.x;A.y=A.y+B._displacement.y}B._displacement={x:0,y:0}}},withinTolerance:function(E,D){var A=this;var C=Math.abs(E.x-D.x);var B=Math.abs(E.y-D.y);return(C<=this.tolerance/A._control.get_scale()&&B<=this.tolerance/A._control.get_scale())},HandleMouseDown:function(A,G){var B=this;switch(B._mode){case Laserfiche.Modes.MODE_VFREEHAND:B.addBreak();B.addPoint(A,G);break;case Laserfiche.Modes.MODE_POLYGON:var C=false;if(B._points.length>0){var E=B._points[B._points.length-1];var F=B._points[0];if(B.withinTolerance(E,{x:A,y:G})||B.withinTolerance(F,{x:A,y:G})){C=true;B.addPoint(F.x,F.y)}}if(C){B.endDrawing();B._control.wait(500)}else{B.addPoint(A,G);if(B._guideline){B._guideline.setShape({x1:A,y1:G,x2:A,y2:G})}else{B._guideline=B._surface.createLine({x1:A,y1:G,x2:A,y2:G}).setStroke(B.getStroke(0.25))}}break;case Laserfiche.Modes.MODE_VECTOR:var D=false;if(B._points.length>0){var E=B._points[B._points.length-1];if(B.withinTolerance(E,{x:A,y:G})){D=true}}if(D){B.endDrawing();B._control.wait(500)}else{B.addPoint(A,G);if(B._guideline){B._guideline.setShape({x1:A,y1:G,x2:A,y2:G})}else{B._guideline=B._surface.createLine({x1:A,y1:G,x2:A,y2:G}).setStroke(B.getStroke(0.25))}}break}},HandleMouseMove:function(A,G,E){var C=this;switch(C._mode){case Laserfiche.Modes.MODE_VFREEHAND:if(E){this.addPoint(A,G)}break;case Laserfiche.Modes.MODE_POLYGON:case Laserfiche.Modes.MODE_VECTOR:if(C._guideline){var D=C._guideline.getShape().x1;var F=C._guideline.getShape().y1;C._guideline.setShape({x1:D,y1:F,x2:A,y2:G})}else{var B=C._points[C._points.length-1];C._guideline=C._surface.createLine({x1:B.x,y1:B.y,x2:A,y2:G}).setStroke(C.getStroke(0.25))}break}},HandleMouseUp:function(A,D){var B=this;switch(B._mode){case Laserfiche.Modes.MODE_VFREEHAND:var C=function(){B.endDrawing()};B._control.addTimeout(C);break}},HandleRescale:function(B){if(!(dojox.gfx.renderer=="svg")){var A=this;A._shape.setStroke(A.getStroke())}},ProcessChanges:function(A){if(typeof (A.Opacity)!="undefined"){this.set_opacity(A.Opacity)}if(typeof (A.LineColor)!="undefined"){this.set_color(A.LineColor)}if(typeof (A.LineStyle)!="undefined"){this.set_linestyle(A.LineStyle)}if(typeof (A.Thickness)!="undefined"){this.set_thickness(A.Thickness)}}};Laserfiche.VectorAnnotation.CreateFromInfo=function(G,B,F){var C=new Laserfiche.VectorAnnotation(G,B,F.ID);C.set_color(F.MoreInfo.Color);C.set_opacity(F.MoreInfo.Opacity);C.set_thickness(F.MoreInfo.Thickness);C.set_linestyle(F.MoreInfo.LineStyle);var E=F.MoreInfo.Points.length;for(var D=0;D<E;D++){var A=F.MoreInfo.Points[D];if(A){C.addPoint(A.X,A.Y)}else{C.addBreak()}}C.makeMoveable();C.setChangeRecording(true);return C};Laserfiche.VectorAnnotation.registerClass("Laserfiche.VectorAnnotation");if(!top.LF){top.LF={}}LF.EntryListingGrid=function(){};LF.EntryListingGrid.prototype={preinitialize:function(F,B,E,A,D){this._id=F;this._entryId=null;this._repoName=null;this._div=B.parentNode;this._container=B;this._container.style.display="block";this.getImgURL=E;this._callbackFunc=A;this.listener=new LF.Listener(F+"_listener");this.listener.setHandler("FolderOpened",this.GetOnFolderOpened());this.listener.setHandler("NewFolderCreated",this.GetOnNewFolderCreated());this.listener.setHandler("NewDocumentCreated",this.GetOnNewDocumentCreated());this.listener.setHandler("NewShortcutCreated",this.GetOnNewShortcutCreated());this.listener.setHandler("EntryDeleted",this.GetOnEntryDeleted());this.listener.setHandler("EntryRenamed",this.GetOnEntryRenamed());this.listener.setHandler("EntryChanged",this.GetOnEntryChanged());this.listener.setHandler("EntryMoved",this.GetOnEntryMoved());this.listener.setHandler("EntryRestored",this.GetOnEntryMoved());this.listener.setHandler("EntryPurged",this.GetOnEntryPurged());this.listener.setHandler("Logout",this.GetOnLogout());this.listener.setHandler("LogoutAll",this.GetOnLogout());this.listener.setHandler("EntryMigrated",this.GetOnEntryMigrated());this.listener.setHandler("UpFolder",this.goUpFolder());this._allowRename=!!D;this.editLag=750;this.lastSelectEntryId=null;this.lastSelArray=[];this.selectRowIndex=[];this.selectRowTimeout=[];var C=!!(this.listingMask==3);if(!this._allowRename){this._layout=[{noscroll:!C,cells:[[{name:"Name",width:C?"100%":"200px",field:0}]]}]}else{this._layout=[{noscroll:!C,cells:[[{name:"Name",width:C?"100%":"200px",field:0,editor:dojox.grid.editors.Input}]]}]}},IsActive:function(){return !!this._active},activate:function(){this._active=true;this.listener.turnOn()},allowMultiselect:function(A){this._djGrid.selection.multiSelect=A},deactivate:function(){this._active=false;this.listener.turnOff()},get_DOMelement:function(){return this._div},resize:function(B,A){this.set_dimensions(A,B)},refresh:function(){if(this._repoName&&this._controller){this._controller.set_repository(this._repoName)}if(this._model&&this._repoName&&this._entryId){if(this._model.count>100){this._model.setRowCount(0);this._model.clear()}this._model.dbname=this._repoName;this._model.set_id(this._entryId);this._model.requestRows()}},get_entry:function(){return this._entryId},set_entry:function(A,B){if(A==this._entryId&&(!B||B==this._repoName)){return }this._entryId=A;if(B){this._repoName=B;if(this._controller){this._controller.set_repository(B)}}if(this._model){if(this._model.count>100){this._model.setRowCount(0);this._model.clear()}this._model.dbname=this._repoName;this._model.set_id(A);this._model.requestRows()}this._djGrid.selection.unselectAll();this.lastSelectEntryId=null},goUpFolder:function(){var A=this;return function(B){var C=A._model.parentid;if(C){if(A._controller){A._controller.selectCurrentFolder({id:C,repositoryName:B.args.repository},function(){})}else{A.set_entry(C,B.args.repository)}}}},setFullPath:function(){var A=this._model.fullpath;if(document.getElementById("myfolderpath")){document.getElementById("myfolderpath").innerHTML=A}},set_controller:function(A){var B=this;this._controller=A;if(A._context.openedFolder){this.set_entry(A._context.openedFolder.id,A._context.repository)}A.subscribe("FolderOpened",this.listener,true);A.subscribe("EntryRenamed",this.listener,true);A.subscribe("NewFolderCreated",this.listener,true);A.subscribe("NewDocumentCreated",this.listener,true);A.subscribe("NewShortcutCreated",this.listener,true);A.subscribe("EntryDeleted",this.listener,true);A.subscribe("EntryChanged",this.listener,true);A.subscribe("EntryMoved",this.listener,true);A.subscribe("EntryRestored",this.listener,true);A.subscribe("EntryPurged",this.listener,true);A.subscribe("Logout",this.listener,false);A.subscribe("LogoutAll",this.listener,false);A.subscribe("EntryMigrated",this.listener,true);A.subscribe("UpFolder",this.listener,true);this.onFolderDblClick=function(E,C,D){if(B._controller){B._controller.setFocusControl(B);B._controller.selectCurrentFolder({id:E,repositoryName:C},function(){})}};this.onDocumentDblClick=function(E,C,D){if(B._controller){B._controller.openEntry(E,C)}};if(dojo.exists("disableDnD",this)){}else{this.dndController=new LF.EntryListingGrid.dndSource(this,{})}},set_dimensions:function(A,B){this._container.style.height=parseInt(A)+"px";this._container.style.width=parseInt(B)+"px";this._djGrid.domNode.style.height=parseInt(A)+"px";this._djGrid.domNode.style.width=parseInt(B)+"px";this._djGrid.sizeChange()},initialize:function(A,B){this._entryId=A;this._repoName=B;this._model=new LF.EntryListingModel(null,null);this._model.dbname=B;this._model.id=A;this._model.listingMask=this.listingMask;this._initializeGrid();this._model.requestRows()},_initializeGrid:function(){this._model.set_callback(this._callbackFunc);this._model.observer(this);this._model.setRowCount(0);this._model.clear();this._djGrid=new dojox.Grid({"id":this._id+"_grid","model":this._model,"structure":this._layout});this._djGrid.onRowClick=this.GetOnRowClick();this._djGrid.onCellDblClick=this.GetOnCellDblClick();this._djGrid.onCellMouseOver=this.GetOnCellMouseOver();this._djGrid.onMouseOverRow=this.GetOnMouseOverRow();this._djGrid.onRowContextMenu=this.GetOnRowContextMenu();this._djGrid.doKeyEvent=this.GetOnKeyEvent();dojo.connect(this._djGrid,"onHeaderContextMenu",this.GetOnHeaderContextMenu());dojo.connect(this._djGrid,"onHeaderClick",this.GetOnHeaderClick());dojo.connect(this._djGrid,"onRowDblClick",this.GetOnRowDblClick());dojo.connect(this._djGrid,"onSelected",this.GetOnRowSelected());dojo.connect(this._djGrid,"onDeselected",this.GetOnRowDeselected());dojo.connect(this._djGrid,"onStartEdit",this.GetOnStartEdit());dojo.connect(this._djGrid,"onApplyCellEdit",this.GetOnApplyCellEdit());dojo.connect(this._djGrid,"onSelectionChanged",this.GetOnSelectionChanged());var A=this.GetScrollWheelHandler();if(document.attachEvent){document.detachEvent("onmousewheel",A);document.attachEvent("onmousewheel",A)}else{window.addEventListener("mousewheel",A,false);window.addEventListener("DOMMouseScroll",A,false)}this._djGrid.onCellClick=function(B){this.onRowClick(B)};this._container.appendChild(this._djGrid.domNode);this._menuscontainer=document.createElement("div");this._menuscontainer.style.position="relative";this._container.appendChild(this._menuscontainer);this._djGrid.render();this._djGrid.scrollToRow();this._djGrid.setStructure(this._layout)},GetOnFolderOpened:function(){var A=this;return function(C){var D=C.args.openedFolder.id;var B=C.args.repository;if(A._entryId!=D||A._repoName!=B){A.set_entry(D,B)}}},GetOnEntryPurged:function(){var A=this;return function(B){if(B.args.srcObjName!="ENTRY_GRID"){A._djGrid.selection.unselectAll();A.refresh()}}},GetOnEntryMoved:function(){var A=this;return function(B){if(B.args.srcObjName!="ENTRY_GRID"){A._djGrid.selection.unselectAll();A.refresh()}}},GetOnNewFolderCreated:function(){var A=this;return function(D){if(D.args.srcObjName!="ENTRY_GRID"){var C=-1;var B=function(){C=A._model.getRowIndexByEntryId(D.args.folderId);if(C>-1){A.JumpToEntry(C)}A._model.clearRequestSortedRows()};if(A._repoName&&A._controller){A._controller.set_repository(A._repoName)}if(A._model&&A._repoName&&A._entryId){A._model.dbname=A._repoName;A._model.set_id(A._entryId);A._model.prepareRequestSortedRows(D.args.folderId,null,null,B);A._model.requestRows()}}}},GetOnNewDocumentCreated:function(){var A=this;return function(D){if(D.args.parentId==A._controller._context.openedFolder.id){var C=-1;var B=function(){C=A._model.getRowIndexByEntryId(D.args.documentId);if(C>-1){A.JumpToEntry(C)}A._model.clearRequestSortedRows()};if(A._repoName&&A._controller){A._controller.set_repository(A._repoName)}if(A._model&&A._repoName&&A._entryId){A._model.dbname=A._repoName;A._model.set_id(A._entryId);A._model.prepareRequestSortedRows(D.args.documentId,null,null,B);A._model.requestRows()}}}},GetOnNewShortcutCreated:function(){var A=this;return function(B){if(B.args.srcObjName!="ENTRY_GRID"){A._djGrid.selection.unselectAll();A.refresh()}}},JumpToEntry:function(I){var C=this;if(!C._djGrid.selection.isSelected(I)){C._djGrid.selection.select(I)}var G=C._djGrid.focus;G.setFocusIndex(I,0);var H=G.cell;var J=H.view.scrollboxNode;var B={w:J.clientWidth,l:J.scrollLeft,t:J.scrollTop,h:J.clientHeight};var A=H.view.getRowNode(I);var D=(A==undefined?0:A.offsetHeight);var E=G.grid.scroller.findScrollTop(I);if(E+D>B.t+B.h){G.grid.setScrollTop(E+D-B.h)}else{if(E<B.t){G.grid.setScrollTop(E)}}if(I>(C._model.rowsPerPage/2)){var F=I-(C._model.rowsPerPage/2)}},GetOnEntryDeleted:function(){var A=this;return function(B){if(B.args.srcObjName!="ENTRY_GRID"){if(B.args.entryCount==1&&B.args.entryId==A._controller._context.openedFolder.id){if(A._controller){A._controller.setFocusControl(A);A._controller.selectCurrentFolder({id:B.args.parentId,repositoryName:A._controller._context.repository},function(){})}}else{A._djGrid.selection.unselectAll();A.refresh()}}}},GetOnEntryMigrated:function(){var A=this;return function(B){if(B.args.srcObjName!="ENTRY_GRID"){A.refresh()}}},GetOnEntryRenamed:function(){var A=this;return function(C){var E=A._model.requiredColumnIndices;if(C.args.srcObjName!="ENTRY_GRID"){for(var B=0;B<A._model.getRowCount();B++){var D=A._model.getRow(B);if(!D){continue}if((D[E["idIndex"]]-0)==(C.args.args.id-0)){D[0]=C.args.newName;A._model.datumChange(C.args.newName,B,0)}}}else{}}},GetOnEntryChanged:function(){var A=this;return function(D){var C=D.args;if(dojo.some(C.entryList,function(E){return(E==A._entryId)})){A.refresh();return }var B=dojo.some(C.entryList,function(E){return(A._model.getRowIndexByEntryId(E)!=-1)});if(B&&A.IsActive()){A.refresh()}}},_checkGrid:function(A){if(!A){return true}return(A.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.id==this._djGrid.id)},GetOnLogout:function(){var A=this;return function(B){A._model.setRowCount(0);A._model.clearData()}},GetOnRowContextMenu:function(){var A=this;return function(G){if(!A._checkGrid(G.rowNode)){return false}A._controller.setFocusControl(A);if(!A._djGrid.selection.selected[G.rowIndex]){A._djGrid.onRowClick(G)}var D=true;if(A.onRowContextMenu){D=A.onRowContextMenu(G)}if(D&&A._controller){var J=G.grid.model.getRow(G.rowIndex);var C=J[0];var F=top.TYPE_GRID_ENTRY;if(G.grid.model.isRecyclebinItem){F=top.TYPE_RECYCLEBIN_ENTRY}else{var E=G.grid.model.requiredColumnIndices.elecSizeIndex;if(!!J[E]){F=top.TYPE_GRID_ENTRY_HAS_EDOC}}var H=A._controller.getContextMenuItems(F);var B=top.SimpleMenu.CreateMenu(H,A._menuscontainer);var I=dojo.coords(A._menuscontainer);B.UpdateContextMenu(A._controller);B.Show(G.clientX-I.x,G.clientY-I.y);B.onselect=function(){A._controller.doAction(B.value);B.Hide()};B.onhide=function(){B.DeleteMenu()}}dojo.stopEvent(G)}},GetOnHeaderContextMenu:function(){var A=this;return function(E){if(!A._checkGrid(E.rowNode)){return false}var B=true;if(A.onRowContextMenu){B=A.onRowContextMenu(E)}if(B&&A._controller&&top.myFolderTree.IsRepositoryConnected(A._repoName)){var C=A._controller.getContextMenuItems(top.TYPE_GRID_HEADER);A.sortColumn=E.cell;var D=top.SimpleMenu.CreateMenu(C,A._menuscontainer);var F=dojo.coords(A._menuscontainer);D.Show(E.clientX-F.x,E.clientY-F.y);D.onselect=function(){A._controller._context.setFocusControl(A);A._controller.doAction(D.value)};D.onhide=function(){D.DeleteMenu()}}}},GetOnHeaderClick:function(){var A=this;return function(C){if(!top.myFolderTree||top.myFolderTree.IsRepositoryConnected(A._repoName)){A.sortColumn=C.cell;var B=(A.lastSortedColumn?A.lastSortedColumn.name:"");if(A.sortColumn){if((B==A.sortColumn.name&&A.lastSortIsAsc==true)||(!A.lastSortedColumn&&A.sortColumn.name=="Name")){A.sort("DESCENDING")}else{A.sort("ASCENDING")}}}dojo.stopEvent(C)}},GetOnMouseOverRow:function(){var A=this;return function(B){if(!A._checkGrid(B.rowNode)){return false}if(!this.rows.isOver(B.rowIndex)){this.rows.setOverRow(B.rowIndex);B.rowIndex==-1?this.onHeaderMouseOver(B):this.onRowMouseOver(B)}}},GetOnCellMouseOver:function(){var A=this;return function(B){if(!A._checkGrid(B.rowNode)){return false}dojo.addClass(B.cellNode,this.cellOverClass)}},GetOnRowClick:function(){var A=this;return function(E){if(!A._checkGrid(E.rowNode)){return false}this.edit.rowClick(E);this.selection.clickSelectEvent(E);A.lastSelectEntryId=A._model.getEntryIdByRowIndex(E.rowIndex);if(A._allowRename){if(E.grid.edit.isEditing()){return }A.lastSelArray.push(E.rowIndex);while(A.lastSelArray.length>2){A.lastSelArray.splice(0,1)}if(A.lastSelArray&&A.lastSelArray.length==2&&(A.lastSelArray[0]==A.lastSelArray[1])&&(A.lastSelArray[0]==E.rowIndex)&&E.cellIndex==0){if(Array.contains(A.selectRowIndex,E.rowIndex)){var B=Array.indexOf(A.selectRowIndex,E.rowIndex);clearTimeout(A.selectRowTimeout[B]);A.selectRowTimeout.splice(B,1);A.selectRowIndex.splice(B,1)}else{var D=E.rowIndex;var C=setTimeout(function(){E.grid.edit.setEditCell(E.cell,E.rowIndex);Array.remove(A.selectRowIndex,D);Array.remove(A.selectRowTimeout,C)},A.editLag);A.selectRowIndex.push(D);A.selectRowTimeout.push(C)}}else{}}if(A.onRowClick){A.onRowClick(E)}A._djGrid.focus.styleRow=function(){};A._djGrid.focus.setFocusIndex(E.rowIndex,0)}},GetOnCellDblClick:function(){var A=this;return function(B){if(!A._checkGrid(B.rowNode)){return false}this.onRowDblClick(B)}},GetOnRowDblClick:function(){var A=this;return function(D){if(!A._checkGrid(D.rowNode)){return false}if(A._allowRename){while(A.selectRowTimeout&&A.selectRowTimeout.length){var C=A.selectRowTimeout.splice(0,1);A.selectRowIndex.splice(0,1);if(C&&C.length==1){clearTimeout(C[0])}}}if(D.grid.model.isRecyclebinItem){return false}var G=D.grid.model.getRow(D.rowIndex);var F=D.grid.model.requiredColumnIndices;if(A.onRowDblClick){if(!A.onRowDblClick(D)){return false}}var H=G[F.idIndex];var E=G[F.linkToIndex];if(E&&E!=0){H=E}var B=G[F.flagIndex];if((B&256)>0){if(E&&E!=0){A.OpenFolderShortcut(A._repoName,H,D)}else{if(A.onFolderDblClick){A.onFolderDblClick(H,A._repoName,D)}}}else{if(A.onDocumentDblClick){A.onDocumentDblClick(H,A._repoName,D)}}}},OpenFolderShortcut:function(A,F,C){var E=this;function D(G){var H=G;if(H&&H.length){if(H[0].id==1){if(E.onFolderDblClick){E.onFolderDblClick(F,A,C)}}else{top.window.open("index.aspx?db="+A+"#id="+F+";view=newroot")}}}function B(G){}Laserfiche.WebAccess.BreadCrumbService.GetPathNodesToRoot(A,F,D,B)},GetOnKeyEvent:function(){var A=this;return function(F){var C=dojo.keys;if(F.cancelBubble==true||A._djGrid.rowCount==0||F.type!="keydown"){return false}var E=A._djGrid.scroller.lastVisibleRow-A._djGrid.scroller.firstVisibleRow-2;var B=A._djGrid.focus.rowIndex;var D=A._djGrid.rowCount-1;F.cancelBubble=true;F.returnValue=false;switch(F.keyCode){case C.UP_ARROW:if(B>0){A.JumpToEntry(--B)}break;case C.DOWN_ARROW:if(B<D){A.JumpToEntry(++B)}break;case C.PAGE_UP:var G=B-E;if(G>0){A.JumpToEntry(G)}else{A.JumpToEntry(0)}break;case C.PAGE_DOWN:var G=B+E;if(G>D){A.JumpToEntry(D)}else{A.JumpToEntry(G)}break;case C.END:A.JumpToEntry(D);break;case C.HOME:A.JumpToEntry(0);break;case C.ENTER:LF.Actions.OpenEntry(A._controller._context);break;case C.DELETE:LF.Actions.DeleteEntry(A._controller._context);break;case 67:if(F.ctrlKey&&F.altKey){LF.Actions.Copy(A._controller._context)}break;case 86:if(F.ctrlKey&&F.altKey){LF.Actions.Paste(A._controller._context)}break;case 88:if(F.ctrlKey&&F.altKey){LF.Actions.Cut(A._controller._context)}break;case C.F2:LF.Actions.Rename(A._controller._context);break;case C.TAB:top.myAppController.TabToNextMainCtrl(A,!F.shiftKey);break;default:F.cancelBubble=false;F.returnValue=true;return true}return false}},GetOnSelectionChanged:function(){var A=this;return function(){if(A._controller){A._controller.selectedEntryChanged(A)}}},GetOnRowSelected:function(B){var A=this;return function(C){if(A._controller){A._controller.setFocusControl(A)}}},GetOnRowDeselected:function(B){var A=this;return function(C){if(A._controller){}}},GetScrollWheelHandler:function(){var A=this;return function(B){B=(!B)?window.event:B;var C=0;if(B.wheelDelta){C=-B.wheelDelta/120}else{if(B.detail){C=B.detail/3}}}},GetOnStartEdit:function(){var A=this;return function(B,C){A._model.beforeEditRowIndex=C;A._model.beforeEditData=A._model.data[C][B.fieldIndex];A._model.beforeEditDataController=A._controller}},GetOnApplyCellEdit:function(){var A=this;return function(C,G,E){if(E==0){if(C!=A._model.beforeEditData){var B=C;var F=A._model.getEntryArgsByRowIndex(G);var D="ENTRY_GRID";A._model.updateEntryName(B,F,D)}else{}}}},modelColumnChange:function(){this.setFullPath();var G=this._model.requiredColumnIndices;var H=this._model.columnNames;var B={};var C=!!(this.listingMask==3);if(!this._allowRename){B={noscroll:!C,cells:[[{name:"Name",width:C?"100%":"200px",field:0,formatter:this.getNameFormatter()}]]}}else{B={noscroll:!C,cells:[[{name:"Name",width:C?"100%":"200px",field:0,formatter:this.getNameFormatter(),editor:dojox.grid.editors.Input}]]}}var E=new Array();for(var D=1;D<=H.length;D++){var F={name:H[D-1].replace(/ /g,"&nbsp;"),field:D,formatter:this.formatString};E.push(F)}var A={cells:[E]};if(this.listingMask==3){this._layout=[B]}else{this._layout=[B,A]}this._djGrid.setStructure(this._layout)},modelChange:function(){if(this.onRowCountChanged){this.onRowCountChanged(this.get_rowCount())}},modelDatumChange:function(A,C,B){},get_rowCount:function(){return this._model.getRowCount()},formatString:function(B,D){if(!B){return"&nbsp;"}var C=this.grid.model.getDatum(D,this.field);var A=document.createElement("div");A.appendChild(document.createTextNode(C));return A.innerHTML.replace(/ /g,"&nbsp;")},getNameFormatter:function(){var A=this;return function(F,G){var J=this.grid.model.getRow(G);if(typeof (J)=="undefined"||!J){return""}var I=this.grid.model.requiredColumnIndices;var B=this.grid.model.isRecyclebinItem;var C=A._getIconHTML(B,J[I.flagIndex],J[I.extIndex],J[I.linkToIndex],J[I.linkTypeIndex],J[I.volIndex],J[I.templateIndex],J[I.plockOwnerIndex],J[I.lockOwnerIndex],J[I.typeIndex]);var E=J[I.idIndex]+":"+A._repoName+":grid";var H=document.createElement("div");H.appendChild(document.createTextNode(F));var D="<div class='EntryName' id='"+E+"'>"+C+" "+H.innerHTML+"</div>";return D}},_getIconHTML:function(N,E,D,O,G,S,M,L,Q,B){var F;var T;var P=false;if(N){if(!this._model.disableEdocIcons&&(D&&D.length>0)){P=true;F="edocs/"+D+".gif"}else{if(B==0){F="Folder.gif"}else{if(B==1){F="RecordSeries.gif"}else{F="batch-icon.gif"}}}}else{if(!this._model.disableEdocIcons&&(D&&D.length>0)){P=true;F="edocs/"+D+".gif"}else{if((E&64)>0){F="RecordFolder.gif"}else{if((E&128)>0){F="RecordSeries.gif"}else{if(N==true){if(B==0){F="Folder.gif"}else{F="DocPage0.gif"}}else{if((E&256)>0){F="Folder.gif"}else{F="DocPage_Grey.gif";var J="_Grey";if(this._model.colorByVolume){if(S){J=S%7}F="DocPage"+J+".gif"}else{if(M){J=M%7;F="DocPage"+J+".gif"}else{F="batch-icon.gif"}}}}}}}}var A=null;var R=L;var H=null;if(!N){if(O&&O!=0){H="overlays/Shortcut.gif"}if(R&&R.length>0){var C=(this._controller)?this._controller._context.user:"";if(R.toUpperCase()==C.toUpperCase()){A="overlays/CheckedOutSelf.gif"}else{A="overlays/CheckedOutOther.gif"}T="Checked out by "+R}else{R=Q;if(R&&R.length>0){A="overlays/Locked.gif";T="Locked by "+R}}}var I="";var K="";if(!A){if(H){K="title='Shortcut to "+B+"' "}else{K="title='"+B+"' "}}I=I+"<img "+K+'src="'+this.getImgURL(F)+'" ';if(P){I=I+"onerror=\"this.src='"+this.getImgURL("edocs/noimage.gif")+"';this.onerror=null;\""}I=I+">";if(H){I=I+"<img "+K+"class='OverlayIcon' src=\""+this.getImgURL(H)+'">'}if(A){I=I+"<img class='OverlayIcon' title='"+T+"' src=\""+this.getImgURL(A)+'">'}return I},onFocus:function(){this._controller.selectedEntryChanged(this)},getSelectedItems:function(){var C=this;var F=C._model.requiredColumnIndices;var B=C._djGrid.selection.getSelected();var E=false;var A=dojo.map(B,function(H){var N=C._model.getRow(H);if(N){var K=C._repoName;var J=N[F.idIndex]-0;var L=N[F.nameIndex];var G=N[F.pathIndex];var I=N[F.typeIndex];var M={repository:K,id:J,name:L,path:G,entryType:I};if(N[F.linkToIndex]){M.linkToID=N[F.linkToIndex]-0;M.linkToType=N[F.linkTypeIndex]}return M}else{E=true;return null}});var D="ENTRIES";return({items:E?[]:A,type:D})},getLastSelectedItem:function(){var C=this;var B=C._model.requiredColumnIndices;var A=C._djGrid.selection.selectedIndex;var H=C._model.getRow(A);var F=C._repoName;var E=H[B.idIndex]-0;var G={repository:F,id:E};var D="ENTRIES";return({item:G,type:D})},setCtrlFocus:function(){var A=this._djGrid.focus;A.setFocusIndex(1,0)},GetOnLostFocus:function(){},sort:function(D){var C=this;if(!C.sortColumn){return false}var E=(C.sortColumn.name==undefined?"Name":C.sortColumn.name);var B=(C.sortColumn.fieldIndex==undefined?0:C.sortColumn.fieldIndex);var F=true;if(D=="DESCENDING"){F=false}var A=function(){C._djGrid.selection.unselectAll();C._djGrid.setSortIndex(B,F);if(C.lastSelectEntryId!=null){var G=C._model.getRowIndexByEntryId(C.lastSelectEntryId);if(G>-1){if(C._model.count>100){setTimeout(dojo.hitch(C,"JumpToEntry",G),500)}else{setTimeout(dojo.hitch(C,"JumpToEntry",G),1)}}}C._model.clearRequestSortedRows()};if(C._model.count>100){C._model.setRowCount(0);C._model.clear()}C._model.prepareRequestSortedRows(C.lastSelectEntryId,E,F,A);C._model.requestRows();C.lastSortedColumn=C.sortColumn;C.lastSortIsAsc=F;C.sortColumn=null},getType:function(){return"ENTRY_LISTING"},getId:function(){return this._container.id},setListingMask:function(A){this.listingMask=A;if(this._model){this._model.listingMask=A}}};dojo.require("dojox.grid.Grid");dojo.require("dojox.grid._data.model");dojo.require("dojo.parser");dojo.declare("LF.EntryListingModel",dojox.grid.data.Dynamic,{constructor:function(){this.page=[];this.pages=[];this.colorByVolume=false;this.disableEdocIcons=false},rowsPerPage:100,fieldNames:[],set_callback:function(A){this._callback=A},set_dbname:function(A){this.listingid=-1;this.dbname=A},set_id:function(A){this.listingid=-1;this.id=A;this.parentid=A},clearData:function(){dojox.grid.data.Dynamic.prototype.clearData.apply(this,arguments)},fillParams:function(A){A=A||{};A.dbname=this.dbname;A.id=this.id;A.count=this.rowsPerPage;if(dojo.exists("listingMask",this)&&this.listingMask){if(this.listingMask&1){A.maskDocuments=true}if(this.listingMask&2){A.maskShortcuts=true}if(this.listingMask&4){A.maskFolders=true}}if(this.listingid){A.listingid=this.listingid}},send:function(A,D,F,B){this.fillParams(D);var E=Sys.Serialization.JavaScriptSerializer.serialize(D);var C=F;top.KillPendingCallbacks("EL");this._callback(E,F,{callee:"EL"},B);this.onSend(D)},receive:function(B){var A=B;try{A=Sys.Serialization.JavaScriptSerializer.deserialize(B);if(A.IsException){this.handleError(A.Message);return }this.processRows(A);if(this.onReceive){this.onReceive(A)}}catch(C){if(this.onError){this.onError(A)}}},handleError:function(A){if(A!="SESSION_TIMEOUT"){alert(A)}if(this.onError){this.onError(A)}},error:function(B,C,A){if(!A){this.handleError(B)}},fetchRowCount:function(A){this.send(true,A)},prepareRequestSortedRows:function(A,D,E,F){var B=this;var C=!(D==B.sortColumnName&&E==B.sortIsAsc);B.focusedEntryId=A;B.sortColumnName=D;B.sortIsAsc=E;if(C){this.listingid=-1}B.onReceiveSuccess=F},clearRequestSortedRows:function(){var A=this;A.focusedEntryId=null;A.onReceiveSuccess=function(){}},requestRows:function(E,B,D){var A=this;var D=!!D;if(D){A.listingid=-1}E=(E==undefined?0:E);A.focusedEntryId=(A.focusedEntryId==undefined?-1:A.focusedEntryId);A.sortColumnName=(A.sortColumnName==undefined?"Name":A.sortColumnName);A.sortIsAsc=(A.sortIsAsc==undefined?true:A.sortIsAsc);var C={start:E+1,focusentryid:A.focusedEntryId,sortcolumnname:A.sortColumnName,sortisasc:A.sortIsAsc};this.send(true,C,function(G){A.receive(G);if(A.onReceiveSuccess){var H=top.i;var F=top.__pendingCallbacks[H];A.onReceiveSuccess();top.__pendingCallbacks[H]=F;top.i=H}},function(G,H,F){A.error(G,H,F)})},processRows:function(D){var F=D.start;var C=D.total;var E=D.count;this.listingid=D.listingid;this.parentid=D.parentid;this.fullpath=D.fullpath;this.isRecyclebinItem=D.isRecyclebinItem;var A=!(this.colorByVolume==D.ColorByVolume&&this.disableEdocIcons==D.DisableEdocIcons);this.colorByVolume=D.ColorByVolume;this.disableEdocIcons=D.DisableEdocIcons;if(D.requiredColumnIndices){this.requiredColumnIndices=D.requiredColumnIndices;this.columnNames=D.columnNames;this.notify("ColumnChange",arguments)}else{if(A){this.notify("ColumnChange",arguments)}}for(var B=0;B<E;B++){this.setRow(D.result[B],F-1+B)}if(this.count!=C){this.setRowCount(C);this.allChange();this.onInitializeData(D)}},updateEntryNameByRow:function(A,F){var B=this;var E=B.requiredColumnIndices;var D=this.data[F];var G=D[E.idIndex];var C={Command:"RenameEntry",NewName:A,EntryID:G};this.send(true,C,function(H){},function(I,J,H){D[0]=B.beforeEditData;B.allChange();B.error(I,J,H)})},updateEntryName:function(A,D,C){var B=this;var E={Command:"RenameEntry",NewName:A,EntryID:D.id};this.send(true,E,function(F){if(B.beforeEditDataController&&B.beforeEditDataController.EntryRenamed){B.beforeEditDataController.EntryRenamed(A,D,C)}},function(G,H,F){var I=B.data[B.beforeEditRowIndex];I[0]=B.beforeEditData;B.datumChange(B.beforeEditData,B.beforeEditRowIndex,0);B.error(G,H,F)})},getDatum:function(C,A){var B=this.getRow(C);if(A==undefined){return B}return(B?B[A]:"")},getRowIndexByEntryId:function(C){if(this.requiredColumnIndices){var A=this.requiredColumnIndices.idIndex;var B=this.data;var D=dojo.map(B,function(F){return(F==undefined?-1:F[A]-0)});var E=dojo.indexOf(D,C);return E}else{return -1}},getEntryIdByRowIndex:function(B){var A=this.getRow(B);return A[this.requiredColumnIndices.idIndex]},getEntryArgsByRowIndex:function(C){var B=this.getRow(C);var A=this.requiredColumnIndices;return{id:B[A.idIndex],name:B[A.nameIndex],permissions:B[A.permissionIndex],flags:B[A.flagIndex],volume:B[A.volIndex],template:B[A.templateIndex],extension:B[A.extIndex],plockOwner:B[A.plockOwnerIndex],lockOwner:B[A.lockOwnerIndex],type:B[A.typeIndex],linkTo:B[A.linkToIndex],linkType:B[A.linkTypeIndex],recycleguid:B[A.recycleguid],recyclesid:B[A.recyclesid],mimetype:B[A.mimetype],path:B[A.pathIndex],dbname:this.dbname,elecSize:B[A.elecSizeIndex],pages:B[A.numPagesIndex]}},requestPage:function(C){var B=this.pageToRow(C);var A=Math.min(this.rowsPerPage,this.count-B);if(A>0){this.requests++;this.requestsPending(true);setTimeout(dojo.hitch(this,"requestRows",B,A),1)}},canSort:function(){return true},sort:function(){},onInitializeData:function(){},onSend:function(){},onReceive:function(){},onReceiveSuccess:function(){}});dojo.require("dijit.Tree");dojo.require("dojo.parser");dojo.require("dojo.data.ItemFileWriteStore");if(!top.LF){top.LF={}}LF.FolderTree=function(B,A){this._domNode=B.parentNode;this._container=B;this._callbackFunc=A;this.expandOnClick=false;this.lastFocusedNode=null;this._openedFolder=null;this._active=false;this.listener=new LF.Listener("FolderTreeListener");this.listener.setHandler("FolderOpened",this.GetOnFolderOpened());this.listener.setHandler("EntryRenamed",this.GetOnEntryRenamed());this.listener.setHandler("NewFolderCreated",this.GetOnNewFolderCreated());this.listener.setHandler("EntryChanged",this.GetOnEntryChanged());this.listener.setHandler("EntryMoved",this.GetOnEntryMoved());this.listener.setHandler("EntryRestored",this.GetOnEntriesRestored());this.listener.setHandler("EntryDeleted",this.GetOnEntryDeleted());this.listener.setHandler("Logout",this.GetOnLogout());this.listener.setHandler("LogoutAll",this.GetOnLogoutAll());this.listener.setHandler("UpFolder",this.GetUpFolder())};LF.FolderTree.prototype={activate:function(){this._active=true},deactivate:function(){this._active=false},get_DOMelement:function(){return this._domNode},resize:function(B,A){},set_controller:function(A){var B=this;this._controller=A;A.subscribe("FolderOpened",this.listener);A.subscribe("EntryRenamed",this.listener);A.subscribe("NewFolderCreated",this.listener);A.subscribe("EntryChanged",this.listener);A.subscribe("EntryMoved",this.listener);A.subscribe("EntryRestored",this.listener);A.subscribe("EntryDeleted",this.listener);A.subscribe("Logout",this.listener,true);A.subscribe("LogoutAll",this.listener,true);A.subscribe("UpFolder",this.listener);B._djTree._controller=A;var D=function(I,H){if(B.openFolderTimeout){clearTimeout(B.openFolderTimeout);B.openFolderTimeout=null}var F=I.id[0];if(F==null){return }var L=parseInt(F);var J=F.substr(F.indexOf(":")+1);var E=B._store.getValue(I,"name");if(I.tunnelid&&(I.tunnelid[0]!=0)){L=I.tunnelid[0]}var G={id:L,name:I.name[0],flags:I.flags?I.flags[0]:null};if(B.IsRepositoryConnected(J)){var K=function(){B._openedFolder={repository:J,name:E,id:G.id};var M=B._controller._context.repository!=J;B._controller.set_repository(J);B._controller.setFocusControl(B);B._controller.selectCurrentFolder({id:L,name:E,repositoryName:J,forceRefresh:M},function(){});B._controller.selectedEntryChanged();B.openFolderTimeout=null};B.openFolderTimeout=setTimeout(K,100)}else{B._controller.checkSecurity()}};this.onFocusItem=D;var C=1;this.LoadFolder(A._context.repository,C,true)},initialize:function(B){var C=this;this._store=new dojo.data.ItemFileWriteStore({data:{label:"name",identifier:"id",items:B}});var A=function(G,H){var E=document.createElement("div");var F=document.createElement("div");dojo.addClass(F,"FolderIcon");dojo.addClass(F,"dijitInline");E.appendChild(F);E.appendChild(document.createTextNode(G.entryName));return{node:E,data:dojo.delegate(G,{entryType:"FOLDER"}),type:["FOLDER"]}};var D=function(F,E){if(!F.tree){return false}return true};this._djTree=new dijit.Tree({store:this._store,labelAttr:"name",typeAttr:"type",getIconClass:this.Create_getIconClassFunc(),mayHaveChildren:this.Create_mayHaveChildrenFunc(),persist:false,query:{type:"root"},onClick:function(F,E){C._onTreeClick(F,E)},dndController:"dijit._tree.dndSource",dndParams:["creator","_normalizedCreator","onDndDrop","itemCreator","onDndCancel","checkAcceptance","checkItemAcceptance"],creator:A,_normalizedCreator:A,checkAcceptance:D},this._container);this._djTree._onTab=this._onTabClicked;this._djTree._onCopy=this._onCopyClicked;this._djTree._onPaste=this._onPasteClicked;this._djTree._onCut=this._onCutClicked;this._djTree._onRename=this._onRenameClicked;this._djTree._onDelete=this._onDeleteClicked;this._djTree._onKeyPress=this.myKeyPress;this._djTree.getItemChildren=this.Create_getItemChildrenFunc();this._djTree.blurNode=this.Create_blurNode(this._djTree.blurNode);dojo.connect(this._djTree.domNode,"oncontextmenu",function(E){C._onTreeContextMenu(E)});dojo.connect(this._djTree.domNode,dojo.isIE?"ondeactivate":"onblur",function(){setTimeout(function(){C._onTreeBlur()},1)});dojo.connect(this._djTree.domNode,dojo.isIE?"onactivate":"onfocus",function(E){setTimeout(function(){C._onTreeFocus(E)},1)});for(id in this._djTree._itemNodeMap){this._initializeNode(id)}},Create_blurNode:function(A){this._djTree.base_blurNode=A;return function(){var D=this.lastFocused;if(!D){return }var C=D.labelNode;var B=D.contentNode;dojo.removeClass(C,"dijitTreeLabelInactiveFocus");dojo.removeClass(B,"dijitTreeContentFocused");this.base_blurNode()}},_initializeNode:function(C){var A=this;var D=this._djTree._itemNodeMap[C];if(D.hasChildren()){if(!D.containerNode){D.containerNode=this._djTree.containerNodeTemplate.cloneNode(true);D.domNode.appendChild(D.containerNode)}}if(D.containerNode&&!D._wipeIn){D._wipeIn=dojo.fx.wipeIn({node:D.containerNode,duration:150});D._wipeOut=dojo.fx.wipeOut({node:D.containerNode,duration:150})}var E=this.Create_OnExpandFunc(C);var B=this.Create_OnCollapseFunc(C);dojo.connect(D._wipeIn,"onEnd",E);dojo.connect(D._wipeOut,"onEnd",B)},_onTreeFocus:function(A){var B=dijit.getEnclosingWidget(A.target);this._focusNode(B)},_focusNode:function(C){if(this.lastFocusedNode){var B=this.lastFocusedNode.labelNode;var A=this.lastFocusedNode.contentNode;dojo.removeClass(B?B:this.lastFocusedNode,"dijitTreeLabelInactiveFocus");if(A){dojo.removeClass(A,"dijitTreeContentFocused")}}this.lastFocusedNode=C||C.labelNode;if(C.contentNode){dojo.addClass(C.contentNode,"dijitTreeContentFocused")}if(this.onFocusItem){this.onFocusItem(C.item,C)}},_onTreeBlur:function(){if(this.openFolderTimeout){clearTimeout(this.openFolderTimeout);this.openFolderTimeout=null}var B=this.lastFocusedNode;if(B){var A=B.labelNode;dojo.addClass(A?A:B,"dijitTreeLabelInactiveFocus")}},_isNodeSelected:function(B,A){return((B==this._openedFolder.id)&&(this._openedFolder.repository==A))},_showTreeContextMenu:function(C){var B=this;var E=dijit.getEnclosingWidget(C.target);var D=-1;if(E.item.IsRecycleBin&&E.item.IsRecycleBin.length&&E.item.IsRecycleBin[0]){D=top.TYPE_RECYCLEBIN}else{if(E.item.id&&E.item.id.length&&parseInt(E.item.id[0])==1){if(E.item.connected&&E.item.connected.length&&E.item.connected[0]){D=TYPE_FOLDER_TREE_ROOT_ENTRY}else{D=TYPE_REPOSITORY_LOGIN}}else{if(E.item.id&&!isNaN(parseInt(E.item.id[0]))){D=top.TYPE_FOLDER_TREE_ENTRY}}}if(D==-1){return }this._menuscontainer=document.createElement("div");this._menuscontainer.style.position="relative";document.body.appendChild(this._menuscontainer);var A=this._controller.getContextMenuItems(D);var F=top.SimpleMenu.CreateMenu(A,this._menuscontainer);B._folderTreeContextMenu=F;var G=dojo.coords(this._menuscontainer);F.UpdateContextMenu(B._controller,C.clientX-G.x,C.clientY-G.y);F.Show(C.clientX-G.x,C.clientY-G.y);F.onselect=function(){B._controller.doAction(F.value);F.Hide()};F.onhide=function(){F.DeleteMenu();B._folderTreeContextMenu=null};if(this.onContextMenu){this.onContextMenu(E.item,E)}},_onTreeContextMenu:function(A){var B=this;dojo.stopEvent(A);var E=dijit.getEnclosingWidget(A.target);var C={target:A.target,clientX:A.clientX,clientY:A.clientY};var D=E.item.id[0];var G=parseInt(D);var F=D.substr(D.indexOf(":")+1);if(E.item.tunnelid&&(E.item.tunnelid[0]!=0)){G=E.item.tunnelid[0]}if(dojo.exists("_folderTreeContextMenu",B)){B._folderTreeContextMenu.Hide()}B._controller.setFocusControl(B);if(!B._isNodeSelected(G,F)){B._openedFolder={repository:F,id:G};if(B._active){B._djTree.focusNode(E)}setTimeout(function(){B._showTreeContextMenu(C)},0)}else{B._showTreeContextMenu(C)}},_onTreeClick:function(C,B){var A=C.id[0];var E=parseInt(A);this._focusNode(B);if(E==1){var D=A.substr(A.indexOf(":")+1);if(!this.IsRepositoryConnected(D)){this._djTree._expandNode(B)}}else{if(this.expandOnClick){this._djTree._expandNode(B)}}if(this.onClickItem){this.onClickItem(C,B)}},FailedLoadHandler:function(A,C){C(new Array());var B=this._djTree._itemNodeMap[A];B.state="UNCHECKED";B.makeExpandable()},Create_getIconClassFunc:function(){var A=this;return function(E,F){if(!E){return"LaserficheIcon"}var C=A._store.getValue(E,"type");var D;if(C=="root"){if(A._store.getValue(E,"connected")){return"RepositoryConnectedIcon"}else{return"RepositoryIcon"}}else{if(A._store.getValue(E,"IsRecycleBin")){return"RecycleBinIcon"}else{var B=parseInt(A._store.getValue(E,"flags"));if((B&64)>0){return"RFIcon"}else{if((B&128)>0){return"RSIcon"}}return"FolderIcon"}}}},Create_mayHaveChildrenFunc:function(){var A=this;return function(C){var B=A._store.getValue(C,"type");return(B=="root"||A._store.getValue(C,"hasChildFolders"))}},Create_getItemChildrenFunc:function(){var A=this;return function(J,E){var F=function(K){E(K);for(var L=0;L<K.length;L++){A._initializeNode(K[L].id[0])}};var G=A._store.getValue(J,"id");var B=parseInt(G);var D=G.substr(G.indexOf(":")+1);if(J.tunnelid&&(J.tunnelid[0]!=0)){B=J.tunnelid[0]}var H=A._store.getValue(J,"type");var I=function(){var K={callee:"FL",item:J,id:B,dbname:D};var L={id:B,dbname:D};var M=Sys.Serialization.JavaScriptSerializer.serialize(L);top.KillPendingCallbacks("FL");A._callbackFunc(M,A.Create_OnCallbackSuccessFunc(F,L),K,A.Create_OnCallbackErrorFunc(F))};var C=function(){A.FailedLoadHandler(G,E)};if(H=="root"&&!A._store.getValue(J,"connected")){if(A.onNeedLogin){A.onNeedLogin(D,I,C)}}else{I()}}},Create_OnCallbackSuccessFunc:function(B){var A=this;return function(F,C){try{var L=Sys.Serialization.JavaScriptSerializer.deserialize(F);if(L.IsException){A.handleError(L.Message);A.FailedLoadHandler(C.id+":"+C.dbname,B);return }if(!L.connected){var K=function(){var N={id:C.id,dbname:C.dbname};var O=Sys.Serialization.JavaScriptSerializer.serialize(N);A._callbackFunc(O,A.Create_OnCallbackSuccessFunc(B,N),C,A.Create_OnCallbackErrorFunc(B))};var E=function(){A.FailedLoadHandler(C.id+":"+C.dbname,B)};if(A.onNeedLogin){A.onNeedLogin(C.dbname,K,E)}}else{var I=L.result;for(var G=0;G<I.length;G++){var M=I[G];for(prop in M){var H=M[prop];if(dojo.isArray(H)){M[prop]=H}else{M[prop]=[H]}}A._store._arrayOfAllItems.push(M);M[A._store._storeRefPropName]=A._store;M[A._store._itemNumPropName]=(A._store._arrayOfAllItems.length-1)}B(L.result)}}catch(J){B(new Array());var D="error: "+J.message;alert(D);if(this.onError){this.onError(F)}}}},handleError:function(A){if(A!="SESSION_TIMEOUT"){alert(A)}if(this.onError){this.onError(A)}},Create_OnCallbackErrorFunc:function(B){var A=this;return function(D,E,C){if(!C){A.handleError(D)}A.FailedLoadHandler(E.id+":"+E.dbname,B)}},Create_OnExpandFunc:function(B){var A=this;return function(){if(A._djTree&&A._djTree.lastFocused&&A._djTree.lastFocused.labelNode){dojo.addClass(A._djTree.lastFocused.labelNode,"dijitTreeLabelFocused");dojo.addClass(A._djTree.lastFocused.contentNode,"dijitTreeContentFocused")}if(A.onExpand){A.onExpand(B)}}},Create_OnCollapseFunc:function(B){var A=this;return function(){dojo.addClass(A._djTree.lastFocused.labelNode,"dijitTreeLabelFocused");dojo.addClass(A._djTree.lastFocused.contentNode,"dijitTreeContentFocused");if(A.onCollapse){A.onCollapse(B)}}},IsRepositoryConnected:function(B){var A=this._store._getItemByIdentity("1:"+B);return this._store.getValue(A,"connected")},GetRepositoryConnectedUser:function(B){var A=this._store._getItemByIdentity("1:"+B);return this._store.getValue(A,"username")},NotifyLogin:function(C,A){var B=this._store._getItemByIdentity("1:"+C);this._store.setValue(B,"connected",A);if(this._djTree.lastFocused){dojo.addClass(this._djTree.lastFocused.labelNode,"dijitTreeLabelFocused");dojo.addClass(this._djTree.lastFocused.contentNode,"dijitTreeContentFocused")}},RenameRootItem:function(E,F,A,B){var D=this;var C=D._store._getItemByIdentity("1:"+E);D._store.setValue(C,"name",B);D._store.setValue(C,"tunnelid",F);D.LoadFolder(E,A,true,true)},IsNodeLoaded:function(B,A){return !!this.RetrieveItemFromNodeMap(A,B)},getParentFolderId:function(C,A){var D=this.RetrieveItemFromNodeMap(A,C);var B=D.getParent();return parseInt(B.item.id,10)},CollapseNode:function(C,A){var B=this.RetrieveItemFromNodeMap(A,C);B.state="UNCHECKED";B.makeExpandable();B.collapse()},ExpandNode:function(C,A){var B=this.RetrieveItemFromNodeMap(A,C);B.expand()},ClickNode:function(C,A){var B=this.RetrieveItemFromNodeMap(A,C);this._djTree.onClick(B.item,B)},GetPathNodesToRoot:function(D,C,A){var B=this.RetrieveItemFromNodeMap(C,D);if(!B){if(!A){this.LoadFolder(D,C,false)}return[]}var E=[];while(B&&B.getParent()){if(B.declaredClass=="dijit._TreeNode"){E.push(B)}B=B.getParent()}E.reverse();return E},HighlightNode:function(D,C){var B=this.RetrieveItemFromNodeMap(C,D);var A=this;if(B){setTimeout(function(){dojo.addClass(B.labelNode,"dijitTreeLabelFocused");B.labelNode.focus();A._openedFolder={repository:D,id:C};if(A._active){A._djTree.focusNode(B)}},0)}},SelectLoadedNode:function(E,B){var C=this.RetrieveItemFromNodeMap(B,E);var D=this;var F=this.GetPathNodesToRoot(E,B);for(var A=0;A<F.length-1;A++){if(F[A].expand){F[A].collapse();F[A].expand()}}if(this._active&&C!=null){this._djTree.focusNode(C)}this._openedFolder={repository:E,id:B}},LoadFolder:function(B,D,H,K){var G=1;var I=this._store._getItemByIdentity("1:"+B);if(I.tunnelid&&(I.tunnelid[0]!=0)){G=I.tunnelid[0]}if(this.openFolderTimeout){clearTimeout(this.openFolderTimeout);this.openFolderTimeout=null}if(H){this._djTree.lastFocused=null}function C(N,M){var P=Sys.Serialization.JavaScriptSerializer.deserialize(N);var O=A._djTree;function L(){if(!P||!P.length){if(H){if(A.IsNodeLoaded(B,D)&&!K){A.SelectLoadedNode(B,D)}else{setTimeout(arguments.callee,50)}}return }var Q=P[0];var R=A.RetrieveItemFromNodeMap(Q,B);if(R){P.splice(0,1);var S=O.lastFocused;O._expandNode(R);setTimeout(arguments.callee,50)}else{setTimeout(arguments.callee,50)}}setTimeout(L,10)}function F(M,L){}var A=this;if(this.IsNodeLoaded(B,D)&&!K){this.SelectLoadedNode(B,D);return }else{var E={id:D,dbname:B,Command:"GetPathToRoot",rootid:G};var J=Sys.Serialization.JavaScriptSerializer.serialize(E);this._callbackFunc(J,C,null,F)}},DisconnectRepo:function(B){var A=this;top.myFolderTree.onLogout(B);A.SelectLoadedNode(B,1);A.CollapseNode(B,1);A.NotifyLogin(B,false)},GetOnLogout:function(){var A=this;return function(B){A.DisconnectRepo(B.args.repository)}},GetOnLogoutAll:function(){var A=this;return function(D){var C=A._store._getItemsArray();for(i=0;i<C.length;++i){if(A._store.getValue(C[i],"connected")){var B=C[i].id[0];A.DisconnectRepo(B.substr(B.indexOf(":")+1))}}}},GetUpFolder:function(){var A=this;return function(B){A.SelectLoadedNode(B.args.repository,B.args.openedFolder.id)}},GetOnFolderOpened:function(){var A=this;return function(C){var D=C.args.openedFolder.id;var B=C.args.repository;if(A._controller._context.focusedControl!=A){A.LoadFolder(B,D,true)}}},GetOnNewFolderCreated:function(){var A=this;return function(D){if(D.args.srcObjName!="Tree"){var C=false;var B=A.RetrieveItemFromNodeMap(D.args.parentId,D.args.repoName);if(B.isExpanded){C=true}B.makeExpandable();B.state="UNCHECKED";A.LoadFolder(D.args.repoName,D.args.parentId,C,C)}}},RetrieveItemFromNodeMap:function(E,B){var A=this;var D=this._store._getItemByIdentity("1:"+B);if(D.tunnelid&&(D.tunnelid[0]==E)){E=1}var C=A._djTree._itemNodeMap[String.format("{0}:{1}",E,B)];return C},GetOnEntriesRestored:function(){var A=this;return function(B){if(B.args.srcObjName!="Tree"){if(dojo.isArray(B.args.parentId)){dojo.forEach(B.args.parentId,function(E){var C=A.RetrieveItemFromNodeMap(E,B.args.repoName);if(!C){return }var D=!!C.isExpanded;C.state="UNCHECKED";if(C.isExpanded){C.collapse();A._djTree._expandNode(C)}else{C.makeExpandable();C.collapse()}})}}}},GetOnEntryMoved:function(){var A=this;return function(D){if(D.args.srcObjName!="Tree"){var C=false;var B=A.RetrieveItemFromNodeMap(D.args.parentId,D.args.repoName);if(B.isExpanded){C=true}B.state="UNCHECKED";A.LoadFolder(D.args.repoName,D.args.parentId,C,C)}}},GetOnEntryDeleted:function(){var A=this;return function(D){if(D.args.srcObjName!="Tree"){var C=false;var B=A.RetrieveItemFromNodeMap(D.args.parentId,D.args.repoName);if(B){if(B.isExpanded){C=true}B.state="UNCHECKED"}A.LoadFolder(D.args.repoName,D.args.parentId,C,C)}}},GetOnEntryChanged:function(){var A=this;return function(C){var B=C.args;if(B.repository&&B.entryList){dojo.forEach(B.entryList,function(D){var E=A.RetrieveItemFromNodeMap(D,B.repository);if(E){E.state="UNCHECKED";if(E.isExpanded){A._djTree._expandNode(E)}else{E.makeExpandable()}}})}}},GetOnEntryRenamed:function(){var A=this;return function(B){if(B.args.srcObjName!="Tree"){var E=function(F,I){for(var G=0;G<F.length;G++){var H=F[G];A._store.setValue(H,"name",B.args.newName)}};var D=A.RetrieveItemFromNodeMap(B.args.args.id,B.args.args.repository);if(D){var C=A._store.fetch({query:{id:D.item.id[0]},queryOptions:{ignoreCase:false,deep:true},onComplete:E})}}else{}}},myKeyPress:function(E){var A=this;var B=dijit.getEnclosingWidget(E.target);if(!B){return }var D=(E.keyCode)?E.keyCode:((E.charCode)?E.charCode:E.key);if(E.charCode&&(!(E.altKey&&E.ctrlKey))){var F=E.charCode;if(!E.altKey&&!E.ctrlKey&&!E.shiftKey&&!E.metaKey){F=(String.fromCharCode(F)).toLowerCase();this._onLetterKeyNav({node:B,key:F});dojo.stopEvent(E)}}else{var C=this._keyHandlerMap;if(!C){C={};C[dojo.keys.TAB]="_onTab";C[dojo.keys.ENTER]="_onEnterKey";C[dojo.keys.LEFT_ARROW]="_onLeftArrow";C[dojo.keys.RIGHT_ARROW]="_onRightArrow";C[dojo.keys.UP_ARROW]="_onUpArrow";C[dojo.keys.DOWN_ARROW]="_onDownArrow";C[dojo.keys.HOME]="_onHomeKey";C[dojo.keys.END]="_onEndKey";C[dojo.keys.DELETE]="_onDelete";C[67]="_onCopy";C[99]="_onCopy";C[86]="_onPaste";C[118]="_onPaste";C[88]="_onCut";C[120]="_onCut";C[dojo.keys.F2]="_onRename"}if(C[D]){setTimeout(function(){A[C[D]]({node:B,item:B.item,shift:E.shiftKey,controller:A._controller})},500);dojo.stopEvent(E)}}},_onTabClicked:function(B){var A=this;top.myAppController.TabToNextMainCtrl(top.myFolderTree,!B.shift)},_onCopyClicked:function(B){var A=this;LF.Actions.Copy(B.controller._context)},_onPasteClicked:function(B){var A=this;LF.Actions.Paste(B.controller._context)},_onDeleteClicked:function(B){var A=this;LF.Actions.Delete(B.controller._context)},_onCutClicked:function(B){var A=this;LF.Actions.Cut(B.controller._context)},_onRenameClicked:function(B){var A=this;LF.Actions.Rename(B.controller._context)},setCtrlFocus:function(){if(top.myFolderTree._djTree.lastFocused){top.myFolderTree._djTree.focusNode(top.myFolderTree._djTree.lastFocused)}},getSelectedItems:function(){var A=this._openedFolder?[this._openedFolder]:[];var B="ENTRIES";return({items:A,type:B})},getLastSelectedItem:function(){var B=this._openedFolder;var A="ENTRIES";return({item:B,type:A})},getType:function(){return"FOLDER_TREE"},getId:function(){return this._container.id}};top.CommandBarButton=function(c,C,D,I,a,G,N,S){this._title=c;this._showImage=(C)?true:false;this._showText=D;this._hasMenu=(a)?true:false;this._commandID=I;this._isSplitButton=(I&&a)?true:false;this.disabled=false;this._hyperKey=N;if(!S){S=function(e){return e}}this.getImgURL=S;var T=this;var O=c.replace("&","");var E=document.createElement("div");E.className="OuterButtonDiv";var B=document.createElement("div");B.className=this._isSplitButton?"Button SplitButton":"Button";B.title=O;B.onmouseover=function(){top.SetOver(this)};B.onmouseout=function(){top.SetOut(this)};var M;if(this._isSplitButton){var M=document.createElement("div");M.className="ClickArea";B.appendChild(M)}else{M=B}M.tabIndex=1;if(this._showImage){var d=document.createElement("img");d.src=this.getImgURL("transparent.gif");d.alt=O;if(C){d.className="ActionIcon "+C}M.appendChild(d)}if(this._showText){if(N){var Q=c.toUpperCase();N=N.toUpperCase();var H=Q.indexOf("&");c=O;if(H==-1){B.title=O+" ("+N+")";M.appendChild(document.createTextNode(O))}else{var F=document.createElement("div");F.className="ClickArea";var V=document.createElement("div");V.appendChild(document.createTextNode(O.substr(0,H)));var J=document.createElement("u");J.appendChild(document.createTextNode(O.substr(H,1)));V.appendChild(J);V.appendChild(document.createTextNode(O.substr(H+1)));F.appendChild(V);M.appendChild(F)}}else{var A=document.createElement("div");A.innerHTML=O;M.appendChild(A)}}if(I){M.onmousedown=function(){SetDown(M)};M.onmouseout=function(){SetOut(M)};M.onmouseup=function(){SetUp(M)};M.onclick=function(){if(!T.disabled){T.notifySelect(I)}}}M.onkeydown=function(e){if(!e){e=window.event}var f=(e.keyCode)?e.keyCode:((e.charCode)?e.charCode:e.key);if(!T._hasMenu||!T._buttonMenu.IsOpen()){if(f==ENTER_KEY_CODE){M.onmousedown(e);M.onmouseup(e);M.onclick()}}else{T._buttonMenu.GetOnKeyDown()(e)}};if(this._hasMenu){if(this._isSplitButton){var Y=document.createElement("div");Y.className="DropDownSeparator";Y.innerHTML="&nbsp;";B.appendChild(Y)}var L=document.createElement("div");L.className="DropDownArrow";L.innerHTML="&nbsp;";B.appendChild(L);var Z=document.createElement("div");Z.className="Menu";Z.style.zIndex=801;Z.tabIndex=2;Z.style.top="25px";var K=document.createElement("iframe");K.className="MenuShim";if(G.rightAligned){Z.style.right="0px";K.style.right="0px"}else{Z.style.left="0px";K.style.left="0px"}E.appendChild(Z);E.appendChild(K);var P=this._isSplitButton?L:B;var R=new top.SimpleMenu(Z,K,P);for(var W=0;W<a.length;W++){var X=a[W];if(X!=null){var U=null;if(X.menu){var U=top.SimpleMenu.CreateMenu(X.menu,R.menuDiv.parentNode,R._focusDiv,true,R._bRawCoor,true)}R.AddItem(X.title,X.id,X.iconClass,false,U,X.hyperKey)}else{R.AddItem()}}R.onselect=function(){T.notifySelect(R.value);R.Hide()};if(this._isSplitButton){R.onpreshow=function(){SetDown(B);B.onmouseout=function(){top.SetOut(this,true)}};L.tabIndex=1;R.onhide=function(){SetUp(B);B.onmouseout=function(){top.SetOut(this)}};L.onmousedown=function(e){if(!e){e=window.event}top.SetDown(B);R.Toggle()};L.onmouseup=function(){R.onblur=function(){R.Hide()}};L.onblur=function(){R.Hide()};L.onkeydown=function(e){if(!e){e=window.event}if(!R.IsOpen()){var f=(e.keyCode)?e.keyCode:((e.charCode)?e.charCode:e.key);if(f==ENTER_KEY_CODE){R.Show()}}else{R.GetOnKeyDown()(e)}}}else{R.onpreshow=function(){SetDown(B);B.onmouseout=function(){top.SetOut(this,true)}};R.onhide=function(){SetUp(B);B.onmouseout=function(){top.SetOut(this)}};B.onmousedown=function(){top.SetDown(B);R.Toggle()};B.onblur=function(){R.Hide()};B.onkeydown=function(e){if(!e){e=window.event}var f=(e.keyCode)?e.keyCode:((e.charCode)?e.charCode:e.key);if(!R.IsOpen()){if(f==ENTER_KEY_CODE){R.Show()}}else{if(f==dojo.keys.ESCAPE){R.Toggle()}else{R.GetOnKeyDown()(e)}}}}this._buttonMenu=R}E.appendChild(B);this._outerDiv=E;this._buttonDiv=B};top.CommandBarButton.prototype={insertInto:function(A){A.appendChild(this._outerDiv)},notifySelect:function(A){if(this.onselect){this.onselect(A)}},Enable:function(){dojo.removeClass(this._buttonDiv,"Disabled");this.disabled=false},Disable:function(){dojo.addClass(this._buttonDiv,"Disabled");this.disabled=true},destroy:function(){this._buttonDiv.onmouseover=null;this._buttonDiv.onmouseout=null;this._buttonDiv.onblur=null;this._buttonDiv.onkeydown=null;this._buttonDiv.onmousedown=null;this._buttonDiv.onmouseup=null;this._buttonDiv.onmouseout=null;this._buttonDiv.onclick=null;if(this._isSplitButton){var A=this._buttonDiv.firstChild;A.onmouseover=null;A.onmouseout=null;A.onblur=null;A.onkeydown=null;A.onmousedown=null;A.onmouseup=null;A.onmouseout=null;A.onclick=null}}};top.CommandBar=function(C,A,B){this._div=C;this.rightAligned=A;this._buttons=new Array();this._actions={};this._imgPath=B;this.ContextMenuType=null};top.CommandBar.prototype={set_controller:function(A){var B=this;this._controller=A;dojo.connect(this._div,"oncontextmenu",dojo.hitch(this,this._onContextMenu));this.notifySelect=function(C){if(B._controller){B._controller.doAction(C)}}},_onContextMenu:function(A){var C=this;dojo.stopEvent(A);var D=this.ContextMenuType;this._menuscontainer=document.createElement("div");this._menuscontainer.style.position="relative";document.body.appendChild(this._menuscontainer);var B=this._controller.getContextMenuItems(D);if(!B||B.length==0){return false}var E=top.SimpleMenu.CreateMenu(B,this._menuscontainer);var F=dojo.coords(this._menuscontainer);E.Show(A.clientX-F.x,A.clientY-F.y);E.onselect=function(){C._controller.doAction(E.value);E.Hide()};E.onhide=function(){E.DeleteMenu()};if(this.onContextMenu){this.onContextMenu(node.item,node)}},AddButton:function(F,A,B,G,D,E){var C=new CommandBarButton(F,A,B,G,D,this,E,this._imgPath);C.insertInto(this._div);this._buttons.push(C);C.onselect=this.notifySelect},AddSeparator:function(){var A=document.createElement("div");A.className="Separator";this._div.appendChild(A);this._buttons.push(null)},Clear:function(){while(this._buttons.length>0){var A=this._buttons.pop();if(A){A.destroy()}}this._div.innerHTML=""},FindHyperKey:function(C){for(var B=0;B<this._buttons.length;B++){var A=this._buttons[B];if(A){if(A._hyperKey==String.fromCharCode(C.keyCode)){if(!A.disabled){if(A._hasMenu){A._buttonMenu.Show(false,false,true)}else{A.onselect()}}return true}else{if(A._buttonMenu.IsOpen()){if(A._buttonMenu.FindHyperKey(C)){return true}}}}}},MoveRightSelection:function(){var B=-1;for(var A=0;A<this._buttons.length;A++){if(this._buttons[A]._buttonMenu.IsOpen()){this._buttons[A]._buttonMenu.Toggle(true);B=A+1;if(B==this._buttons.length){B=0}break}}if(B!=-1){this._buttons[B]._buttonMenu.Toggle(true)}},MoveLeftSelection:function(){var B=-1;for(var A=0;A<this._buttons.length;A++){if(this._buttons[A]._buttonMenu.IsOpen()){this._buttons[A]._buttonMenu.Toggle(true);B=A-1;if(B==-1){B=this._buttons.length-1}break}}if(B!=-1){this._buttons[B]._buttonMenu.Toggle(true)}},UpdateSecurity:function(A,D){for(var C=0;C<this._buttons.length;C++){var B=this._buttons[C];if(B){if(B._commandID){var F=B._commandID;var E=this._controller.Actions.getActionPropertiesByID(F);if(E.enabledFunc){if(E.enabledFunc(A,D)){B.Enable()}else{B.Disable()}}}if(B._buttonMenu){B._buttonMenu.UpdateSecurity(A,D,this._controller)}}}}};top.QuickBar=function(E,B,A,D,C){this._controller=A;this._commandbar=new top.CommandBar(E,false,C);this._commandbar.ContextMenuType=top.CUSTOMIZE_TOOLBAR;this._commandbar.set_controller(A);this._callback=D;A.set_quickbar(this);this.set_definition(B);this._currentRootName="BrowseQuickBar";this._repository=A._context.repository};top.QuickBar.prototype={set_definition:function(A){this._commandbar.Clear();var B=false;for(var D=0;D<A.length;D++){var H=A[D];var G=H.Action;if(G){var I=this._controller.Actions.getActionProperties(G);if(I&&(I.hideFunc!=null)&&I.hideFunc(top.myAppController)){continue}var F=H.Title?H.Title:(I&&I.title)||"";var E=H.IconClass?H.IconClass:(I&&I.iconClass)||"";var C=E?H.ShowText:true;if(B){this._commandbar.AddSeparator();B=false}this._commandbar.AddButton(F,E,C,(I&&I.numid)||"")}else{B=true}}},LoadDefinition:function(H,G,E){if(!E&&H==this._currentRootName&&this._repository==G){return }var A=this;var D={RootName:H,RepositoryName:G};var I=Sys.Serialization.JavaScriptSerializer.serialize(D);var B=C;top.KillPendingCallbacks("QB");this._currentRootName=H;var C=function(J){A.onSuccess(J)};var F=function(K,L,J){A.onError(K,L,J)};this._callback(I,C,{callee:"QB"},F)},UpdateSecurity:function(A,B){this._commandbar.UpdateSecurity(A,B)},onSuccess:function(B,C){var A=this;if(C==null){C=0}result=Sys.Serialization.JavaScriptSerializer.deserialize(B);if(this._controller._checkingsecurity&&C<4){setTimeout(function(){A.onSuccess(B,++C)},500)}else{this.set_definition(result)}},onError:function(B,C,A){},FindHyperKey:function(A){this._commandbar.FindHyperKey(A)}};dojo.require("dojo.fx");top.DOWN_ARROW_KEY_CODE=40;top.UP_ARROW_KEY_CODE=38;top.ENTER_KEY_CODE=13;top.SimpleMenu=function(A,B,C,G,F,I){var E=this;this.menuDiv=A;this._issub=I;this._isopen=false;this._submenus=new Array();this._submenuIndices={};this._submenuRowPos={};this._focusDiv=C;this._bRawCoor=!!G;this._bRawY=!!F;var D=A.ownerDocument||document;var H=D.createElement("table");H.cellSpacing=0;A.appendChild(H);this.menuTable=H;this.shim=B;this.currentHoverRow=-1;this.menuDiv.onkeydown=function(R){R=R?R:window.event;var P=-1;var Q=(R.keyCode)?R.keyCode:((R.charCode)?R.charCode:R.key);var N=false;if(Q==DOWN_ARROW_KEY_CODE){if(E.currentHoverRow<E.menuTable.rows.length-1){for(var M=0;M<E._submenus.length;M++){if(E._submenus[M]._isopen){var O=E._submenus[M].currentHoverRow+1;if(O>=E._submenus[M].idNumbers.length){O=0}if(E._submenus[M].IsEmpty(E._submenus[M].menuTable.rows[O])){O++}E._submenus[M].HighlightRow(O);R.cancelBubble=true;R.returnValue=false;return }}var P=E.currentHoverRow+1;if(E.IsEmpty(E.menuTable.rows[P])){P++}}N=true}else{if(Q==UP_ARROW_KEY_CODE){if(E.currentHoverRow>0){for(var M=0;M<E._submenus.length;M++){if(E._submenus[M]._isopen){var O=E._submenus[M].currentHoverRow-1;if(O<0){O=E._submenus[M].idNumbers.length-1}if(E._submenus[M].IsEmpty(E._submenus[M].menuTable.rows[O])){O--}E._submenus[M].HighlightRow(O);R.cancelBubble=true;R.returnValue=false;return }}var P=E.currentHoverRow-1;if(E.IsEmpty(E.menuTable.rows[P])){P--}}N=true}else{if(Q==ENTER_KEY_CODE){for(var M=0;M<E._submenus.length;M++){if(E._submenus[M]._isopen){if(E._submenus[M].currentHoverRow>=0){E._submenus[M].SelectItem(E._submenus[M].idNumbers[E._submenus[M].currentHoverRow])}return }}if(E.currentHoverRow>=0){E.SelectItem(E.idNumbers[E.currentHoverRow])}}else{if(Q==dojo.keys.ESCAPE){E.currentHoverRow=-1;N=true}else{if(Q==dojo.keys.RIGHT_ARROW||Q==dojo.keys.LEFT_ARROW){if(Q==dojo.keys.RIGHT_ARROW){if(E.idNumbers[E.currentHoverRow]==0){var K=E.GetSubmenuByRow(E.currentHoverRow);if(K._isopen){top.myAppController._commandBar.MoveRightSelection()}else{K.opensubmenu(true)}}else{top.myAppController._commandBar.MoveRightSelection()}}else{if(Q==dojo.keys.LEFT_ARROW){var L=false;if(E._submenus){for(var M=0;M<E._submenus.length;M++){if(E._submenus[M]._isopen){var J=E.currentHoverRow;E._submenus[M].Toggle(true);if(J!=-1){E.HighlightRow(J)}L=true;break}}}if(!L){top.myAppController._commandBar.MoveLeftSelection()}}}}}}}}if(N){if(E._submenus){for(var M=0;M<E._submenus.length;M++){if(E._submenus[M]._isopen){E._submenus[M].Toggle()}}}if(P>=0){E.HighlightRow(P)}else{if(E.currentHoverRow==0){E.UnhighlightRow(0)}else{if(E.currentHoverRow==-1){E.Hide()}}}R.cancelBubble=true;R.returnValue=false}else{if(E.FindHyperKey(R)){R.cancelBubble=true;R.returnValue=false}}};this.Hide();this.rowNumbers=new Array();this.idNumbers=new Array();this.hyperKeyValue=new Array();this.onselect=function(){};this.value=""};top.SimpleMenu.ZIndex=801;top.SimpleMenu.CreateMenu=function(A,B,E,J,H,I){var F=B.ownerDocument||document;var D=F.createElement("div");if(!E){E=D;D.tabIndex=1}D.className="Menu";D.style.zIndex=top.SimpleMenu.ZIndex;D.style.left="0px";D.style.top="28px";D.style.visibility="hidden";var G=F.createElement("iframe");G.className="MenuShim";G.style.display="none";B.appendChild(D);B.appendChild(G);var C=new top.SimpleMenu(D,G,E,H,I,J);C.SetItems(A);if(J){D.onmouseover=function(){C.Show()};D.onmouseout=function(){C.Hide(100)}}if(D.tabIndex){D.onkeydown=function(K){if(!K){K=window.event}if(dojo.keys.ESCAPE==K.keyCode){C.Hide()}};D.onblur=function(){C.Hide()}}return C};top.SimpleMenu.prototype={IsOpen:function(){return this._isopen},GetSubmenuByID:function(A){return this._submenus[this._submenuIndices[A]]},GetSubmenuByRow:function(A){return this._submenus[this._submenuRowPos[A]]},GetOpenedSubmenu:function(){for(var A=0;A<this._submenus.length;A++){if(this._submenus[A]._isopen){return this._submenus[A]}}return null},Show:function(A,F,D,C){var E=this;if(E._hideTimer){clearTimeout(E._hideTimer)}E._hideTimer=null;if(E.onpreshow){E.onpreshow()}if(this._isopen){return }this._isopen=true;if(A&&F){E.SetCoords(A,F,E._bRawCoor)}if(this.currentHoverRow>=0){this.UnhighlightRow(this.currentHoverRow)}this.currentHoverRow=-1;if(D){this.currentHoverRow=0;this.HighlightRow(0)}var B=function(){if(!E.IsOpen()){return }E.shim.style.top=E.menuDiv.style.top;E.shim.style.left=E.menuDiv.style.left;E.shim.style.zIndex=E.menuDiv.style.zIndex-1;E.shim.style.width=E.menuDiv.offsetWidth;E.shim.style.height=E.menuDiv.offsetHeight;E.shim.style.display="block";if(E.onshow){E.onshow()}if(E._focusDiv&&!C){E._focusDiv.focus()}};this.menuDiv.style.visibility="";setTimeout(B,1)},Hide:function(A){var C=this;if(C._hideTimer){clearTimeout(C._hideTimer)}C._hideTimer=null;for(var B=0;B<C._submenus.length;B++){C._submenus[B].Hide()}var D=function(){C._isopen=false;if(C.shim){C.shim.style.display="none"}if(C.menuDiv){C.menuDiv.style.visibility="hidden"}if(C.onhide){C.onhide()}};if(A){C._hideTimer=setTimeout(D,A)}else{D()}},FindHyperKey:function(C){var B=this.GetOpenedSubmenu();if(B){for(var A=0;A<B.hyperKeyValue.length;A++){if(B.hyperKeyValue[A]==String.fromCharCode(C.keyCode)){var F=B.idNumbers[A];if(F){this.SelectItem(F)}return true}}}for(var E in this.idNumbers){if(this.hyperKeyValue[E]==String.fromCharCode(C.keyCode)){if(this.idNumbers[E]){this.SelectItem(this.idNumbers[E])}else{var D=this.menuTable.rows[E];D.onmouseover()}return true}}return false},Toggle:function(A){if(this.IsOpen()){this.Hide()}else{this.Show(false,false,A)}},SetItems:function(C){this.ClearItems();for(var B=0;B<C.length;B++){var D=C[B];if(D!=null){var A=null;if(D.menu){A=top.SimpleMenu.CreateMenu(D.menu,this.menuDiv.parentNode,this._focusDiv,true,this._bRawCoor,this._bRawY)}this.AddItem(D.title,D.id,D.iconClass,false,A,D.hyperKey)}else{this.AddItem()}}},ClearItems:function(){while(this._submenus.length>0){var A=this._submenus.pop();A.DeleteMenu()}this._submenuIndices={};this._submenuRowPos={};this.RemoveChildren(this.menuTable,true)},AddItem:function(A,B,N,J,D,M){var K=this;var G=this.menuDiv.ownerDocument||document;var Q=this.menuTable.rows.length;var P=this.menuTable.insertRow(Q);if(!A){P.className="EmptyRow";var O=P.insertCell(0);O.colSpan=3;var L=G.createElement("div");O.appendChild(L);P.onmousedown=function(){top.IgnoreNextBlur(K._focusDiv)}}else{P.className="Row";if(J){P.className="Row Disabled"}if(D){P.onmousedown=function(){if(B!=top.myAppController.Actions.NOACTION_ID){K.SelectItem(B)}top.IgnoreNextBlur(K._focusDiv)};P.onmouseover=function(){if(B!=top.myAppController.Actions.NOACTION_ID){K.HighlightRow(Q)}D.opensubmenu(false)};P.onmouseout=function(){K.UnhighlightRow(Q);D.Hide(100)};D.opensubmenu=function(U){K.HighlightRow(Q);var T=dojo.coords(D.menuDiv.parentNode);var S=dojo.coords(K.menuTable);var R=S.x+K.menuTable.offsetWidth-2-T.x;var V=S.y+P.offsetTop-2-T.y;D.Show(R,V,U)};D.onpreshow=function(){K.HighlightRow(Q)};D.onhide=function(){K.UnhighlightRow(Q)};D.onselect=function(){K.SelectItem(D.value)};this._submenuIndices[B]=this._submenus.length;this._submenuRowPos[Q]=this._submenus.length;this._submenus.push(D);K.HighlightRow(Q)}else{P.onmouseover=function(){K.HighlightRow(Q)};P.onmouseout=function(){K.UnhighlightRow(Q)};P.onmousedown=function(){K.SelectItem(B)}}var O=P.insertCell(0);O.className="IconCell";var I=G.createElement("div");if(N){I.className="ActionIcon "+N}O.appendChild(I);O=P.insertCell(1);var H=G.createElement("nobr");O.className="NameCell";if(M){var F=A.toUpperCase();M=M.toUpperCase();var E=F.indexOf("&");A=A.replace("&","");if(E==-1){H.appendChild(G.createTextNode(A));O.appendChild(H);O=P.insertCell(2);O.appendChild(G.createTextNode("Ctrl+Alt+"+M))}else{H.appendChild(G.createTextNode(A.substr(0,E)));var C=G.createElement("u");C.appendChild(G.createTextNode(A.substr(E,1)));H.appendChild(C);H.appendChild(G.createTextNode(A.substr(E+1)));O.appendChild(H);O=P.insertCell(2)}}else{H.appendChild(G.createTextNode(A));O.appendChild(H);O=P.insertCell(2)}if(D){O=P.insertCell(3);O.className="SubArrow";O.innerHTML="&nbsp;&nbsp;&nbsp;&nbsp;"}this.idNumbers[Q]=B;this.rowNumbers[B]=Q;this.hyperKeyValue[Q]=M}},SelectItem:function(D){var C=this;var B=this.rowNumbers[D];if(B!=null){var A=this.menuTable.rows[B];if(this.IsDisabled(A)){top.IgnoreNextBlur(C._focusDiv);return false}}this.value=D;if(this.onselect){this.onselect()}},HighlightRow:function(D){if(this.currentHoverRow>=0){this.UnhighlightRow(this.currentHoverRow)}var C=this.menuTable.rows[D];var A=C.className;var B=A.indexOf(" RowOver");if(B<0){C.className=A+" RowOver"}this.currentHoverRow=D;return true},UnhighlightRow:function(C){var B=this.menuTable.rows[C];var A=B.className;B.className=A.replace(" RowOver","");if(this.currentHoverRow==C){this.currentHoverRow=-1}},IsEmpty:function(C){var A=C.className;var B=A.indexOf("EmptyRow");return(B>=0)},RowHasClass:function(B,A){return dojo.hasClass(B,A)},HasClass:function(C,B){var A=this.rowNumbers[C];if(A!=null){return this.RowHasClass(this.menuTable.rows[A],B)}return false},SetItemClass:function(D,B){var A=this.rowNumbers[D];if(A!=null){var C=this.menuTable.rows[A];dojo.addClass(C,B)}},UnsetItemClass:function(D,B){var A=this.rowNumbers[D];if(A!=null){var C=this.menuTable.rows[A];dojo.removeClass(C,B)}},IsDisabled:function(A){return this.RowHasClass(A,"Disabled")},EnableBold:function(C){var A=this.rowNumbers[C];if(A!=null){var B=this.menuTable.rows[A];dojo.style(B.childNodes[1],"fontWeight","bold")}},EnableItem:function(A){this.UnsetItemClass(A,"Disabled")},DisableItem:function(A){this.SetItemClass(A,"Disabled")},HideItem:function(A){this.SetItemClass(A,"Hide")},ShowItem:function(A){this.UnsetItemClass(A,"Hide")},SetDisabledItems:function(C){var D=this.menuTable.rows.length;for(var B=0;B<D;B++){var E=this.menuTable.rows[B];dojo.removeClass(E,"Disabled")}var A=C.length;for(var B=0;B<A;B++){this.DisableItem(C[B])}for(var B=0;B<this._submenus.length;B++){this._submenus[B].SetDisabledItems(C)}},UpdateSecurity:function(A,D,B){if(this.menuTable==null){return }for(var F in this.rowNumbers){var E=B.Actions.getActionPropertiesByID(F);if(E.enabledFunc){if(E.enabledFunc(A,D)){this.EnableItem(F)}else{this.DisableItem(F)}}else{this.EnableItem(F)}if(E.boldFunc){if(E.boldFunc(A,D)){this.EnableBold(F)}}}for(var C=0;C<this._submenus.length;C++){this._submenus[C].UpdateSecurity(A,D,B)}},GetOnKeyDown:function(){return this.menuDiv.onkeydown},SetCoords:function(C,H,B){if(B){this.menuDiv.style.left=C+"px";this.menuDiv.style.top=H+"px";return }var A=this.menuDiv.parentNode.offsetHeight;var F=this.menuDiv.parentNode.offsetWidth;var G=this.GetDimensions();var E=C;if(C+G.x>F){E=(this._issub)?C-2*G.x+5:F-G.x-5}var D=H;if(!this._bRawY&&(H+G.y>A)){D=A-G.y-5}this.menuDiv.style.left=E+"px";this.menuDiv.style.top=D+"px"},GetDimensions:function(){return{x:this.menuDiv.offsetWidth,y:this.menuDiv.offsetHeight}},RemoveChildren:function(B,C){for(var A=B.childNodes.length-1;A>-1;A--){top.SimpleMenu.prototype.RemoveChildren(B.childNodes[A])}if(!C){if(B.tagName=="TR"){B.onmouseover=null;B.onmouseout=null;B.onmousedown=null}B.parentNode.removeChild(B)}},ReleaseDOMElements:function(){while(this._submenus&&this._submenus.length>0){var A=this._submenus.pop();A.DeleteMenu()}if(this.menuDiv){this.menuDiv.onkeydown=null;this.menuDiv=null}if(this.menuTable){this.RemoveChildren(this.menuTable);this.menuTable=null}this.onselect=null;try{this.shim.parentNode.removeChild(this.shim)}catch(B){}this.shim=null},DeleteMenu:function(){var A=this.menuDiv;this.ReleaseDOMElements();try{A.parentNode.removeChild(A)}catch(B){}},UpdateContextMenu:function(G){var C=this;var H=1;var D=100;for(var B in this.rowNumbers){var E=G.Actions.getActionPropertiesByID(B);C.DisableItem(B);if(E.hideFunc){if(E.hideFunc(G)){this.HideItem(B)}else{this.ShowItem(B)}}}for(var F=0;F<C._submenus.length;F++){var A=C._submenus[F];if(A){for(var I in A.rowNumbers){A.DisableItem(I)}}}setTimeout(function(){if(G._lastSecParams){C.UpdateSecurity(G._lastSecParams,G._context,G)}else{if(H>D){return }else{H++;setTimeout(arguments.callee,50)}}},100)}};Type.registerNamespace("Laserfiche");Type.registerNamespace("Laserfiche.Layout");Laserfiche.Layout.Scroller=function(C,B){var A=this;A._scrolldiv=C;while(C.firstChild){C.removeChild(C.firstChild)}C.style.backgroundColor="transparent";A._innerdiv=top.document.createElement("div");A._innerdiv.style.height="1px";A._innerdiv.style.width="1px";A._innerdiv.style.backgroundColor="transparent";A._innerdiv.innerHTML="&nbsp;";C.appendChild(A._innerdiv);A._horizontal=B;if(B){C.style.height="18px";C.style.overflow="scroll";C.style.overflowY="hidden"}else{C.style.width="18px";C.style.overflow="scroll";C.style.overflowX="hidden"}};Laserfiche.Layout.Scroller.prototype={initialize:function(){var A=this;A._scrolldiv.onscroll=A.HandleScroll();A.set_position(0)},set_length:function(B){var A=this;if(A._horizontal){A._innerdiv.style.width=B+"px"}else{A._innerdiv.style.height=B+"px"}A._update()},set_actualLength:function(B){var A=this;var C=0;if(A._horizontal){A._scrolldiv.style.width=B+"px";C=parseInt(A._innerdiv.style.width)}else{A._scrolldiv.style.height=B+"px";C=parseInt(A._innerdiv.style.height)}A._update()},move_position:function(C){var B=this;var E=B._horizontal?B._scrolldiv.scrollWidth:B._scrolldiv.scrollHeight;var F=parseInt(B._horizontal?B._innerdiv.style.width:B._innerdiv.style.height);var D=C/F;var A=parseInt(D*E);B.set_position(Math.min(Math.max(0,B.get_position()+A),F))},set_position:function(B,E,D){var C=this;var A=B;if(E){var G=C._horizontal?C._scrolldiv.scrollWidth:C._scrolldiv.scrollHeight;var H=parseInt(C._horizontal?C._innerdiv.style.width:C._innerdiv.style.height);var F=B/H;A=parseInt(F*G)}if(C._horizontal){C._scrolldiv.scrollLeft=A}else{C._scrolldiv.scrollTop=A}if(!D){C.HandleScroll()}},get_position:function(){if(this._horizontal){return this._scrolldiv.scrollLeft}else{return this._scrolldiv.scrollTop}},get_scrollPercent:function(){if(this._horizontal){return this._scrolldiv.scrollLeft/this._scrolldiv.scrollWidth}else{return this._scrolldiv.scrollTop/this._scrolldiv.scrollHeight}},HandleScroll:function(){var A=this;return function(B){if(A.onscroll){var C=function(){var G=parseInt(A._horizontal?A._innerdiv.style.width:A._innerdiv.style.height);var E=parseInt(A._horizontal?A._scrolldiv.style.width:A._scrolldiv.style.height);var D=A.get_scrollPercent();var F=parseInt(G*D);A.onscroll(F);A._lastTimeout=null};if(A._lastTimeout){window.clearTimeout(A._lastTimeout)}A._lastTimeout=window.setTimeout(C,10)}}},_update:function(){var A=this;var C=parseInt(A._horizontal?A._innerdiv.style.width:A._innerdiv.style.height);var B=parseInt(A._horizontal?A._scrolldiv.style.width:A._scrolldiv.style.height);A._scrolldiv.style.display=(C<=B)?"none":""},pageUp:function(){var A=this;var B=parseInt(A._horizontal?A._scrolldiv.style.width:A._scrolldiv.style.height);A.move_position(-B)},pageDown:function(){var A=this;var B=parseInt(A._horizontal?A._scrolldiv.style.width:A._scrolldiv.style.height);A.move_position(B)},pageHome:function(){this.set_position(0)},pageEnd:function(){var A=this;var B=parseInt(A._horizontal?A._innerdiv.style.width:A._innerdiv.style.height);A.set_position(B,true)},checkNeedScroll:function(C){var A=this;var B=parseInt(A._horizontal?A._innerdiv.style.width:A._innerdiv.style.height);return B>C}};Laserfiche.Layout.Scroller.registerClass("Laserfiche.Layout.Scroller");Type.registerNamespace("Laserfiche");Type.registerNamespace("Laserfiche.Layout");Laserfiche.Layout.Splitter=function(C,D,H,A,G,E){var B=this;this.splitterId=C;this.container=D;this.main=H;this.sub=A;this.direction=G;this.minmain=1;this.minsub=1;this.collapsed=false;this.collapsable=!E;this.width=5;this.length=1;var I=document.getElementById(C);I.style.overflow="hidden";I.style.height=this.width+"px";I.style.width=this.width+"px";switch(G){case"N":I.style.position="relative";I.className="SplitterHorizontal";this.arrowNormalClass="SplitterArrowNorth";this.arrowCollapsedClass="SplitterArrowSouth";break;case"S":I.style.position="relative";I.className="SplitterHorizontal";this.arrowNormalClass="SplitterArrowSouth";this.arrowCollapsedClass="SplitterArrowNorth";break;case"W":I.style.position="absolute";I.className="SplitterVertical";this.arrowNormalClass="SplitterArrowWest";this.arrowCollapsedClass="SplitterArrowEast";break;case"E":I.style.position="absolute";I.className="SplitterVertical";this.arrowNormalClass="SplitterArrowEast";this.arrowCollapsedClass="SplitterArrowWest";break}if(this.collapsable){var F=top.document.createElement("div");F.style.position="absolute";F.style.top="0px";F.style.left="0px";F.onmousedown=function(J){if(!J){J=window.event}B.ToggleCollapse();dojo.stopEvent(J)};F.className=this.arrowNormalClass;I.appendChild(F);this.collapseArrow=F}I.onmousedown=B._getStartDragHandler()};Laserfiche.Layout.Splitter.prototype={set_Length:function(A){this.length=A;if(this.direction=="N"||this.direction=="S"){document.getElementById(this.splitterId).style.width=A+"px";if(this.collapsable){this.collapseArrow.style.left=parseInt(A/2)+"px"}}else{document.getElementById(this.splitterId).style.height=A+"px";if(this.collapsable){this.collapseArrow.style.top=parseInt(A/2)+"px"}}},get_Length:function(){return this.length},set_AvailableWidth:function(A){this._availableWidth=A;this.ResizePanes()},set_MinMainSize:function(A){this.minmain=A},set_MinSubSize:function(A){this.minsub=A},set_collapsed:function(B){var A=this;if(B!=A.collapsed){A.ToggleCollapse()}},ToggleCollapse:function(){var A=this;if(!A.collapsable){return }document.getElementById(A.sub).style.display=A.collapsed?"block":"none";A.collapsed=!A.collapsed;A.collapseArrow.className=A.collapsed?A.arrowCollapsedClass:A.arrowNormalClass;A.ResizePanes()},_notifyResize:function(){if(this.onresize){this.onresize()}},_getStartDragHandler:function(){var A=this;return function(G){if(!A.dragging){if(!G){G=window.event}var C=G.clientX;var H=G.clientY;var F=document.createElement("div");F.style.position="absolute";F.style.left="0px";F.style.top="0px";F.style.height="100%";F.style.width="100%";F.style.backgroundColor="transparent";F.style.zIndex=200;var B=document.createElement("div");var D=document.getElementById(A.splitterId);B.style.height=D.style.height;B.style.width=D.style.width;B.style.backgroundColor=D.style.backgroundColor;B.style.overflow="hidden";B.style.position="absolute";B.style.left="0px";B.style.top="0px";B.style.zIndex=200;B.className=D.className;dojo.style(B,"opacity",0.6);switch(A.direction){case"N":A.mainvalue=parseInt(document.getElementById(A.main).style.height);A.subvalue=parseInt(document.getElementById(A.sub).style.height);A.markerpos=A.subvalue;B.style.top=A.markerpos+"px";break;case"S":A.mainvalue=parseInt(document.getElementById(A.main).style.height);A.subvalue=parseInt(document.getElementById(A.sub).style.height);A.markerpos=A.mainvalue;B.style.top=A.markerpos+"px";break;case"W":A.mainvalue=parseInt(document.getElementById(A.main).style.width);A.subvalue=parseInt(document.getElementById(A.sub).style.width);A.markerpos=A.subvalue;B.style.left=A.markerpos+"px";break;case"E":A.mainvalue=parseInt(document.getElementById(A.main).style.width);A.subvalue=parseInt(document.getElementById(A.sub).style.width);A.markerpos=A.mainvalue;B.style.left=A.markerpos+"px";break}var E=document.getElementById(A.container);A.container_mousemove=E.onmousemove;A.container_mouseup=E.onmouseup;A.container_selectstart=E.onselectstart;E.onmousemove=A._getMoveHandler();E.onmouseup=A._getEndDragHandler();E.onselectstart=function(){return false};E.appendChild(F);F.appendChild(B);A.trueoffset=0;A.offset=0;A.lastCoords={x:C,y:H};A.markerdiv=F;A.marker=B;A.dragging=true;if(A.onstartdrag){A.onstartdrag()}dojo.stopEvent(G)}}},_getMoveHandler:function(){var A=this;return function(C){if(!A.dragging){return }if(!C){C=window.event}var G=C.clientX;var F=C.clientY;var K=G-A.lastCoords.x;var J=F-A.lastCoords.y;A.lastCoords={x:G,y:F};var E=false;var I=false;var B;switch(A.direction){case"N":A.trueoffset=A.trueoffset+J;toMain=-J;I=true;E=true;break;case"S":A.trueoffset=A.trueoffset+J;toMain=J;E=true;break;case"W":A.trueoffset=A.trueoffset+K;toMain=-K;I=true;break;case"E":A.trueoffset=A.trueoffset+K;toMain=K;break}if(A.trueTooBig&&A.trueoffset<=A.offset){A.trueTooBig=false}else{if(A.trueTooSmall&&A.trueoffset>=A.offset){A.trueTooSmall=false}}var D=A.mainvalue+toMain;var H=A.subvalue-toMain;if(D<A.minmain){toMain=A.minmain-A.mainvalue;if(A.trueoffset>A.offset){A.trueTooBig=true}else{A.trueTooSmall=true}}else{if(H<A.minsub){toMain=A.subvalue-A.minsub;if(A.trueoffset>A.offset){A.trueTooBig=true}else{A.trueTooSmall=true}}}if(A.trueTooBig||A.trueTooSmall){return }A.mainvalue=A.mainvalue+toMain;A.subvalue=A.subvalue-toMain;A.offset=A.offset+(I?-toMain:toMain);if(E){A.marker.style.top=A.markerpos+A.offset+"px"}else{A.marker.style.left=A.markerpos+A.offset+"px"}dojo.stopEvent(C)}},_getEndDragHandler:function(){var A=this;return function(D){if(!A.dragging){return }if(!D){D=window.event}var E=document.getElementById(A.sub);var C=isNaN(A.subvalue)?"0px":A.subvalue+"px";switch(A.direction){case"N":case"S":E.style.height=C;break;case"W":case"E":E.style.width=C;break}var B=document.getElementById(A.container);A.markerdiv.removeChild(A.marker);B.removeChild(A.markerdiv);A.markerdiv=null;A.marker=null;B.onmousemove=A.container_mousemove;B.onmouseup=A.container_mouseup;B.onselectstart=A.container_selectstart;A.container_mousemove=null;A.container_mouseup=null;A.container_selectstart=null;A.dragging=false;A.trueTooBig=false;A.trueTooSmall=false;A.ResizePanes();if(A.onenddrag){A.onenddrag()}dojo.stopEvent(D)}},ResizePanes:function(){var E=this;var A=(E.direction=="N"||E.direction=="S");var B=0;if(!E.collapsed){var F=document.getElementById(E.sub);var C=F.style;if(A){B=parseInt(C.height)}else{B=parseInt(C.width)}if(isNaN(B)){B=0}}var D=E._availableWidth-E.width-B;if(D<E.minmain){var G=Math.min(E.minmain-D,B-5);D=D+G;if(D<1){D=1}if(A){document.getElementById(E.sub).style.height=B-G+"px"}else{document.getElementById(E.sub).style.width=B-G+"px"}}if(A){document.getElementById(E.main).style.height=D+"px"}else{document.getElementById(E.main).style.width=D+"px";if(E.direction=="E"){document.getElementById(E.splitterId).style.left=D+"px";document.getElementById(E.sub).style.left=D+this.width+"px"}else{document.getElementById(E.splitterId).style.left=B+"px";document.getElementById(E.main).style.left=B+this.width+"px"}}E._notifyResize()},Release:function(){this.collapseArrow=null}};Laserfiche.Layout.Splitter.registerClass("Laserfiche.Layout.Splitter");top.DialogWrapper=function(D){var C=this;this._id=D+"_DialogWrapper";this._name=D;this._result=null;this._help="";this._isShowing=false;this._url=null;this._inDOM=false;this._relativeX=0;this._relativeY=0;this._centered=true;this._ismodal=false;this._fog=document.createElement("div");this._fog.className="DialogFog";this._fog.style.zIndex=900;this._shim=document.createElement("iframe");this._shim.frameBorder=0;this._shim.style.position="absolute";this._shim.style.display="none";this._shim.style.zIndex=900;this._div=document.createElement("div");this._div.className="FFCursorFix";this._div.style.display="none";this._div.style.zIndex=900;this._headerDiv=document.createElement("div");this._headerDiv.className="DialogTop";var G=document.createElement("div");G.className="DialogTopLeft";this._headerDiv.appendChild(G);this._titleDiv=document.createElement("div");this._titleDiv.className="DialogTitle";this._headerDiv.appendChild(this._titleDiv);var B=document.createElement("div");B.className="DialogTopRight";this._headerDiv.appendChild(B);this.CloseButton=document.createElement("a");this.CloseButton.className="DialogClose";this.CloseButton.href="javascript:void(0);";this.CloseButton.appendChild(document.createElement("div"));this._headerDiv.appendChild(this.CloseButton);this._div.appendChild(this._headerDiv);this._contentDiv=document.createElement("div");this._contentDiv.style.position="relative";var E=document.createElement("div");E.className="DialogLeft";this._contentDiv.appendChild(E);this._mainDiv=document.createElement("div");this._mainDiv.className="DialogContent";this._mainDiv.style.position="absolute";this._mainDiv.style.left="8px";this._mainDiv.style.top="0px";this._dummyNode=document.createElement("div");this._iframe=document.createElement("iframe");this._iframe.frameBorder=0;this._iframe.style.display="block";this._mainDiv.appendChild(this._iframe);this._buttonsPanel=document.createElement("div");this._buttonsPanel.className="DialogButtonPanel";this.OKButton=document.createElement("button");this.OKButton.innerHTML="OK";this.OKButton.style.width="11em";this._buttonsPanel.appendChild(this.OKButton);this.CancelButton=document.createElement("button");this.CancelButton.innerHTML="Cancel";this.CancelButton.style.width="11em";this._buttonsPanel.appendChild(this.CancelButton);this.HelpButton=document.createElement("button");this.HelpButton.innerHTML="Help";this._buttonsPanel.appendChild(this.HelpButton);this._mainDiv.appendChild(this._buttonsPanel);this._contentDiv.appendChild(this._mainDiv);var H=document.createElement("div");H.className="DialogRight";this._contentDiv.appendChild(H);this._div.appendChild(this._contentDiv);this._contentLDiv=E;this._contentRDiv=H;this._footerDiv=document.createElement("div");this._footerDiv.className="DialogBottom";var F=document.createElement("div");F.className="DialogBottomLeft";this._footerDiv.appendChild(F);var A=document.createElement("div");A.className="DialogBottomRight";this._footerDiv.appendChild(A);this._div.appendChild(this._footerDiv);this.CloseButton.onclick=function(){C._result=null;if(C.onclickClose){C.onclickClose()}C.Close();return false};this.CloseButton.onkeydown=function(I){if(!C._lastButton){return }I=(!I)?window.event:I;var J=I.key?I.key:I.keyCode;if(I.shiftKey&&J==dojo.keys.TAB){C._lastButton.focus();I.cancelBubble=true;I.returnValue=false}};this.CancelButton.onclick=function(){C._result=null;if(C.onclickCancel){C.onclickCancel()}C.Close();return false};this.OKButton.onclick=function(){C.OKButton.disabled=true;var I=true;if(C.onclickOK){I=C.onclickOK()}if(I){C.Close()}return false};this.HelpButton.onclick=function(){if(C._help){window.open(C._help)}return false};this._lastButton=this.HelpButton};top.DialogWrapper.prototype={RepoVariants:["db","repository","Repository","repositoryName","RepositoryName","repo","Repo","repoName","RepoName","r","R"],RepoFromUrl:function(A){var E={};var D="";dojo.forEach(A.split("?"),function(F){dojo.mixin(E,dojo.queryToObject(F))});dojo.some(this.RepoVariants,function(F){if(!!E[F]){D=E[F];return true}});var B=/^\"(.*)\"$/;var C=B.exec(D);if(!C){B=/^'(.*)'$/;C=B.exec(D)}return((C&&C.length)?C[1]:D)},Show:function(C){C=true;this.HideButtons();this._ismodal=C;if(!this._inDOM){document.body.appendChild(this._fog);document.body.appendChild(this._shim);document.body.appendChild(this._div);this._inDOM=true;var A=this;dojo.connect(window,"onresize",function(){A.AdjustPosition()})}if(this._ismodal){this._fog.style.display="block"}this._isShowing=true;this._shim.style.display="";var B=this._dummyNode.parentNode;if(B){B.replaceChild(this._iframe,this._dummyNode)}this._div.style.display="";this.AdjustPosition()},OpenModalDialog:function(B,A,C){this.OpenDialog(B,A,C,true)},OpenDialog:function(B,N,C,L,H){function F(){alert("Login failed.");D._bWaitOnShow=false}function G(){D._bWaitOnShow=false;D._iframe.src=J;D.Show(L)}function I(O){if(!!O){G()}else{E()}}function E(){var Q=D.RepoFromUrl(J);if(!Q){G();return }if(K){F();return }K=true;var O=top.getAvailableLoginDlg();if(!O){F()}var P=top.isLoggedIn(Q)?dojo.string.substitute("Session timeout occurred. Please log in to the Laserfiche repository '${0}'",[Q]):"";var R={RepositoryName:Q,m:P};var S=dojo.string.substitute("${0}?${1}",["Dialogs/LoginDialog.aspx",dojo.objectToQuery(R)]);O.OpenDialog(S,320,378,false,true);O.onclose=function(T){top.CurrentLoginDlg=null;if(T&&T.success){top.myAppController.changeLogin(Q,T.info);A.apply()}else{top.myAppController.changeLogin(Q,null);F()}}}var D=this;var K=false;this._result=null;this._bWaitOnShow=true;this.onclickOK=null;this.set_OKName("OK");this.set_title("Loading...");this.SetSize(N,C);var J=B;if(B.indexOf("?")>=0){J=J+"&dialog="+this._name}else{J=J+"?dialog="+this._name}var M=D.RepoFromUrl(J);var A=M?function(){Laserfiche.WebAccess.DocumentService.HasDbConnection(M,I,E)}:function(){Laserfiche.WebAccess.DocumentService.HasSession(I,E)};if(!H){A.apply()}else{G(true)}},Close:function(){this._isShowing=false;this._shim.style.display="none";this._iframe.src="blank.html";var A=this._iframe.parentNode;if(A){A.replaceChild(this._dummyNode,this._iframe)}this._div.style.display="none";this._fog.style.display="none";this._fog.style.height="1px";this._fog.style.width="1px";if(this.onclose){this.onclose(this._result)}},set_title:function(A){this._titleDiv.innerHTML="";this._titleDiv.appendChild(document.createTextNode(A))},set_result:function(A){this._result=A},get_result:function(){return this._result},set_help:function(A){this._help=A;if(A==null||A.length==0){this.HelpButton.style.display="none"}else{this.HelpButton.style.display=""}this.HandleButtonChange()},set_OKName:function(A){this.OKButton.innerHTML=A},set_CancelName:function(A){this.CancelButton.innerHTML=A},get_isShowing:function(){var A=!!this._isShowing;return A},get_isWaitingForShow:function(){return !!this._bWaitOnShow},SetSize:function(A,B){A=parseInt(A);B=parseInt(B);this._titleDiv.style.width=B+2+"px";this._mainDiv.style.width=B+"px";this._iframe.style.width=B+"px";this._iframe.style.height=A+"px";this._contentDiv.style.width=B+18+"px";this._contentDiv.style.height=A+((this._buttonsPanel.style.display=="none")?0:35)+"px";this._contentLDiv.style.height=this._contentDiv.style.height;this._contentRDiv.style.height=this._contentDiv.style.height;this._div.style.width=this._contentDiv.style.width;this._div.style.height=this._contentDiv.style.height},HideButtons:function(){this._buttonsPanel.style.display="none";this._contentDiv.style.height=this._iframe.style.height;this._contentLDiv.style.height=this._contentDiv.style.height;this._contentRDiv.style.height=this._contentDiv.style.height;this.AdjustPosition()},ShowButtons:function(){this._buttonsPanel.style.display="";this._contentDiv.style.height=parseInt(this._iframe.style.height)+35+"px";this._contentLDiv.style.height=this._contentDiv.style.height;this._contentRDiv.style.height=this._contentDiv.style.height;this.AdjustPosition()},HandleButtonChange:function(){var A=this;if(this._lastButton){this._lastButton.onkeydown=null;this._lastButton=null}if(this.HelpButton.style.display!="none"){this._lastButton=this.HelpButton}else{if(this.CancelButton.style.display!="none"){this._lastButton=this.CancelButton}else{if(this.OKButton.style.display!="none"){this._lastButton=this.OKButton}}}if(this._lastButton){this._lastButton.onkeydown=function(B){B=(!B)?window.event:B;var C=B.key?B.key:B.keyCode;if(C==dojo.keys.TAB){A.CloseButton.focus();B.cancelBubble=true;B.returnValue=false}}}},HideCancel:function(){this.CancelButton.style.display="none";this.HandleButtonChange()},ShowCancel:function(){this.CancelButton.style.display="";this.HandleButtonChange()},SetRelativeOffset:function(A,B){this._relativeX=A;this._relativeY=B;this.AdjustPosition()},GetRelativeOffset:function(){return{x:this._relativeX,y:this._relativeY}},IsCentered:function(){return !!this._centered},SetPositionArgs:function(A){this._centered=false;for(positionArg in A){switch(positionArg){case"left":this._div.style.right=null;this._div.style.left=A[positionArg]+"px";break;case"right":this._div.style.left=null;this._div.style.right=A[positionArg]+"px";break;case"top":this._div.style.bottom=null;this._div.style.top=A[positionArg]+"px";break;case"bottom":this._div.style.top=null;this._div.style.bottom=A[positionArg]+"px";break}}this.AdjustPosition()},Center:function(){this._centered=true;this.AdjustPosition()},AdjustPosition:function(){if(!this._isShowing){return }var B=dijit.getViewport();var A=B.h;var E=B.w;var D=this._div.offsetHeight;var C=this._div.offsetWidth;if(!this._centered){if(this._ismodal){this._fog.style.height=Math.max(A,this._div.offsetTop+D)+"px";this._fog.style.width=Math.max(E,this._div.offsetLeft+C)+"px";this._shim.style.top=this._div.offsetTop+"px";this._shim.style.left=this._div.offsetLeft+8+"px";this._shim.style.height=D+"px";this._shim.style.width=C-16+"px"}return }var G=Math.min(200,Math.max(0,parseInt((A-D)/2)));var F=Math.max(0,parseInt((E-C)/2));this._div.style.left=F+this._relativeX+"px";this._div.style.top=G+this._relativeY+"px";this._shim.style.left=F+this._relativeX+8+"px";this._shim.style.top=this._div.style.top;this._shim.style.height=D+"px";this._shim.style.width=C-16+"px";if(this._ismodal){this._fog.style.height=Math.max(A,G+D)+"px";this._fog.style.width=Math.max(E,F+C)+"px"}},GetStackPosition:function(){return this._div.style.zIndex-900},SetStackPosition:function(A){this._fog.style.zIndex=900+A*2;this._shim.style.zIndex=900+A*2;this._div.style.zIndex=900+A*2+1}};Type.registerNamespace("Laserfiche.Layout");Laserfiche.Layout.PlaceholderInput=function(D,A,C,E){var B=this;this._placeholder=D;this._input=A;this._disableBlur=!!C;this._disableSubmitOnEnter=!!E;this._input.onblur=function(){if(B._disableBlur){return }if(B._keyupTimer){clearTimeout(B._keyupTimer)}B.getOnChangedFunc()();B.update()};this._input.onkeyup=function(){if(B._keyupTimer){clearTimeout(B._keyupTimer)}B._keyupTimer=setTimeout(B.getOnChangedFunc(),2000)};if(this._disableSubmitOnEnter){dojo.connect(this._input,"keypress",function(G){var F=G.keyCode||G.charCode;if(F==10||F==13){if(B._keyupTimer){clearTimeout(B._keyupTimer)}dojo.stopEvent(G);B.getOnChangedFunc()()}})}this._hasValue=this._input.value!="";B.update()};Laserfiche.Layout.PlaceholderInput.prototype={set_value:function(A){this._hasValue=A!="";this._input.value=A;this.update()},get_value:function(){if(this._hasValue){return this._input.value}else{return""}},getOnChangedFunc:function(){var A=this;return function(){A._keyupTimer=null;A._hasValue=A._input.value!="";if(A.ontimedchange){A.ontimedchange()}}},update:function(){var A=this;if(this._hasValue){this._input.className="";this._input.onfocus=null}else{this._input.className="Placeholder";this._input.value=this._placeholder;this._input.onfocus=function(){this.className="";this.value="";A._hasValue=true}}}};Laserfiche.Layout.PlaceholderInput.registerClass("Laserfiche.Layout.PlaceholderInput");top.PreviewTitleBar=function(D){var B=this;this._div=D;this._titleSpan=document.createElement("span");this._titleSpan.className="PreviewPaneTitle";D.appendChild(this._titleSpan);this._buttonsDiv=document.createElement("div");this._buttonsDiv.style.position="absolute";this._buttonsDiv.style.right="0px";this._buttonsDiv.className="IconButtons";var C=document.createElement("a");C.href="javascript:void(0);";C.title="Preview";var A=document.createElement("img");A.src="Assets/images/buttons/preview.gif";A.alt="Preview";C.appendChild(A);C.onclick=function(){B.SelectMode("Preview");return false};this._buttonsDiv.appendChild(C);this._previewButton=C;C=document.createElement("a");C.href="javascript:void(0);";C.title="Thumbnails";A=document.createElement("img");A.src="Assets/images/buttons/thumbs.gif";A.alt="Thumbnails";C.appendChild(A);C.onclick=function(){B.SelectMode("Thumbnails");return false};this._buttonsDiv.appendChild(C);this._thumbsButton=C;this.collapsed=false;C=document.createElement("a");C.href="javascript:void(0);";C.title="Hide";A=document.createElement("img");A.src="Assets/images/buttons/chevronDown.gif";A.alt="Hide";C.appendChild(A);C.onclick=function(){B.ToggleCollapse();return false};this._buttonsDiv.appendChild(C);this._collapseButton=C;this._collapseImg=A;D.appendChild(this._buttonsDiv);this.listener=new LF.Listener("PreviewTitleListener");this.listener.setHandler("SelectedEntryChanged",this.GetOnSelectedEntryChanged());this.listener.setHandler("EntryRenamed",this.GetOnEntryRenamed());this.listener.setHandler("ModeChanged",this.GetOnModeChanged())};top.PreviewTitleBar.prototype={SelectMode:function(A){switch(A){case"Preview":this._previewButton.className="Selected";this._thumbsButton.className="";if(this._controller){this._controller.layout.MoveToSlot("Preview","PreviewPane")}break;case"Thumbnails":this._previewButton.className="";this._thumbsButton.className="Selected";if(this._controller){this._controller.layout.MoveToSlot("Preview","ThumbnailControl")}break}if(this.collapsed){this.ToggleCollapse()}},set_controller:function(A){var B=this;this._controller=A;A.subscribe("SelectedEntryChanged",this.listener);A.subscribe("EntryRenamed",this.listener);A.subscribe("ModeChanged",this.listener)},ToggleCollapse:function(){var A=!this.collapsed;this.collapsed=A;this._collapseImg.src="Assets/images/buttons/"+(A?"chevronUp.gif":"chevronDown.gif");this._collapseButton.title=A?"Show":"Hide";this._collapseImg.alt=A?"Show":"Hide";if(this.ontoggle){this.ontoggle(A)}},GetOnSelectedEntryChanged:function(){var A=this;return function(C){if(C.args.getSelectedItems){var B=C.args.getSelectedItems();if(B&&B.items&&B.items.length){var D=B.items[0];A._titleSpan.innerHTML="";A._titleSpan.appendChild(document.createTextNode(D.name))}}}},GetOnEntryRenamed:function(){var A=this;return function(B){if(B&&B.args&&B.args.args){A._titleSpan.innerHTML="";A._titleSpan.appendChild(document.createTextNode(B.args.newName))}}},GetOnModeChanged:function(){var A=this;return function(D){var C=D.args;var G=true;var F=true;switch(C.mode){case 0:break;case 1:A._titleSpan.innerHTML="";A._titleSpan.appendChild(document.createTextNode("Thumbnails"));G=false;F=false;break;case 2:break;case 3:break;case 4:break;case 5:break}if(G&&C.context.getSelectedItems){var B=C.context.getSelectedItems();if(B&&B.items&&B.items.length){var E=B.items[0];A._titleSpan.innerHTML="";A._titleSpan.appendChild(document.createTextNode(E.name))}}A._buttonsDiv.style.display="";A._buttonsDiv.style.display=F?"":"none"}}};top.PreviewPane=function(F,E){this._domNode=F.parentNode;this._div=F;this._active=false;this._callback=E;this._loaded=false;var B=document.createElement("table");this._infoTable=B;var C=0;var D;var A;D=B.insertRow(C);C++;A=D.insertCell(0);A.className="ImageCell";this._imageCell=A;this._firstDataRowIndex=C;F.appendChild(B);F.className="PreviewPane";this.listener=new LF.Listener("PreviewPaneListener");this.listener.setHandler("SelectedEntryChanged",this.GetOnSelectedEntryChanged());this.listener.setHandler("EntryRenamed",this.GetOnEntryRenamed());this.listener.setHandler("EntryChanged",this.GetOnEntryChanged())};top.PreviewPane.prototype={activate:function(){this._active=true;if(!this._loaded){this._updateContent()}},deactivate:function(){this._active=false},get_DOMelement:function(){return this._domNode},resize:function(B,A){},set_entry:function(C,B,A){if(this._id==C&&this._repository==B&&!A){return }this._loaded=false;this._id=C;this._repository=B;this._clearDataRows();if(this._active){this._updateContent()}},set_controller:function(A){var B=this;this._controller=A;A.subscribe("SelectedEntryChanged",this.listener);A.subscribe("EntryRenamed",this.listener);A.subscribe("EntryChanged",this.listener)},onSuccess:function(A){result=Sys.Serialization.JavaScriptSerializer.deserialize(A);this._loaded=true;while(this._imageCell.childNodes.length!=0){this._imageCell.removeChild(this._imageCell.firstChild)}if(result.image){var B=new Image();B.onerror=function(){try{B.parentNode.removeChild(B)}catch(C){}B.onload=null;B.onerror=null;B=null};B.onload=function(){B.onload=null;B.onerror=null;B=null};B.src=result.image+"&count="+(new Date()).valueOf();this._imageCell.appendChild(B)}this._addDataRow("Type",result.type);if(this._id==-1){this._addDataRow("Size",result.size);this._addDataRow("Full Path",result.path)}else{if(result.loggedin){this._addDataRow("Last Modified",result.modified);this._addDataRow("Size",result.size)}if(this._id==1){this._addDataRow("Server",result.server);this._addDataRow("Version",result.version);this._addDataRow("Full Path",this._repository)}else{this._addDataRow("Author",result.creator);this._addDataRow("Full Path",this._repository+result.path)}}},onError:function(B,C,A){},get_height:function(){return this._div.offsetHeight},_clearDataRows:function(){while(this._infoTable.rows.length>this._firstDataRowIndex){this._infoTable.deleteRow(this._firstDataRowIndex)}},_addDataRow:function(C,E){var D=this._infoTable.insertRow(this._infoTable.rows.length);var A=D.insertCell(0);var F=document.createElement("span");F.className="TitleSpan";F.innerHTML=C+": ";var B=document.createElement("span");B.innerHTML=E;A.appendChild(F);A.appendChild(B)},_updateContent:function(){var B=this;if(isNaN(parseInt(this._id))){return }var A=this._controller?(this._controller._context.openedFolder.id==-1):false;var E={id:this._id,repository:this._repository};if(A&&this._id!=-1){this._loaded=true;while(this._imageCell.childNodes.length!=0){this._imageCell.removeChild(this._imageCell.firstChild)}this._addDataRow("Full Path",this._repository+"\\Recycle Bin\\"+this._name)}else{var G=Sys.Serialization.JavaScriptSerializer.serialize(E);var D=F;top.KillPendingCallbacks("PP");var F=function(H){B.onSuccess(H)};var C=function(I,J,H){B.onError(I,J,H)};this._callback(G,F,{callee:"PP"},C)}},GetOnSelectedEntryChanged:function(){var A=this;return function(C){if(C.args.getSelectedItems){var B=C.args.getSelectedItems();if(B&&B.items&&B.items.length){var D=B.items[0];A._name=D.name;A.set_entry(D.id,C.args.repository)}}}},GetOnEntryRenamed:function(){var A=this;return function(B){if(B&&B.args&&B.args.args){A.set_entry(B.args.args.id,B.args.args.repository,true)}}},GetOnEntryChanged:function(){var A=this;return function(C){var B=C&&C.args;var D=dojo.some(B.entryList,function(E){return(E==A._id)});if(D&&B.repository){A.set_entry(A._id,A._repository,true)}}}};if(!top.LF){top.LF={}}LF.ThumbnailControl=function(A,B){this._div=A.parentNode;this._container=A;this._callback=B;this._active=false;this._thumbArray=new Array();this.THUMBSIZE=80;this.MAXLOADERS=3;this.THUMBS_PER_PAGE=200;this._thumbcount=0;this._pagecount=0;this._viewSize=0;this._lastSelectedPage=null;this._lastStart=0;this._nextThumb=1;this._lastThumb=1;this._numLoaders=0;this._pageStart=1;this.initialize();this.listener=new LF.Listener("ThumbnailControlListener");this.listener.setHandler("SelectedEntryChanged",this.GetOnSelectedEntryChanged());this.listener.setHandler("EntryOpened",this.GetOnEntryOpened());this.listener.setHandler("EntryChanged",this.GetOnEntryChanged())};LF.ThumbnailControl.prototype={activate:function(){this._active=true;this._updateContent()},deactivate:function(){this._active=false},get_DOMelement:function(){return this._div},resize:function(B,A){this._container.style.width=B+"px";this._container.style.height=A+"px";this.CalculateViewingArea()},set_focusDiv:function(B){var A=this;A._focusDiv=(dojo.isArray(B)&&B.length&&B)||A._focusDiv;dojo.forEach(this._focusDiv,function(C){if(C){dojo.connect(C,"keydown",A.GetOnKeyEvent())}})},initialize:function(){var A=this;this._sourceDiv=document.createElement("div");this._sourceDiv.id=this._container.id+"_sourceDiv";this._container.appendChild(this._sourceDiv);this._focusDiv=[this._container];this.thumbSource=new dojo.dnd.Source(A._sourceDiv.id,{creator:this.GetThumbCreator(),accept:["thumb"],horizontal:true,copyOnly:false});dojo.mixin(this.thumbSource,{getSelectedItems:function(){var C=this.getSelectedNodes();var B=dojo.map(C,function(H,F,D){var G=dojo.query("img",H)[0];var E=G.src.split("?")[1];var I=dojo.queryToObject(E);var J={domNode:H,data:{repository:I.r,id:I.i,entryName:"",page:I.p,type:"thumb",parentId:I.i},type:["thumb"]};return J});return B},isThumbItemSelected:function(C){var B=C;while(B&&B!=this._sourceDiv){if(dojo.hasClass(B,"dojoDndItemSelected")||dojo.hasClass(B,"dojoDndItemAnchor")){return true}B=B.parentNode}return false},onMouseDown:function(B){if(B.button==2&&this.isThumbItemSelected(B.target)){return }dojo.hitch(this,dojo.dnd.Source.prototype.onMouseDown)(B)}});dojo.subscribe("/dnd/drop",this.GetOnDropHandler());dojo.connect(this._container,"mouseover",this.GetMouseOverFunc());dojo.connect(this._container,"mouseout",this.GetMouseOutFunc());dojo.connect(this._sourceDiv,"oncontextmenu",this.GetOnContextMenuFunc());this._container.onscroll=function(){var B=A._container.scrollTop;var C=Math.floor(B/A._thumbheight);var D=C*A._numCols+1;A.startLoading(D)};this.CalculateViewingArea()},set_entry:function(B,A){if(this._id==B&&this._repository==A){return }this._id=B;this._repository=A;this._updateContent()},set_pagecount:function(A){var B=this._pagecount;this._pagecount=A;this._thumbcount=A;this.initializeThumbs(B+1,A);this.CalculateViewingArea()},set_controller:function(A){var B=this;this._controller=A;A.subscribe("SelectedEntryChanged",this.listener);A.subscribe("EntryOpened",this.listener);A.subscribe("EntryChanged",this.listener)},_clearThumbnails:function(){this.thumbSource.selectAll();this.thumbSource.deleteSelectedNodes();this._thumbArray=new Array();this._pagecount=0;this._sourceDiv.style.height="1px";this._sourceDiv.style.width="1px"},_updateNumbers:function(){var H=this.thumbSource.node.childNodes;for(var A=0;A<H.length;A++){var E=A+1;var C=H[A];var B=this.thumbSource.getItem(C.id);B.data=E;var G=C.childNodes[1];G.innerHTML="Page "+E;var D=C.childNodes[0].childNodes[0];if(D.src){D.src="Thumbnail.aspx?r="+this._repository+"&i="+this._id+"&p="+E+"&n="+this.getRand()}var F={};F.div=C;F.img=D;F.pagenumdiv=G;this._thumbArray[A]=F}this.startLoading(this._lastStart,true)},_updateContent:function(){var A=this;if(!this._active){return }A._clearThumbnails();top.KillPendingCallbacks("TH");if(this._id>0){var C={id:this._id,repository:this._repository};var E=Sys.Serialization.JavaScriptSerializer.serialize(C);var D=function(F){A.onSuccess(F)};var B=function(G,H,F){A.onError(G,H,F)};this._callback(E,D,{callee:"TH"},B)}},getRand:function(){var D="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var C=[];for(var B=0;B<5;B++){var A=Math.floor(Math.random()*D.length);C.push(D.substring(A,A+1))}return C.join("")},initializeThumbs:function(D,B){var A=new Array();for(var C=D;C<=B;C++){A.push(C)}this.thumbSource.insertNodes(false,A);this._lastStart=0},startLoading:function(B,A){if(!A&&this._lastStart==B){return }this._lastStart=B;this._nextThumb=B;this._lastThumb=Math.min(B+this._viewSize-1,this._thumbcount);while(this._numLoaders<this.MAXLOADERS&&this._nextThumb<=this._lastThumb){this._numLoaders++;this._loadNextThumb()}},_loadNextThumb:function(){if(this._nextThumb>this._lastThumb){this._numLoaders--;return }var A=this._nextThumb;this._nextThumb++;this._loadThumb(A)},_loadThumb:function(B){var A=this;var C=function(){var D=A._thumbArray[B-1];if(D){if(D.img.src){A._loadNextThumb();return }D.img.onload=function(){D.img.onload=null;D.img.onerror=null;A.FitImage(D.img);A._loadNextThumb()};D.img.onerror=function(){D.img.onload=null;D.img.onerror=null;A._loadNextThumb()};D.img.src="Thumbnail.aspx?r="+A._repository+"&i="+A._id+"&p="+B+"&n="+A.getRand()}};window.setTimeout(C,5)},GetThumbCreator:function(){var A=this;return function(E,C){var H=E;var G=["thumb"];var J=document.createElement("div");J.className="OuterThumbDiv";var F=document.createElement("div");F.className="Thumbnail";var B=document.createElement("img");if(C=="avatar"){B.src="Thumbnail.aspx?r="+A._repository+"&i="+A._id+"&p="+H+"&n="+A.getRand();B.onload=function(){A.FitImage(B)}}else{dojo.connect(J,"ondblclick",function(){A._activateThumb(J)});dojo.connect(J,"onclick",function(K){A._onclick(K,J)});dojo.connect(J,"oncontextmenu",function(K){A._oncontextmenu(K,J)})}var D=document.createElement("div");D.className="ThumbPageText";D.innerHTML="Page "+H;F.appendChild(B);J.appendChild(F);J.appendChild(D);var I={};I.div=F;I.img=B;I.pagenumdiv=D;F.id=dojo.dnd.getUniqueId();A._thumbArray[H-1]=I;return{node:J,data:E,type:G}}},CalculateViewingArea:function(){if(!this._thumbheight){var G=document.createElement("div");G.className="OuterThumbDiv";var C=document.createElement("div");C.className="Thumbnail";C.innerHTML="test";var B=document.createElement("div");B.className="ThumbPageText";B.innerHTML="test";G.appendChild(C);G.appendChild(B);this._container.appendChild(G);this._thumbheight=G.offsetHeight;this._thumbwidth=G.offsetWidth;this._container.removeChild(G)}var F=this._container.offsetHeight;var E=this._container.offsetWidth;this._numCols=Math.floor(E/this._thumbwidth);this._numRows=Math.ceil(this._thumbcount/this._numCols);this._viewRows=Math.ceil(F/this._thumbheight)+1;this._viewSize=this._viewRows*this._numCols;if(this._numCols>0){var D=this._numRows*this._thumbheight;var A=this._numCols*this._thumbwidth;this._sourceDiv.style.height=(D>0?D:1)+"px";this._sourceDiv.style.width=(A>0?A:1)+"px"}},FitImage:function(B){if(B.width==0||B.height==0){return }var D=this.THUMBSIZE;var A;var C=B.height*1/B.width;if(C>1){D=parseInt(this.THUMBSIZE/C);A=this.THUMBSIZE}else{A=parseInt(this.THUMBSIZE*C);B.style.marginTop=parseInt((this.THUMBSIZE-A)/2)+"px"}B.width=D;B.height=A},onSuccess:function(A){result=Sys.Serialization.JavaScriptSerializer.deserialize(A);var B=result.pagecount;this.set_pagecount(B);this.startLoading(1)},onError:function(B,C,A){},GetOnMoveSuccess:function(){var A=this;return function(B){if(B==false){alert("The page(s) failed to move.");A._updateContent()}else{A._updateNumbers()}}},GetOnMoveError:function(){return function(B){var A=this;alert(B);A._updateContent()}},_activateThumb:function(B){var D=B.id;var C=this.thumbSource.getItem(D);var A=C.data;this._controller.selectCurrentPage({pagenum:A,docid:this._id},"MainTabs")},_onclick:function(B,D){var C=this;var F=D.id||null;var E=C.thumbSource.getItem(F);if(E&&E.data){var A=E.data;this._lastSelectedPage=A;this._controller.setFocusControl(C)}else{this._lastSelectedPage=null}if(dojo.exists("_focusDiv",C)){dojo.some(C._focusDiv,function(H){try{if(dojo.style(H,"display")=="none"||dojo.style(H.parentNode,"display")=="none"){return false}H.focus();return true}catch(G){return false}})}},_oncontextmenu:function(B,D){var C=this;var F=D.id||null;var E=C.thumbSource.getItem(F);if(E&&E.data){var A=E.data;this._lastSelectedPage=A;this._controller.setFocusControl(C)}else{this._lastSelectedPage=null}if(dojo.exists("_focusDiv",C)){dojo.some(C._focusDiv,function(H){try{if(dojo.style(H,"display")=="none"||dojo.style(H.parentNode,"display")=="none"){return false}H.focus();return true}catch(G){return false}})}},GetOnKeyEvent:function(){var A=this;return function(C){var B=dojo.keys;if(C.cancelBubble==true||C.type!="keydown"){return false}C.cancelBubble=true;C.returnValue=false;switch(C.keyCode){case B.DELETE:if(A.thumbSource.getSelectedNodes().length){if(dojo.exists("Actions.DeletePages",LF)&&dojo.isFunction(LF.Actions.DeletePages)&&dojo.exists("myAppController._context",top)){LF.Actions.DeletePages(top.myAppController._context)}}break;case 67:if(C.ctrlKey&&C.altKey){LF.Actions.Copy(top.myAppController._context)}break;case 86:if(C.ctrlKey&&C.altKey){LF.Actions.Paste(top.myAppController._context)}break;case 88:if(C.ctrlKey&&C.altKey){LF.Actions.Cut(top.myAppController._context)}break;default:break}}},GetOnDropHandler:function(){var A=this;return function(C,E,G){if(A.containerState!="Over"){return }if(!(A.thumbSource===C)){return }var H=new Array();for(var I=0;I<E.length;I++){var D=E[I].id;var M=C.getItem(D);var K=M.data;H.push(K)}var L=0;if(G){var B=C.getSelectedNodes()[0];if(B){var F=B.id;var J=C.getItem(F);L=J.data+1}}else{if(E[0].previousSibling){var F=E[0].previousSibling.id;var J=C.getItem(F);L=J.data}if(H.length==1&&H[0]==L+1){return }}Laserfiche.WebAccess.DocumentService.MovePagesWithinDocument(A._repository,A._id,H,L+1,G,A.GetOnMoveSuccess(),A.GetOnMoveError());if(G){A._pagecount=A._pagecount+H.length;A._thumbcount=A._thumbcount+H.length;A.CalculateViewingArea()}}},GetMouseOverFunc:function(){var A=this;return function(B){A.containerState="Over"}},GetMouseOutFunc:function(){var A=this;return function(B){A.containerState="Out"}},GetOnContextMenuFunc:function(){var A=this;return function(B){dojo.stopEvent(B);var C={target:B.target,clientX:B.clientX,clientY:B.clientY};A._showContextMenu(C)}},_showContextMenu:function(C){var B=this;var D=top.TYPE_THUMBNAIL;this._menuscontainer=document.createElement("div");this._menuscontainer.style.position="relative";document.body.appendChild(this._menuscontainer);if(B._contextMenu){B._contextMenu.Hide();B._contextMenu=null}var A=this._controller.getContextMenuItems(D);var E=top.SimpleMenu.CreateMenu(A,this._menuscontainer);B._contextMenu=E;var F=dojo.coords(this._menuscontainer);E.UpdateContextMenu(B._controller,C.clientX-F.x,C.clientY-F.y);E.Show(C.clientX-F.x,C.clientY-F.y);E.onselect=function(){B._controller.doAction(E.value);E.Hide();if(B.onContextItemAction){B.onContextItemAction()}};E.onhide=function(){E.DeleteMenu();B._contextMenu=null};if(this.onContextMenu){this.onContextMenu()}},GetOnSelectedEntryChanged:function(){var A=this;return function(C){if(C.args.getSelectedItems){var B=C.args.getSelectedItems();if(B&&B.items&&B.items.length){if(B.items.length>1){A.set_entry(0,C.args.repository)}else{var D=B.items[0];A.set_entry(D.id,C.args.repository)}}}}},GetOnEntryOpened:function(){var A=this;return function(B){if(B.args.openedDocument){A.set_entry(B.args.openedDocument.id,B.args.repository)}}},GetOnEntryChanged:function(){var A=this;return function(C){var B=C.args;if(B.repository&&B.entryList){if(dojo.some(B.entryList,function(D){return D==A._id})){A._updateContent()}}}},getSelectedItems:function(){var B=this;var C=this._id;var E=this._repository;var A=dojo.map(B.thumbSource.getSelectedNodes(),function(H){var G=B.thumbSource.getItem(H.id);var F=(G.data-0)||0;return{docid:C,pageid:F,repository:E,repository:B._repository}});A.sort(function(F,G){return(F.pageid-G.pageid)});var D="PAGES";return({items:A,type:D})},getLastSelectedItem:function(){var A=this;var C=null;if(this._lastSelectedPage){C={docid:this._id-0,pageid:this._lastSelectedPage-0,repository:this._repository}}var B="PAGES";return({item:C,type:B})},getType:function(){return"THUMBNAIL_CONTROL"},getId:function(){return this._container.id}};if(typeof (LF)=="undefined"){LF={}}dojo.require("dojo.fx");var DOWN_ARROW_KEY_CODE=40;var UP_ARROW_KEY_CODE=38;var ENTER_KEY_CODE=13;LF.ColorMenu=function(C,E,A){var D=this;this.menuDiv=C;this._isopen=false;this._submenus=new Array();this._focusDiv=A;this._nextColorRow=0;var B=document.createElement("table");B.cellPadding=0;B.cellSpacing=0;B.style.width="100%";C.appendChild(B);this.menuTable=B;this.shim=E;this.currentHoverRow=-1;this.menuDiv.onkeydown=function(I){I=I?I:window.event;var F=-1;var H=(I.keyCode)?I.keyCode:((I.charCode)?I.charCode:I.key);var G=false;if(H==DOWN_ARROW_KEY_CODE){if(D.currentHoverRow<D.menuTable.rows.length-1){var F=D.currentHoverRow+1;if(D.IsEmpty(D.menuTable.rows[F])){F++}}G=true}else{if(H==UP_ARROW_KEY_CODE){if(D.currentHoverRow>0){var F=D.currentHoverRow-1;if(D.IsEmpty(D.menuTable.rows[F])){F--}}G=true}else{if(H==ENTER_KEY_CODE){if(D.currentHoverRow>=0){D.SelectItem(D.idNumbers[D.currentHoverRow])}}}}if(G){if(F>=0){D.HighlightRow(F)}else{if(D.currentHoverRow==0){D.UnhighlightRow(0)}else{if(D.currentHoverRow==-1){D.Hide()}}}I.cancelBubble=true;I.returnValue=false}};this.Hide();this.rowNumbers=new Array();this.idNumbers=new Array();this.onselect=function(){};this.value=""};LF.ColorMenu.CreateMenu=function(A,B,E,H,I){var D=document.createElement("div");if(!E){E=D;D.tabIndex=1}D.className="Menu";D.style.zIndex=2;D.style.left="-1px";D.style.top="18px";D.style.visibility="hidden";D.style.width="100px";var G=document.createElement("iframe");G.className="MenuShim";G.style.display="none";B.appendChild(D);B.appendChild(G);var C=new LF.ColorMenu(D,G,E);for(var F=0;F<A.length;F++){var J=A[F];if(J!=null){C.AddColor(J.title,J.id)}}if(I){C._addItem("(None)",-1)}if(H){C._addItem();C._addItem("More Colors...",-2)}if(D.tabIndex){D.onblur=function(){C.Hide()}}return C};LF.ColorMenu.prototype={IsOpen:function(){return this._isopen},Show:function(A,E){var D=this;if(D._hideTimer){clearTimeout(D._hideTimer)}D._hideTimer=null;if(D.onpreshow){D.onpreshow()}if(this._isopen){return }this._isopen=true;if(A&&E){D.SetCoords(A,E)}if(this.currentHoverRow>=0){this.UnhighlightRow(this.currentHoverRow)}this.currentHoverRow=-1;var B=function(){if(!D.IsOpen()){return }D.shim.style.top=D.menuDiv.style.top;D.shim.style.left=D.menuDiv.style.left;D.shim.style.zIndex=D.menuDiv.style.zIndex-1;D.shim.style.width=D.menuDiv.offsetWidth;D.shim.style.height=D.menuDiv.offsetHeight;D.shim.style.display="block";if(D.onshow){D.onshow()}if(D._focusDiv){D._focusDiv.focus()}};var C=dojo.fx.wipeIn({node:this.menuDiv,duration:200});dojo.connect(C,"onEnd",B);C.play()},Hide:function(A){var C=this;if(C._hideTimer){clearTimeout(C._hideTimer)}C._hideTimer=null;for(var B=0;B<C._submenus.length;B++){C._submenus[B].Hide()}var D=function(){C._isopen=false;C.shim.style.display="none";C.menuDiv.style.visibility="hidden";if(C.onhide){C.onhide()}};if(A){C._hideTimer=setTimeout(D,A)}else{D()}},Toggle:function(){if(this.IsOpen()){this.Hide()}else{this.Show()}},AddColor:function(A,G){if(this.rowNumbers[G]>=0){return }var D=this;var J=this._nextColorRow;this._nextColorRow++;var E=this.menuTable.rows.length;if(E>J){var F=E-1;while(F>=J){var B=this.idNumbers[F];this.idNumbers[F+1]=B;this.rowNumbers[B]=F+1;F--}}var I=this.menuTable.insertRow(J);I.className="Row";I.onmouseover=function(){D.HighlightRow(J)};I.onmouseout=function(){D.UnhighlightRow(J)};I.onmousedown=function(){D.SelectItem(G)};var H=I.insertCell(0);var C=document.createElement("div");C.style.border="solid 1px #FFFFFF";C.style.margin="3px 5px";C.style.backgroundColor="#"+G;C.style.height="14px";C.style.lineHeight="12px";C.innerHTML="&nbsp;";C.title=A;H.appendChild(C);this.idNumbers[J]=G;this.rowNumbers[G]=J},_addItem:function(A,F){var D=this;var I=this.menuTable.rows.length;var H=this.menuTable.insertRow(I);if(!A){H.className="EmptyRow";var G=H.insertCell(0);var E=document.createElement("div");G.appendChild(E);H.onmousedown=function(){top.IgnoreNextBlur(D._focusDiv)}}else{H.className="Row";H.onmouseover=function(){D.HighlightRow(D.rowNumbers[F])};H.onmouseout=function(){D.UnhighlightRow(D.rowNumbers[F])};H.onmousedown=function(){D.SelectItem(F)};var G=H.insertCell(0);G.style.padding="0px 5px";var C=document.createElement("nobr");var B=document.createTextNode(A);C.appendChild(B);G.appendChild(C);this.idNumbers[I]=F;this.rowNumbers[F]=I}},SelectItem:function(D){var C=this;var B=this.rowNumbers[D];if(B!=null){var A=this.menuTable.rows[B]}this.value=D;if(this.onselect){this.onselect()}},HighlightRow:function(D){if(this.currentHoverRow>=0){this.UnhighlightRow(this.currentHoverRow)}var C=this.menuTable.rows[D];var A=C.className;var B=A.indexOf(" RowOver");if(B<0){C.className=A+" RowOver"}this.currentHoverRow=D;return true},UnhighlightRow:function(C){var B=this.menuTable.rows[C];var A=B.className;B.className=A.replace(" RowOver","");if(this.currentHoverRow==C){this.currentHoverRow=-1}},IsEmpty:function(C){var A=C.className;var B=A.indexOf("EmptyRow");return(B>=0)},GetOnKeyDown:function(){return this.menuDiv.onkeydown},SetCoords:function(B,G){var A=this.menuDiv.parentNode.offsetHeight;var E=this.menuDiv.parentNode.offsetWidth;var F=this.GetDimensions();var D=(B+F.x+this.menuDiv.offsetLeft>E)?E-F.x-5:B;var C=(G+F.y+this.menuDiv.offsetTop>A)?A-F.y-5:G;this.menuDiv.style.left=D+"px";this.menuDiv.style.top=C+"px"},GetDimensions:function(){return{x:this.menuDiv.offsetWidth,y:this.menuDiv.offsetHeight}},RemoveChildren:function(B){for(var A=B.childNodes.length-1;A>-1;A--){LF.ColorMenu.prototype.RemoveChildren(B.childNodes[A])}if(B.tagName=="TR"){B.onmouseover=null;B.onmouseout=null;B.onmousedown=null}B.parentNode.removeChild(B)},ReleaseDOMElements:function(){while(this._submenus&&this._submenus.length>0){var A=this._submenus.pop();A.DeleteMenu()}if(this.menuDiv){this.menuDiv.onkeydown=null;this.menuDiv=null}if(this.menuTable){this.RemoveChildren(this.menuTable);this.menuTable=null}this.onselect=null;try{this.shim.parentNode.removeChild(this.shim)}catch(B){}this.shim=null},DeleteMenu:function(){var A=this.menuDiv;this.ReleaseDOMElements();try{A.parentNode.removeChild(A)}catch(B){}}};if(!top.LF){top.LF={}}dojo.declare("top.LF.PageContext",null,{constructor:function(){this.repository="";this.user="";this.openedFolder=null;this.openedDocument=null;this.openedPage=null;this.openedTabId="";this.focusedControl=null;this.lastSelected=null;this.defaultSettings={OpenEdocAsDoc:"No",OpenPagelessAsDoc:"No",MImportShowTemplate:"Yes"}},setFocusControl:function(A){this.focusedControl=A},setLastSelected:function(A){this.lastSelected=A},setOpenedFolder:function(B,A){this._defineEntryFromData(B,A);this.openedFolder=B;this.openedFolder.repository=this.repository},setOpenedDocument:function(B,A){this._defineEntryFromData(B,A);this.openedDocument=B;this.openedFolder.repository=this.repository},setOpenedPage:function(B,A){this.openedPage=B},setRepository:function(A){this.repository=A},setUser:function(A){this.user=A},getLastSelected:function(){return this.lastSelected},getSelectedItems:function(B){var A=top.myAppController._mainTabs._curTab;var D=null;var C=null;if(A){switch(A.charAt(0)){case"D":return(top.docviewControl&&top.docviewControl.getSelectedItems&&top.docviewControl.getSelectedItems(B));default:return(this.focusedControl&&this.focusedControl.getSelectedItems&&this.focusedControl.getSelectedItems(B));break}}return null},_defineEntryFromData:function(E,F){var C=this;var D=E.id+":"+C.repository.toUpperCase();var B=function(G){if(G.id!=D){return }E.name=G.name;E.flags=G.flags;E.path=G.path;C.loaded=true;if(F){setTimeout(F,1)}};var A=function(){};if(!E.name||!E.flags||!E.path){C.loaded=false;Laserfiche.WebAccess.DocumentService.GetEntryInfo(E.id,C.repository,B,A)}else{C.loaded=true;if(F){setTimeout(F,1)}}return E}});if(!top.LF){top.LF={}}LF.ImageViewer=function(G,C,A,E,F){this._div=G;this.id=F;this.TILEDIM=256;this._lastX=0;this._lastY=0;this.Height=A;this.Width=C;this.Scale=E;this.LoadTime=new Date();this.bottomEdgeHeight=this.TILEDIM;this.rightEdgeWidth=this.TILEDIM;this._loading=false;G.style.overflow="hidden";G.style.height=A+"px";G.style.width=C+"px";var D=document.createElement("img");D.className="StackingControl";D.style.left="0px";D.style.top="0px";G.appendChild(D);this._thumbImg=D;var B=document.createElement("div");B.id=this.id+"layer1";B.className="StackingControl";B.style.zIndex=2;B.style.left="0px";B.style.top="0px";G.appendChild(B);this._tileDiv1=B;B=document.createElement("div");B.id=this.id+"layer2";B.className="StackingControl";B.style.zIndex=1;B.style.left="0px";B.style.top="0px";G.appendChild(B);this._tileDiv2=B;this._loadingDiv=this._tileDiv1;this._intermediateDiv=null;this._loadingDivNum=1;this._loadTilesQueue=new Array()};LF.ImageViewer.prototype={activate:function(){},deactivate:function(){},get_DOMelement:function(){return this._div},resize:function(B,A){this.Resize(A,B)},set_controller:function(A){this._controller=A},_getcurrentrepository:function(){return this._controller._context.repository},_getcurrentdocid:function(){return this._controller._context.openedDocument.id},setData:function(E,G,D,B,A,C,F){this.Rotation=E;this.Xdpi=G;this.Ydpi=D;this.PageNum=B;this.PageID=A;this.ImageHeight=C;this.ImageWidth=F;this.Ratio=C*1/F;this.LoadTime=new Date()},ChangePage:function(A){var C=this._getcurrentrepository();var B=this._getcurrentdocid();this.LoadTime=new Date();this.StartImageLoad(A,this.search)},ChangeSearch:function(B){if(this.search==B){return }var C=this._getcurrentrepository();var A=this._getcurrentdocid();this.LoadTime=new Date();this.StartImageLoad(this.PageNum,B)},Resize:function(A,B){this.Height=A;this.Width=B;this._div.style.height=A+"px";this._div.style.width=B+"px";this.checkTiles(this._lastX,this._lastY)},Rescale:function(B){this._thumbImg.width=(B/100)*this.ImageWidth;var A=B*1/this.Scale;var C=(!this._intermediateDiv||!this._loading);this.ClearImages(!C,true,false);if(C){this.SwapTileDivs()}this._resizeIntermediateTiles(A);this.Scale=B;this.CountPanels();this.checkTiles(this._lastX,this._lastY)},SetRotation:function(B){var C=B-this.Rotation;if(C%180!=0){var A=this.Xdpi;this.Xdpi=this.Ydpi;this.Ydpi=A;A=this.ImageHeight;this.ImageHeight=this.ImageWidth;this.ImageWidth=A}this.Rotation=B;this.CountPanels();this.ClearImages(true,true,true);this.checkTiles(this._lastX,this._lastY)},setPosition:function(A,B){this.checkTiles(A,B);this._loadingDiv.style.left=A+"px";this._loadingDiv.style.top=B+"px";if(this._intermediateDiv){this._intermediateDiv.style.left=A+"px";this._intermediateDiv.style.top=B+"px"}this._thumbImg.style.left=A+"px";this._thumbImg.style.top=B+"px"},CountPanels:function(){var C=this.Scale/100;var A=parseInt(this.ImageWidth*C);var B=parseInt(this.ImageHeight*C);this.xPanelCount=parseInt((this.ImageWidth*C+this.TILEDIM-1)/this.TILEDIM);this.yPanelCount=parseInt((this.ImageHeight*C+this.TILEDIM-1)/this.TILEDIM);this.rightEdgeWidth=this.TILEDIM-((this.xPanelCount*this.TILEDIM)-A);this.bottomEdgeHeight=this.TILEDIM-((this.yPanelCount*this.TILEDIM)-B)},SwapTileDivs:function(){if(this._loadingDivNum==1){this._loadingDivNum=2;this._loadingDiv=this._tileDiv2;this._intermediateDiv=this._tileDiv1}else{this._loadingDivNum=1;this._loadingDiv=this._tileDiv1;this._intermediateDiv=this._tileDiv2}this._loadingDiv.style.zIndex=2;this._intermediateDiv.style.zIndex=1},_resizeIntermediateTiles:function(O){var Q=this._lastX*O;var P=this._lastY*O;var J=this.TILEDIM*O;var H=Math.floor((-Q)/J);var E=Math.floor((-P)/J);var M=Math.floor(this.Width/J)+1;var I=Math.floor(this.Height/J)+1;for(var G=-1;G<=M;++G){for(var D=-1;D<=I;++D){var N=G+H;var L=D+E;var C=this._intermediateDiv.id+"_tile_"+N+"_"+L;var K=document.getElementById(C);if(K){K.style.zIndex=5;K.style.left=parseInt(J*N)+"px";K.style.top=parseInt(J*L)+"px";K.style.width=(parseInt(K.style.width)*O)+"px";K.style.height=(parseInt(K.style.height)*O)+"px"}}}var F=this._intermediateDiv.childNodes.length;for(var B=F-1;B>=0;B--){var A=this._intermediateDiv.childNodes[B];if(A.style.zIndex!=5){if(A.onerror){A.onerror=null}if(A.onload){A.onload=null}this._intermediateDiv.removeChild(A)}}},ClearImages:function(A,C,B){this.ResetTileQueue();if(A){while(this._loadingDiv.firstChild){var D=this._loadingDiv.firstChild;if(D.onerror){D.onerror=null}if(D.onload){D.onload=null}this._loadingDiv.removeChild(D)}this._loading=true}if(C&&this._intermediateDiv){while(this._intermediateDiv.firstChild){var D=this._intermediateDiv.firstChild;if(D.onerror){D.onerror=null}if(D.onload){D.onload=null}this._intermediateDiv.removeChild(D)}}if(B){this._thumbImg.src="transparent.gif"}},ResetTileQueue:function(){while(this._loadTilesQueue.length>0){this._loadTilesQueue.pop()}},checkTiles:function(K,G){if(!this.PageNum){return }var I=new Array();this._lastX=K;this._lastY=G;var H=Math.floor((-K)/this.TILEDIM);var E=Math.floor((-G)/this.TILEDIM);var L=Math.floor(this.Width/this.TILEDIM)+1;var J=Math.floor(this.Height/this.TILEDIM)+1;var B=this._loadingDiv;for(var F=-1;F<=L;++F){for(var D=-1;D<=J;++D){if(F+H>=0&&D+E>=0){var C=this._getAddTileFunc(F+H,D+E,B);if(F==-1||D==-1||F==L||D==J){I.push(C)}else{this._loadTilesQueue.push(C)}}}}while(I.length>0){this._loadTilesQueue.push(I.pop())}var A=Math.min(3,this._loadTilesQueue.length);for(var F=0;F<A;F++){this._loadNextTile()}},_loadNextTile:function(){var A=this._loadTilesQueue.shift();if(A){setTimeout(A,5)}else{this._loading=false}},_getAddTileFunc:function(A,D,C){var B=this;return function(){if(B._controller._context.openedDocument){B.addTile(A,D,C)}}},addTile:function(D,C,G){var A=this;var F=G.id+"_tile_"+D+"_"+C;if(document.getElementById(F)){A._loadNextTile();return }if(D>=this.xPanelCount||C>=this.yPanelCount){A._loadNextTile();return }var E=document.createElement("img");E.zIndex=2;E.id=F;E.style.position="absolute";E.style.left=(this.TILEDIM*D)+"px";E.style.top=(this.TILEDIM*C)+"px";E.style.width=(D==this.xPanelCount-1)?(this.rightEdgeWidth+"px"):(this.TILEDIM+"px");E.style.height=(C==this.yPanelCount-1)?(this.bottomEdgeHeight+"px"):(this.TILEDIM+"px");var B=this._getTileQueryString(D,C);G.appendChild(E);E.onload=function(){A._loadNextTile();E.onload=null;E.onerror=null;E.src=B};E.onerror=function(){var H=function(){E.onerror=null;E.onload=null;E.src=B;A._loadNextTile()};window.setTimeout(H,2000)};E.src="transparent.gif"},_getTileQueryString:function(A,B){return"Helper/TileData.aspx?reposName="+this._getcurrentrepository()+"&docID="+this._getcurrentdocid()+"&x="+A+"&y="+B+"&pageNum="+this.PageNum+"&scale="+this.Scale+"&ro="+this.Rotation+"&time="+this.LoadTime.getTime()+(this.PageID?"&pageID="+this.PageID:"")+(this.search?"&search="+this.search:"")},StartImageLoad:function(A,D){var C=this;var E=C._getcurrentrepository();var B=C._getcurrentdocid();this.PageNum=A;this.PageID=null;this.search=D;this.ClearImages(true,true,true);Laserfiche.WebAccess.DocumentService.InitializePage(A,this.Scale,B,E,D?D:"",this.GetImageLoadedFunc(),this.GetImageErrorFunc())},GetImageLoadedFunc:function(){var A=this;return function(E,C){top.docviewControl.DisplayErrorMessage("");var D=A._getcurrentrepository();var B=A._getcurrentdocid();A.setData(E.Rotation,E.Xdpi,E.Ydpi,E.PageNum,E.PageID,E.ImageHeight,E.ImageWidth);if(E.Empty!=true){A._thumbImg.onload=function(){A._thumbImg.width=A.ImageWidth*A.Scale/100};A._thumbImg.onerror=function(){A._thumbImg.src="Assets/images/errorTile.png";var F=function(){A._thumbImg.src="Thumbnail.aspx?r="+D+"&i="+B+"&p="+A.PageNum};window.setTimeout(F,2000)};A._thumbImg.src="Thumbnail.aspx?r="+D+"&i="+B+"&p="+A.PageNum}A.CountPanels();if(A.onloadpage){A.onloadpage()}else{A.checkTiles(A._lastX,A._lastY)}}},GetImageErrorFunc:function(){var A=this;return function(B,C){top.docviewControl.Clear();top.docviewControl.DisplayErrorMessage(B._message)}}};if(!top.LF){top.LF={}}LF.PageViewControl=function(A){this._div=A;this.initializeStructure(A);this._imagevisible=true;this._textvisible=true;this._tempTextSize=0;this._pageloaded=false;this._loaded=false;this._pagenum=1;this._active=false;this._search=null};LF.PageViewControl.prototype={activate:function(){this._active=true},deactivate:function(){this._active=false},get_DOMelement:function(){return this._div},resize:function(B,A){this._pagedisplayContainer.resize({w:B,h:A});this._pagedisplayContainer.layout();this.onNeedImageViewResize()},Load:function(){var C=parseInt(this._div.style.width);var A=parseInt(this._div.style.height);if(isNaN(C)){C=200}if(isNaN(A)){A=200}var B=new LF.ImageViewer(this._imageviewerDiv,C,A,25,"myImageViewer");B.set_controller(this._controller);B.onloadpage=this.GetOnPageLoadedHandler();this._imageViewer=B;this._initializeScrollbars();this._attachEvents();this._loaded=true},Clear:function(){this._pageloaded=false;this._docid=null;if(this._imageViewer){this._imageViewer.ClearImages(true,true,true)}if(this.annControl){this.annControl.clearState()}if(this.annControl&&this.annControl._editor&&this.annControl._editor.OnEditorHide){this.annControl._editor.OnEditorHide()}},set_controller:function(A){this._controller=A},get_pagenum:function(){return this._pagenum},set_pagenum:function(A){this._imageViewer.ChangePage(A);if(this.annControl){this.annControl.set_page(A)}this._pagenum=A},get_search:function(){return this._search},set_search:function(A){this._imageViewer.ChangeSearch(A);this._search=A},get_docid:function(){return this._docid},get_repository:function(){return this._repository},set_document:function(A,B){this._docid=A;this._repository=B;this._annLayerDiv.innerHTML="";this.loadAnnotationControl();this._search=null},refresh:function(){if(!this._pageloaded){return }var A=this.get_pagenum();this._imageViewer.ChangePage(A);this.annControl.set_page(A)},rescale:function(A){if(!this._pageloaded){return }if(this._imageViewer.Scale!=A){if(this.annControl){this.annControl.set_scale(A/100)}else{this._imageViewer.Rescale(A)}}},onNeedImageViewResize:function(){if(!this._loaded){return }if(!this._imagevisible){return }var B=parseInt(this._imageContainer.domNode.offsetHeight);var D=parseInt(this._imageContainer.domNode.offsetWidth);this._imageViewer.Resize(B,D);if(!this._pageloaded){return }var E=this._imageViewer.Scale;var A=0;var C=0;if(this._imageViewer.ImageHeight){A=this._imageViewer.ImageHeight*E/100;C=this._imageViewer.ImageWidth*E/100}this._adjustScrollBars(B,D,A,C);if(this.annControl){switch(Laserfiche.ZoomMode.ZoomType){case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_WIDTH:this.annControl.FitToWidth();break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_HEIGHT:this.annControl.FitToHeight();break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_PAGE:this.annControl.FitToPage();break}}},UpdateDimensions:function(){var B=this._imageViewer.Height;var D=this._imageViewer.Width;var E=this._imageViewer.Scale;var A=this._imageViewer.ImageHeight*E/100;var C=this._imageViewer.ImageWidth*E/100;this._adjustScrollBars(B,D,A,C)},GetOnPageLoadedHandler:function(){var A=this;return function(){A._pageloaded=true;if(A.annControl){A.annControl.RefreshImageInfo();if(A._imageViewer.ImageHeight!=0&&A._imageViewer.ImageWidth!=0){A.annControl.set_offset(0,0);A.annControl.set_rotation(A._imageViewer.Rotation,true)}}A.UpdateDimensions()}},_attachEvents:function(){var B=this;var E=this._outerDiv;var C=this._annOuterDiv;var D=function(G,F){if(G&&G.target){G.target.scrollTop=0;G.target.scrollLeft=0}if(G){G.preventDefault();G.stopPropagation()}return false};$addHandler(C,"scroll",D);var A=this.GetScrollWheelHandler();E.onmouseover=function(){document.onkeydown=B.GetKeyDownHandler();document.onkeyup=B.GetKeyUpHandler();if(document.attachEvent){document.detachEvent("onmousewheel",A);document.attachEvent("onmousewheel",A)}else{window.addEventListener("mousewheel",A,false);window.addEventListener("DOMMouseScroll",A,false)}};E.onmouseout=function(){document.onkeydown=null;document.onkeyup=null;if(document.attachEvent){document.detachEvent("onmousewheel",A)}else{window.removeEventListener("mousewheel",A,false);window.removeEventListener("DOMMouseScroll",A,false)}}},GetKeyDownHandler:function(){var A=this;return function(B){B=(!B)?window.event:B;var C=B.key?B.key:B.keyCode;if(A.annControl._currentAnnotation!=null){if(C==dojo.keys.TAB){A.annControl.SelectNextAnnotation(!B.shiftKey);B.cancelBubble=true;B.returnValue=false}else{A.annControl.HandleKeyDown(C,B.shiftKey,B.ctrlKey,B.altKey)}}else{switch(C){case dojo.keys.HOME:A.VScroller.pageHome();break;case dojo.keys.END:A.VScroller.pageEnd();break;case dojo.keys.PAGE_UP:A.VScroller.pageUp();break;case dojo.keys.PAGE_DOWN:A.VScroller.pageDown();break;case dojo.keys.UP_ARROW:A.VScroller.move_position(-50);break;case dojo.keys.DOWN_ARROW:A.VScroller.move_position(50);break;case dojo.keys.LEFT_ARROW:A.HScroller.move_position(-50);break;case dojo.keys.RIGHT_ARROW:A.HScroller.move_position(50);break;default:A.annControl.HandleKeyDown(C,B.shiftKey,B.ctrlKey,B.altKey)}}}},GetKeyUpHandler:function(){var A=this;return function(B){B=(!B)?window.event:B;var C=B.key?B.key:B.keyCode;return A.annControl.HandleKeyUp(C,B.shiftKey,B.ctrlKey,B.altKey)}},GetScrollWheelHandler:function(){var A=this;return function(B){B=(!B)?window.event:B;var C=0;if(B.wheelDelta){C=-B.wheelDelta/120}else{if(B.detail){C=B.detail/3}}if(!A.annControl.HandleScroll(C)){A.VScroller.move_position(C*50)}}},loadAnnotationControl:function(){var G=this._docid+":"+this._repository;var C=this;var B=parseInt(this._annOuterDiv.style.height);var F=parseInt(this._annOuterDiv.style.width);if(B==0){B=5}if(F==0){F=5}var H=C._imageViewer.Scale/100;if(!C._imageViewer.ImageHeight){C._imageViewer.ImageHeight=100;C._imageViewer.ImageWidth=100;C._imageViewer.Rotation=0}var E=C._imageViewer.Rotation;var D=this.annControl&&this.annControl._editor;this.annControl=new Laserfiche.AnnotationControl(this._repository,this._docid);this.annControl.set_surface(this._annLayerDiv,F,B,this._imageViewer);this.annControl.set_pageviewCtrl(C);var A=this._controller._lastSecParams;if(A){this.annControl._readonly=(A.Rights.indexOf("Ann")==-1)||A.VolReadOnly}this.annControl.set_appController(this._controller);if(this.annControl._rotation!=E){this.annControl.set_rotation(E,true)}this.annControl.set_scale(H);if(D){this.annControl._editor=D;this.annControl._textNodeContainer=this._textContainer.domNode;this.annControl._editorLoaded=true}else{this.annControl.set_textEditor(this._textContainer.domNode)}this.annControl.onNeedImageViewResize=function(){C.onNeedImageViewResize()};this.annControl.onmove=function(I,L,K,J){if(J){C.VScroller.set_position(-L,true,true)}if(K){C.HScroller.set_position(-I,true,true)}};this.annControl.onscale=function(){if(C.onscale){C.onscale()}C.UpdateDimensions()};this.annControl.onrotate=function(){C.UpdateDimensions()};this._controller.set_annotationControl(this.annControl)},SetImageVisibility:function(B){var A=this._imageContainer.domNode.style.display!="none";if(B!=this._imagevisible){this._imagevisible=B;if(B){this._imageContainer.domNode.style.display="";if(this._textvisible){this._pagedisplayContainer._splitters.right.style.display="";if(this._tempTextSize>0){this._textContainer.domNode.style.width=this._tempTextSize+"px";this._tempTextSize=0}}else{this._textContainer.domNode.style.width="1px";this._pagedisplayContainer._splitters.right.style.display="none"}}else{if(this._textvisible){this._tempTextSize=parseInt(this._textContainer.domNode.style.width);this._textContainer.domNode.style.width="100%"}else{this._tempTextSize=parseInt(dojo.attr(this._textContainer.domNode,"savedWidth")||"200px")}this._imageContainer.domNode.style.display="none";this._pagedisplayContainer._splitters.right.style.display="none"}this._pagedisplayContainer.layout()}},SetTextVisibility:function(A){if(A!=this._textvisible){this._textvisible=A;if(A){if(this._imagevisible){this._textContainer.domNode.style.width=dojo.attr(this._textContainer.domNode,"savedWidth")||"200px";this._pagedisplayContainer._splitters.right.style.display=""}else{this._textContainer.domNode.style.width="100%";this._pagedisplayContainer._splitters.right.style.display="none"}}else{if(this._imagevisible){dojo.attr(this._textContainer.domNode,"savedWidth",this._textContainer.domNode.style.width)}this._textContainer.domNode.style.width="1px";this._pagedisplayContainer._splitters.right.style.display="none";if(this.annControl&&this.annControl._editor&&this.annControl._editor.OnEditorHide){this.annControl._editor.OnEditorHide()}}this._pagedisplayContainer.layout()}},initializeStructure:function(C){var E=this;var H=document.createElement("div");H.style.position="absolute";H.style.left="0px";H.style.backgroundColor="#8E95AD";var K=new dijit.layout.BorderContainer({},H);K.startup();this._pagedisplayContainer=K;var N=document.createElement("div");N.className="ImageView";var M=new dijit.layout.ContentPane({region:"center"},N);this._imageContainer=M;var J=document.createElement("div");J.className="TextView";J.style.width="250px";var F=new dijit.layout.ContentPane({region:"trailing",splitter:true},J);this._textContainer=F;K.addChild(M);K.addChild(F);E.resizetimeout=null;var I=function(){clearTimeout(E.resizetimeout);E.resizetimeout=setTimeout(function(){E.onNeedImageViewResize();E.resizetimeout=null},500)};dojo.connect(M,"resize",I);var O=document.createElement("div");O.style.position="absolute";O.style.top="0px";O.style.left="0px";O.className="StackingControl";dojo.connect(O,"contextmenu",this.GetOnContextMenu());this._outerDiv=O;var G=document.createElement("div");G.className="StackingControl";G.style.overflow="hidden";this._contentDiv=G;var L=document.createElement("div");L.className="StackingControl";L.style.zIndex=5;this._imageviewerDiv=L;var Q=document.createElement("div");Q.className="StackingControl";Q.style.overflow="hidden";Q.style.height="100px";Q.style.width="100px";Q.style.zIndex=10;this._annOuterDiv=Q;var B=document.createElement("div");B.className="StackingControl";B.style.backgroundImage="url(transparent.gif)";B.style.position="absolute";this._annLayerDiv=B;Q.appendChild(B);G.appendChild(L);G.appendChild(Q);O.appendChild(G);var P=document.createElement("div");P.style.position="absolute";P.style.top="0px";P.style.right="0px";this._vscrollDiv=P;var D=document.createElement("div");D.style.position="absolute";D.style.bottom="0px";D.style.left="0px";this._hscrollDiv=D;O.appendChild(P);O.appendChild(D);M.domNode.appendChild(O);C.appendChild(K.domNode);var A=dijit.byId(K._splitters.right.id);dojo.connect(A,"_startDrag",function(){E._textContainer.domNode.style.backgroundColor="#DCE1F5";E._textContainer.domNode.firstChild.style.visibility="hidden"});dojo.connect(A,"_stopDrag",function(){E._textContainer.domNode.style.backgroundColor="#FFFFFF";E._textContainer.domNode.firstChild.style.visibility=""})},GetOnContextMenu:function(){var A=this;return function(E){var B=true;if(B&&A._controller){A._menuscontainer=document.createElement("div");A._menuscontainer.style.position="relative";document.body.appendChild(A._menuscontainer);var C=A._controller.getContextMenuItems(top.TYPE_DOCUMENT_PAGE_IMAGE);var D=top.SimpleMenu.CreateMenu(C,A._menuscontainer);D.UpdateContextMenu(A._controller);var F=dojo.coords(A._menuscontainer);D.Show(E.clientX-F.x,E.clientY-F.y);D.onselect=function(){A._controller.doAction(D.value);D.Hide()};D.onhide=function(){D.DeleteMenu()}}dojo.stopEvent(E)}},_adjustScrollBars:function(L,B,I,H){var J=this._outerDiv;var N=this._annOuterDiv;var D=this._contentDiv;var G=17;if(!this._pageloaded){return }if(I<=0||H<=0){return }var A=L>1?L:1;var M=B>1?B:1;J.style.height=A+"px";J.style.width=M+"px";var E=I>A;var F=H>M;var K=A;var C=M;if(E){C=B-G;if(!F){F=H>C}if(F){K=L-G}}else{if(F){K=L-G;E=I>K;if(E){C=B-G}}}N.style.height=(K>0?K:1)+"px";N.style.width=(C>0?C:1)+"px";D.style.height=N.style.height;D.style.width=N.style.width;if(this.annControl){this.annControl.set_fullDimensions(C,K);this.annControl.set_imageviewDimensions(Math.min(H,C),Math.min(I,K))}this.VScroller.set_length(I);this.VScroller.set_actualLength(K>0?K:1);this.HScroller.set_length(H);this.HScroller.set_actualLength(C>0?C:1)},_initializeScrollbars:function(){var A=this;var C=this._vscrollDiv;var B=this._hscrollDiv;this.VScroller=new Laserfiche.Layout.Scroller(C,false);this.VScroller.initialize();this.VScroller.onscroll=function(D){A.annControl.set_yoffset(-parseInt(D/A.annControl.get_scale()),true)};this.HScroller=new Laserfiche.Layout.Scroller(B,true);this.HScroller.initialize();this.HScroller.onscroll=function(D){A.annControl.set_xoffset(-parseInt(D/A.annControl.get_scale()),true)}}};if(!top.LF){top.LF={}}LF.DocViewControl=function(B,A){this._div=B;this._imageShown=true;this._textShown=false;this._fieldsShown=true;this._setManuelTextShown=false;this._setManuelImageShown=true;this._thumbsShown=false;this._searchShown=false;this._tempThumbsSize=0;this._controller=A;this.initializeStructure(B,A);this._otherZoomIndex=-1;this._numPages=100;this._loaded=false;this._active=false;this.listener=new LF.Listener("DocViewControlListener");this.listener.setHandler("PageOpened",this.GetOnPageOpened());this.listener.setHandler("DisplaySearchResults",this.DisplaySearchResults());A.subscribe("PageOpened",this.listener);A.subscribe("DisplaySearchResults",this.listener)};LF.DocViewControl.prototype={activate:function(){this._active=true;this.listener.turnOn();this._pageviewControl.activate();if(this._width&&this._height){this.resize(this._width,this._height)}},deactivate:function(){this._active=false;this.listener.turnOff();this._pageviewControl.deactivate()},get_DOMelement:function(){return this._div},resize:function(B,A){this._width=B;this._height=A;if(!this._active){return }var C=Math.max(1,A-25);this._mainContainer.resize({w:B,h:C});this._mainContainer.layout()},doLayout:function(){this._adjustLeftPane();if(this._thumbsShown){this._controller.layout.ActivateSlot("Preview")}else{this._controller.layout.DeactivateSlot("Preview")}},unsetLayout:function(){if(!dojo.exists("_leftPane.domNode",this)){return }var B=this._leftPane.domNode.style.display!="none";var A=false;if(!B){this._leftPane.domNode.style.display="";this._mainPane._splitters.left.style.display=""}if(this._ltopPane.domNode.style.display=="none"){this._ltopPane.domNode.style.display="";A=true}if(this._lbtmPane.domNode.style.display=="none"){this._lbtmPane.domNode.style.display="";A=true}if(this._leftPane._splitters.bottom.style.display=="none"){this._leftPane._splitters.bottom.style.display="";A=true}if(this._tempThumbsSize>0){this._lbtmPane.domNode.style.height=this._tempThumbsSize+"px";A=true}if(!B){this._mainPane.layout()}else{if(A){this._leftPane.layout()}}},get_pagenum:function(){return this._pageviewControl.get_pagenum()},set_pagenum:function(G){var C=this;var E=this.get_pagenum();var H=parseInt(G);if(isNaN(H)){H=E;this._pageInput.set_value(H);return }H=Math.max(1,Math.min(this._numPages,H));this._pageInput.set_value(H);if(E!=H){var F=false;var I=this._pageviewControl.annControl;if(I&&I.isDirty()){F=confirm("Save changes to the current page?\n\nPress OK to save changes, or Cancel to discard changes.")}if(F){var B=function(){C._pageviewControl.set_pagenum(H)};var D=function(J){if(Laserfiche.Exception.IsConnectionLost(J)){Laserfiche.Exception.DocViewConnectionLostFunc();return }alert(J.get_message());C._pageviewControl.set_pagenum(H)};var A=function(){var J=new Array();if(I._rotationchanged){J.push({Property:"rotation",Value:I._rotation})}I._editor.saveText();Laserfiche.WebAccess.DocumentService.SaveEntry(C.get_docid(),C.get_repository(),E,null,J,B,D)};if(I&&I.ChangesPending()){I.onChangesSent=A}else{A()}}else{if(I){I.setClean()}this._pageviewControl.set_pagenum(H)}}else{this._pageviewControl.set_pagenum(H)}},get_docid:function(){return this._pageviewControl.get_docid()},get_repository:function(){return this._pageviewControl.get_repository()},set_document:function(A,B){if(this.get_docid()==A&&this.get_repository()==B){return }this._searchInput.set_value("");this._searchButton.disabled=false;this._pageviewControl.set_document(A,B);if(this._hitsControl){this._hitsControl.set_entry(A,B)}this._totalPagesSpan.innerHTML="--";Laserfiche.WebAccess.DocumentService.GetDocumentInfo(A,B,this.GetOnInfo(),this.GetOnInfoError())},setPaneInfo:function(A,E,D,C,B){this._mainPane=A;this._leftPane=E;this._ltopPane=D;this._lbtmPane=C;this._previewTitle=B},setContextHitsControl:function(A){this._hitsControl=A},Clear:function(){this._pageviewControl.Clear()},FirstPage:function(){var A=this.get_pagenum();if(A==1){this._pageInput.set_value(A);return }this.set_pagenum(1)},PreviousPage:function(){var A=Math.max(1,this.get_pagenum()-1);var B=this.get_pagenum();if(B==A){this._pageInput.set_value(B);return }this.set_pagenum(A)},NextPage:function(){var A=Math.min(this._numPages,parseInt(this.get_pagenum())+1);var B=this.get_pagenum();if(B==A){this._pageInput.set_value(B);return }this.set_pagenum(A)},LastPage:function(){var A=this.get_pagenum();if(A==this._numPages){this._pageInput.set_value(A);return }this.set_pagenum(this._numPages)},ZoomIn:function(){this._pageviewControl.annControl.ZoomIn()},ZoomOut:function(){this._pageviewControl.annControl.ZoomOut()},SelectScale:function(B){var A=this._pageviewControl.annControl;switch(B){case"P":A.FitToPage();break;case"W":A.FitToWidth();break;case"H":A.FitToHeight();break;default:Laserfiche.ZoomMode.ZoomType=Laserfiche.ZoomTypes.ZOOM_TYPE_USE_SCALE;A.set_scale(parseInt(B)/100)}},Rotate:function(){var A=this._pageviewControl.annControl;var B=A.get_rotation();B=(B+90)%360;A.set_rotation(B)},RotateCCW:function(){var A=this._pageviewControl.annControl;var B=A.get_rotation();B=(B-90);while(B<0){B=B+360}B=B%360;A.set_rotation(B)},RunSearch:function(){var B=this;var A=false;var C=this._searchInput.get_value();if(C.length>0){this._hitsControl.onRowCountChanged=function(D){if(B._active){B._searchButton.disabled=false;B._searchStatus.innerHTML=D+" matches found."}};this._hitsControl.onreceive=function(){B._searchButton.disabled=false;if(B._active){B._pageviewControl.set_search(B._hitsControl.get_searchhandle());if(!A){var D=B._pageviewControl.annControl;A=true;setTimeout(function(){D.refreshTextContextHits(B._hitsControl.get_searchhandle())},0)}}};this._hitsControl.RunSearch(C)}else{alert("Please enter a word or phrase to search for.");this._searchButton.disabled=false}},ToggleMode:function(A){switch(A){case"Metadata":this._fieldsShown=!this._fieldsShown;this._metadataBtn.className=this._fieldsShown?"Selected":"";this._adjustLeftPane();break;case"Thumbnails":this._thumbsShown=!this._thumbsShown;this._thumbsBtn.className=this._thumbsShown?"Selected":"";this._adjustLeftPane();if(this._thumbsShown){this._controller.layout.ActivateSlot("Preview");top.previewTitleBar.GetOnModeChanged()({args:{mode:1}})}else{this._controller.layout.DeactivateSlot("Preview")}break;case"DocSearch":this._searchShown=!this._searchShown;this._docsearchBtn.className=this._searchShown?"Selected":"";if(this._searchShown){this._searchviewContainer.domNode.style.display="";this._mainContainer._splitters.bottom.style.display="";this._controller.layout.ActivateSlot("DocumentSearchHits")}else{this._searchviewContainer.domNode.style.display="none";this._mainContainer._splitters.bottom.style.display="none";this._controller.layout.DeactivateSlot("DocumentSearchHits")}this._mainContainer.layout();break;case"Image":this._setManuelImageShown=!this._imageShown;this.SetImageVisibility(!this._imageShown);break;case"Text":this._setManuelTextShown=!this._textShown;this.SetTextVisibility(!this._textShown);break}},_adjustLeftPane:function(){var B=this._leftPane.domNode.style.display!="none";var A=false;if(this._fieldsShown&&this._thumbsShown){if(!B){A=true}this._leftPane.domNode.style.display="";this._mainPane._splitters.left.style.display="";this._ltopPane.domNode.style.display="";this._lbtmPane.domNode.style.display="";this._leftPane._splitters.bottom.style.display="";if(this._tempThumbsSize>0){this._lbtmPane.domNode.style.height=this._tempThumbsSize+"px";this._tempThumbsSize=0}}else{if(this._fieldsShown){if(!B){A=true}this._leftPane.domNode.style.display="";this._mainPane._splitters.left.style.display="";this._ltopPane.domNode.style.display="";this._lbtmPane.domNode.style.display="none";this._leftPane._splitters.bottom.style.display="none"}else{if(this._thumbsShown){if(!B){A=true}this._leftPane.domNode.style.display="";this._mainPane._splitters.left.style.display="";this._ltopPane.domNode.style.display="none";this._lbtmPane.domNode.style.display="";if(this._tempThumbsSize<=0){this._tempThumbsSize=parseInt(this._lbtmPane.domNode.style.height);this._lbtmPane.domNode.style.height="100%"}this._leftPane._splitters.bottom.style.display="none"}else{if(B){A=true}this._leftPane.domNode.style.display="none";this._mainPane._splitters.left.style.display="none"}}}if(A){this._mainPane.layout()}else{this._leftPane.layout()}},initializeStructure:function(L,M){var N=this;var A=document.createElement("div");A.className="DocumentPanel";var P=document.createElement("div");P.className="IconButtons";P.style.position="absolute";P.style.top="0px";P.style.left="2px";P.style.verticalAlign="middle";var D="Assets/images/buttons/";this._metadataBtn=this._generateImageButton(D+"metadata.gif","Show Metadata");this._metadataBtn.onclick=function(){N.ToggleMode("Metadata");return false};this._metadataBtn.className=this._fieldsShown?"Selected":"";P.appendChild(this._metadataBtn);this._thumbsBtn=this._generateImageButton(D+"thumbs.gif","Show Thumbnails");this._thumbsBtn.onclick=function(){N.ToggleMode("Thumbnails");return false};this._thumbsBtn.className=this._thumbsShown?"Selected":"";P.appendChild(this._thumbsBtn);this._imageBtn=this._generateImageButton(D+"image.gif","Show Image");this._imageBtn.onclick=function(){N.ToggleMode("Image");return false};this._imageBtn.className=this._imageShown?"Selected":"";P.appendChild(this._imageBtn);this._textBtn=this._generateImageButton(D+"text.gif","Show Text");this._textBtn.onclick=function(){N.ToggleMode("Text");return false};this._textBtn.className=this._textShown?"Selected":"";P.appendChild(this._textBtn);this._docsearchBtn=this._generateImageButton(D+"docsearch.gif","Search Document");this._docsearchBtn.onclick=function(){N.ToggleMode("DocSearch");return false};this._docsearchBtn.className=this._searchShown?"Selected":"";P.appendChild(this._docsearchBtn);P.appendChild(document.createTextNode("   "));this._firstpageBtn=this._generateImageButton(D+"LeftArrowLine.gif","First Page");this._firstpageBtn.onclick=function(){N.FirstPage();return false};P.appendChild(this._firstpageBtn);this._prevpageBtn=this._generateImageButton(D+"LeftArrow.gif","Previous Page");this._prevpageBtn.onclick=function(){N.PreviousPage();return false};P.appendChild(this._prevpageBtn);P.appendChild(document.createTextNode("Page"));var Q=document.createElement("input");Q.size=2;Q.style.textAlign="center";Q.style.verticalAlign="middle";this._pageInput=new Laserfiche.Layout.PlaceholderInput("",Q,true,true);this._pageInput.ontimedchange=function(){N.set_pagenum(N._pageInput.get_value())};P.appendChild(Q);P.appendChild(document.createTextNode(" of "));this._totalPagesSpan=document.createElement("span");this._totalPagesSpan.innerHTML="--";P.appendChild(this._totalPagesSpan);this._nextpageBtn=this._generateImageButton(D+"RightArrow.gif","Next Page");this._nextpageBtn.onclick=function(){N.NextPage();return false};P.appendChild(this._nextpageBtn);this._lastpageBtn=this._generateImageButton(D+"RightArrowLine.gif","Last Page");this._lastpageBtn.onclick=function(){N.LastPage();return false};P.appendChild(this._lastpageBtn);P.appendChild(document.createTextNode("   "));this._zoomoutBtn=this._generateImageButton(D+"zoomOut.gif","Zoom Out");this._zoomoutBtn.onclick=function(){N.ZoomOut();return false};P.appendChild(this._zoomoutBtn);this._zoomSelect=document.createElement("select");this._zoomSelect.style.verticalAlign="middle";this._zoomSelect.options[0]=new Option("Fit Window","P");this._zoomSelect.options[1]=new Option("Fit Width","W");this._zoomSelect.options[2]=new Option("Fit Height","H");this._zoomSelect.options[3]=new Option("25%","25");this._zoomSelect.options[4]=new Option("50%","50");this._zoomSelect.options[5]=new Option("75%","75");this._zoomSelect.options[6]=new Option("100%","100");this._zoomSelect.options[7]=new Option("200%","200");this._zoomSelect.options[8]=new Option("400%","400");this._otherZoomIndex=9;this._zoomSelect.onchange=function(){N.SelectScale(this.options[this.selectedIndex].value)};P.appendChild(this._zoomSelect);this._zoominBtn=this._generateImageButton(D+"zoomIn.gif","Zoom In");this._zoominBtn.onclick=function(){N.ZoomIn();return false};P.appendChild(this._zoominBtn);P.appendChild(document.createTextNode("   "));this._rotateCCWBtn=this._generateImageButton(D+"rotateCCW.gif","Rotate Counterclockwise");this._rotateCCWBtn.onclick=function(){N.RotateCCW();return false};P.appendChild(this._rotateCCWBtn);this._rotateBtn=this._generateImageButton(D+"rotate.gif","Rotate Clockwise");this._rotateBtn.onclick=function(){N.Rotate();return false};P.appendChild(this._rotateBtn);A.appendChild(P);L.appendChild(A);var E=document.createElement("div");E.style.position="relative";var G=new dijit.layout.BorderContainer({},E);G.startup();this._mainContainer=G;var R=document.createElement("div");var O=new dijit.layout.ContentPane({region:"center"},R);this._pageviewContainer=O;var J=new LF.PageViewControl(R);J.set_controller(M);J.onscale=this.GetOnScaleChanged();J.Load();this._pageviewControl=J;var S=document.createElement("div");S.style.height="200px";S.style.backgroundColor="#DCE1F5";var U=new dijit.layout.ContentPane({region:"bottom",splitter:true},S);this._searchviewContainer=U;var I=document.createElement("div");I.className="DocumentSearchBar";I.appendChild(document.createTextNode("Search for "));var K=document.createElement("input");K.style.width="185px";I.appendChild(K);this._searchButton=document.createElement("button");this._searchButton.appendChild(document.createTextNode("Search"));this._searchButton.onclick=function(){N._searchButton.disabled=true;N.RunSearch()};I.appendChild(this._searchButton);var V=function(W){if(!W){W=window.event}var X=dojo.keys;switch(W.keyCode){case X.ENTER:N._searchButton.click();W.cancelBubble=true;W.returnValue=false;return false;break}};K.onkeydown=V;K.onkeyup=V;this._searchInput=new Laserfiche.Layout.PlaceholderInput("Search document...",K);this._searchStatus=document.createElement("div");this._searchStatus.style.position="absolute";this._searchStatus.style.right="30px";this._searchStatus.style.top="4px";I.appendChild(this._searchStatus);var T=document.createElement("a");T.style.position="absolute";T.style.right="5px";T.style.top="4px";T.title="Close Document Search";T.href="javascript:void(0);";T.onclick=function(){N.ToggleMode("DocSearch")};var B=document.createElement("img");B.src="Assets/images/close.gif";B.onmouseover=function(){this.src="Assets/images/closeOver.gif"};B.onmouseout=function(){this.src="Assets/images/close.gif"};T.appendChild(B);I.appendChild(T);S.appendChild(I);var H=document.createElement("div");this._searchhitsDiv=H;S.appendChild(H);this._controller.layout.RegisterSlot("DocumentSearchHits",H,false);var F=function(){var W=N._searchviewContainer.domNode.offsetHeight;var X=N._searchviewContainer.domNode.offsetWidth;W=Math.max(1,W-25);N._controller.layout.ResizeSlot("DocumentSearchHits",X,W)};dojo.connect(U,"resize",F);G.addChild(O);G.addChild(U);L.appendChild(E);G.layout();U.domNode.style.display="none";G._splitters.bottom.style.display="none";G.layout();this._pageviewControl.SetImageVisibility(this._imageShown);this._pageviewControl.SetTextVisibility(this._textShown);this._insertConnectionChecks();var C=document.createElement("div");L.appendChild(C);C.className="ImageErrorInfo";this._errormessage=document.createElement("span");C.appendChild(this._errormessage)},_insertConnectionChecks:function(){var A=this;var B=["FirstPage","PreviousPage","NextPage","LastPage","SelectScale","ZoomIn","ZoomOut","RotateCCW","Rotate"];dojo.forEach(B,function(F,E,C){A["_"+F]=A[F];var D=function(H){return function(I){if(I){A["_"+F](H)}else{G()}}};var G=function(){top.lostConnectionHandler.onLostConnection(A.get_repository(),dojo.hitch(A,A["_"+F]),null)};A[F]=function(H){Laserfiche.WebAccess.DocumentService.HasDbConnection(A.get_repository(),D(H),G)}})},_generateImageButton:function(A,D){var C=document.createElement("a");C.href="javascript:void(0);";var B=document.createElement("img");B.src=A;B.alt=D;C.appendChild(B);C.title=D;return C},GetOnScaleChanged:function(){var A=this;return function(){var B=A._pageviewControl.annControl;var E=B.get_scale();var C=false;switch(Laserfiche.ZoomMode.ZoomType){case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_PAGE:A._zoomSelect.selectedIndex=0;break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_WIDTH:A._zoomSelect.selectedIndex=1;break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_HEIGHT:A._zoomSelect.selectedIndex=2;break;case Laserfiche.ZoomTypes.ZOOM_TYPE_USE_SCALE:if(E==0.25){A._zoomSelect.selectedIndex=3}else{if(E==0.5){A._zoomSelect.selectedIndex=4}else{if(E==0.75){A._zoomSelect.selectedIndex=5}else{if(E==1){A._zoomSelect.selectedIndex=6}else{if(E==2){A._zoomSelect.selectedIndex=7}else{if(E==4){A._zoomSelect.selectedIndex=8}else{C=true}}}}}}break}if(A._otherZoomIndex<0){A._otherZoomIndex=A._zoomSelect.options.length}if(C){var D=parseInt(E*100)+"";A._zoomSelect.options[A._otherZoomIndex]=new Option(D+"%",D);A._zoomSelect.selectedIndex=A._otherZoomIndex}else{A._zoomSelect.options[A._otherZoomIndex]=null}}},GetOnInfo:function(){var A=this;return function(C){var B=A.get_docid()+":"+A.get_repository().toUpperCase();if(C.id!=B){return }A._numPages=parseInt(C.numpages);A._checkout=C.checkout;A._lock=C.lock;A._flags=C.flags;if(C.HowOpen=="Text"){A.SetTextVisibility(true);A.SetImageVisibility(false)}else{if(C.HowOpen=="Meta"){A.SetTextVisibility(false);A.SetImageVisibility(false)}else{A._imageShown=A._setManuelImageShown;A._textShown=A._setManuelTextShown;A.SetImageVisibility(A._setManuelImageShown);A.SetTextVisibility(A._setManuelTextShown)}}A._totalPagesSpan.innerHTML=A._numPages}},GetOnInfoError:function(){var A=this;return function(B){}},SetTextVisibility:function(B){var A=this;A._textShown=B;A._textBtn.className=A._textShown?"Selected":"";A._pageviewControl.SetTextVisibility(A._textShown)},SetImageVisibility:function(B){var A=this;A._imageShown=B;A._imageBtn.className=A._imageShown?"Selected":"";A._pageviewControl.SetImageVisibility(A._imageShown)},GetOnPageOpened:function(){var A=this;return function(D){if(D.args.openedDocument){var B=D.args.openedDocument.id;var E=(D.args.openedPage&&D.args.openedPage.pageId)||1;var C=D.args.repository;A.set_document(B,C);setTimeout(function(){A.set_pagenum(E)},100)}}},DisplaySearchResults:function(){var A=this;return function(C){if(C.args.annid==0){A._pageviewControl._imageViewer.search=C.args.searchhandle}var B=A._pageviewControl.annControl;B.PopulateSearchResults(C.args);if(B["annLoaded"]){B.DisplaySearchResults()}}},DisplayErrorMessage:function(A){while(this._errormessage.firstChild){this._errormessage.removeChild(this._errormessage.firstChild)}if(A!=""){this._errormessage.appendChild(document.createTextNode(A))}},getSelectedItems:function(D){var B=this;if((D!=null&&D!="ENTRIES")||(B._pageviewControl._docid==null)){var C=B._controller._context.focusedControl;if(C){var E=C.getSelectedItems&&C.getSelectedItems();if(E&&((E.type==D)||(B._pageviewControl._docid==null))){return E}}}var A=[{repository:B._pageviewControl._repository,id:B._pageviewControl._docid-0,name:""}];D="ENTRIES";return({items:A,type:D})},getLastSelectedItem:function(){return this.getSelectedItems()},setCtrlFocus:function(){return },getType:function(){return"DOCUMENT_VIEW"},getId:function(){return this._div.id}};if(!top.LF){top.LF={}}LF.ActionRegistry=function(A){this._controller=A;this.initialize()};LF.ActionRegistry.prototype={initialize:function(){var F=1;var T=2;var H=4;this._actions=new Array();var U=this;var l=function(x,w,v){return U.registerAction(x,w,function(y){alert(w)},null,v)};var o=function(v){return v?true:false};var k=function(v){return v&&v.AllDocuments&&v.HasPage};var A=function(v){var w=v&&v.getSelectedItems&&v.getSelectedItems();return(w&&w.items&&w.items.length==1)};var e=function(y,w){var x=A(w);var v=y&&y.AllDocuments&&y.HasImage;return x&&v};var S=function(y,w){var x=A(w);var v=y&&y.AllDocuments&&y.HasImage;return x&&v};var W=function(y,v){var x=A(v);var w=y&&y.AllDocuments&&y.HasText;return x&&w};var Q=function(y,w){var x=A(w);var v=y&&y.AllDocuments&&y.HasEfile;return x&&v};var p=function(v){return v&&!v.InRB};var X=function(x,w){var v=(top.myAppController._mainTabs._curTab=="S");var y=top.mySearchResultListingControl;var z=!!(y&&y._model&&y._model.searchhandle);return v};var I=function(v){return true};var J=function(v){return !!v.LoggedIn};var n=function(v){return !!v.AllowCut};var a=function(v){return !!v.AllowCopy};var u=function(v){return !!v.AllowPaste};var C=function(w,v){return !!w.AllowPasteSC};var L=function(w,v){return !!w.AllowPasteFolOnly&&w.CreateFolder};var s=function(w,v){var x=v&&v.getSelectedItems&&v.getSelectedItems();if(!x||x.items.length==0){return false}if(x.items[0].id==1){return false}return top.hasFeature(v.repository,"Delete")&&w.AllowDelete};var M=function(x,v){var w=A(v);var y=!(x&&x.HasEfile&&!x.IsCheckedOut);return w&&!y};var q=function(y,v){var x=A(v);var w=y&&y.IsCheckedOut&&y.HasCheckedOut;return x&&w};var j=function(x,v){var z=new RightsStringClass(x.Rights);var y=z.hasRight("ACCESS_READ_ACL");var w=x&&x.IsCheckedOut&&(x.HasCheckedOut||y);return w};var E=function(x,v){var w=A(v);var y=x&&x.IsCheckedOut;return w&&y};var R=function(x,v){var w=A(v);var y=!!x.LoggedIn;return w&&y};var d=function(w,v){var x=!!w.LoggedIn;return x};var f=function(y,v){var x=A(v);var w=y.AllowRename;return x&&w&&v.getSelectedItems().items[0].id!=1};var Y=function(w,v){return !!top.hasFeature(v.repository,"EditText")&&!top.myAppController._lastSecParams.VolReadOnly};var c=function(w){var v=dojo.exists("docviewControl._pageviewControl.annControl._editor.hasTextChanged",top);return !!(v&&top.docviewControl._pageviewControl.annControl._editor.hasTextChanged())};var D=function(x,v){var w=A(v);var z=new RightsStringClass(x.Rights);var y=z.hasRight("ACCESS_READ_ACL");return y&&w};var N=function(x,v){var w=A(v);var y=x&&x.HasEfile;return w&&y};var P=function(x,v){var w=A(v);var y=x&&x.HasEfile;return w&&y};var Z=function(x,v){var w=A(v);var y=x&&x.HasEfile;return w&&y};var B=function(x,w){var v=new RightsStringClass(x.Rights);if(v.hasRight("ENTRY_WRITE_CONTENT")){return true}else{return false}};var h=function(z,x){var v=new RightsStringClass(z.Rights);var w=top.hasFeature(x.repository,"Delete");var y=v.hasRight("ENTRY_REMOVE_PAGE");return(w&&y)};var t=function(w,v){return w.VolAddFiles};var V=function(v){return top.myAppController.Settings.OpenEdocAsDoc};var G=function(v){return !top.myAppController.Settings.OpenEdocAsDoc};var m=function(w){var v=w._lastSecParams;if(v){return v.Rights.indexOf("Ann")==-1||v.VolReadOnly}return false};this.registerAction("NoAction",null,function(){},null);var O=this.registerAction("OpenPages","Open Pages",LF.Actions.OpenPages,function(){return true},null,null,0);var K=this.registerAction("OpenEDoc","Open Electronic File",LF.Actions.OpenEdoc,function(){return true},null,null,0);this.addBoldFunc(O,V);this.addBoldFunc(K,G);this.registerAction("Cut","Cut",LF.Actions.Cut,n,"CutIcon","X",F,function(v){return !v.CurrentLoginInfo.Move});this.registerAction("Copy","Copy",LF.Actions.Copy,a,"CopyIcon","C",F);this.registerAction("Paste","Paste",LF.Actions.Paste,u,"PasteIcon","V",F);this.registerAction("PASTESHORT","Paste Shortcut",LF.Actions.PasteShortCut,C,"PasteShortIcon",null,F);this.registerAction("PASTE_FOLDERS_ONLY","Paste Folder Only",LF.Actions.PasteFoldersOnly,L,"",null,F);this.registerAction("Open","Open",LF.Actions.OpenEntry,o,"OpenIcon",null,F);this.registerAction("Open_Parent_Folder","Open Containing Folder",LF.Actions.OpenParentFolder,o,"OpenIcon",null,F);this.registerAction("REFRESH","Refresh",LF.Actions.Refresh,J,"RefreshIcon",null,F);this.registerAction("SCAN","Scan",LF.Actions.Scan,J,"ScanIcon",null,F|T,function(v){return !v.CurrentLoginInfo.Scan});this.registerAction("IMPORT","Import",LF.Actions.Import,function(v){return v.CreateDoc},"ImportIcon",null,F,function(v){return !v.CurrentLoginInfo.Import});this.registerAction("Delete","Delete",LF.Actions.Delete,s,"DeleteIcon",null,F,function(v){return !v.CurrentLoginInfo.Delete});this.registerAction("CHECKEDOUTDOCS","Checked Out Documents",LF.Actions.ShowCheckedOutDocs,J,"CODocsIcon",null,F);this.registerAction("Email","Send As E-mail",LF.Actions.AddEmailAttachment,function(w,v){return(w.HasEfile||w.HasImage||w.HasText)},"EmailIcon",null,F|T|H,function(v){return !v.CurrentLoginInfo.Export||!v.CurrentLoginInfo.Mapi});this.registerAction("Save","Save",LF.Actions.Save,J,"SaveIcon",null,T);this.registerAction("SaveMetadata","Save",LF.Actions.SaveMetadata,J,"SaveIcon",null,H);this.registerAction("RevertMetadata","Revert",LF.Actions.RevertMetadata,J,"RevertIcon",null,H);this.registerAction("ABOUT","About",LF.Actions.About,J,null,null,F|T|H);this.registerAction("HELP","Help",LF.Actions.Help,J,null,null,F|T|H);this.registerAction("Open_Page","Open Page",LF.Actions.OpenPage,function(){return true},"OpenIcon",null,0);this.registerAction("NewDoc_FromPages","New Document",LF.Actions.NewDocFromPages,function(){return true},"NewDocIcon",null,0);this.registerAction("Rotate_CW","Clockwise",LF.Actions.RotatePages90,B,"",null,0);this.registerAction("Rotate_CCW","Counter Clockwise",LF.Actions.RotatePages270,B,"",null,0);this.registerAction("Rotate_UD","Upside-down",LF.Actions.RotatePages180,B,"",null,0);this.registerAction("DeletePages","Delete Pages",LF.Actions.DeletePages,h,"DeleteIcon",null,0);this.registerAction("SETTINGS","Settings",LF.Actions.Settings,J,"SettingsIcon",null,F|T|H);this.registerAction("PASSWORD","Change Password",LF.Actions.ChangePassword,J,"ChangePWIcon",null,F);this.registerAction("SearchAttributes","Choose Search Attributes",LF.Actions.ChooseSearchAttributes,J,"SearchAttIcon",null,F);this.registerAction("COLUMNS","Configure Columns",LF.Actions.CustomizeColumns,J,"ColumnsIcon",null,F);this.registerAction("SEARCH_COLUMNS","Configure Search Columns",LF.Actions.CustomizeSearchColumns,J,"ColumnsIcon",null,F);this.registerAction("TOOLBAR","Customize Toolbar",LF.Actions.CustomizeToolbar,J,"ToolbarIcon",null,F);this.registerAction("SORTASC","Sort Ascending",LF.Actions.SortAscending,J,null,null,0);this.registerAction("SORTDESC","Sort Descending",LF.Actions.SortDescending,J,null,null,0);this.registerAction("MIGRATE","Migrate",LF.Actions.MigrateEntry,J,"MigrateIcon",null,F,function(v){return !v.CurrentLoginInfo.Migrate});this.registerAction("Move","Move",LF.Actions.Move,J,"MoveIcon",null,F|T,function(v){return !v.CurrentLoginInfo.Move});this.registerAction("NEWFOL","New Folder",LF.Actions.NewFolder,function(v){return v.CreateFolder},"NewFolIcon",null,F);this.registerAction("NEWDOC","New Document",LF.Actions.NewDocument,function(v){return v.CreateDoc},"NewDocIcon",null,F);this.registerAction("NEWSHORT","New Shortcut",LF.Actions.NewShortcut,function(v){return v.CreateDoc},"ShortcutIcon",null,F);this.registerAction("PURGE","Purge",LF.Actions.Purge,J,"PurgeIcon",null,F);this.registerAction("RESTORE","Restore",LF.Actions.Restore,J,"RestoreIcon",null,F);this.registerAction("PURGEALLENTRIES","Purge all entries",LF.Actions.PurgeAll,J,"PurgeAllIcon",null,F);this.registerAction("RENAME","Rename",LF.Actions.Rename,f,"RenameIcon",null,F);this.registerAction("UPFOLDER","Up Folder",LF.Actions.UpFolder,function(w,v){return v.openedFolder&&v.openedFolder.id!=1},"UpFolderIcon",null,F);this.registerAction("LOGIN","Login",LF.Actions.Login,!J,null,null,0);this.registerAction("LOGOUT","Log Out",LF.Actions.Logout,o,null,null,0);this.registerAction("LogOutAll","Log Out All Repositories",LF.Actions.LogoutAll,J,null,null,0);this.registerAction("PRINT_FOLDER","Print Folder Contents",LF.Actions.PrintFolder,J,"PrintContentsIcon",null,F,function(v){return !v.CurrentLoginInfo.Print});this.registerAction("Fields","Fields",LF.Actions.Fields,d,"FieldsIcon",null,F);this.registerAction("PROPS","Properties",LF.Actions.ShowProperties,R,"PropsIcon",null,F|T|H);this.registerAction("ACCESS","Access Rights",LF.Actions.AccessRights,D,"EntryAccessIcon",null,F);this.registerAction("MAKETEXT","Extract Text",LF.Actions.ExtractText,N,"MakeTextIcon",null,F,function(v){return !v.CurrentLoginInfo.Process});this.registerAction("CHECKOUT","Check Out",LF.Actions.CheckOutDocument,M,"CheckOutIcon",null,F);this.registerAction("CHECKIN","Check In",LF.Actions.CheckinDocument,q,"CheckInIcon",null,F);this.registerAction("UNDOCHECKOUT","Undo Check Out",LF.Actions.UndoCheckoutDocument,j,"UndoCOIcon",null,F);this.registerAction("CHECKOUTDETAILS","Check Out Details",LF.Actions.CheckoutDetails,E,"CODetailsIcon",null,F);this.registerAction("DELETEELEC","Delete Electronic Files",LF.Actions.DeleteElecFile,P,"DeleteEfileIcon",null,F|T|H,function(v){return !v.CurrentLoginInfo.Delete});this.registerAction("REPLACEELEC","Replace Electronic File",LF.Actions.ReplaceElecFile,Z,"ReplaceEfileIcon",null,F|T|H,function(v){return !v.CurrentLoginInfo.Delete});this.registerAction("ExportPDF","Export PDF",LF.Actions.ExportPDF,e,"PDFIcon",null,F|T|H,function(v){return !v.CurrentLoginInfo.Export});this.registerAction("ExportEfile","Export Electronic File",LF.Actions.ExportElectFile,Q,"EfileIcon",null,F|T|H,function(v){return !v.CurrentLoginInfo.Export});this.registerAction("ExportImage","Export Image",LF.Actions.ExportTIFF,S,"ImageIcon",null,F|T|H,function(v){return !v.CurrentLoginInfo.Export});this.registerAction("ExportText","Export Text",LF.Actions.ExportText,W,"TextIcon",null,F|T|H,function(v){return !v.CurrentLoginInfo.Export});this.registerAction("EXPORTBRIEF","Export Briefcase",LF.Actions.ExportBriefcase,p,"BriefcaseIcon",null,F,function(v){return !v.CurrentLoginInfo.Export});this.registerAction("EXPORT_LISTING","Export Listing",LF.Actions.ExportListing,I,"ListContentsIcon",null,1,function(v){return !v.CurrentLoginInfo.Export});this.registerAction("EXPORTBRIEF_LISTING","Export Search Results",LF.Actions.ExportSearchResults,X,null,null,1,function(x){var w=x.CurrentLoginInfo.Export;var v=(top.myAppController._mainTabs._curTab=="S");return(!w||!v)});this.registerAction("Rotate","Rotate Clockwise",LF.Actions.Rotate,J,"RotateIcon",null,T);this.registerAction("RotateCCW","Rotate Counterclockwise",LF.Actions.RotateCCW,J,"RotateCCWIcon",null,T);this.registerAction("NextPage","Next Page",LF.Actions.NextPage,J,"NextPageIcon",null,T);this.registerAction("PrevPage","Previous Page",LF.Actions.PrevPage,J,"PrevPageIcon",null,T);this.registerAction("FirstPage","First Page",LF.Actions.FirstPage,J,"FirstPageIcon",null,T);this.registerAction("LastPage","Last Page",LF.Actions.LastPage,J,"LastPageIcon",null,T);this.registerAction("ZoomIn","Zoom In",LF.Actions.ZoomIn,J,"ZoomInIcon",null,T);this.registerAction("ZoomOut","Zoom Out",LF.Actions.ZoomOut,J,"ZoomOutIcon",null,T);this.registerAction("FitWindow","Fit Window",LF.Actions.FitWindow,J,"FitWindowIcon",null,T);this.registerAction("FitWidth","Fit Width",LF.Actions.FitWidth,J,"FitWidthIcon",null,T);this.registerAction("FitHeight","Fit Height",LF.Actions.FitHeight,J,"FitHeightIcon",null,T);this.registerAction("AnnProps","Show Annotation Properties",LF.Actions.ShowAnnotationProperties,J,"AnnPropsIcon",null,T);this.registerAction("AnnotationGroup",null,function(){},null,null,null,null,m);this.registerAction("Highlight","Add Highlight",this._controller.GetModeFunc(Laserfiche.Modes.MODE_HIGHLIGHT),J,"HighlightIcon",null,T,m);this.registerAction("Redaction","Add Redaction",this._controller.GetModeFunc(Laserfiche.Modes.MODE_BLACKOUT),J,"RedactionIcon",null,T,m);this.registerAction("Underline","Add Underline",this._controller.GetModeFunc(Laserfiche.Modes.MODE_UNDERLINE),J,"UnderlineIcon",null,T,m);this.registerAction("StrikeThrough","Add Strikethrough",this._controller.GetModeFunc(Laserfiche.Modes.MODE_STRIKEOUT),J,"StrikeoutIcon",null,T,m);this.registerAction("Edit_Text","Edit Text",this._controller.GetEditTextFunc(),Y,"",null,T,m);this.registerAction("Discard_Text","Discard Text Changes",this._controller.GetDiscardTextFunc(),c,"",null,T,m);this.registerAction("StickyNote","Add Sticky Note",this._controller.GetModeFunc(Laserfiche.Modes.MODE_STICKYNOTE),J,"StickyNoteIcon",null,T,m);this.registerAction("Stamp","Add Stamp",this._controller.GetModeFunc(Laserfiche.Modes.MODE_STAMP),J,"StampIcon",null,T,m);this.registerAction("Rectangle","Add Rectangle",this._controller.GetModeFunc(Laserfiche.Modes.MODE_RECTANGLE),J,"RectangleIcon",null,T,m);this.registerAction("TextBox","Add Text Box",this._controller.GetModeFunc(Laserfiche.Modes.MODE_TEXTBOX),J,"TextAnnIcon",null,T,m);this.registerAction("Callout","Add Callout Text",this._controller.GetModeFunc(Laserfiche.Modes.MODE_CALLOUT),J,"CalloutIcon",null,T,m);this.registerAction("Line","Add Line",this._controller.GetModeFunc(Laserfiche.Modes.MODE_LINE),J,"LineIcon",null,T,m);this.registerAction("Freehand","Add Freehand",this._controller.GetModeFunc(Laserfiche.Modes.MODE_VFREEHAND),J,"FreehandIcon",null,T,m);this.registerAction("ImageAnn","Add Image Annotation",this._controller.GetModeFunc(Laserfiche.Modes.MODE_BITMAP),J,"ImageAnnIcon",null,T,m);this.registerAction("AttachmentAnn","Add Attachment Annotation",this._controller.GetModeFunc(Laserfiche.Modes.MODE_ATTACHMENT),t,"AttachmentIcon",null,T,m);this.registerAction("Pan","Pan Tool",this._controller.GetModeFunc(Laserfiche.Modes.MODE_PAN),J,"PanIcon",null,T);this.registerAction("Zoom","Zoom Tool",this._controller.GetModeFunc(Laserfiche.Modes.MODE_ZOOM),J,"ZoomIcon",null,T);this.registerAction("Selection","Selection Tool",this._controller.GetModeFunc(Laserfiche.Modes.MODE_SELECTION),J,"SelectionIcon",null,T)},registerAction:function(B,I,C,F,H,E,A,J){var D={};D.id=B;D.title=I;D.func=C;D.iconClass=H;D.enabledFunc=F;D.hideFunc=J;D.hyperKey=E;D.toolbarFlags=A?A:0;var G=this._actions.push(D)-1;this[B.toUpperCase()+"_ID"]=G;D.numid=G;return G},addBoldFunc:function(B,A){if(B&&A){var C=this._actions[B];C.boldFunc=A}},GetActionsList:function(){return this._actions},getActionProperties:function(A){var B=this[A.toUpperCase()+"_ID"];return this._actions[B]},getActionPropertiesByID:function(A){return this._actions[A]}};LF.Actions={};top.getEntryType=function(D,H,A){var E=function(I){A(I)};var F=function(I){};var B=false;if(top.myFolderTree){if(top.myFolderTree.IsNodeLoaded(D,H)){A("FOLDER");B=true}}if(!B&&top.myEntryBrowser){if(top.myEntryBrowser._repoName==D){var G=top.myEntryBrowser._model.getRowIndexByEntryId(H);if(G!=-1){var C=top.myEntryBrowser._model.getEntryArgsByRowIndex(G);if(((C.flags-0)&256)>0){A("FOLDER")}else{A("DOCUMENT")}B=true}}}if(!B){Laserfiche.WebAccess.DocumentService.GetEntryType(D,H,E,F)}};top.getEntryElecProps=function(C,A,I){var G=function(J){I(J)};var H=function(J){};var B=false;if(top.myFolderTree){if(top.myFolderTree.IsNodeLoaded(C,A)){I(":0:0");B=true}}if(!B&&top.myEntryBrowser){if(top.myEntryBrowser._repoName==C){var F=top.myEntryBrowser._model.getRowIndexByEntryId(A);if(F!=-1){var E=top.myEntryBrowser._model.getEntryArgsByRowIndex(F);var D=[E.extension,E.elecSize,E.pages].join(":");I(D);B=true}}}if(!B){Laserfiche.WebAccess.DocumentService.GetEntryElecProps(C,A,G,H)}};LF.Actions.OpenParentFolder=function(D){var A=D.getSelectedItems&&D.getSelectedItems();var C=null;var F=D.repository;var B=function(H,G){top.myFolderTree.LoadFolder(G.repository,H,true,false);top.myAppController._mainTabs.showBrowser()};var E=function(G,H){alert(G.get_message())};if(A&&A.items&&A.items.length){var C=A.items[0];Laserfiche.WebAccess.DocumentService.GetParentFolderID(F,C.id,B,E,{name:C.name,id:C.id,repository:F})}};LF.Actions.OpenEntry=function(C){var A=C.getSelectedItems&&C.getSelectedItems();var B=null;var D=C.repository;if(A&&A.items&&A.items.length){var B=A.items[0];LF.Actions.OpenEntryById(D,B)}};LF.Actions.OpenPages=function(C){var E=C.repository;var D=C.getSelectedItems().items[0];var A=top.myAppController;var B=function(I){var G=I.split(":");var F=!!(G&&G.length>=3&&!!G[1]&&G[1]!="0");var H=!!(G&&G.length>=3&&G[2]-0);if(F&&H){A._mainTabs.openDocument(D.id,D.name,E);return }if(F&&!H){A._mainTabs.openMetadata([D.id],E);return }A._mainTabs.openDocument(D.id,D.name,E)};top.getEntryElecProps(E,D.id,B)};LF.Actions.OpenEdoc=function(D){var G=D.repository;var F=D.getSelectedItems().items[0];var B=top.getAvailableDlg();var A={r:G,i:F.id,t:"ElectronicFile"};var E="Dialogs/Export/ExportDisplay.aspx";var C=dojo.string.substitute("${0}?${1}",[E,dojo.objectToQuery(A)]);B.OpenDialog(C,150,350,false);B.onclose=function(H){}};LF.Actions.OpenEntryById=function(D,C){var B=function(G){if(G=="FOLDER"){A.selectCurrentFolder({id:C.id,repositoryName:D,name:C.name,type:"Folder"},function(){})}else{if(G=="DOCUMENT"){var F={id:C.id,repositoryName:D,name:C.name,type:"Document"};if(C.page){F.page=C.page-0}A.openDocument(F,function(){})}else{if(G=="SHORTCUT"){if(C.linkToID){C.id=C.linkToID;var E="";if(C.linkToType==-2){E="DOCUMENT"}if(C.linkToType==0){E="FOLDER"}B(E)}}else{if(G=="SERIES"){}}}}};var A=top.myAppController;if(C.entryType=="Document"){B("DOCUMENT")}else{if(C.entryType=="Folder"){B("FOLDER")}else{if(C.entryType=="Shortcut"){B("SHORTCUT")}else{top.getEntryType(D,C.id,B)}}}};LF.Actions.NewDocument=function(F){var G=F.repository;var A=F.openedFolder.id;if(top.myAppController.Settings.MImportShowTemplate){var D=String.format("{0}?{1}={2}&{3}={4}","Dialogs/NewDocumentDialog.aspx","RepositoryName",G,"ParentPathID",A);var C=top.getAvailableDlg();C.onclose=function(I){if(I==null){return false}var J=I;if(J.NewDocumentCreated){top.myAppController.newDocumentCreated(J,"Action")}};C.OpenDialog(D,460,440,false)}else{function E(I,M,L){if(I.NewDocumentCreated){var O={NewDocumentCreated:true,RepositoryName:M.r,ParentFolderId:M.folID,NewDocumentName:I.NewDocumentNameSuggestion,NewDocumentId:I.NewDocumentID};top.myAppController.newDocumentCreated(O,"Action");return }if(I.NewDocumentNameRequested){var N={r:M.r,folID:M.folID};var K=dojo.string.substitute("${0}?${1}",["Dialogs/NewDocRenameDialog.aspx",dojo.objectToQuery(N)]);var J=top.getAvailableDlg();J.OpenDialog(K,130,365,false);J.onclose=function(P){if(P==null){return false}var Q={NewDocumentCreated:true,RepositoryName:M.r,ParentFolderId:M.folID,NewDocumentName:P.NewDocumentNameSuggestion,NewDocumentId:P.NewDocumentID};if(P.NewDocumentCreated){top.myAppController.newDocumentCreated(Q,"Action")}}}}function H(I,K,J){alert(I.get_message())}var B={r:G,folID:A};Laserfiche.WebAccess.DocumentService.CreateNewDefDocument(G,A,E,H,B)}};LF.Actions.NewShortcut=function(B){var C=function(L,O,M,J){var K=function(){top.myAppController.newShortcutCreated(L,O,"Action")};var N=function(P){alert(P.get_message());return false};Laserfiche.WebAccess.ActionsWebService.NewShortcut(L,O,M,J,K,N)};var H;var F;var I=B.getSelectedItems&&B.getSelectedItems();if(I&&I.items&&I.items.length&&B.focusedControl._djGrid){H=I.items.length;for(var E=0;E<H;E++){var D=I.items[E];if(E==0){F=D.id}else{F+=";"+D.id}}C(B.repository,B.openedFolder.id,F,H)}else{var A=String.format("{0}?RepositoryName={1}&ValidEntryTypes={2}&ValidEntryTypesMsg={3}&StartLocation={4}        &EntriesPerPage={5}&ExcludeEntryList={6}&ExcludeErrorMsg={7}&ShowEntryTypes={8}&AllowMultipleSelect=[false]&DlgTitle={9}","Dialogs/EntryPicker.aspx","'"+B.repository+"'","['FOLDER', 'DOCUMENT', 'SHORTCUT']","[ 'Error:  You must select {0} entry type.']","[1]","[30]","[]","['Please select valid entries.']","['FOLDER']","'Select Entries'");var G=top.getAvailableDlg();G.OpenDialog(A,345,520,false);G.onclose=function(J){if(J==null){return false}else{var K=J.getEntryId();C(B.repository,B.openedFolder.id,K,1)}}}};LF.Actions.Move=function(D){if(top.myAppController&&top.myAppController.ViewMode==top.myAppController.PAGES_MODE){var A=D.getSelectedItems("PAGES");if(!(A&&A.items&&A.type=="PAGES"&&A.items.length>0)){alert("Please select the thumbnail you wish to perform the action on.");return }}var C=String.format("{0}?RepositoryName={1}&ValidEntryTypes={2}&ValidEntryTypesMsg={3}&StartLocation={4}    &EntriesPerPage={5}&ExcludeEntryList={6}&ExcludeErrorMsg={7}&ShowEntryTypes={8}&AllowMultipleSelect=[false]&DlgTitle={9}","Dialogs/EntryPicker.aspx","'"+D.repository+"'","['FOLDER']","[ 'Error:  You must select {0} entry type.']","[1]","[30]","[]","['Please select another folder.']","['FOLDER']","'Select a Folder'");var B=top.getAvailableDlg();B.OpenDialog(C,345,520,false);B.onclose=function(M){if(M==null){return false}else{var K;var I;var L=(top.myAppController&&top.myAppController.ViewMode==top.myAppController.PAGES_MODE)?D.getSelectedItems("PAGES"):D.getSelectedItems&&D.getSelectedItems();if(!(top.myAppController.ViewMode==top.myAppController.PAGES_MODE)&&L.type=="ENTRIES"){onMoveSuccess=function(){top.myAppController.EntryMoved(D.repository,D.openedFolder.id,"Action")};onMoveFailure=function(){return false};if(L&&L.items&&L.items.length){K=L.items.length;for(var H=0;H<K;H++){var G=L.items[H];if(H==0){I=G.id}else{I+=";"+G.id}}}Laserfiche.WebAccess.ActionsWebService.MoveEntry(D.repository,M.getEntryId(),I,K,onMoveSuccess,onMoveFailure)}else{if(L.type=="PAGES"){var F={RepositoryName:D.repository,ParentPathID:M.getEntryId()};var E=dojo.string.substitute("${0}?${1}",["Dialogs/NewDocumentDialog.aspx",dojo.objectToQuery(F)]);var J=top.getAvailableDlg();J.OpenDialog(E,460,440,false);J.onclose=function(Q){var S=Q;function R(){if(S.NewDocumentCreated){top.myEntryBrowser.refresh();top.myThumbnailControl._updateContent()}}function P(){if(S.NewDocumentCreated){top.myEntryBrowser.refresh();top.myThumbnailControl._updateContent()}}if(M==null){return false}var N=dojo.map(L.items,function(T){return T.pageid});var O=Laserfiche.WebAccess.DocumentService.MovePagesBetweenDocs;O(D.repository,L.items[0].docid,N,Q.NewDocumentId,1,R,P)}}}}}};LF.Actions.NewFolder=function(C){var B=String.format("{0}?{1}={2}&{3}={4}","Dialogs/NewFolderDialog.aspx","RepositoryName",C.repository,"ParentPathID",C.openedFolder.id);var A=top.getAvailableDlg();A.OpenDialog(B,50,300,false);A.onclose=function(D){if(D==null){return false}var E=D;if(E.FolderCreated){top.myAppController.newFolderCreated(E,"Action")}}};LF.Actions.DeleteEntry=function(B){if(!top.hasFeature(B.repository,"Delete")){return }var I=B.getSelectedItems&&B.getSelectedItems();var H=I.items.length;if(H){if(I.items[0].entryType<0||(top.myAppController&&top.myAppController._context.openedFolder&&top.myAppController._context.openedFolder.id==-1)){LF.Actions.Purge(B);return }var C=dojo.map(I.items,function(J){return J.id});var D=C.join(";");if(C[0]==1||C[0]==-1){return }var F="Dialogs/DeleteDialog.aspx";var G={RepositoryName:B.repository,EntryId:D,EntryCount:H};var A=dojo.string.substitute("${0}?${1}",[F,dojo.objectToQuery(G)]);var E=top.getAvailableDlg();E.OpenDialog(A,120,320,false);E.onclose=function(J){if(J==null){return false}var K=J;if(K.EntriesDeleted){top.myAppController.EntryDeleted(K,"Action")}else{if(J.ErrMsg){alert(J.ErrMsg);return }}}}else{alert("No entry selected.");return false}};LF.Actions.DeletePages=function(A){if(!top.hasFeature(A.repository,"Delete")){return }function E(M){function O(P,Q){return P-Q}var K=dojo.map(M,function(P){return P-0}).sort(O);var J=[];var L=[];dojo.forEach(K,function(R,Q,P){if(L.length==0||(L[L.length-1]+1==R)){L.push(R)}else{J.push(L);L=[R]}});if(L.length){J.push(L)}var N=dojo.map(J,function(P){if(P.length==1){return P[0].toString()}else{return dojo.string.substitute("${0}-${1}",[P[0].toString(),P[P.length-1].toString()])}});return N.join(",")}function I(J,L){var M=[];if(L.docid){M.push(L.docid-0)}if(L.parentfol){M.push(L.parentfol-0)}var K={repository:L.repository,entryList:M};myAppController.entriesChanged(K)}function D(J){}if(LF.Actions.CheckDocChanges(top.metadataviewControl,top.docviewControl._pageviewControl.annControl)){return }var H=A.getSelectedItems&&A.getSelectedItems("PAGES");if(H.type=="PAGES"){var F=H.items[0].docid;var G=dojo.map(H.items,function(J){return J.pageid});if(F&&G.length){var C="";if(G.length==1){C=dojo.string.substitute("Permanently delete page ${0}?",[E(G)])}else{C=dojo.string.substitute("Permanently delete pages ${0}?",[E(G)])}var B=confirm(C);if(B){Laserfiche.WebAccess.DocumentService.DeletePages(A.repository,F,G,I,D,{repository:A.repository,docid:F,pages:G,parentfol:A.openedFolder.id})}return }}alert("No pages selected.");return false};LF.Actions.Delete=function(B){if(!top.hasFeature(B.repository,"Delete")){return }var A=B.getSelectedItems&&B.getSelectedItems();switch(A.type){case"PAGES":LF.Actions.DeletePages(B);break;case"ENTRIES":LF.Actions.DeleteEntry(B);break;default:break}return };LF.Actions.Rename=function(B){function C(J,L){if(J&&J.success==false){alert("Object with that name already exists.");LF.Actions.Rename(B);return }var K=J.newName;top.myAppController.EntryRenamed(K,{id:L.id,repository:L.repository,name:L.originalName},"")}function I(J){alert(J.get_message())}var H=B.getSelectedItems&&B.getSelectedItems();if(H&&H.items&&H.items.length==1){var D=H.items[0];var F="Dialogs/RenameDialog.aspx";var G={r:B.repository,i:D.id};var A=String.format("{0}?{1}",F,dojo.objectToQuery(G));var E=top.getAvailableDlg();E.OpenDialog(A,100,300,false);E.onclose=function(J){if(J==null||J.newname==D.name){return false}Laserfiche.WebAccess.DocumentService.RenameEntry(D.id,B.repository,J.newname,C,I,{repository:D.repository,id:D.id,originalName:D.name,newnameRequested:J.newname})}}};LF.Actions.MigrateEntry=function(G){var F;var A;var B=G.getSelectedItems&&G.getSelectedItems();if(B&&B.items&&B.items.length){F=B.items.length;for(var E=0;E<F;E++){var H=B.items[E];if(E==0){A=H.id}else{A+=";"+H.id}}}if(A&&F){var D=String.format("{0}?{1}={2}&{3}={4}&{5}={6}","Dialogs/MigrateDialog.aspx","RepositoryName",G.repository,"EntryId",A,"EntryCount",F);var C=top.getAvailableDlg();C.OpenDialog(D,160,380,false);C.onclose=function(I){if(I==null){return false}var J=I;if(J.ErrorMessage!=null&&J.ErrorMessage.length>0){alert(J.ErrorMessage)}top.myAppController.EntryMigrated(J,"Action")}}else{alert("No entry selected.");return false}};LF.Actions.SortAscending=function(B){var A=B.focusedControl;if(A.sort){A.sort("ASCENDING")}else{alert("This control does not support sorting.");return false}};LF.Actions.SortDescending=function(B){var A=B.focusedControl;if(A.sort){A.sort("DESCENDING")}else{alert("This control does not support sorting.");return false}};LF.Actions.Import=function(B){var A=new LF.Importer();A.Import(B);A=null};LF.Actions.Fields=function(B){if(B.getSelectedItems){var A=B.getSelectedItems();if(A&&A.items&&A.items.length){var D=A.items[0];var C=dojo.map(A.items,function(E){return E.id});top.myAppController._mainTabs.openMetadata(C,B.repository)}}};LF.Actions.AccessRights=function(E){var D=E.repository;var A=E.getSelectedItems();var F=A&&A.items&&A.items.length&&A.items[0].id;if(D&&F){var C=String.format("{0}?{1}={2}&{3}={4}","Dialogs/AccessRightsPage.aspx","RepositoryName",D,"EntryID",F);var B=top.getAvailableDlg();B.OpenDialog(C,452,450,false);B.onclose=function(G){if(!G){var H=function(){Laserfiche.WebAccess.DocumentService.ClearAccessRightsChanges()};setTimeout(H,100)}}}};LF.Actions.CustomizeToolbar=function(B){var A="BrowserToolbarSection";switch(top.myAppController.ViewMode){case top.myAppController.METADATA_MODE:A="MetadataToolbarSection";break;case top.myAppController.PAGES_MODE:A="ImageViewToolbarSection";break}LF.Actions.Settings(B,A)};LF.Actions.CustomizeSearchColumns=function(A){var B="SearchColumnsSection";LF.Actions.Settings(A,B)};LF.Actions.CustomizeColumns=function(A){var B="BrowserColumnsSection";if(A.openedFolder.id==-1){B="RecycleBinColumnsSection"}LF.Actions.Settings(A,B)};LF.Actions.ExportPDF=function(D){var A=D.getSelectedItems().items||null;if(!D||!A||!A.length){alert("No items were selected.");return }var C=String.format("{0}?{1}={2}&{3}={4}&{5}={6}","Dialogs/PdfExport.aspx","RepositoryName",D.repository,"DocumentID",A[0].id,"ForceTextOnly","false");var B=top.getAvailableDlg();B.OpenDialog(C,250,310,false);B.onclose=function(F){if(F){var E=top.getAvailableDlg();var G="Dialogs/Export/ExportDisplay.aspx";var H={r:D.repository,i:A[0].id,e:F,t:"pdf"};var I=dojo.string.substitute("${0}?${1}",[G,dojo.objectToQuery(H)]);E.OpenDialog(I,150,350,false);E.onclose=function(J){}}}};LF.Actions.ExportElectFile=function(C){var A=top.getAvailableDlg();var E={r:C.repository,i:C.getSelectedItems().items[0].id,t:"ElectronicFile"};var D="Dialogs/Export/ExportDisplay.aspx";var B=dojo.string.substitute("${0}?${1}",[D,dojo.objectToQuery(E)]);A.OpenDialog(B,150,350,false);A.onclose=function(F){}};LF.Actions.ExportTIFF=function(B){if(top.myAppController.Settings.ExportImageFormat==3){LF.Actions.ExportPDF(B);return }var C=top.getAvailableDlg();var A=dojo.string.substitute("${0}?r=${1}&i=${2}",["Dialogs/Export/ImageExportPickerPage.aspx",B.repository,B.getSelectedItems().items[0].id,]);C.OpenDialog(A,270,310,false);C.onclose=function(D){if(D!==null){var E=top.getAvailableDlg();var H={r:B.repository,i:B.getSelectedItems().items[0].id,t:"Image"};if(D){H.p=D.pages;if(dojo.exists("watermark",D)){H.w=D.watermark}H.f=D.format}var G="Dialogs/Export/ExportDisplay.aspx";var F=dojo.string.substitute("${0}?${1}",[G,dojo.objectToQuery(H)]);E.OpenDialog(F,150,350,false);E.onclose=function(I){}}}};LF.Actions.ExportBriefcase=function(D){var C=top.myAppController._mainTabs._curTab;var G=null;if(C=="S"){var I=top.mySearchResultListingControl;var H=I&&I.getSelectedItems();if(H&&H.items&&H.items.length){var A=dojo.map(H.items,function(J){return J.id}).join(",");G={r:D.repository,i:A,t:"Briefcase"}}else{G={r:I._repoName,sh:I._model.searchhandle,t:"Briefcase"}}}else{var A=dojo.map(D.getSelectedItems().items,function(J){return J.id}).join(",");G={r:D.repository,i:A,t:"Briefcase"}}if(!G){return }var E=top.getAvailableDlg();var F="Dialogs/Export/ExportDisplay.aspx";var B=dojo.string.substitute("${0}?${1}",[F,dojo.objectToQuery(G)]);E.OpenDialog(B,150,350,false);E.onclose=function(J){}};LF.Actions.ExportText=function(A){var B=top.getAvailableDlg();B.OpenDialog("Dialogs/Export/PagePickerPage.aspx",150,350,false);B.onclose=function(C){if(C!==null){var D=top.getAvailableDlg();var G={r:A.repository,i:A.getSelectedItems().items[0].id,t:"Text"};if(C){G.p=C}var F="Dialogs/Export/ExportDisplay.aspx";var E=dojo.string.substitute("${0}?${1}",[F,dojo.objectToQuery(G)]);D.OpenDialog(E,150,350,false);D.onclose=function(H){}}}};LF.Actions.Refresh=function(A){top.myAppController.refresh();setTimeout(function(){myAppController.checkSecurity()},0)};LF.Actions.Logout=function(A){top.myAppController.logout()};LF.Actions.Login=function(A){top.myFolderTree.ClickNode(A.repository,1)};LF.Actions.LogoutAll=function(){top.myAppController.logoutAll()};LF.Actions.Save=function(C){if(dojo.exists("top.myAppController._context.openedDocument.id")){var E=function(){var J=top.myAppController._annControl;J.LoadAnnotations();if(J._editor){var K=function(L){J.InitText(L)};Laserfiche.WebAccess.DocumentService.GetTextByID(C.repository,B,J._pageid,0,K,J.SetTextError)}top.metadataviewControl.refresh()};var F=function(J){if(Laserfiche.Exception.IsConnectionLost(J)){Laserfiche.Exception.DocViewConnectionLostFunc();return }alert(J.get_message());var K=top.myAppController._annControl;top.myAppController._annControl.LoadAnnotations();if(K._editor){var L=function(M){K.InitText(M)};Laserfiche.WebAccess.DocumentService.GetTextByID(C.repository,B,K._pageid,0,L,K.SetTextError)}};var I=top.myAppController._annControl;var G=top.metadataviewControl;var D=0;if(I){D=top.myAppController._annControl._pageid}var H=null;if(G&&G.isDirty()){H=G.getChanges()}var B=C.getSelectedItems().items[0].id;var A=function(){I.onChangesSent=null;var J=new Array();if(I._rotationchanged){J.push({Property:"rotation",Value:I._rotation})}I._editor.saveText();Laserfiche.WebAccess.DocumentService.SaveEntry(B,C.repository,D,H,J,E,F)};if(I.ChangesPending()){I.onChangesSent=A}else{A()}}};LF.Actions.UpFolder=function(){top.myAppController.goUpFolder()};LF.Actions.SaveMetadata=function(){if(dojo.exists("top.metadataviewControl")){top.metadataviewControl.saveChanges()}};LF.Actions.RevertMetadata=function(C){var G=function(){if(dojo.exists("top.metadataviewControl.refresh")&&dojo.isFunction(top.metadataControl.refresh)){top.metadataviewControl.refresh()}};var F=function(H){alert(H.get_message());if(dojo.exists("top.metadataviewControl.refresh")&&dojo.isFunction(top.metadataControl.refresh)){top.metadataviewControl.refresh()}};var E=top.metadataviewControl._metadataCoordinator.getEntryIdArray();var A=new Array();var D=top.metadataviewControl._metadataCoordinator._repoName;for(var B=0;B<E.length;B++){A.push(E[B]+":"+D)}Laserfiche.WebAccess.DocumentService.UnlockEntries(A,G,F)};LF.Actions.ChangePassword=function(C){var D="Dialogs/ChangePasswordDialog.aspx";var B=String.format("{0}?{1}={2}",D,"RepositoryName",C.repository);var A=top.getAvailableDlg();A.OpenDialog(B,250,315,false);A.onclose=function(E){}};LF.Actions.AddEmailAttachment=function(D){var E=dojo.map(D.getSelectedItems().items,function(H){return(H.id)});var G={r:D.repository,i:"["+E.join(",")+"]"};var F="Dialogs/EmailBasket.aspx";var A=dojo.objectToQuery(G);var C=String.format("{0}?{1}",F,A);var B=top.getAvailableDlg();B.OpenDialog(C,385,500,false);B.onclose=function(H){}};LF.Actions.EmailDocument=function(C){var D="Dialogs/SendEmail.aspx";var B=String.format("{0}?db={1}",D,C.repository);var A=top.getAvailableDlg(true);A.OpenDialog(B,460,530,false);A.onclose=function(E){}};LF.Actions.ShowProperties=function(B){var C=String.format("{0}?{1}={2}&{3}={4}","Dialogs/Properties.aspx","r",B.repository,"i",B.getSelectedItems().items[0].id);var A=top.getAvailableDlg();A.OpenDialog(C,390,545,false);A.onclose=function(D){if(D&&D.RefreshGrid){LF.Actions.Refresh(B)}}};LF.Actions.ShowAnnotationProperties=function(C){var A=top.myAppController._annControl;var B=A.getLastSelectedItem().item;if(B){B.showProperties()}else{alert("No annotation is selected.")}};LF.Actions.Cut=function(C){var B=top.myAppController._mainTabs._curTab;var E="ENTRIES";if(B){if(B.charAt(0)=="D"){E="PAGES";var A=C.getSelectedItems(E);if(!(A&&A.items&&A.type==E&&A.items.length>0)){alert("Please select the thumbnail you wish to perform the action on.");return }}}var D=top.myAppController.ClipboardReceiver.isInArgsEmpty();top.myAppController.ClipboardCommands.Cut.execute(E);if(D){top.myAppController.checkSecurity()}};LF.Actions.Copy=function(C){var B=top.myAppController._mainTabs._curTab;var E="ENTRIES";if(B){if(B.charAt(0)=="D"){E="PAGES";var A=C.getSelectedItems(E);if(!(A&&A.items&&A.type==E&&A.items.length>0)){alert("Please select the thumbnail you wish to perform the action on.");return }}}var D=top.myAppController.ClipboardReceiver.isInArgsEmpty();top.myAppController.ClipboardCommands.Copy.execute(E);if(D){top.myAppController.checkSecurity()}};LF.Actions.Paste=function(A){if(top.myAppController._lastSecParams&&!!top.myAppController._lastSecParams.AllowPaste){top.myAppController.ClipboardCommands.Paste.execute()}};LF.Actions.PasteShortCut=function(A){if(top.myAppController._lastSecParams&&!!top.myAppController._lastSecParams.AllowPasteSC){top.myAppController.ClipboardCommands.PasteShortCut.execute()}};LF.Actions.PasteFoldersOnly=function(A){if(top.myAppController._lastSecParams&&!!top.myAppController._lastSecParams.AllowPasteFolOnly){top.myAppController.ClipboardCommands.PasteFoldersOnly.execute()}};LF.Actions.ShowCheckedOutDocs=function(B){var C=String.format("{0}?{1}={2}","Dialogs/CheckedOutDocs.aspx","r",B.repository);var A=top.getAvailableDlg();A.OpenDialog(C,320,490,false);A.onclose=function(D){top.myAppController.refresh()}};LF.Actions.PurgeAll=function(D){if(!top.hasFeature(D.repository,"Purge")){return }function E(H,I){top.myAppController.EntryPurged(I.r,[],"")}function C(H){alert("Purge all failed.");top.myAppController.EntryPurged(myContext.r,[],"")}var F="Dialogs/RBPurge.aspx";var G={r:D.repository,all:1};var B=dojo.string.substitute("${0}?${1}",[F,dojo.objectToQuery(G)]);var A=top.getAvailableDlg();A.OpenDialog(B,100,300,false);A.onclose=function(H){if(H){Laserfiche.WebAccess.RecycleBinService.PurgeAllEntries(G.r,E,C,G)}}};LF.Actions.Purge=function(D){if(!top.hasFeature(D.repository,"Purge")){return }function E(I,J){top.myAppController.EntryPurged(J.r,J.id.split(","),"")}function C(I){alert("Purge failed.");top.myAppController.EntryPurged(myContext.r,[],"")}var H=dojo.map(D.getSelectedItems().items,function(I){return I.id-0});var F="Dialogs/RBPurge.aspx";var G={r:D.repository,all:0,id:H.join(","),name:(D.getSelectedItems().items.length==1)?D.getSelectedItems().items[0].name:""};var B=dojo.string.substitute("${0}?${1}",[F,dojo.objectToQuery(G)]);var A=top.getAvailableDlg();A.OpenDialog(B,100,300,false);A.onclose=function(I){if(I){Laserfiche.WebAccess.RecycleBinService.PurgeEntries(G.r,H,E,C,G)}}};LF.Actions.Restore=function(C){function A(J){top.myAppController.EntryRestored(C.repository,J,"")}function G(J){alert("Recycle bin restore failed.")}function E(K,J){var L=[""];dojo.forEach(K.split("\\"),function(M){if(M){L.push(M)}});dojo.forEach(J.split("\\"),function(M){if(M){L.push(M)}});return L.join("\\")}var D=this;var H="Dialogs/RBRestoreEntry.aspx";var I={r:C.repository,l:C.getSelectedItems?C.getSelectedItems().items.length:0};var B=dojo.string.substitute("${0}?${1}",[H,dojo.objectToQuery(I)]);var F=top.getAvailableDlg();F.OpenDialog(B,120,365,false);F.onclose=function(J){if(J){if(J.restoreToDefault){Laserfiche.WebAccess.RecycleBinService.RestoreEntriesByFullPath(C.repository,dojo.map(C.getSelectedItems().items,function(K){return K.id}),dojo.map(C.getSelectedItems().items,function(K){return E(K.path,K.name)}),A,G)}else{Laserfiche.WebAccess.RecycleBinService.RestoreEntriesByFullPath(C.repository,dojo.map(C.getSelectedItems().items,function(K){return K.id}),dojo.map(C.getSelectedItems().items,function(K){return E(J.restorePath,K.name)}),A,G)}}}};LF.Actions.CheckOutDocument=function(C){var B=C.getSelectedItems().items[0].id;var D=String.format("{0}?{1}={2}&{3}={4}","Dialogs/CheckOutDocPage.aspx","r",C.repository,"i",B);var A=top.getAvailableDlg();A.OpenDialog(D,200,325,false);A.onclose=function(E){function G(K){if(K){LF.Actions.Refresh(C);var I=top.getAvailableDlg();var H={r:C.repository,i:B,t:"ElectronicFile",notexport:"1"};var L="Dialogs/Export/ExportDisplay.aspx";var J=dojo.string.substitute("${0}?${1}",[L,dojo.objectToQuery(H)]);I.OpenDialog(J,150,350,false);I.onclose=function(M){}}else{F(null)}}function F(I){var H="Could not check out the document: "+I.get_message();alert(H)}if(E){Laserfiche.WebAccess.CICOService.CheckoutDocument(C.repository,B,E.commentText,G,F)}}};LF.Actions.CheckinDocument=function(D){var C=function(){LF.Actions.Refresh(D)};var B=D.getSelectedItems().items[0].id;var E=D.repository;var A=top.getAvailableDlg();LF.Actions.CheckinDocument2(E,B,A,C)};LF.Actions.UndoCheckoutDocument=function(C){var B=function(I){LF.Actions.Refresh(C)};var F=C.repository;var H=C.getSelectedItems()&&C.getSelectedItems().items;var E=dojo.map(H,function(I){return I.id});var G=H.length>1?("these "+H.length+" documents"):H[0].name;var D=dojo.string.substitute("Are you sure you wish to undo the check out for ${0}?",[G]);var A=confirm(D);if(A){LF.Actions.UndoCheckoutDocument2(F,E,B)}};LF.Actions.CheckoutDetails=function(C){var B=C.getSelectedItems().items[0].id;var D=C.repository;if(B>0){var E=String.format("Dialogs/CheckoutDetails.aspx?r={0}&i={1}",D,B);var A=top.getAvailableDlg();A.OpenDialog(E,265,400,false)}};LF.Actions.DeleteElecFile=function(G){var F;var A;var B=G.getSelectedItems&&G.getSelectedItems();if(B&&B.items&&B.items.length){F=B.items.length;for(var E=0;E<F;E++){var H=B.items[E];if(E==0){A=H.id}else{A+=";"+H.id}}}if(A&&F){var D=String.format("{0}?{1}={2}&{3}={4}&{5}={6}&OnlyElec=true","Dialogs/DeleteDialog.aspx","RepositoryName",G.repository,"EntryId",A,"EntryCount",F);var C=top.getAvailableDlg();C.OpenDialog(D,120,320,false);C.onclose=function(I){if(I==null){return false}var J=I;if(J.EntriesDeleted){top.myAppController.EntryDeleted(J,"Action")}}}else{alert("No entry selected.");return false}};LF.Actions.ReplaceElecFile=function(C){var B=C.getSelectedItems().items[0].id;var D=C.repository;var E=String.format("{0}?{1}={2}&{3}={4}","Dialogs/ReplaceElecFile.aspx","r",D,"i",B);var A=top.getAvailableDlg();A.OpenDialog(E,200,340,false);A.onclose=function(F){top.ImportFileInput=null;if(!F){return }var G=F;if(G.EntryReplaced){top.myAppController.EntryDeleted(G,"Action")}}};LF.Actions.Scan=function(B){var E=null;if(top.myAppController._mainTabs._curTab=="Browser"){E=top.myFolderTree.getSelectedItems().items[0].id}else{E=myAppController._context.openedDocument.id}var N=function(){var X=B.repository;var Y=String.format("Dialogs/ScanningMode.aspx?r={0}",X);var U=top.getAvailableDlg();U.OpenDialog(Y,265,400,false);var V=String.format("lfwa80://scanning/{0}//{1}",window.location.protocol,window.location.host);var T=window.location.pathname.split("/");for(var W=0;W<T.length-1;++W){V+="/"+T[W]}U.onclose=function(a){if(!a){return }var Z={r:X,w:1,dbg:0};if(a&&dojo.exists("ScanMode",a)){Z[a.ScanMode]=E}if(a&&dojo.exists("SharingKey",a)){Z["k"]=a.SharingKey}if(a&&dojo.exists("CultureInfo",a)){Z["ci"]=a.CultureInfo}function d(){var f=getExportIFrame();if(V.charAt(V.length-1)!="/"){V=V+"/"}var e=V+"App_Services/ScanningService.asmx";var h=dojo.objectToQuery(Z);var j=String.format("{0}?{1}",e,h);f.src=j}function c(h){if(h=="FOLDER"){d()}else{if(h=="DOCUMENT"){var f=String.format("Dialogs/InsertPagePicker.aspx?r={0}&d={1}",X,E);var e=top.getAvailableDlg();e.OpenDialog(f,120,300,false);e.onclose=function(j){if(j){if(j&&dojo.exists("tgtPage",j)){Z["p"]=j.tgtPage-1;Z["d"]=1;d()}}}}else{alert("Only folders or documents are currently supported")}}}top.getEntryType(X,E,c)}};var C=top.myAppController._mainTabs._curTab.charAt(0);var D=(C=="M");if(D||C=="D"){var F=top.myAppController._mainTabs._curTab.substring(1);var Q=F.indexOf(":");var P=F.substring(Q+1);var S=F.substring(0,Q);var L=D?0:parseInt(S);var M=D?dojo.fromJson(S):null;if(D){for(var O=0;O<M.length;O++){M[O]=M[O]+":"+P}}var R=function(){N();if(top.metadataviewControl){top.metadataviewControl.refresh()}if(top.myAppController._annControl){top.myAppController._annControl.setClean()}};var G=function(T){alert(T.get_message());N();if(top.metadataviewControl){top.metadataviewControl.refresh()}if(top.myAppController._annControl){top.myAppController._annControl.setClean()}};var J=top.myAppController._annControl;var K=top.metadataviewControl;if((J&&J.isDirty())||(K&&K.isDirty())){var A=null;if(K&&K.isDirty()){A=K.getChanges()}var H=J?J._pageid:0;if(confirm("Save changes to this document?\n\nPress OK to save changes, or Cancel to discard changes.")){if(D){Laserfiche.WebAccess.DocumentService.SaveEntries(M,P,0,0,A,null,false,R,G)}else{var I=function(){J.onChangesSent=null;var T=new Array();if(J._rotationchanged){T.push({Property:"rotation",Value:J._rotation})}J._editor.saveText();Laserfiche.WebAccess.DocumentService.SaveEntry(L,P,H,A,T,R,G)};if(J.ChangesPending()){J.onChangesSent=I}else{I()}}}else{if(D){Laserfiche.WebAccess.DocumentService.UnlockEntries(M,R,G)}else{Laserfiche.WebAccess.DocumentService.UnlockEntry(L,P,R,G)}}}else{N()}}else{N()}};LF.Actions.CheckinDocument2=function(D,C,B,A){var E=String.format("{0}?{1}={2}&{3}={4}&{5}","Dialogs/CheckInDocument.aspx","r",D,"i",C);B.OpenDialog(E,300,375,false);B.onclose=function(F){top.ImportFileInput=null;if(!F){return }var K=F.checkinType-0;function M(N){if(N&&typeof (A)=="function"){A()}}function J(N){alert("Check in failed: "+N.get_message())}switch(K){case 0:case 1:var I=function(N){var O=String.format("{0}?{1}={2}&{3}={4}&{5}={6}&{7}={8}&{9}={10}&{11}={12}","Dialogs/ImportDocument.aspx","RepositoryName",D,"FullPathID",C,"FileToken",F.token,"CurImport",1,"TotalNumImport",1,"CISrcID",C);B.OpenDialog(O,480,440,false);B.onclose=function(P){if(P){if(K==0&&P.importedEntryId){Laserfiche.WebAccess.CICOService.CheckinDocNewVersion(D,C,P.importedEntryId,N,M,J)}else{if(K==1){Laserfiche.WebAccess.CICOService.CheckinDocument(D,C,P.importedEntryId,M,J)}}}}};if(K==0){var L="Dialogs/VersionComment.aspx";var G={i:C,r:D};var H=dojo.string.substitute("${0}?${1}",[L,dojo.objectToQuery(G)]);B.OpenDialog(H,210,300,false);B.onclose=function(O){if(O){var N=O.comment||"";I(N)}}}else{I()}break;case 2:Laserfiche.WebAccess.CICOService.CheckinReplaceEdoc(D,C,F.token,M,J);break;default:break}}};LF.Actions.UndoCheckoutDocument2=function(D,C,A){function E(G){if(G&&typeof (A)=="function"){A(C)}}function B(H){var G="Could not complete the undo check out operation. ${0}";alert(dojo.string.substitute(G,[H.get_message()]))}var F=dojo.map(C,function(G){return G});if(D&&dojo.isArray(F)&&F.length){Laserfiche.WebAccess.CICOService.UndoCheckoutDocument(D,F,E,B)}};LF.Actions.ExtractText=function(D){var C=dojo.map(D.getSelectedItems().items,function(G){return G.id});var E=D.repository;var A={r:E,i:C.join(",")};var F=dojo.string.substitute("${0}?${1}",["Dialogs/TextExtract.aspx",dojo.objectToQuery(A)]);var B=top.getAvailableDlg();B.OpenDialog(F,110,315,false);B.onclose=function(G){if(G){Laserfiche.WebAccess.TextExtractService.CancelTextExtract(G,function(){},function(){})}else{}}};LF.Actions.Rotate=function(){top.docviewControl.Rotate()};LF.Actions.RotateCCW=function(){top.docviewControl.RotateCCW()};LF.Actions.NextPage=function(){top.docviewControl.NextPage()};LF.Actions.PrevPage=function(){top.docviewControl.PreviousPage()};LF.Actions.FirstPage=function(){top.docviewControl.FirstPage()};LF.Actions.LastPage=function(){top.docviewControl.LastPage()};LF.Actions.ZoomIn=function(){top.docviewControl.ZoomIn()};LF.Actions.ZoomOut=function(){top.docviewControl.ZoomOut()};LF.Actions.FitWindow=function(){top.docviewControl.SelectScale("P")};LF.Actions.FitWidth=function(){top.docviewControl.SelectScale("W")};LF.Actions.FitHeight=function(){top.docviewControl.SelectScale("H")};LF.Actions.Settings=function(C,D){var B=String.format("Dialogs/Settings.aspx?db={0}&folid={1}",C.repository,C.openedFolder.id);if(D){B=B+"&Start="+D}var A=top.getAvailableDlg();A.OpenDialog(B,450,675,false);A.onclose=function(E){LF.Actions.Refresh(C);top.myAppController.updateQuickbar(true);top.myAppController.applySettings(E);var F=top.searchControl._searchPanel.Attributes["Text"];if(F){F.attribute.update()}}};LF.Actions.About=function(B){var A=top.getAvailableDlg();A.OpenDialog("Dialogs/About.aspx",260,400,false)};LF.Actions.Help=function(A){window.open(GetString("_HELP_LOCATION")+"#Introduction.htm")};LF.Actions.ChooseSearchAttributes=function(B){var A=top.getAvailableDlg();A.OpenDialog("Dialogs/SearchAttributes.aspx?control=searchControl&r="+B.repository,375,550,false);A.onclose=function(C){if(C){top.searchControl.ProcessAttributeSelection(C)}}};LF.Actions.PrintFolder=function(C){var B=top.myAppController._mainTabs._curTab;var E=null;var D=null;switch(B){case"Browser":E=top.myEntryBrowser;D={r:E._repoName,i:E._entryId};if(dojo.exists("lastSortedColumn",E)){D.sortcol=top.unescapeHTML(E.lastSortedColumn.name)}if(typeof (E.lastSortIsAsc)=="boolean"){D.sortasc=E.lastSortIsAsc-0}break;case"S":E=top.mySearchResultListingControl;D={r:E._repoName,handle:E._model.searchhandle,search:E._model.search};if(dojo.exists("lastSortedColumn",E)){D.sortcol=top.unescapeHTML(E.lastSortedColumn.name)}if(typeof (E.lastSortIsAsc)=="boolean"){D.sortasc=E.lastSortIsAsc-0}break;default:break}if(!E){return }var A=top.getAvailableDlg();A.OpenDialog("Dialogs/ChooseListingType.aspx",120,350,false);A.onclose=function(F){if(!F){return }if(dojo.exists("ListingMode",F)){D.t=(F.ListingMode=="l")?1:0}var H="PrintableListings.aspx";var G=dojo.string.substitute("${0}?${1}",[H,dojo.objectToQuery(D)]);window.open(G)}};LF.Actions.ExportListing=function(C){var B=top.myAppController._mainTabs._curTab;var E=null;var D=null;switch(B){case"Browser":E=top.myEntryBrowser;D={r:E._repoName,i:E._entryId};if(dojo.exists("lastSortedColumn",E)){D.sortcol=top.unescapeHTML(E.lastSortedColumn.name)}if(typeof (E.lastSortIsAsc)=="boolean"){D.sortasc=E.lastSortIsAsc-0}break;case"S":E=top.mySearchResultListingControl;D={r:E._repoName,handle:E._model.searchhandle,search:E._model.search};if(dojo.exists("lastSortedColumn",E)){D.sortcol=top.unescapeHTML(E.lastSortedColumn.name)}if(typeof (E.lastSortIsAsc)=="boolean"){D.sortasc=E.lastSortIsAsc-0}break;default:break}if(!E){return }var A=top.getAvailableDlg();A.OpenDialog("Dialogs/ChooseListingSeparator.aspx",80,350,false);A.onclose=function(F){if(!F){return }if(dojo.exists("DDList",F)){D.sep=F.DDList;if(D.sep=="\\t"){D.sep="\t"}D.t=2}var I="PrintableListings.aspx";var H=dojo.string.substitute("${0}?${1}",[I,dojo.objectToQuery(D)]);var G=getExportIFrame();G.src=H}};LF.Actions.ExportSearchResults=function(D){var C=top.myAppController._mainTabs._curTab;var F=null;if(C=="S"){var G=top.mySearchResultListingControl;if(G&&G._model&&G._model.searchhandle){F={r:G._repoName,sh:G._model.searchhandle,t:"Briefcase"}}}if(!F){return }var A=top.getAvailableDlg();var E="Dialogs/Export/ExportDisplay.aspx";var B=dojo.string.substitute("${0}?${1}",[E,dojo.objectToQuery(F)]);A.OpenDialog(B,150,350,false);A.onclose=function(H){}};LF.Actions.CloseTab=function(A){top.myAppController._mainTabs.close(A)};LF.Actions.OpenPage=function(B){var C=B.focusedControl._lastSelectedPage;var E=B.getSelectedItems("PAGES");if(C&&E.items&&E.items.length>0){var A=E.items[0];var D={id:A.docid,repositoryName:B.repository,name:"",type:"Document"};if(C){D.page=C-0}if(dojo.exists("myAppController._mainTabs._curTab",top)&&top.myAppController._mainTabs._curTab=="Browser"){top.myAppController.openDocument(D,function(){})}else{if(top.myAppController._mainTabs._curTab.charAt(0)=="D"){top.docviewControl.set_pagenum(C-0)}}}};LF.Actions.CheckDocChanges=function(D,B){var C="Error: You cannot move, delete, rotate pages while you are editing the current page. Please save the document and try again.";var E=dojo.exists("myAppController._mainTabs._curTab",top)&&top.myAppController._mainTabs._curTab.charAt(0)=="D";var A=((B&&B.isDirty())||(D&&D.isDirty()));if(E&&A){alert(C);return true}return false};LF.Actions.NewDocFromPages=function(E){var D=function(H){if(H){top.myThumbnailControl._updateContent();if(dojo.exists("myAppController._mainTabs._curTab",top)&&top.myAppController._mainTabs._curTab=="Browser"){top.myAppController.refresh()}}else{G({})}};var B=function(L,K){if(L){var J={RepositoryName:K.repository,ParentPathID:L};var I=dojo.string.substitute("${0}?${1}",["Dialogs/NewDocumentDialog.aspx",dojo.objectToQuery(J)]);var H=top.getAvailableDlg();H.OpenDialog(I,460,440,false);H.onclose=function(M){var Q=M;function P(){if(Q.NewDocumentCreated){top.myAppController.newDocumentCreated(Q,"Action")}}function N(){if(Q.NewDocumentCreated){top.myAppController.newDocumentCreated(Q,"Action")}}if(M==null){return false}var O=Laserfiche.WebAccess.DocumentService.MovePagesBetweenDocs;O(K.repository,K.id,K.pages,M.NewDocumentId,1,D,G)}}};var G=function(I,J){var H="Error: Creation of new document from pages failed.";alert((I.get_message&&I.get_message())||H)};if(LF.Actions.CheckDocChanges(top.metadataviewControl,top.docviewControl._pageviewControl.annControl)){return }var A=E.getSelectedItems&&E.getSelectedItems("PAGES");if(A&&A.items&&A.items.length){var C=A.items[0];var F={id:C.docid,repository:C.repository,pages:dojo.map(A.items,function(H){return H.pageid-0})};Laserfiche.WebAccess.DocumentService.GetParentFolderID(C.repository,C.docid,B,G,F)}};LF.Actions._getRotationObj=function(B){var C={};C.repository=B.repository;var D=B.getSelectedItems("PAGES");if(D.items&&D.items.length>0){var A=D.items[0];C.id=A.docid}C.pages=dojo.map(D.items,function(E){return E.pageid});return C};LF.Actions.RotatePages=function(B){var A=function(){top.myThumbnailControl._updateContent()};var C=function(D){alert((D.get_message&&D.get_message())||"Error: Rotate Pages Failed.")};if(LF.Actions.CheckDocChanges(top.metadataviewControl,top.docviewControl._pageviewControl.annControl)){return }Laserfiche.WebAccess.DocumentService.ApplyRotation(B.repository,B.id,B.pages,B.rotationAmount,A,C)};LF.Actions.RotatePages90=function(B){var A=LF.Actions._getRotationObj(B);A.rotationAmount=90;LF.Actions.RotatePages(A)};LF.Actions.RotatePages180=function(B){var A=LF.Actions._getRotationObj(B);A.rotationAmount=180;LF.Actions.RotatePages(A)};LF.Actions.RotatePages270=function(B){var A=LF.Actions._getRotationObj(B);A.rotationAmount=270;LF.Actions.RotatePages(A)};top.TYPE_FOLDER_TREE_ROOT_ENTRY=10;top.TYPE_FOLDER_TREE_ENTRY=11;top.TYPE_RECYCLEBIN=12;top.TYPE_GRID_ENTRY=13;top.TYPE_RECYCLEBIN_ENTRY=14;top.TYPE_GRID_HEADER=15;top.TYPE_REPOSITORY_LOGIN=16;top.CUSTOMIZE_TOOLBAR=17;top.TYPE_DOCUMENT_PAGE_IMAGE=18;top.TYPE_GRID_ENTRY_HAS_EDOC=19;top.TYPE_SEARCH_GRID_ENTRY=30;top.TYPE_SEARCH_GRID_HEADER=31;top.TYPE_SEARCH_GRID_ENTRY_HAS_EDOC=32;top.TYPE_THUMBNAIL=40;if(!top.LF){top.LF={}}LF.MainContextMenu=function(){};LF.MainContextMenu.prototype={getItems:function(D,C,A){var B=null;switch(D){case top.TYPE_REPOSITORY_LOGIN:B=new Array({title:"Login",id:A.Actions.LOGIN_ID,iconClass:""});break;case top.TYPE_GRID_ENTRY:B=[{title:"Open",id:A.Actions.OPEN_ID,iconClass:"OpenIcon"},{title:"Fields...",id:A.Actions.FIELDS_ID,iconClass:"FieldsIcon"},{title:"Send E-mail",id:A.Actions.EMAIL_ID,iconClass:"EmailIcon"},null,{title:"Cut",id:A.Actions.CUT_ID,iconClass:"CutIcon",hyperKey:"X"},{title:"Copy",id:A.Actions.COPY_ID,iconClass:"CopyIcon",hyperKey:"C"},{title:"Paste",id:A.Actions.PASTE_ID,iconClass:"PasteIcon",hyperKey:"V"},{title:"Paste Shortcut",id:A.Actions.PASTESHORT_ID,iconClass:"PasteShortIcon"},{title:"Paste Folders Only",id:A.Actions.PASTE_FOLDERS_ONLY_ID,iconClass:""},null,{title:"Delete",id:A.Actions.DELETE_ID,iconClass:"DeleteIcon"},{title:"Rename",id:A.Actions.RENAME_ID,iconClass:"RenameIcon"},{title:"Check In/Out",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Check Out",id:A.Actions.CHECKOUT_ID,iconClass:"CheckOutIcon"},{title:"Check In",id:A.Actions.CHECKIN_ID,iconClass:"CheckInIcon"},{title:"Undo Check Out",id:A.Actions.UNDOCHECKOUT_ID,iconClass:"UndoCOIcon"},{title:"Check Out Details",id:A.Actions.CHECKOUTDETAILS_ID,iconClass:"CODetailsIcon"})},null,{title:"New",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Folder",id:A.Actions.NEWFOL_ID,iconClass:"NewFolIcon"},{title:"Shortcut",id:A.Actions.NEWSHORT_ID,iconClass:"ShortcutIcon"},{title:"Document",id:A.Actions.NEWDOC_ID,iconClass:"NewDocIcon"})},{title:"Access Rights...",id:A.Actions.ACCESS_ID,iconClass:"EntryAccessIcon"},{title:"Properties",id:A.Actions.PROPS_ID,iconClass:"PropsIcon"}];break;case top.TYPE_GRID_ENTRY_HAS_EDOC:B=[{title:"Open",id:A.Actions.OPEN_ID,iconClass:"OpenIcon",menu:[{title:"Pages",id:A.Actions.OPENPAGES_ID,iconClass:""},{title:"Electronic File",id:A.Actions.OPENEDOC_ID,iconClass:""}]},{title:"Fields...",id:A.Actions.FIELDS_ID,iconClass:"FieldsIcon"},{title:"Send E-mail",id:A.Actions.EMAIL_ID,iconClass:"EmailIcon"},null,{title:"Cut",id:A.Actions.CUT_ID,iconClass:"CutIcon",hyperKey:"X"},{title:"Copy",id:A.Actions.COPY_ID,iconClass:"CopyIcon",hyperKey:"C"},{title:"Paste",id:A.Actions.PASTE_ID,iconClass:"PasteIcon",hyperKey:"V"},{title:"Paste Shortcut",id:A.Actions.PASTESHORT_ID,iconClass:"PasteShortIcon"},{title:"Paste Folders Only",id:A.Actions.PASTE_FOLDERS_ONLY_ID,iconClass:""},null,{title:"Delete",id:A.Actions.DELETE_ID,iconClass:"DeleteIcon"},{title:"Rename",id:A.Actions.RENAME_ID,iconClass:"RenameIcon"},{title:"Check In/Out",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Check Out",id:A.Actions.CHECKOUT_ID,iconClass:"CheckOutIcon"},{title:"Check In",id:A.Actions.CHECKIN_ID,iconClass:"CheckInIcon"},{title:"Undo Check Out",id:A.Actions.UNDOCHECKOUT_ID,iconClass:"UndoCOIcon"},{title:"Check Out Details",id:A.Actions.CHECKOUTDETAILS_ID,iconClass:"CODetailsIcon"})},null,{title:"New",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Folder",id:A.Actions.NEWFOL_ID,iconClass:"NewFolIcon"},{title:"Shortcut",id:A.Actions.NEWSHORT_ID,iconClass:"ShortcutIcon"},{title:"Document",id:A.Actions.NEWDOC_ID,iconClass:"NewDocIcon"})},{title:"Access Rights...",id:A.Actions.ACCESS_ID,iconClass:"EntryAccessIcon"},{title:"Properties",id:A.Actions.PROPS_ID,iconClass:"PropsIcon"}];break;case top.TYPE_RECYCLEBIN_ENTRY:B=new Array({title:"Purge",id:A.Actions.PURGE_ID,iconClass:"PurgeIcon"},{title:"Restore",id:A.Actions.RESTORE_ID,iconClass:"RestoreIcon"},null,{title:"Purge All Entries",id:A.Actions.PURGEALLENTRIES_ID,iconClass:"PurgeAllIcon"});break;case TYPE_GRID_HEADER:B=new Array({title:"Customize Columns...",id:A.Actions.COLUMNS_ID,iconClass:"ColumnsIcon"},{title:"Sort By This Column",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Ascending",id:A.Actions.SORTASC_ID,iconClass:null},{title:"Descending",id:A.Actions.SORTDESC_ID,iconClass:null})});break;case top.TYPE_RECYCLEBIN:B=new Array({title:"Purge All Entries",id:A.Actions.PURGEALLENTRIES_ID,iconClass:"PurgeAllIcon"});break;case top.TYPE_FOLDER_TREE_ROOT_ENTRY:B=[{title:"Fields...",id:A.Actions.FIELDS_ID,iconClass:"FieldsIcon"},null,{title:"Cut",id:A.Actions.CUT_ID,iconClass:"CutIcon",hyperKey:"X"},{title:"Copy",id:A.Actions.COPY_ID,iconClass:"CopyIcon",hyperKey:"C"},{title:"Paste",id:A.Actions.PASTE_ID,iconClass:"PasteIcon",hyperKey:"V"},{title:"Paste Shortcut",id:A.Actions.PASTESHORT_ID,iconClass:"PasteShortIcon"},{title:"Paste Folders Only",id:A.Actions.PASTE_FOLDERS_ONLY_ID,iconClass:""},null,{title:"Create Briefcase",id:A.Actions.EXPORTBRIEF_ID,iconClass:"BriefcaseIcon"},{title:"Migrate Entries",id:A.Actions.MIGRATE_ID,iconClass:"MigrateIcon"},null,{title:"New",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Folder",id:A.Actions.NEWFOL_ID,iconClass:"NewFolIcon"},{title:"Shortcut",id:A.Actions.NEWSHORT_ID,iconClass:"ShortcutIcon"},{title:"Document",id:A.Actions.NEWDOC_ID,iconClass:"NewDocIcon"})},{title:"Access Rights...",id:A.Actions.ACCESS_ID,iconClass:"EntryAccessIcon"},{title:"Properties",id:A.Actions.PROPS_ID,iconClass:"PropsIcon"},{title:"Log Out",id:A.Actions.LOGOUT_ID,iconClass:""}];break;case top.TYPE_FOLDER_TREE_ENTRY:B=[{title:"Fields...",id:A.Actions.FIELDS_ID,iconClass:"FieldsIcon"},null,{title:"Cut",id:A.Actions.CUT_ID,iconClass:"CutIcon",hyperKey:"X"},{title:"Copy",id:A.Actions.COPY_ID,iconClass:"CopyIcon",hyperKey:"C"},{title:"Paste",id:A.Actions.PASTE_ID,iconClass:"PasteIcon",hyperKey:"V"},{title:"Paste Shortcut",id:A.Actions.PASTESHORT_ID,iconClass:"PasteShortIcon"},{title:"Paste Folders Only",id:A.Actions.PASTE_FOLDERS_ONLY_ID,iconClass:""},null,{title:"Delete",id:A.Actions.DELETE_ID,iconClass:"DeleteIcon"},{title:"Rename",id:A.Actions.RENAME_ID,iconClass:"RenameIcon"},{title:"Create Briefcase",id:A.Actions.EXPORTBRIEF_ID,iconClass:"BriefcaseIcon"},{title:"Migrate Entries",id:A.Actions.MIGRATE_ID,iconClass:"MigrateIcon"},null,{title:"New",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Folder",id:A.Actions.NEWFOL_ID,iconClass:"NewFolIcon"},{title:"Shortcut",id:A.Actions.NEWSHORT_ID,iconClass:"ShortcutIcon"},{title:"Document",id:A.Actions.NEWDOC_ID,iconClass:"NewDocIcon"})},{title:"Access Rights",id:A.Actions.ACCESS_ID,iconClass:"EntryAccessIcon"},{title:"Properties",id:A.Actions.PROPS_ID,iconClass:"PropsIcon"},{title:"Log Out",id:A.Actions.LOGOUT_ID,iconClass:""}];break;case top.CUSTOMIZE_TOOLBAR:B=new Array({title:"Customize Toolbar...",id:A.Actions.TOOLBAR_ID,iconClass:"ToolbarIcon"});break;case top.TYPE_DOCUMENT_PAGE_IMAGE:B=[{title:"Add Annotation ",id:A.Actions.ANNOTATIONGROUP_ID,iconClass:null,menu:[{title:"Highlight",id:A.Actions.HIGHLIGHT_ID,iconClass:"HighlightIcon"},{title:"Redaction",id:A.Actions.REDACTION_ID,iconClass:"RedactionIcon"},{title:"Underline",id:A.Actions.UNDERLINE_ID,iconClass:"UnderlineIcon"},{title:"Strike-Through",id:A.Actions.STRIKETHROUGH_ID,iconClass:"StrikeoutIcon"},null,{title:"Sticky Note",id:A.Actions.STICKYNOTE_ID,iconClass:"StickyNoteIcon"},{title:"Stamp",id:A.Actions.STAMP_ID,iconClass:"StampIcon"},{title:"Rectangle",id:A.Actions.RECTANGLE_ID,iconClass:"RectangleIcon"},{title:"Text Box",id:A.Actions.TEXTBOX_ID,iconClass:"TextAnnIcon"},{title:"Callout",id:A.Actions.CALLOUT_ID,iconClass:"CalloutIcon"},{title:"Line",id:A.Actions.LINE_ID,iconClass:"LineIcon"},{title:"Freehand",id:A.Actions.FREEHAND_ID,iconClass:"FreehandIcon"},{title:"Image",id:A.Actions.IMAGEANN_ID,iconClass:"ImageAnnIcon"},{title:"Attachment",id:A.Actions.ATTACHMENTANN_ID,iconClass:"AttachmentIcon"}]},{title:"Pan Tool",id:A.Actions.PAN_ID,iconClass:"PanIcon"},{title:"Zoom Tool",id:A.Actions.ZOOM_ID,iconClass:"ZoomIcon"},{title:"Selection Tool",id:A.Actions.SELECTION_ID,iconClass:"SelectionIcon"},null,{title:"Zoom",id:A.Actions.NOACTION_ID,iconClass:null,menu:[{title:"Zoom In",id:A.Actions.ZOOMIN_ID,iconClass:"ZoomInIcon"},{title:"Zoom Out",id:A.Actions.ZOOMOUT_ID,iconClass:"ZoomOutIcon"},{title:"Fit Window",id:A.Actions.FITWINDOW_ID,iconClass:"FitWindowIcon"},{title:"Fit Width",id:A.Actions.FITWIDTH_ID,iconClass:"FitWidthIcon"},{title:"Fit Height",id:A.Actions.FITHEIGHT_ID,iconClass:"FitHeightIcon"}]},{title:"Rotate Clockwise",id:A.Actions.ROTATE_ID,iconClass:"RotateIcon"},null,{title:"Previous Page",id:A.Actions.PREVPAGE_ID,iconClass:"PrevPageIcon"},{title:"Next Page",id:A.Actions.NEXTPAGE_ID,iconClass:"NextPageIcon"},null,{title:"Properties",id:A.Actions.PROPS_ID,iconClass:"PropsIcon"}];break;case top.TYPE_SEARCH_GRID_ENTRY:B=[{title:"Open Containing Folder",id:A.Actions.OPEN_PARENT_FOLDER_ID,iconClass:"OpenIcon"},{title:"Open",id:A.Actions.OPEN_ID,iconClass:"OpenIcon"},{title:"Fields...",id:A.Actions.FIELDS_ID,iconClass:"FieldsIcon"},{title:"Send E-mail",id:A.Actions.EMAIL_ID,iconClass:"EmailIcon"},null,{title:"Copy",id:A.Actions.COPY_ID,iconClass:"CopyIcon",hyperKey:"C"},null,{title:"Delete",id:A.Actions.DELETE_ID,iconClass:"DeleteIcon"},{title:"Rename",id:A.Actions.RENAME_ID,iconClass:"RenameIcon"},{title:"Check In/Out",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Check Out",id:A.Actions.CHECKOUT_ID,iconClass:"CheckOutIcon"},{title:"Check In",id:A.Actions.CHECKIN_ID,iconClass:"CheckInIcon"},{title:"Undo Check Out",id:A.Actions.UNDOCHECKOUT_ID,iconClass:"UndoCOIcon"},{title:"Check Out Details",id:A.Actions.CHECKOUTDETAILS_ID,iconClass:"CODetailsIcon"})},null,{title:"Access Rights...",id:A.Actions.ACCESS_ID,iconClass:"EntryAccessIcon"},{title:"Properties",id:A.Actions.PROPS_ID,iconClass:"PropsIcon"}];break;case top.TYPE_SEARCH_GRID_ENTRY_HAS_EDOC:B=[{title:"Open Containing Folder",id:A.Actions.OPEN_PARENT_FOLDER_ID,iconClass:"OpenIcon"},{title:"Open",id:A.Actions.OPEN_ID,iconClass:"OpenIcon",menu:[{title:"Pages",id:A.Actions.OPENPAGES_ID,iconClass:""},{title:"Electronic File",id:A.Actions.OPENEDOC_ID,iconClass:""}]},{title:"Fields...",id:A.Actions.FIELDS_ID,iconClass:"FieldsIcon"},{title:"Send E-mail",id:A.Actions.EMAIL_ID,iconClass:"EmailIcon"},null,{title:"Copy",id:A.Actions.COPY_ID,iconClass:"CopyIcon",hyperKey:"C"},null,{title:"Delete",id:A.Actions.DELETE_ID,iconClass:"DeleteIcon"},{title:"Rename",id:A.Actions.RENAME_ID,iconClass:"RenameIcon"},{title:"Check In/Out",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Check Out",id:A.Actions.CHECKOUT_ID,iconClass:"CheckOutIcon"},{title:"Check In",id:A.Actions.CHECKIN_ID,iconClass:"CheckInIcon"},{title:"Undo Check Out",id:A.Actions.UNDOCHECKOUT_ID,iconClass:"UndoCOIcon"},{title:"Check Out Details",id:A.Actions.CHECKOUTDETAILS_ID,iconClass:"CODetailsIcon"})},null,{title:"Access Rights...",id:A.Actions.ACCESS_ID,iconClass:"EntryAccessIcon"},{title:"Properties",id:A.Actions.PROPS_ID,iconClass:"PropsIcon"}];break;case top.TYPE_SEARCH_GRID_HEADER:B=new Array({title:"Customize Columns...",id:A.Actions.SEARCH_COLUMNS_ID,iconClass:"ColumnsIcon"},{title:"Sort By This Column",id:A.Actions.NOACTION_ID,iconClass:null,menu:new Array({title:"Ascending",id:A.Actions.SORTASC_ID,iconClass:null},{title:"Descending",id:A.Actions.SORTDESC_ID,iconClass:null})});break;case top.TYPE_THUMBNAIL:B=new Array({title:"Open Page",id:A.Actions.OPEN_PAGE_ID,iconClass:""},null,{title:"Cut",id:A.Actions.CUT_ID,iconClass:"CutIcon",hyperKey:"X"},{title:"Copy",id:A.Actions.COPY_ID,iconClass:"CopyIcon",hyperKey:"C"},{title:"Paste",id:A.Actions.PASTE_ID,iconClass:"PasteIcon",hyperKey:"V"},null,{title:"New Document",id:A.Actions.NEWDOC_FROMPAGES_ID,iconClass:"NewDocIcon",hyperKey:"N"},{title:"Rotate",id:A.Actions.NOACTION_ID,iconClass:"RotateIcon",menu:[{title:"Clockwise",id:A.Actions.ROTATE_CW_ID,iconClass:"RotateIcon"},{title:"Counter Clockwise",id:A.Actions.ROTATE_CCW_ID,iconClass:"RotateCCWIcon"},{title:"Upside-down",id:A.Actions.ROTATE_UD_ID,iconClass:null}]},{title:"Delete",id:A.Actions.DELETEPAGES_ID,iconClass:"DeleteIcon"});break}return B}};if(!top.LF){top.LF={}}LF.MainController=function(){var A=this;this.initializeEvents();this._lastSecParams=null;this._context=new top.LF.PageContext();this._context.setOpenedFolder({id:1},function(){});this.Actions=new LF.ActionRegistry(this);this.ClipboardReceiver=new Laserfiche.MainCopyPasteReceiver(this);this.ClipboardCommands={Cut:new Laserfiche.CutCommand(this.ClipboardReceiver,this._context),Copy:new Laserfiche.CopyCommand(this.ClipboardReceiver,this._context),Paste:new Laserfiche.PasteCommand(this.ClipboardReceiver,this._context),PasteShortCut:new Laserfiche.PasteShortCutCommand(this.ClipboardReceiver,this._context),PasteFoldersOnly:new Laserfiche.PasteFoldersOnlyCommand(this.ClipboardReceiver,this._context)};this.Settings={PartialMatches:true,DefaultZoom:1};this.RepositoryMetadata={};this.ContextMenu=new LF.MainContextMenu();this.layout=new LF.LayoutManager();this.listener=new LF.Listener("MainListener");this.loginInfo={};this.ViewMode=this.BROWSE_MODE;this._checkingsecurity=false;this._MainControls=[];this.registerEventType("RepositoryLoginChanged");this.registerEventType("EntryChanged");this.registerEventType("PagesChanged");this.registerEventType("NumPagesChanged");this.registerEventType("EntryRenamed");this.registerEventType("NewFolderCreated");this.registerEventType("NewDocumentCreated");this.registerEventType("NewShortcutCreated");this.registerEventType("EntryMoved");this.registerEventType("EntryRestored");this.registerEventType("EntryPurged");this.registerEventType("EntryDeleted");this.registerEventType("EntryMigrated");this.registerEventType("FolderOpened");this.registerEventType("SelectedEntryChanged");this.registerEventType("EntryOpened");this.registerEventType("PageOpened");this.registerEventType("DisplaySearchResults");this.registerEventType("SearchEntryFocused");this.registerEventType("SelectedPageChanged");this.registerEventType("RepositoryChanged");this.registerEventType("MetadataOpened");this.registerEventType("SearchSelected");this.registerEventType("SearchHandleChanged");this.registerEventType("ZoomChanged");this.registerEventType("ContextChanged");this.registerEventType("DocumentEdited");this.registerEventType("Login");this.registerEventType("Logout");this.registerEventType("UpFolder");this.registerEventType("LogoutAll");this.registerEventType("ModeChanged")};LF.MainController.prototype={initialize:function(A){if(A.loginInfo){top.searchControl;for(repository in A.loginInfo){this.GetClipboardPullFunc(repository).apply();this.loginInfo[repository]=A.loginInfo[repository]}}this.applySettings(A.settings)},applySettings:function(A){if(A){for(name in A){this.Settings[name]=A[name]}}},loadMetadata:function(F,B){var A=this;var C=this._context.repository;var E=function(H){top.unescapeRepositoryMetadata(H);var G=[];dojo.forEach(H.templates,function(I){G.push(I.name)});H["templateNameList"]=G;A.RepositoryMetadata[C]=H;if(F){F()}};var D=function(G){if(B&&Laserfiche.Exception.IsConnectionLost(G)){}else{alert(G.get_message())}if(B){B(G)}};Laserfiche.WebAccess.MetadataService.GetRepositoryMetadata(C,1,E,D)},setMainTabOrder:function(A){A.tabPosition=this._MainControls.length;this._MainControls.push(A)},changeLogin:function(B,A){this.loginInfo[B]=A;if(B==this._context.repository&&A!=null){this.CurrentLoginInfo=A;this._context.user=this.CurrentLoginInfo.User;this.redrawCommandBar();this._notify("Login",this._context)}},GetClipboardPullFunc:function(B){var A=this;return function(){A.ClipboardReceiver.pullInArgs(B)}},set_annotationControl:function(A){this._annControl=A},set_currentSearchHandle:function(A){this.searchhandle=A;this._notify("SearchHandleChanged",{searchhandle:A,repository:this._context.repository})},set_repository:function(B){if(this._context.repository.toUpperCase()==B.toUpperCase()){return }for(var A in this.loginInfo){if(A.toUpperCase()==B.toUpperCase()){B=A}}if(this.loginInfo[B]){this.CurrentLoginInfo=this.loginInfo[B]}else{this.CurrentLoginInfo=null}this._context.setRepository(B);if(this.CurrentLoginInfo){this._context.setUser(this.CurrentLoginInfo.User)}else{this._context.setUser("")}this.redrawCommandBar();this.updateQuickbar();this._notify("RepositoryChanged",this._context)},set_centerWidth:function(A){this._mainTabs.set_width(A)},set_mainTabContainer:function(A){this._mainTabs=new LF.MainTabs(A,this)},set_quickbar:function(A){this._quickbar=A},refresh:function(){if(myEntryBrowser.IsActive()){myEntryBrowser.refresh()}var A=this.layout.GetRegisteredControl("SearchResults");if(A.IsActive()){A.refresh()}},openEntry:function(E,B,C,A,D){this._context.setOpenedDocument({id:E},function(){});this.doAction(this.Actions.OPEN_ID);this._notify("EntryOpened",this._context)},openEntryMetadata:function(A,B,C){this._notify("MetadataOpened",A)},doAction:function(A){if(this.Actions.getActionPropertiesByID(A).hideFunc&&this.Actions.getActionPropertiesByID(A).hideFunc(this)){if(top.myAppController._lastSecParams.VolReadOnly){alert("Annotations cannot be applied to read-only volumes.")}else{alert("Insufficient rights to perform this action.")}}else{this.Actions.getActionPropertiesByID(A).func(this._context)}},setMode:function(B,A){this._annControl.selectMode(B)},loadSecurity:function(C,B,A,H){var D=this;if(D._lastSecParams&&!H&&top.entriesSame(C,D._lastSecIdArray)){if(B){B(D._lastSecParams.Rights,D._lastSecParams.VolReadOnly)}}else{var F=function(I){D.GetOnSecurityCheckSuccess(C);if(B){B(I.Rights,I.VolReadOnly)}};var E=function(I){D.GetOnSecurityCheckError();if(A){A()}};var G=D._repositoryName||top.myAppController._context.repository;Laserfiche.WebAccess.DocumentService.CalculateSecurity(C,0,G,F,E)}},checkSecurity:function(){if(this._loggingout){return }var D=this._context.getSelectedItems();this._checkingsecurity=true;if(D&&D.items&&D.items.length){this._lastSecParams=null;var A=D.items;var C=D.type;if(A.length>0&&C=="ENTRIES"){var B=dojo.map(A,function(E){return E.id});Laserfiche.WebAccess.DocumentService.CalculateSecurity(B,this._context.openedFolder.id,this._context.repository,this.GetOnSecurityCheckSuccess(B),this.GetOnSecurityCheckError(),{ids:B,openedFolder:this._context.openedFolder.id,repository:this._context.repository,onSuccessFunc:this.GetOnSecurityCheckSuccess(B)})}if(A.length>0&&C=="PAGES"){Laserfiche.WebAccess.DocumentService.CalculateSecurityOnPages(this._context.repository,A,this.GetOnSecurityCheckSuccess(),this.GetOnSecurityCheckError())}}else{if(this._lastSecIdArray&&this._lastSecIdArray.length&&this._lastSecParams){this.GetOnSecurityCheckSuccess(this._lastSecIdArray)(this._lastSecParams)}}},ReceivedKeyPress:function(A){if(A.keyCode==dojo.keys.CTRL){if(A.type=="keydown"){this.ctrlHeld=true}else{this.ctrlHeld=false}return false}if(A.keyCode==dojo.keys.ALT){if(A.type=="keydown"){this.altHeld=true}else{this.altHeld=false}return false}if(this.ctrlHeld&&this.altHeld){if(A.type=="keypress"&&A.keyCode==86){LF.Actions.Paste(top.myAppController._context)}else{this._commandBar.FindHyperKey(A)}A.cancelBubble=true;A.returnValue=false}return false},logoutAll:function(){var B=this;this._loggingout=true;var A=function(){B._context.setUser("");B._notify("LogoutAll",B._context)};this._mainTabs.prepareForLogoutAll(A)},logout:function(){var B=this;this._loggingout=true;var A=function(){B._context.setUser("");B._notify("Logout",B._context)};this._mainTabs.prepareForLogout(this._context.repository,A)},goUpFolder:function(){this._notify("UpFolder",this._context)},TabToNextMainCtrl:function(C,B){var A=this;if(C.tabPosition==null){this.setMainTabOrder(top.myFolderTree);this.setMainTabOrder(top.myEntryBrowser);this.setMainTabOrder(top.searchControl)}var D=C.tabPosition;if(D!=null){if(B){D++}else{D--}if(D>(this._MainControls.length-1)){D=0}if(D<0){D=(this._MainControls.length-1)}}else{D=0}this._MainControls[D].setCtrlFocus()},GetOnSecurityCheckSuccess:function(B){var A=this;return function(C){A._checkingsecurity=false;A._lastSecIdArray=B;A._lastSecParams=C;A._commandBar.UpdateSecurity(C,A._context);A._quickbar.UpdateSecurity(C,A._context)}},GetOnSecurityCheckError:function(){var A=this;return function(J,C,I){A._checkingsecurity=false;if(J.get_statusCode()==500&&J.get_exceptionType()=="Laserfiche.WebAccess.Common.ConnectionException"){var K=C.repository;var B=function(){Laserfiche.WebAccess.DocumentService.HasDbConnection(K,G,D)};var G=function(M){if(!!M){Laserfiche.WebAccess.DocumentService.CalculateSecurity(C.ids,C.openedFolder,C.repository,C.onSuccessFunc,function(){})}};var D=function(){};var E=top.getAvailableLoginDlg();if(!E){return }var L=top.isLoggedIn(K)?dojo.string.substitute("Session timeout occurred. Please log in to the Laserfiche repository '${0}'",[K]):"";var H={RepositoryName:K,m:L};var F=dojo.string.substitute("${0}?${1}",["Dialogs/LoginDialog.aspx",dojo.objectToQuery(H)]);E.OpenDialog(F,320,378,false,true);E.onclose=function(M){top.CurrentLoginDlg=null;if(M&&M.success){A.changeLogin(K,M.info);B.apply()}else{A.changeLogin(K,null);D()}}}}},entriesChanged:function(A){this._notify("EntryChanged",A)},setFocusControl:function(A){this._context.setFocusControl(A);if(A.onFocus){A.onFocus()}},selectedEntryChanged:function(){this.checkSecurity();this._notify("SelectedEntryChanged",this._context)},DetermineRootItem:function(E,F,B){var D=this;function C(G){var J=G;if(J&&J.length){var I=false;for(var H=J.length-1;H>-1;H--){if(J[H].id==F){if(!J[H].folder){if(H!=0){F=J[H-1].id}else{F=1}}I=true;break}}if(!I){F=1}if(B){top.myFolderTree.RenameRootItem(E,J[0].id,F,J[0].label);D.selectCurrentFolder({id:F,repositoryName:E})}else{for(var H=J.length-1;H>-1;H--){if(J[H].id==F){top.myFolderTree.RenameRootItem(E,F,F,J[H].label);D.selectCurrentFolder({id:F,repositoryName:E});break}}}}}function A(G){}Laserfiche.WebAccess.BreadCrumbService.GetPathNodesToRoot(E,F,C,A)},selectCurrentFolder:function(A,B){this._mainTabs.showBrowser();if(this._context.openedFolder.id==A.id&&this._context.repository==A.repositoryName&&!A.forceRefresh){if(A.name&&this._context.openedFolder.name!=A.name){this._context.openedFolder.name=A.name}return }this._context.setOpenedFolder({id:A.id,name:A.name,flags:A.flags,path:A.path},this._getUpdateTitleFunc(B));this._notify("FolderOpened",this._context);this._notify("SelectedEntryChanged",this._context);this.recordState()},selectCurrentDocument:function(A,B){if(this._context.openedDocument&&A.id&&this._context.openedDocument.id==A.id){return }this._context.setOpenedDocument({id:A.id,name:A.name,flags:A.flags,path:A.path},this._getUpdateTitleFunc(B));this._notify("EntryOpened",this._context)},openDocument:function(C){var B=this;var D=this._mainTabs;if(C.page){if(this._context.openedDocument&&C.id&&this._context.openedDocument.id==C.id){if(!(this._context.openedPage&&this._context.openedPage.pageId==C.page&&this._context.openedPage.docId==C.id)){this.selectCurrentPage({pagenum:C.page,docid:C.id})}this.displaySearchResults(C)}else{D.openDocument(C.id,C.name,C.repositoryName,C.page,C.annid,C.searchhandle)}return }var A=function(L){var J=L.split(":");var G=!!(J&&J.length>=3&&!!J[1]&&J[1]!="0");var K=!!(J&&J.length>=3&&J[2]-0);if(G){if(B.Settings.OpenEdocAsDoc){B._mainTabs.openDocument(C.id,C.name,C.repositoryName)}else{var F=top.getAvailableDlg();var E={r:C.repositoryName,i:C.id,t:"ElectronicFile"};var I="Dialogs/Export/ExportDisplay.aspx";var H=dojo.string.substitute("${0}?${1}",[I,dojo.objectToQuery(E)]);F.OpenDialog(H,150,350,false);F.onclose=function(M){}}return }if(!K){B._mainTabs.openMetadata([C.id],C.repositoryName);return }D.openDocument(C.id,C.name,C.repositoryName,C.pagenum)};top.getEntryElecProps(C.repositoryName,C.id,A)},selectCurrentPage:function(A,B){this._context.setOpenedPage({pageId:A.pagenum,docId:A.docid});this._notify("PageOpened",this._context);this._notify("SelectedPageChanged",this._context)},selectCurrentAnn:function(){},displaySearchResults:function(A){this._notify("DisplaySearchResults",A)},newFolderCreated:function(A,B){this._notify("NewFolderCreated",{repoName:A.RepositoryName,parentId:A.ParentFolderId,folderId:A.NewFolderId,srcObjName:B})},newDocumentCreated:function(A,B){this._notify("NewDocumentCreated",{repoName:A.RepositoryName,parentId:A.ParentFolderId,documentId:A.NewDocumentId,srcObjName:B})},newShortcutCreated:function(C,B,A){this._notify("NewShortcutCreated",{repoName:C,parentId:B,srcObjName:A})},EntryDeleted:function(A,B){this._notify("EntryDeleted",{repoName:A.RepositoryName,parentId:A.ParentFolderId,entryId:A.DeletedEntryId,entryCount:A.EntryCount,srcObjName:B})},EntryMoved:function(D,B,A){var C=null;this._notify("EntryMoved",{repoName:D,parentId:B,srcObjName:A})},EntryRestored:function(D,B,A){var C=null;this._notify("EntryRestored",{repoName:D,parentId:B,srcObjName:A})},EntryPurged:function(D,C,A){var B=null;this._notify("EntryPurged",{repoName:D,idlist:C,srcObjName:A})},EntryRenamed:function(A,C,B){this._notify("EntryRenamed",{newName:A,args:C,srcObjName:B})},EntryMigrated:function(A,B){this._notify("EntryMigrated",{repoName:A.RepositoryName,parentId:A.ParentFolderId})},_ensureDateFormat:function(){if(!this.DateFormat){var J=dojo.date.locale._getGregorianBundle(dojo.locale);var E=J["dateFormat-short"];var H=E.indexOf("M");if(H<0){H=E.indexOf("m")}var C=E.indexOf("d");if(C<0){C=E.indexOf("D")}var D=E.indexOf("y");if(D<0){D=E.indexOf("Y")}var B=Math.min(Math.min(H,C),D);var G=Math.max(Math.max(H,C),D);var F="";var A="";var I="";if(H==B){F="M"}else{if(H==G){I="M"}else{A="M"}}if(C==B){F="D"}else{if(C==G){I="D"}else{A="D"}}if(D==B){F="Y"}else{if(D==G){I="Y"}else{A="Y"}}this.DateFormat=F+A+I}},RunSearch:function(A,C,B){if(A.length==0){alert("No valid search criteria have been specified.");return }this._ensureDateFormat();this.search=A;this.isquicksearch=!C;this._mainTabs.openSearchResults();this._notify("SearchSelected",{search:A,repository:this._context.repository,imageenable:B});this.recordState()},RunDocumentSearch:function(A){},initializeCommandBar:function(B){var A=new CommandBar(B);this._commandBar=A;A.set_controller(this)},redrawCommandBar:function(){if(this._loggingout||!this._commandBar){return }switch(this.ViewMode){case this.BROWSE_MODE:case this.SEARCH_MODE:LF.MainCommandBarDefs.InitializeBrowseBar(this._commandBar,this);setTimeout(function(){myAppController.checkSecurity()},0);break;case this.PAGES_MODE:LF.MainCommandBarDefs.InitializeDocumentBar(this._commandBar,this);setTimeout(function(){myAppController.checkSecurity()},0);break;case this.METADATA_MODE:break}},updateQuickbar:function(B){if(!this._quickbar){return }var A=this._context.repository;switch(this.ViewMode){case this.BROWSE_MODE:this._quickbar.LoadDefinition("BrowseQuickBar",A,B);break;case this.PAGES_MODE:this._quickbar.LoadDefinition("DocumentQuickBar",A,B);break;case this.SEARCH_MODE:this._quickbar.LoadDefinition("BrowseQuickBar",A,B);break;case this.METADATA_MODE:this._quickbar.LoadDefinition("MetadataQuickBar",A,B);break}},_getUpdateTitleFunc:function(B){var A=this;return function(){A.updateTitle();if(B){B()}}},updateTitle:function(){switch(this.ViewMode){case this.BROWSE_MODE:view="browse";if(this._context.openedFolder){document.title=this._context.openedFolder.name+" - Laserfiche Web Access"}break;case this.PAGES_MODE:case this.METADATA_MODE:case this.PDF_MODE:case this.EFILE_MODE:view="pages";document.title=this._context.openedDocument.name+" - Laserfiche Web Access";break;case this.SEARCH_MODE:document.title="Search Results - Laserfiche Web Access";break}},readInitialHash:function(){var A=window.location.hash;if(A.charAt(0)=="#"){A=A.substring(1)}A=dojo.isMozilla?A:decodeURIComponent(A);this.readHash(A);if(this.ViewMode==this.BROWSE_MODE){this.UseBrowseMode()}},readHash:function(B){if(B.length<1){if(dojo.exists("_context.repository",this)&&dojo.exists("myFolderTree",top)){top.myFolderTree.HighlightNode(this._context.repository,1)}return }var E=B.split(";");var F={};for(var C=0;C<E.length;C++){if(E&&E.length>0){var D=E[C].indexOf("=");var H=E[C].substring(0,D);var G=E[C].substring(D+1);F[H.toLowerCase()]=G}}if(F["db"]){this.set_repository(F["db"])}if(F["quicksearch"]){var A=(F["imageenable"]=="true");this.RunSearch(F["quicksearch"],false,A)}else{if(F["search"]){var A=(F["imageenable"]=="true");this.RunSearch(F["search"],true,A)}else{if(F["view"]){F["view"]=F["view"].toLowerCase()}if(F["id"]&&(F["view"]!="newroot")){this.DetermineRootItem(this._context.repository,F["id"],true)}switch(F["view"]){case"browse":if(F["id"]){LF.Actions.OpenEntryById(this._context.repository,{id:F["id"]})}else{if(dojo.exists("_context.repository",this)&&dojo.exists("myFolderTree",top)){top.myFolderTree.HighlightNode(this._context.repository,1)}}this._mainTabs.showBrowser();break;case"pages":if(F["id"]){var I={id:F["id"],repository:this._context.repository,page:F["page"]||1,annid:F["annotation"]||null,searchhandle:F["search"]||null};this._mainTabs.openDocument(I.id,"",I.repository,I.page||1,I.annid,I.searchhandle)}break;case"metadata":if(F["id"]){this._mainTabs.openMetadata([F["id"]],this._context.repository)}break;case"newroot":if(F["id"]){this.DetermineRootItem(this._context.repository,F["id"],false);LF.Actions.OpenEntryById(this._context.repository,{id:F["id"]})}break;default:if(F["id"]){LF.Actions.OpenEntryById(this._context.repository,{id:F["id"]})}else{if(dojo.exists("_context.repository",this)&&dojo.exists("myFolderTree",top)){top.myFolderTree.HighlightNode(this._context.repository,1)}}break}}}},recordState:function(){var C=this;var A=(!this._lastHash);var B=this.getHash();if(B==this._lastHash){return }this._lastHash=B;var D={changeUrl:B,back:function(){C._lastHash=this.changeUrl;C.readHash(this.changeUrl)},forward:function(){C._lastHash=this.changeUrl;C.readHash(this.changeUrl)}};if(A){dojo.back.setInitialState(D)}else{dojo.back.addToHistory(D)}},getHash:function(){var D="";var B=this._context.repository;var A="browse";switch(this.ViewMode){case this.BROWSE_MODE:A="browse";D=D+"id="+this._context.openedFolder.id+";";break;case this.PAGES_MODE:A="pages";D=D+"id="+this._context.openedDocument.id+";";break;case this.METADATA_MODE:A="metadata";D=D+"id="+this._context.openedDocument.id+";";break;case this.PDF_MODE:A="pdf";break;case this.EFILE_MODE:A="efile";break;case this.SEARCH_MODE:A="search";if(this.search&&this.search.length>0){var C=this.isquicksearch?"quicksearch":"search"}D=D+C+"="+this.search+";";break}D=D+"db="+B+";view="+A;return D},BROWSE_MODE:0,PAGES_MODE:1,METADATA_MODE:2,PDF_MODE:3,EFILE_MODE:4,SEARCH_MODE:5,SetViewMode:function(B){var A=this.ViewMode;if(B!=this.PAGES_MODE&&A!=B){top.docviewControl.unsetLayout()}this.ViewMode=B;this.redrawCommandBar();switch(B){case this.BROWSE_MODE:this._context.openedDocument=null;this.layout.MoveToSlot("CenterStage","EntryBrowser");this.layout.MoveToSlot("Preview","PreviewPane");this.layout.MoveToSlot("LeftTop","FolderTree");this.layout.ActivateSlot("Preview");break;case this.METADATA_MODE:this.layout.MoveToSlot("CenterStage","MetadataView");this.layout.MoveToSlot("Preview","PreviewPane");this.layout.MoveToSlot("LeftTop","FolderTree");this.layout.ActivateSlot("Preview");break;case this.PAGES_MODE:this.layout.MoveToSlot("Preview","ThumbnailControl");this.layout.MoveToSlot("LeftTop","MetadataView");this.layout.MoveToSlot("DocumentSearchHits","ContextHits");this.layout.MoveToSlot("CenterStage","DocView");if(A!=this.PAGES_MODE){top.docviewControl.doLayout()}break;case this.SEARCH_MODE:this._context.openedDocument=null;this.layout.MoveToSlot("SearchResultsListing","SearchResults");this.layout.MoveToSlot("SearchContextHits","ContextHits");this.layout.MoveToSlot("CenterStage","SearchView");this.layout.MoveToSlot("Preview","PreviewPane");this.layout.MoveToSlot("LeftTop","FolderTree");this.layout.ActivateSlot("Preview");break}this.updateQuickbar();this.updateStatusBar();this._notify("ModeChanged",{context:this._context,mode:this.ViewMode})},UseBrowseMode:function(){this.SetViewMode(this.BROWSE_MODE)},UsePagesMode:function(){this.SetViewMode(this.PAGES_MODE)},UseSearchMode:function(){this.SetViewMode(this.SEARCH_MODE)},UseMetadataMode:function(){this.SetViewMode(this.METADATA_MODE)},set_statusBar:function(B,A){this._statusBar=B;this._rightStatusBar=A},updateStatusBar:function(C){this._statusBar.innerHTML="";if(C){this._statusBar.appendChild(document.createTextNode(C))}else{switch(this.ViewMode){case this.BROWSE_MODE:this._rightStatusBar.style.display="none";var B=this.layout.GetRegisteredControl("EntryBrowser");var G=Number(B.get_rowCount());this._statusBar.appendChild(document.createTextNode(G+(G==1?" entry":" entries")));break;case this.METADATA_MODE:this._rightStatusBar.style.display="none";this._statusBar.appendChild(document.createTextNode("Displaying metadata for entry"));break;case this.PAGES_MODE:this._rightStatusBar.style.display="";if(this._annControl){this._statusBar.appendChild(document.createTextNode(this._annControl.get_statusMessage()))}break;case this.SEARCH_MODE:this._rightStatusBar.style.display="none";var E=this.layout.GetRegisteredControl("SearchResults");var A=Number(E.get_rowCount());var D=Number(E.get_hitCount());var F="Found: "+A+(A==1?" matching entry":" matching entries");if(D>0){F+=", "+D+(D==1?" hit":" hits")}this._statusBar.appendChild(document.createTextNode(F));break}}},GetModeFunc:function(C,B){var A=this;return function(){A.setMode(C,B)}},GetEditTextFunc:function(){var A=this;return function(){var B=!!top.hasFeature(myAppController._context.repository,"EditText")&&!top.myAppController._lastSecParams.VolReadOnly;if(B){var C=top.docviewControl;if(!C._textShown){C.ToggleMode("Text")}A._annControl._editor.EnableTextEdit()}else{alert("You do not have sufficient feature rights to edit text.")}}},GetDiscardTextFunc:function(){var A=this;return function(){var B=dojo.exists("docviewControl._pageviewControl.annControl._editor.hasTextChanged",top);var C=(B&&top.docviewControl._pageviewControl.annControl._editor.hasTextChanged());if(C){A._annControl._editor.DiscardTextChanges()}else{alert("There are no text changes to discard.")}}},getContextMenuItems:function(B,A){return this.ContextMenu.getItems(B,A,this)}};LF.Notifier.applyInterface(LF.MainController);if(!top.LF){top.LF={}}LF.MainTabs=function(C,B){var D=this;this.MAX_SIZE=140;this.MIN_SIZE=90;this.spacing=8;this._controller=B;this._container=C;C.className="TabContainer";this.listener=new LF.Listener("MainTabsListener");this.listener.setHandler("EntryRenamed",this.GetOnEntryRenamed());B.subscribe("EntryRenamed",this.listener);this._moreTabsButton=document.createElement("div");this._moreTabsButton.title="More...";this._moreTabsButton.tabIndex=1;this._moreTabsButton.className="MoreLink";this._moreTabsImg=document.createElement("img");this._moreTabsImg.src="Assets/images/arrows/chevronRight.gif";this._moreTabsImg.alt="More...";this._moreTabsButton.appendChild(this._moreTabsImg);C.appendChild(this._moreTabsButton);var A=document.createElement("div");A.className="MoreTabsMenu";C.appendChild(A);this._moreTabsMenu=top.SimpleMenu.CreateMenu([],A,this._moreTabsButton,false,false,true);this._moreTabsMenu.menuDiv.style.left=null;this._moreTabsMenu.menuDiv.style.zIndex=10;this._moreTabsMenu.menuDiv.style.top="22px";this._moreTabsButton.onmousedown=function(){D._moreTabsMenu.Toggle()};this._moreTabsButton.onblur=function(){D._moreTabsMenu.Hide()};this._moreTabsButton.onkeydown=function(G){if(!G){G=window.event}if(!D._moreTabsMenu.IsOpen()){var F=(G.keyCode)?G.keyCode:((G.charCode)?G.charCode:G.key);if(F==ENTER_KEY_CODE){D._moreTabsMenu.Show()}}else{D._moreTabsMenu.GetOnKeyDown()(G)}};this._moreTabsMenu.onselect=function(){var F=D._moreTabsMenu.value;D.SelectTab(F)};this._tabs={};this._taborder=new Array();this._nextX=0;this.addTab({id:"Browser",name:"Current Folder",icon:"Assets/images/buttons/browser.gif"});this._curTab="Browser";var E=D._tabs["Browser"];dojo.addClass(E.div,"TabSelected");Sys.Application.add_unload(this.GetOnUnload())};LF.MainTabs.prototype={GetOnUnload:function(){var A=this;return function(){var L=A._curTab;var O=null;var H=0;var C=null;var P=false;var F=L?L.charAt(0)=="M":false;var D=L?L.charAt(0)=="D":false;if(L){if(F||D){var I=D?top.myAppController._annControl:null;var J=top.metadataviewControl;if((I&&I.isDirty())||(J&&J.isDirty())){if(J&&J.isDirty()){C=J.getChanges()}var H=(I)?I._pageid:0;if(confirm("Save changes to the current document?\n\nPress OK to save changes, or Cancel to discard changes.")){P=true;O=L.substring(1)}else{P=false;O=null;H=0;C=null}}}}var B=new Array();for(var R in A._tabs){if(R.charAt(0)=="D"){var G=R.substring(1);var S=G.indexOf(":");var K=parseInt(G.substring(0,S));var Q=G.substring(S+1);B.push(K+":"+Q)}else{if(R.charAt(0)=="M"){var G=R.substring(1);var E=G.split(":");var M=dojo.fromJson(E[0]);var Q=E[1];for(var N=0;N<M.length;N++){B.push(M[N]+":"+Q)}}}}if(B.length>0){Laserfiche.WebAccess.DocumentService.CloseEntries(B,P,O,H,C,null)}}},prepareForLogoutAll:function(A){this.prepareForLogout(null,A)},prepareForLogout:function(V,G){var O=this;if(!V){V=null}var R=O._curTab;var T=null;var K=0;var C=null;var U=false;var H=R?R.charAt(0)=="M":false;var D=R?R.charAt(0)=="D":false;this._curTab=null;if(R){var B=R.indexOf(":");var Y=V?R.substring(B+1):null;if((Y==V)&&(H||D)){var L=D?top.myAppController._annControl:null;var M=top.metadataviewControl;if((L&&L.isDirty())||(M&&M.isDirty())){if(M&&M.isDirty()){C=M.getChanges()}var K=(L)?L._pageid:0;if(confirm("Save changes to the current document?\n\nPress OK to save changes, or Cancel to discard changes.")){U=true;T=R.substring(1)}else{U=false;T=null;K=0;C=null}}}}var A=new Array();for(var W in O._tabs){if(W.charAt(0)=="D"){var J=W.substring(1);var X=J.indexOf(":");var N=parseInt(J.substring(0,X));var Q=J.substring(X+1);if(!V||(Q==V)){A.push(N+":"+Q);this.removeTab(W)}}else{if(W.charAt(0)=="M"){var J=W.substring(1);var E=J.split(":");var P=dojo.fromJson(E[0]);var Q=E[1];if(!V||(Q==V)){for(var S=0;S<P.length;S++){A.push(P[S]+":"+Q)}this.removeTab(W)}}}}if(A.length>0){var F=function(){O.showBrowser();G()};var I=function(Z){alert(Z.get_message());O.showBrowser();G()};Laserfiche.WebAccess.DocumentService.CloseEntries(A,U,T,K,C,null,F,I)}else{G()}},set_width:function(A){this._width=A;this.calculateTabLengths()},moveTab:function(B,C){var E=-1;for(var D=0;D<this._taborder.length;D++){if(this._taborder[D]==B){E=D;break}}if(D==C){return }if(D>0){this._taborder.splice(D,1);var A=(C>=D)?C-1:C;this._taborder.splice(A,0,B)}this.calculateTabLengths()},addTab:function(E){var C=this;var A=E.id;this._tabs[A]=E;var I=document.createElement("div");I.className="Tab TabSelected";I.style.top="0px";I.style.left=this._nextX+"px";I.onmouseover=function(){dojo.addClass(this,"TabOver")};I.onmouseout=function(){dojo.removeClass(this,"TabOver")};var G=document.createElement("nobr");G.className="NameDiv";if(E.icon){var J=document.createElement("img");J.alt=E.name;J.src=E.icon;G.appendChild(J)}G.appendChild(document.createTextNode(E.name));I.appendChild(G);I.title=E.name;I.onclick=function(){C.SelectTab(E.id)};this._container.appendChild(I);var H=I.offsetWidth;G.style.width=G.offsetWidth+"px";var D=H;if(E.closable){D+=17;var F=document.createElement("div");F.className="CloseDiv";var K=document.createElement("img");K.src="Assets/images/tabs/tabClose.gif";F.onmouseover=function(){K.src="Assets/images/tabs/tabCloseHover.gif"};F.onmouseout=function(){K.src="Assets/images/tabs/tabClose.gif"};F.onclick=function(L){if(!L){L=window.event}C.close(E.id);dojo.stopEvent(L)};F.appendChild(K);I.appendChild(F)}var B=Math.min(this.MAX_SIZE,D);I.style.width=B+"px";I.className="Tab";this._nextX=this._nextX+B+this.spacing;this._tabs[A].div=I;this._tabs[A].nameDiv=G;this._tabs[A].length=H;this._taborder.push(A);this.calculateTabLengths()},removeTab:function(B){var D=this._tabs[B];var A=-1;if(D){this._container.removeChild(D.div);delete this._tabs[B];for(var C=0;C<this._taborder.length;C++){if(this._taborder[C]==B){A=C;break}}if(A>0){this._taborder.splice(C,1)}if(this._curTab==B){var E=Math.max(0,A-1);this.SelectTab(this._taborder[E])}}this.calculateTabLengths()},calculateTabLengths:function(){var I=0;var J=this._width-24;this._moreTabsButton.style.display="none";var D=this._curTab?false:true;var H=true;for(var E=0;E<this._taborder.length;E++){var A=this._taborder[E];var F=this._tabs[A];if(F){F.div.style.left=I+"px";var B=Math.max(this.MIN_SIZE,Math.min(this.MAX_SIZE,F.length+(F.closable?17:0)));I+=B;F.nameDiv.style.width=(B-(F.closable?17:0))+"px";F.div.style.width=B+"px";F.div.style.display="";if(I>J){if(E!=this._taborder.length-1||I>=this._width){H=false;break}}I+=this.spacing}}if(H){this._nextX=I;D=true}else{I=0;var G=true;var C=-1;for(var E=0;E<this._taborder.length;E++){var A=this._taborder[E];var F=this._tabs[A];if(F){F.div.style.left=I+"px";var B=this.MIN_SIZE;I+=B;F.nameDiv.style.width=(B-(F.closable?17:0))+"px";F.div.style.width=B+"px";F.div.style.display="";if(I>J){if(E!=this._taborder.length-1||I>=this._width){C=E;G=false;break}}if(!D&&A==this._curTab){D=true}I+=this.spacing}}if(G){this._nextX=I;D=true}else{if(D){var K=new Array();for(var E=C;E<this._taborder.length;E++){var A=this._taborder[E];var F=this._tabs[A];F.div.style.display="none";K.push({title:F.name,id:F.id})}this._moreTabsMenu.SetItems(K);this._moreTabsButton.style.display=""}else{this.moveTab(this._curTab,1)}}}},showBrowser:function(){this.SelectTab("Browser")},unfocus:function(R,L){var N=this;var C=this._tabs[R];if(R.charAt(0)=="D"){switch(Laserfiche.ZoomMode.ZoomType){case Laserfiche.ZoomTypes.ZOOM_TYPE_USE_SCALE:C.Scale=top.docviewControl._pageviewControl.annControl.get_scale();break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_WIDTH:C.Scale="W";break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_HEIGHT:C.Scale="H";break;case Laserfiche.ZoomTypes.ZOOM_TYPE_FIT_TO_PAGE:C.Scale="P";break}C.Search=top.docviewControl._hitsControl.get_searchhandle();C.Page=top.docviewControl.get_pagenum();C.Position={x:top.docviewControl._pageviewControl.annControl._xoffset,y:top.docviewControl._pageviewControl.annControl._yoffset}}var F=R.substring(1);var S=F.indexOf(":");var Q=F.substring(S+1);var U=F.substring(0,S);var D=(R.charAt(0)=="M");var M=D?0:parseInt(U);var O=D?dojo.fromJson(U):null;if(D){for(var P=0;P<O.length;P++){O[P]=O[P]+":"+Q}}var B=(!L)?null:function(){N.removeTab(R);if(top.docviewControl){top.docviewControl.Clear()}};var E=(!L)?null:function(V){alert(V.get_message());N.removeTab(R);if(top.docviewControl){top.docviewControl.Clear()}};var T=(L)?null:function(){if(top.docviewControl){top.docviewControl.Clear()}};var G=(L)?null:function(V){alert(V.get_message());if(top.docviewControl){top.docviewControl.Clear()}};var J=top.myAppController._annControl;var K=top.metadataviewControl;if((J&&J.isDirty())||(K&&K.isDirty())){var A=null;if(K&&K.isDirty()){A=K.getChanges()}var H=J?J._pageid:0;if(confirm("Save changes to this document?\n\nPress OK to save changes, or Cancel to discard changes.")){if(D){Laserfiche.WebAccess.DocumentService.SaveEntries(O,Q,0,0,A,null,L,L?B:T,L?E:G)}else{var I=function(){J.onChangesSent=null;var V=new Array();if(J._rotationchanged){V.push({Property:"rotation",Value:J._rotation})}if(L){J._editor.saveText();Laserfiche.WebAccess.DocumentService.SaveAndCloseEntry(M,Q,H,A,V,B,E)}else{J._editor.saveText();Laserfiche.WebAccess.DocumentService.SaveEntry(M,Q,H,A,V,T,G)}};if(J.ChangesPending()){J.onChangesSent=I}else{I()}}}else{if(L){if(D){Laserfiche.WebAccess.DocumentService.CloseEntries(O,false,null,0,null,null,B,E)}else{Laserfiche.WebAccess.DocumentService.CloseEntry(M,Q,B,E)}}else{if(D){Laserfiche.WebAccess.DocumentService.UnlockEntries(O,T,G)}else{Laserfiche.WebAccess.DocumentService.UnlockEntry(M,Q,T,G)}if(J){J.setClean()}}}}else{if(L){if(D){Laserfiche.WebAccess.DocumentService.CloseEntries(O,false,null,0,null,null,B,E)}else{Laserfiche.WebAccess.DocumentService.CloseEntry(M,Q,B,E)}}if(top.docviewControl){top.docviewControl.Clear()}}if(K){K.reset()}},close:function(A){var B=this;if(A.charAt(0)=="D"||A.charAt(0)=="M"){this.unfocus(A,true)}else{this.removeTab(A)}},openDocument:function(D,B,H,G,L,J){var C=this;var F=D+":"+H;var A="D"+F;if(this._tabs[A]){this.SelectTab(A)}else{var I=B?B:"Loading...";var E=function(){C.addTab({id:A,name:I,closable:true});C.SelectTab(A,{page:G,annid:L,searchhandle:J})};var K=function(M){alert(M.get_message())};Laserfiche.WebAccess.DocumentService.OpenEntry(D,H,false,E,K)}},openMetadata:function(A,H){var E=this;var B=dojo.toJson(A);var G=B+":"+H;var C="M"+G;if(!this._tabs[C]){var I=dojo.string.substitute("${0} ${1}",["Metadata",(A.length>1)?"("+A.length+")":""]);var J=function(){E.addTab({id:C,name:I,closable:true});E.SelectTab(C)};var D=function(K){alert(K.get_message())};for(var F=0;F<A.length;F++){A[F]=A[F]+":"+H}Laserfiche.WebAccess.DocumentService.OpenEntries(A,false,J,D)}},openSearchResults:function(C){var A="S";if(!this._tabs[A]){var B="Search Results";this.addTab({id:A,name:B,closable:true})}this.SelectTab(A)},SelectTab:function(B,M){var E=this;if(E._curTab==B){return }var J=null;var F=E._tabs[B];var I=E._curTab&&E._curTab.charAt(0)=="S";if(this._tabs[E._curTab]&&(E._curTab.charAt(0)=="D"||E._curTab.charAt(0)=="M")){this.unfocus(E._curTab,false)}if(B=="Browser"){E._controller.UseBrowseMode();J=E._controller.layout.GetRegisteredControl("EntryBrowser")}else{if(B.charAt(0)=="D"){var K=B.substring(1);var D=K.indexOf(":");var C=parseInt(K.substring(0,D));var L=K.substring(D+1);var H=function(){var P=E._controller._context.openedDocument.name;F.nameDiv.innerHTML="";F.nameDiv.appendChild(document.createTextNode(P))};E._controller.selectCurrentDocument({id:C},H);E._controller.UsePagesMode();var O=1;if(M&&M.page){O=M.page}else{if(F.Page){O=F.Page}}E._controller.selectCurrentPage({pagenum:O,docid:C},"MainTabs");if(M&&M.page){E._controller.displaySearchResults(M)}else{if(!I){top.docviewControl._hitsControl.set_searchhandle(null)}}if(F.Scale){switch(F.Scale){case"W":top.docviewControl._pageviewControl.annControl.FitToWidth();break;case"H":top.docviewControl._pageviewControl.annControl.FitToHeight();break;case"P":top.docviewControl._pageviewControl.annControl.FitToPage();break;default:Laserfiche.ZoomMode.ZoomType=Laserfiche.ZoomTypes.ZOOM_TYPE_USE_SCALE;top.docviewControl._pageviewControl.annControl.set_scale(F.Scale);break}}else{top.docviewControl._pageviewControl.annControl.FitToWidth()}if(F.Search){top.docviewControl._hitsControl.set_searchhandle(F.Search)}if(F.Position){top.docviewControl._pageviewControl.annControl.set_offset(F.Position.x,F.Position.y)}else{top.docviewControl._pageviewControl.annControl.set_offset(0,0)}}else{if(B.charAt(0)=="M"){E._controller.UseMetadataMode();var K=B.substring(1);var N=K.split(":");var A=dojo.fromJson(N[0]);var L=N[1];var H=function(){var P=E._controller._context.openedDocument.name;F.nameDiv.innerHTML="";F.nameDiv.appendChild(document.createTextNode(P))};E._controller._context.setOpenedDocument({id:A.join(","),name:"Metadata",flags:0,path:""},function(){});E._controller.openEntryMetadata({ids:A,repository:L},"MainTabs",H)}else{if(B.charAt(0)=="S"){var K=B.substring(1);var D=B.indexOf(":");var C=B.substring(0,D);var L=B.substring(D+1);E._controller.UseSearchMode();J=E._controller.layout.GetRegisteredControl("SearchResults")}}}}var G=E._curTab;if(G&&E._tabs[G]){dojo.removeClass(E._tabs[G].div,"TabSelected")}E._curTab=B;dojo.addClass(F.div,"TabSelected");if(F.div.style.display=="none"){this.moveTab(this._curTab,1)}E._controller.recordState();if(J){E._controller.setFocusControl(J)}},RenameTab:function(C,A){if(C&&A&&this._tabs[C]){var B=this._tabs[C];B.name=A;B.nameDiv.innerHTML="";B.nameDiv.appendChild(document.createTextNode(A))}},GetOnEntryRenamed:function(){var A=this;return function(E){if(E&&E.args&&E.args.args){var G=E.args.args.id;var D=E.args.args.repository;var B=dojo.string.substitute("^${0}${1}:${2}$",["[A-Za-z]",G,"\\w*"]);var F=new RegExp(B,"gi");for(var C in A._tabs){if(F.test(C)){A.RenameTab(C,E.args.newName)}}}}}};if(!top.LF){top.LF={}}LF.MainCommandBarDefs={};LF.MainCommandBarDefs.InitializeBrowseBar=function(A,C){A.Clear();var E=C.CurrentLoginInfo;var F=new Array();F.push({title:"New &Folder",id:C.Actions.NEWFOL_ID,iconClass:"NewFolIcon",hyperKey:"F"});F.push({title:"New Short&cut",id:C.Actions.NEWSHORT_ID,iconClass:"ShortcutIcon",hyperKey:"C"});F.push({title:"&New Document",id:C.Actions.NEWDOC_ID,iconClass:"NewDocIcon",hyperKey:"N"});F.push(null);F.push({title:"&Rename",id:C.Actions.RENAME_ID,iconClass:"RenameIcon",hyperKey:"R"});if(E.Delete){F.push({title:"&Delete",id:C.Actions.DELETE_ID,iconClass:"DeleteIcon",hyperKey:"D"})}F.push(null);if(E.Import){F.push({title:"&Import...",id:C.Actions.IMPORT_ID,iconClass:"ImportIcon",hyperKey:"I"})}if(E.Scan){F.push({title:"&Scan...",id:C.Actions.SCAN_ID,iconClass:"ScanIcon",hyperKey:"S"})}if(E.Print){F.push({title:"Print List Con&tents",id:C.Actions.PRINT_FOLDER_ID,iconClass:"PrintContentsIcon",hyperKey:"t"})}if(E.Export&&E.Mapi){F.push({title:"Send &E-mail",id:C.Actions.EMAIL_ID,iconClass:"EmailIcon",hyperKey:"E"})}if(E.Import||E.Scan||E.Print||(E.Export&&E.Mapi)){F.push(null)}F.push({title:"Fi&elds...",id:C.Actions.FIELDS_ID,iconClass:"FieldsIcon",hyperKey:"E"});F.push({title:"&Access Rights...",id:C.Actions.ACCESS_ID,iconClass:"EntryAccessIcon",hyperKey:"A"});F.push({title:"&Properties",id:C.Actions.PROPS_ID,iconClass:"PropsIcon",hyperKey:"P"});A.AddButton("&File",null,true,null,F,"F");if(E.Export){A.AddButton("Exp&ort",null,true,null,new Array({title:"&PDF...",id:C.Actions.EXPORTPDF_ID,iconClass:"PDFIcon",hyperKey:"P"},{title:"&Images...",id:C.Actions.EXPORTIMAGE_ID,iconClass:"ImageIcon",hyperKey:"I"},{title:"&Text...",id:C.Actions.EXPORTTEXT_ID,iconClass:"TextIcon",hyperKey:"T"},{title:"&Electronic File...",id:C.Actions.EXPORTEFILE_ID,iconClass:"EfileIcon",hyperKey:"E"},{title:"&Briefcase...",id:C.Actions.EXPORTBRIEF_ID,iconClass:"BriefcaseIcon",hyperKey:"B"},{title:"&List Contents...",id:C.Actions.EXPORT_LISTING_ID,iconClass:"ListContentsIcon",hyperKey:"L"},{title:"&Search Results",id:C.Actions.EXPORTBRIEF_LISTING_ID,iconClass:null,hyperKey:"S"}),"O")}var D=new Array();if(E.Move){D.push({title:"Cu&t",id:C.Actions.CUT_ID,iconClass:"CutIcon",hyperKey:"T"})}D.push({title:"&Copy",id:C.Actions.COPY_ID,iconClass:"CopyIcon",hyperKey:"C"});D.push({title:"&Paste",id:C.Actions.PASTE_ID,iconClass:"PasteIcon",hyperKey:"P"});D.push({title:"Paste &Shortcut",id:C.Actions.PASTESHORT_ID,iconClass:"PasteShortIcon",hyperKey:"S"});D.push({title:"Paste Folders Onl&y",id:C.Actions.PASTE_FOLDERS_ONLY_ID,iconClass:"",hyperKey:"Y"});if(E.Move){D.push(null);D.push({title:"&Move to Folder",id:C.Actions.MOVE_ID,iconClass:"MoveIcon",hyperKey:"M"})}A.AddButton("&Edit",null,true,null,D,"E");var B=new Array();if(E.Migrate){B.push({title:"&Migrate Entries",id:C.Actions.MIGRATE_ID,iconClass:"MigrateIcon",hyperKey:"M"})}if(E.Process){B.push({title:"Extract &Text",id:C.Actions.MAKETEXT_ID,iconClass:"MakeTextIcon",hyperKey:"T"})}if(E.Delete){B.push({title:"&Delete Electronic File(s)",id:C.Actions.DELETEELEC_ID,iconClass:"DeleteEfileIcon",hyperKey:"D"})}if(E.Delete){B.push({title:"&Replace Electronic File",id:C.Actions.REPLACEELEC_ID,iconClass:"ReplaceEfileIcon",hyperKey:"R"})}if(B.length>0){B.push(null)}B.push({title:"Check &Out",id:C.Actions.CHECKOUT_ID,iconClass:"CheckOutIcon",hyperKey:"O"});B.push({title:"Check &In",id:C.Actions.CHECKIN_ID,iconClass:"CheckInIcon",hyperKey:"I"});B.push({title:"&Undo Check Out",id:C.Actions.UNDOCHECKOUT_ID,iconClass:"UndoCOIcon",hyperKey:"U"});B.push({title:"Ch&eck Out Details",id:C.Actions.CHECKOUTDETAILS_ID,iconClass:"CODetailsIcon",hyperKey:"E"});B.push(null);B.push({title:"C&hecked Out Documents",id:C.Actions.CHECKEDOUTDOCS_ID,iconClass:"CODocsIcon",hyperKey:"H"});A.AddButton("Tas&ks",null,true,null,B,"K")};LF.MainCommandBarDefs.InitializeDocumentBar=function(B,C){B.Clear();var G=C.CurrentLoginInfo;var D=new Array();D.push({title:"&Save",id:C.Actions.SAVE_ID,iconClass:"SaveIcon",hyperKey:"S"});D.push(null);if(G.Scan){D.push({title:"S&can Page(s)...",id:C.Actions.SCAN_ID,iconClass:"ScanIcon",hyperKey:"C"})}if(G.Export&&G.Mapi){D.push({title:"Send &E-mail",id:C.Actions.EMAIL_ID,iconClass:"EmailIcon",hyperKey:"E"})}if(G.Scan||G.Import||(G.Export&&G.Mapi)){D.push(null)}if(G.Delete){D.push({title:"&Delete Electronic File",id:C.Actions.DELETEELEC_ID,iconClass:"DeleteEfileIcon",hyperKey:"D"});D.push({title:"&Replace Electronic File",id:C.Actions.REPLACEELEC_ID,iconClass:"ReplaceEfileIcon",hyperKey:"R"});D.push(null)}D.push({title:"&Properties",id:C.Actions.PROPS_ID,iconClass:"PropsIcon",hyperKey:"P"});B.AddButton("&File",null,true,null,D,"F");if(G.Export){B.AddButton("Exp&ort",null,true,null,new Array({title:"&PDF...",id:C.Actions.EXPORTPDF_ID,iconClass:"PDFIcon",hyperKey:"P"},{title:"&Images...",id:C.Actions.EXPORTIMAGE_ID,iconClass:"ImageIcon",hyperKey:"I"},{title:"&Text...",id:C.Actions.EXPORTTEXT_ID,iconClass:"TextIcon",hyperKey:"T"},{title:"&Electronic File...",id:C.Actions.EXPORTEFILE_ID,iconClass:"EfileIcon",hyperKey:"E"}),"O")}var E=new Array();if(G.Move){E.push({title:"Cu&t Page",id:C.Actions.CUT_ID,iconClass:"CutIcon",hyperKey:"T"})}E.push({title:"&Copy Page",id:C.Actions.COPY_ID,iconClass:"CopyIcon",hyperKey:"C"});E.push({title:"&Paste Page",id:C.Actions.PASTE_ID,iconClass:"PasteIcon",hyperKey:"P"});if(G.Move){E.push(null);E.push({title:"&Move Page to Folder",id:C.Actions.MOVE_ID,iconClass:"MoveIcon",hyperKey:"M"})}B.AddButton("&Edit",null,true,null,E,"E");var H=new Array();H.push({title:"Rotate &Right",id:C.Actions.ROTATE_ID,iconClass:"RotateIcon",hyperKey:"R"});H.push({title:"Rotate &Left",id:C.Actions.ROTATECCW_ID,iconClass:"RotateCCWIcon",hyperKey:"L"});H.push(null);H.push({title:"&Previous Page",id:C.Actions.PREVPAGE_ID,iconClass:"PrevPageIcon",hyperKey:"P"});H.push({title:"&Next Page",id:C.Actions.NEXTPAGE_ID,iconClass:"NextPageIcon",hyperKey:"N"});H.push({title:"&First Page",id:C.Actions.FIRSTPAGE_ID,iconClass:"FirstPageIcon",hyperKey:"F"});H.push({title:"L&ast Page",id:C.Actions.LASTPAGE_ID,iconClass:"LastPageIcon",hyperKey:"A"});H.push(null);H.push({title:"Zoom &In",id:C.Actions.ZOOMIN_ID,iconClass:"ZoomInIcon",hyperKey:"I"});H.push({title:"Zoom &Out",id:C.Actions.ZOOMOUT_ID,iconClass:"ZoomOutIcon",hyperKey:"O"});H.push({title:"Fit to &Window",id:C.Actions.FITWINDOW_ID,iconClass:"FitWindowIcon",hyperKey:"W"});H.push({title:"Fit to Wi&dth",id:C.Actions.FITWIDTH_ID,iconClass:"FitWidthIcon",hyperKey:"D"});H.push({title:"Fit to &Height",id:C.Actions.FITHEIGHT_ID,iconClass:"FitHeightIcon",hyperKey:"H"});B.AddButton("Vie&w",null,true,null,H,"W");var F=new Array();F.push({title:"&Pan Tool",id:C.Actions.PAN_ID,iconClass:"PanIcon",hyperKey:"P"});F.push({title:"&Zoom Tool",id:C.Actions.ZOOM_ID,iconClass:"ZoomIcon",hyperKey:"Z"});F.push({title:"S&election Tool",id:C.Actions.SELECTION_ID,iconClass:"SelectionIcon",hyperKey:"E"});var A=C._lastSecParams;if(!A||A.Rights.indexOf("Ann")!=-1&&!A.VolReadOnly){F.push(null);F.push({title:"&Highlight",id:C.Actions.HIGHLIGHT_ID,iconClass:"HighlightIcon",hyperKey:"H"});F.push({title:"&Redaction",id:C.Actions.REDACTION_ID,iconClass:"RedactionIcon",hyperKey:"R"});F.push({title:"&Underline",id:C.Actions.UNDERLINE_ID,iconClass:"UnderlineIcon",hyperKey:"U"});F.push({title:"&Strikethrough",id:C.Actions.STRIKETHROUGH_ID,iconClass:"StrikeoutIcon",hyperKey:"S"});F.push(null);F.push({title:"&Edit Text",id:C.Actions.EDIT_TEXT_ID,iconClass:"",hyperKey:"E"});F.push({title:"&Discard Text Changes",id:C.Actions.DISCARD_TEXT_ID,iconClass:"",hyperKey:"D"});F.push(null);F.push({title:"Stick&y Note",id:C.Actions.STICKYNOTE_ID,iconClass:"StickyNoteIcon",hyperKey:"Y"});F.push({title:"Sta&mp",id:C.Actions.STAMP_ID,iconClass:"StampIcon",hyperKey:"M"});F.push({title:"Rectan&gle",id:C.Actions.RECTANGLE_ID,iconClass:"RectangleIcon",hyperKey:"G"});F.push({title:"&Text Box",id:C.Actions.TEXTBOX_ID,iconClass:"TextAnnIcon",hyperKey:"T"});F.push({title:"&Callout Text",id:C.Actions.CALLOUT_ID,iconClass:"CalloutIcon",hyperKey:"C"});F.push({title:"&Line",id:C.Actions.LINE_ID,iconClass:"LineIcon",hyperKey:"L"});F.push({title:"&Freehand",id:C.Actions.FREEHAND_ID,iconClass:"FreehandIcon",hyperKey:"F"});F.push({title:"&Image",id:C.Actions.IMAGEANN_ID,iconClass:"ImageAnnIcon",hyperKey:"I"});F.push({title:"Attachme&nt",id:C.Actions.ATTACHMENTANN_ID,iconClass:"AttachmentIcon",hyperKey:"N"})}B.AddButton("&Tools",null,true,null,F,"T")};LF.MainCommandBarDefs.InitializeMetadataBar=function(A,B){A.Clear();var C=B.CurrentLoginInfo;A.AddButton("Revert","RevertIcon",true,B.Actions.REVERTMETADATA_ID,null);A.AddButton("Save","SaveIcon",true,B.Actions.SAVEMETADATA_ID,null)};top.HIT_TYPE_DOC=1;top.HIT_TYPE_STICKY=2;top.HIT_TYPE_CALLOUT=3;top.HIT_TYPE_TEXTBOX=4;if(!top.LF){top.LF={}}LF.ContextHitGrid=function(D,B,C,A){this._id=D;this._entryId=null;this._repoName=null;this._search=null;this._container=B;this._container.style.display="block";this.iconPath=C;this._callbackFunc=A;this._active=false;this._layout=[{cells:[[{name:"Page Number",width:"100px",field:0,formatter:this.getNameFormatter()},{name:"Context",width:"80%",field:1}]]}];this.listener=new LF.Listener(D+"_listener");this.listener.setHandler("SearchHandleChanged",this.GetOnSearchHandleChanged());this.listener.setHandler("SelectedEntryChanged",this.GetOnSelectedEntryChanged());this.listener.turnOff()};LF.ContextHitGrid.prototype={activate:function(){this._active=true;this.listener.turnOn()},deactivate:function(){this._active=false;this.listener.turnOff()},get_DOMelement:function(){return this._container},resize:function(B,A){if(this._active){this.set_dimensions(A,B)}},set_entry:function(A,B){if(A==this._entryId&&(!B||B==this._repoName)){return }this._entryId=A;if(B){this._repoName=B;if(this._controller){this._controller.set_repository(B)}}if(this._model){this._model.dbname=this._repoName;this._model.set_id(A);if(this._searchhandle){this._model.requestRows()}else{this._model.clearData()}}},get_searchhandle:function(){return this._model.searchhandle},set_searchhandle:function(A){this._searchhandle=A;this._model.set_searchhandle(A);if(this._entryId){this._model.requestRows()}else{this._model.clearData()}},set_controller:function(A){this._controller=A;A.subscribe("SearchHandleChanged",this.listener,true);A.subscribe("SelectedEntryChanged",this.listener,true)},set_dimensions:function(A,B){this._container.style.height=parseInt(A)+"px";this._container.style.width=parseInt(B)+"px";dojo.byId(this._id).style.height=parseInt(A)+"px";dojo.byId(this._id).style.width=parseInt(B)+"px";this._djGrid.sizeChange()},GetOnRowDblClick:function(){var A=this;return function(B){var C=B.grid.model.getRow(B.rowIndex);if(A.ondblclick){A.ondblclick(B,C)}}},ondblclick:function(D,E){var A=this;var B=E[2];if(A._controller){var C=E[0];var F=E[3];A._controller.openDocument({id:A._entryId,repositoryName:A._repoName,page:C,annid:F,searchhandle:A.get_searchhandle()})}},modelChange:function(){if(this.onRowCountChanged){this.onRowCountChanged(this.get_rowCount())}},get_rowCount:function(){return this._model.getRowCount()},getNameFormatter:function(){var A=this;return function(E,H){var G=this.grid.model.getRow(H);if(!G){return"Loading..."}var F=this.grid.model.requiredColumnIndices;var D=G[2]+1;var C="";switch(D){case top.HIT_TYPE_DOC:C='<img src="'+A.iconPath+'hit.gif">';break;case top.HIT_TYPE_STICKY:C='<img src="'+A.iconPath+'sn.gif">';break;case top.HIT_TYPE_CALLOUT:C='<img src="'+A.iconPath+'callout.gif">';break;case top.HIT_TYPE_TEXTBOX:C='<img src="'+A.iconPath+'text.gif">';break}var B="<div class='EntryName'>"+C+" "+E+"</div>";return B}},initialize:function(A,B){this._entryId=A;this._repoName=B;this._model=new LF.ContextHitModel(null,null);this._model.set_callback(this._callbackFunc);this._model.dbname=B;this._model.id=A;this._model.observer(this);this._model.setRowCount(0);this._model.clear();this._djGrid=new dojox.Grid({"id":this._id,"model":this._model,"structure":this._layout});this._djGrid.onCellClick=function(C){this.onRowClick(C)};dojo.connect(this._djGrid,"onRowDblClick",this.GetOnRowDblClick());this._container.appendChild(this._djGrid.domNode);this._djGrid.render()},RunSearch:function(A){if(this.onreceive){this._model.onreceive=this.onreceive}this._searchhandle=null;this._model.set_searchhandle(null);this._search=A;this._model.search=A;this._model.requestRows()},GetOnSearchHandleChanged:function(){var A=this;return function(B){A._entryId=null;A.set_searchhandle(B.args.searchhandle)}},GetOnSelectedEntryChanged:function(){var A=this;return function(C){if(C.args.getSelectedItems){var B=C.args.getSelectedItems();if(B&&B.items&&B.items.length){var D=B.items[0];A.set_entry(D.id,C.args.repository)}}}}};dojo.require("dojox.grid.Grid");dojo.require("dojox.grid._data.model");dojo.require("dojo.parser");dojo.declare("LF.ContextHitModel",dojox.grid.data.Dynamic,{constructor:function(){this.rowsPerPage=100;this.fieldNames=[]},set_callback:function(A){this._callback=A},set_dbname:function(A){this.listingid=-1;this.dbname=A},set_id:function(A){this.listingid=-1;this.id=A;this.parentid=A},set_searchhandle:function(A){this.search=null;this.searchhandle=A},clearData:function(){dojox.grid.data.Dynamic.prototype.clearData.apply(this,arguments)},fillParams:function(A){A=A||{};A.dbname=this.dbname;A.id=this.id;A.search=this.search;A.count=this.rowsPerPage;if(this.searchhandle){A.searchhandle=this.searchhandle}},send:function(A,D,F,B){this.fillParams(D);var E=Sys.Serialization.JavaScriptSerializer.serialize(D);var C=F;top.KillPendingCallbacks("CH");this._callback(E,F,{callee:"CH"},B);this.onSend(D)},receive:function(C){var B=this;if(this.onreceive){this.onreceive()}var A=C;try{A=Sys.Serialization.JavaScriptSerializer.deserialize(C);if(A.IsException){B.handleError(A.Message);return }this.processRows(A);if(this.onReceive){this.onReceive(A)}}catch(D){if(this.onError){this.onError(A)}}},handleError:function(A){if(A!="SESSION_TIMEOUT"){alert(A)}if(this.onError){this.onError(A)}},error:function(B,C,A){if(!A){this.handleError(B)}},fetchRowCount:function(A){this.send(true,A)},requestRows:function(D,B){if(!this.search&&!this.searchhandle){return }var A=this;D=(D==undefined?0:D);var C={start:D+1};this.send(true,C,function(E){A.receive(E)},function(F,G,E){A.error(F,G,E)})},processRows:function(D){var F=D.start;var B=D.total;var E=D.count;this.searchhandle=D.searchhandle;for(var A=0;A<E;A++){var C=D.result[A];this.setRow([C.pagenum,C.context,C.type,C.annotid,C.hitdata],F-1+A)}if(this.count!=B){this.setRowCount(B);this.allChange();this.onInitializeData(D)}},getDatum:function(C,A){var B=this.getRow(C);if(A==undefined){return B}return(B?B[A]:"&nbsp;")},getPageIdByRowIndex:function(B){var A=this.getRow(B);return A[0]},onInitializeData:function(){},onSend:function(){},onReceive:function(){}});if(!top.LF){top.LF={}}LF.ImmediateSearchControl=function(B,A){var C=this;this._container=B;this._controller=A;this.SearchText=true;this.SearchNames=true;this.SearchFields=true;this.SearchAnnotations=true;this._input=document.createElement("input");this._phinput=new Laserfiche.Layout.PlaceholderInput("Search repository...",this._input);this._searchbutton=document.createElement("div");this._searchbutton.innerHTML="&nbsp;";this._searchbutton.className="SearchButton";this._searchbutton.onmouseover=function(){dojo.addClass(this,"SearchButtonOver")};this._searchbutton.onmouseout=function(){dojo.removeClass(this,"SearchButtonOver")};this._searchbutton.onclick=this.GetOnClick();this._optionsbutton=document.createElement("div");this._optionsbutton.tabIndex="0";this._optionsbutton.innerHTML="&nbsp;";this._optionsbutton.className="OptionsButton";this._optionsbutton.onmouseover=function(){dojo.addClass(this,"OptionsButtonOver")};this._optionsbutton.onmouseout=function(){dojo.removeClass(this,"OptionsButtonOver")};this._input.onkeydown=this.GetOnKeyEvent();this._input.onkeyup=this.GetOnKeyEvent();this._expandbuttonDiv=document.createElement("div");this._expandbuttonDiv.innerHTML="&nbsp;";this._expandbuttonDiv.className="ExpandButton";this._expandbuttonDiv.onclick=function(){C.ToggleSearchPanel()};var D=document.createElement("div");D.className="OptionsMenu";this._optionsMenuDiv=D;this._container.appendChild(this._input);this._container.appendChild(this._searchbutton);this._container.appendChild(this._optionsbutton);this._container.appendChild(this._expandbuttonDiv);this._container.appendChild(this._optionsMenuDiv);if(!A.CurrentLoginInfo.Search){this._container.style.display="none"}this.initializeOptionsMenu()};LF.ImmediateSearchControl.prototype={set_searchPanel:function(A){this._searchPanel=A;A.set_searchControl(this);this.HideSearchPanel()},ShowThrobber:function(){dojo.removeClass(this._searchbutton,"SearchButton");dojo.addClass(this._searchbutton,"SearchButtonInProgress")},HideThrobber:function(){dojo.removeClass(this._searchbutton,"SearchButtonInProgress");dojo.addClass(this._searchbutton,"SearchButton")},HideSearchPanel:function(){this._searchPanel.Hide();dojo.removeClass(this._expandbuttonDiv,"ExpandButtonDown");this._expandbuttonDiv.title="Show Search Options"},ShowSearchPanel:function(){this._searchPanel.Show();dojo.addClass(this._expandbuttonDiv,"ExpandButtonDown");this._expandbuttonDiv.title="Hide Search Options"},ToggleSearchPanel:function(){if(this._searchPanel){if(this._searchPanel.IsOpen()){this.HideSearchPanel()}else{this.ShowSearchPanel()}}},GetOnClick:function(){var A=this;return function(){var B=A.GetSearchString();A._searchPanel._queryInput.value=B;if(B.length==0){alert("No valid search criteria have been specified.")}else{A._controller.RunSearch(B,true)}}},GetSearchString:function(){var G=this._controller.Settings.PartialMatches==true;var C="";var F=this._phinput.get_value();var A=new Array();var D="";var E="";if(G){D="*";E="*"}if(F){if(this.SearchText){A.push('"'+F+'"')}if(this.SearchNames){A.push('{LF:name="'+D+F+E+'", Type="DBF"}')}if(this.SearchFields){A.push('{[]:[]="'+D+F+E+'"}');if(G){A.push('{[]:[]="'+F+'"}')}}if(this.SearchAnnotations){A.push('{LF:sticky="'+D+F+E+'"}');A.push('{LF:callout="'+D+F+E+'"}');A.push('{LF:textbox="'+D+F+E+'"}')}C="("+A.join(" | ")+")"}if(this._searchPanel&&this._searchPanel.IsOpen()){var B=this._searchPanel.getSearchString();if(B&&B.length>0){if(C.length>0){C+="&"}C+=B}}return C},GetCurrentAttributes:function(){var A=new Array();for(attid in this._searchPanel.Attributes){A.push(attid)}return{Show:A,Menu:this._searchPanel._menuItems}},ProcessAttributeSelection:function(A){this._searchPanel.setAttributes(A.Show);this._searchPanel.setMenu(A.Menu)},initializeOptionsMenu:function(){if(this._optionsMenu){this._optionsMenu.DeleteMenu()}var B=new Array();B.push({title:"Saved Searches",id:98,menu:new Array({title:"Manage Saved Searches...",id:"ManageSaved"})});B.push(null);B.push({title:"Search Text",id:"Text",iconClass:"SelectableIcon"});B.push({title:"Search Entry Names",id:"Names",iconClass:"SelectableIcon"});B.push({title:"Search Fields",id:"Fields",iconClass:"SelectableIcon"});B.push({title:"Search Annotations",id:"Annotations",iconClass:"SelectableIcon"});B.push(null);B.push({title:"Search Options...",id:"Settings"});this._optionsMenu=top.SimpleMenu.CreateMenu(B,this._optionsMenuDiv,this._optionsbutton,false,false,true);var A=this;A.RetrieveDefaultSearch();this._optionsbutton.onmousedown=function(){A._optionsMenu.Toggle()};this._optionsbutton.onblur=function(){A._optionsMenu.Hide();A.SaveCurrentSearch()};this._optionsbutton.onkeydown=function(D){if(!D){D=window.event}if(!A._optionsMenu.IsOpen()){var C=(D.keyCode)?D.keyCode:((D.charCode)?D.charCode:D.key);if(C==ENTER_KEY_CODE){A._optionsMenu.Show()}}else{A._optionsMenu.GetOnKeyDown()(D)}};this._optionsMenu.onshow=function(){A.LoadSavedSearchesMenu()};this._optionsMenu.onselect=function(){var C=A._optionsMenu.value;var D=false;if((C+"").charAt(0)=="s"){A.OpenSavedSearch(C.substring(1))}else{switch(C){case"Text":A.SearchText=!A.SearchText;D=true;break;case"Names":A.SearchNames=!A.SearchNames;D=true;break;case"Fields":A.SearchFields=!A.SearchFields;D=true;break;case"Annotations":A.SearchAnnotations=!A.SearchAnnotations;D=true;break;case"Settings":LF.Actions.Settings(A._controller._context,"SearchOptionsSection");break;case"SAVE":A.LaunchSaveDialog();break;case"ManageSaved":A.LaunchManageSavedDialog();break}}if(D){if(A._optionsMenu.HasClass(C,"SelectedItem")){A._optionsMenu.UnsetItemClass(C,"SelectedItem")}else{A._optionsMenu.SetItemClass(C,"SelectedItem")}top.IgnoreNextBlur(A._optionsMenu._focusDiv)}else{A._optionsMenu.Hide()}}},LaunchManageSavedDialog:function(){var B=this;var D="Dialogs/ModifySearch.aspx";var E={r:this._controller._context.repository};var C=String.format("{0}?{1}",D,dojo.objectToQuery(E));var A=top.getAvailableDlg();A.OpenDialog(C,290,370,false);A.onclose=function(F){if(F==null){return false}B._optionsMenu.onshow()}},LaunchSaveDialog:function(){var B=this;var D="Dialogs/SaveSearch.aspx";var E={r:this._controller._context.repository};var C=String.format("{0}?{1}",D,dojo.objectToQuery(E));var A=top.getAvailableDlg();A.OpenDialog(C,285,345,false);A.onclose=function(F){if(F==null){return false}B.SaveCurrentSearch(F.name);B._optionsMenu.onshow()}},RetrieveDefaultSearch:function(){Laserfiche.WebAccess.SearchService.GetSearch(this._controller._context.repository,"",this.GetDefaultSearchLoaded(),function(){})},GetDefaultSearchLoaded:function(){var A=this;return function(B){var C=A._optionsMenu;A._phinput.set_value(B.BasicString);A.SearchText=(B.SearchText=="1");A.SearchNames=(B.SearchNames=="1");A.SearchFields=(B.SearchFields=="1");A.SearchAnnotations=(B.SearchAnnotations=="1");if(A.SearchText){C.SetItemClass("Text","SelectedItem")}else{C.UnsetItemClass("Text","SelectedItem")}if(A.SearchNames){C.SetItemClass("Names","SelectedItem")}else{C.UnsetItemClass("Names","SelectedItem")}if(A.SearchFields){C.SetItemClass("Fields","SelectedItem")}else{C.UnsetItemClass("Fields","SelectedItem")}if(A.SearchAnnotations){C.SetItemClass("Annotations","SelectedItem")}else{C.UnsetItemClass("Annotations","SelectedItem")}}},OpenSavedSearch:function(A){Laserfiche.WebAccess.SearchService.GetSearch(this._controller._context.repository,A,this.GetOnOpenSearchLoaded(),this.GetOnOpenSearchError())},GetOnOpenSearchLoaded:function(){var A=this;return function(B){A._phinput.set_value(B.BasicString);A.SearchText=(B.SearchText=="1");A.SearchNames=(B.SearchNames=="1");A.SearchFields=(B.SearchFields=="1");A.SearchAnnotations=(B.SearchAnnotations=="1");var C=A._optionsMenu;if(A.SearchText){C.SetItemClass("Text","SelectedItem")}else{C.UnsetItemClass("Text","SelectedItem")}if(A.SearchNames){C.SetItemClass("Names","SelectedItem")}else{C.UnsetItemClass("Names","SelectedItem")}if(A.SearchFields){C.SetItemClass("Fields","SelectedItem")}else{C.UnsetItemClass("Fields","SelectedItem")}if(A.SearchAnnotations){C.SetItemClass("Annotations","SelectedItem")}else{C.UnsetItemClass("Annotations","SelectedItem")}A.ShowSearchPanel();A._searchPanel.LoadFromSearchInfo(B)}},GetOnOpenSearchError:function(){var A=this;return function(B){alert(B.get_message())}},SaveCurrentSearch:function(B){var A=this._searchPanel.GetCurrentSearchAttributes();var C={Name:B,BasicString:this._phinput.get_value(),SearchText:this.SearchText?"1":"0",SearchNames:this.SearchNames?"1":"0",SearchFields:this.SearchFields?"1":"0",SearchAnnotations:this.SearchAnnotations?"1":"0",Attributes:A};Laserfiche.WebAccess.SearchService.SaveSearch(this._controller._context.repository,C,true,this.GetSaveSearchSucces(),this.GetSaveSearchError())},GetSaveSearchSucces:function(){var A=this;return function(B){}},GetSaveSearchError:function(){var A=this;return function(B){alert(B.get_message())}},LoadSavedSearchesMenu:function(){Laserfiche.WebAccess.SearchService.GetSavedSearches(this._controller._context.repository,this.GetOnSavedSearchesLoaded(),this.GetOnSavedSearchesError())},GetOnSavedSearchesLoaded:function(){var A=this;return function(F){var B=new Array();for(var E=0;E<F.length;E++){var D=F[E];B.push({title:D,id:"s"+D})}B.push(null);B.push({title:"Save Current Search",id:"SAVE"});B.push({title:"Manage Saved Searches...",id:"ManageSaved"});var C=A._optionsMenu.GetSubmenuByID(98);C.SetItems(B)}},GetOnSavedSearchesError:function(){return function(A){alert(A.get_message())}},GetOnKeyEvent:function(){var A=this;return function(B){if(!B){B=window.event}var C=dojo.keys;if(B.keyCode==C.SHIFT){if(B.type=="keydown"){A.shiftHeld=true}else{A.shiftHeld=false}return false}if(B.type=="keyup"){return false}switch(B.keyCode){case C.DOWN_ARROW:A._optionsMenu.Toggle();return false;break;case C.TAB:top.myAppController.TabToNextMainCtrl(top.searchControl,!A.shiftHeld);A.shiftHeld=false;B.cancelBubble=true;B.returnValue=false;return false;break;case C.ENTER:A.GetOnClick()();B.cancelBubble=true;B.returnValue=false;return false;break}}},setCtrlFocus:function(){top.searchControl._input.focus()}};dojo.declare("LF.SearchResultGrid",LF.EntryListingGrid,{constructor:function(){},refresh:function(){if(this._repoName&&this._controller){this._controller.set_repository(this._repoName)}if(this._model&&this._repoName&&this._search){if(this._model.count>100){this._model.setRowCount(0);this._model.clear()}this._model.dateFormat=this._controller.DateFormat;this._model.dbname=this._repoName;this._model.set_search(this._search);this._model.clearData();this._model.requestRows()}},get_hitCount:function(){return this._model.hitcount},set_search:function(A,D,C,B){this._model._imageenable=!!B;this._search=A;if(D){this._repoName=D;if(this._controller){this._controller.set_repository(D)}}if(this._model){this._model.dateFormat=this._controller.DateFormat;this._model.dbname=this._repoName;this._model.set_search(A);this._model.clearData();this._model.requestRows()}this._djGrid.selection.unselectAll()},set_controller:function(A){var B=this;this._controller=A;this.listener.setHandler("SearchSelected",this.GetOnSearchSelected());A.subscribe("EntryRenamed",this.listener,true);A.subscribe("SearchSelected",this.listener,true);this.onFolderDblClick=function(H,D,E){if(B._controller){var G=this;function F(I){var J=I;if(J&&J.length){if(J[0].id==1){B._controller.setFocusControl(B);B._controller.selectCurrentFolder({id:H,repositoryName:D})}else{top.window.open("index.aspx?db="+D+"#id="+H+";view=newroot")}}}function C(I){}Laserfiche.WebAccess.BreadCrumbService.GetPathNodesToRoot(D,H,F,C)}};this.onDocumentDblClick=function(E,C,D){if(B._controller){B._controller.openEntry(E,C)}};this.dndController=new LF.EntryListingGrid.dndSource(this,{})},initialize:function(C,D){var B=this;this._isSearchListing=true;var A={name:"Name",width:"200px",field:0};if(this._allowRename){A.editor=dojox.grid.editors.Input}this._layout=[{cells:[[A]]}];this._search=C;this._repoName=D;this._model=new LF.SearchResultModel(null,null);this._model.dbname=D;this._model.search=C;this._onStartFunc=null;this._initializeGrid()},SetOnSelectSearchFunc:function(A){this._onStartFunc=A},SetOnReceiveFunc:function(A){if(this._model){this._model.onReceive=A}},onDisplayLoadingMsg:function(B){this._model.data=[];this._model.setRowCount(0);this._model.notify("Removal",null);var A=dojo.byId("SearchLoadingMsgDiv");if(!A){A=document.createElement("div");A.id="SearchLoadingMsgDiv";dojo.style(A,"display","none");dojo.style(A,"position","relative");dojo.style(A,"top","3px");dojo.style(A,"left","4px");var C=dojo.query(".dojoxGrid-scrollbox",this._djGrid.domNode)[0];C.appendChild(A)}else{}if(A){while(A.firstChild){A.removeChild(A.firstChild)}A.appendChild(document.createTextNode(B));dojo.style(A,"display","")}},onHideLoadingMsg:function(){var A=dojo.byId("SearchLoadingMsgDiv");if(A){dojo.style(A,"display","none");A.parentNode.removeChild(A)}},GetOnSearchSelected:function(){var A=this;return function(B){if(A._onStartFunc&&dojo.isFunction(A._onStartFunc)){A._onStartFunc()}A.set_search(B.args.search,B.args.repository,B.args.newsearch,B.args.imageenable||false)}},modelColumnChange:function(){var A=this;var E=this._model.requiredColumnIndices;var H=this._model.columnNames;var K=this._model.showContextHits&&E.hitCountIndex>0;var F={name:"Name",width:"200px",field:0,formatter:this.getNameFormatter()};if(this._allowRename){F.editor=dojox.grid.editors.Input}var B=new Array();for(var D=1;D<=H.length;D++){var J={name:H[D-1].replace(/ /g,"&nbsp;"),field:D,formatter:this.formatString};B.push(J)}var I={noscroll:true,cells:[[F]]};var G={cells:[B]};this._layout=[I,G];this._djGrid.setStructure(this._layout);var C=this._controller.layout.GetRegisteredControl("SearchView");if(C){C.SetHitVisibility(K)}},modelSearchHandleChange:function(){this._controller.set_currentSearchHandle(this._model.searchhandle)},onFocus:function(){this._controller.set_currentSearchHandle(this._model.searchhandle);this._controller.selectedEntryChanged(this)},GetOnRowContextMenu:function(){var A=this;return function(G){if(A&&A._contextmenu&&A._contextmenu.Hide){A._contextmenu.Hide()}if(!A._checkGrid(G.rowNode)){return false}if(!A._djGrid.selection.selected[G.rowIndex]){A._djGrid.onRowClick(G)}var D=true;if(A.onRowContextMenu){D=A.onRowContextMenu(G)}if(D&&A._controller){var J=G.grid.model.getRow(G.rowIndex);var C=J[0];var F=top.TYPE_SEARCH_GRID_ENTRY;var E=G.grid.model.requiredColumnIndices.elecSizeIndex;if(!!J[E]){F=top.TYPE_SEARCH_GRID_ENTRY_HAS_EDOC}var H=A._controller.getContextMenuItems(F);var B=top.SimpleMenu.CreateMenu(H,A._menuscontainer);var I=dojo.coords(A._menuscontainer);B.UpdateContextMenu(A._controller);A._contextmenu=B;B.Show(G.clientX-I.x,G.clientY-I.y);B.onselect=function(){A._controller.doAction(B.value);B.Hide()};B.onhide=function(){B.DeleteMenu();A._contextmenu=null}}dojo.stopEvent(G)}},GetOnHeaderContextMenu:function(){var A=this;return function(E){if(!A._checkGrid(E.rowNode)){return false}var B=true;if(A.onRowContextMenu){B=A.onRowContextMenu(E)}if(B&&A._controller&&top.myFolderTree.IsRepositoryConnected(A._repoName)){var C=A._controller.getContextMenuItems(top.TYPE_SEARCH_GRID_HEADER);A.sortColumn=E.cell;var D=top.SimpleMenu.CreateMenu(C,A._menuscontainer);var F=dojo.coords(A._menuscontainer);D.Show(E.clientX-F.x,E.clientY-F.y);D.onselect=function(){A._controller._context.setFocusControl(A);A._controller.doAction(D.value)};D.onhide=function(){D.DeleteMenu()}}}}});dojo.declare("LF.SearchResultModel",LF.EntryListingModel,{constructor:function(){this.page=[];this.pages=[];this.colorByVolume=false;this.disableEdocIcons=false;this.showContextHits=true},set_search:function(A){this.search=A;this.listingid=-1;this.searchhandle=null},fillParams:function(A){A=A||{};A.dbname=this.dbname;A.search=this.search;A.count=this.rowsPerPage;A.dateFormat=this.dateFormat;if(this.listingid){A.listingid=this.listingid}if(this.searchhandle){A.searchhandle=this.searchhandle}},processRows:function(D){var G=D.start;var C=D.total;var F=D.count;if(C>=1&&this._imageenable){if(dojo.exists("LF.Actions.CloseTab",top)){LF.Actions.CloseTab("S")}LF.Actions.OpenEntryById(this.dbname,{id:D.result[0][D.requiredColumnIndices.idIndex]-0});return }this.hitcount=D.hitcount;this.listingid=D.listingid;var A=this.searchhandle;this.searchhandle=D.searchhandle;var E=!(this.colorByVolume==D.ColorByVolume&&this.disableEdocIcons==D.DisableEdocIcons&&this.showContextHits==D.ShowContextHits);this.colorByVolume=D.ColorByVolume;this.disableEdocIcons=D.DisableEdocIcons;this.showContextHits=D.ShowContextHits;if(D.requiredColumnIndices){this.requiredColumnIndices=D.requiredColumnIndices;this.columnNames=D.columnNames;this.notify("ColumnChange")}else{if(E){this.notify("ColumnChange")}}for(var B=0;B<F;B++){this.setRow(D.result[B],G-1+B)}if(this.count!=C){this.setRowCount(C);this.allChange();this.onInitializeData(D)}if(A!=this.searchhandle){this.notify("SearchHandleChange")}}});if(!top.LF){top.LF={}}LF.SearchView=function(B,A){this._div=B;this._controller=A;this.initializeStructure(B,A);this._showHits=true;this._loaded=false;this._active=false};LF.SearchView.prototype={activate:function(){this._active=true;this._controller.layout.ActivateSlot("SearchResultsListing");this._controller.layout.ActivateSlot("SearchContextHits");if(this._width&&this._height){this.resize(this._width,this._height)}if(this.ContextHitsVisible()){var B=this._contextHitsContainer.domNode.offsetHeight;var A=this._contextHitsContainer.domNode.offsetWidth;if(B<5){this._contextHitsContainer.domNode.style.height="240px";B=240;this._mainContainer.layout()}B=Math.max(1,B);this._controller.layout.ResizeSlot("SearchContextHits",A,B)}},deactivate:function(){this._active=false;this._controller.layout.DeactivateSlot("SearchResultsListing");this._controller.layout.DeactivateSlot("SearchContextHits")},get_DOMelement:function(){return this._div},resize:function(B,A){this._width=B;this._height=A;if(!this._active){return }var C=Math.max(1,A);this._mainContainer.resize({w:B,h:C});this._mainContainer.layout()},ShowHits:function(){this.SetHitVisibility(true)},HideHits:function(){this.SetHitVisibility(true)},SetHitVisibility:function(A){if(!!A==!!this._showHits){return }if(A){this._contextHitsContainer.domNode.style.display="";this._mainContainer._splitters.bottom.style.display="";this._controller.layout.ActivateSlot("SearchContextHits")}else{this._contextHitsContainer.domNode.style.display="none";this._mainContainer._splitters.bottom.style.display="none";this._controller.layout.DeactivateSlot("SearchContextHits")}this._showHits=!!A;this._mainContainer.layout()},ContextHitsVisible:function(){return this._showHits},initializeStructure:function(A,F){var D=this;A.style.position="relative";var E=document.createElement("div");var C=new dijit.layout.BorderContainer({},E);C.startup();E.style.position="absolute";E.style.top="0px";E.style.left="0px";this._mainContainer=C;var B=document.createElement("div");var I=new dijit.layout.ContentPane({region:"center"},B);this._searchResultsContainer=I;var H=document.createElement("div");H.style.height="180px";var G=new dijit.layout.ContentPane({region:"bottom",splitter:true},H);this._contextHitsContainer=G;var J=function(){var N=D._mainContainer._contentBox.h;var M=D._mainContainer._contentBox.w;var K=N;var L=M;if(D.ContextHitsVisible()){var P=D._contextHitsContainer.domNode.offsetHeight;var O=M;P=Math.max(1,P);D._controller.layout.ResizeSlot("SearchContextHits",O,P);K=K-P-D._mainContainer._splitters.bottom.offsetHeight}K=Math.max(1,K);D._controller.layout.ResizeSlot("SearchResultsListing",L,K)};dojo.connect(I,"resize",J);C.addChild(I);C.addChild(G);F.layout.RegisterSlot("SearchResultsListing",B,false);F.layout.RegisterSlot("SearchContextHits",H,false);A.appendChild(E);C.layout()}};if(!top.LF){top.LF={}}LF.BreadCrumbCtrl=function(B,A){this._MetadataDisplay=false;this.ASSETS_PATH="";this._init(B);this.getPathHintCtrl=null;this._pathToRoot=[];this.listener=new LF.Listener("BreadcrumbListener");this.listener.setHandler("EntryOpened",this.GetOnEntryOpened());this.listener.setHandler("FolderOpened",this.GetOnFolderOpened());this.listener.setHandler("MetadataOpened",this.GetOnMetadataOpened());this.listener.setHandler("ModeChanged",this.GetOnModeChanged());this.set_controller(A)};LF.BreadCrumbCtrl.prototype={_init:function(A){this._root=A;this._outerinfodiv=document.createElement("div");this._outerinfodiv.className="OuterDiv";this._root.appendChild(this._outerinfodiv);this._innerinfodiv=document.createElement("div");this._outerinfodiv.appendChild(this._innerinfodiv);this._nobreak=document.createElement("nobr");this._innerinfodiv.appendChild(this._nobreak)},set_controller:function(A){this._controller=A;A.subscribe("EntryOpened",this.listener);A.subscribe("FolderOpened",this.listener);A.subscribe("MetadataOpened",this.listener);A.subscribe("ModeChanged",this.listener);if(this._controller._context.openedFolder){this.setEntry(A._context.repository,A._context.openedFolder.id)}this.onclick=function(D,H,G){var F=this;var B=this._controller._context.repository;function E(I){var J=I;if(J&&J.length){if(J[0].id==G){A.selectCurrentFolder({id:H,repositoryName:B},null)}else{top.window.open("index.aspx?db="+B+"#id="+H+";view=newroot")}}}function C(I){}Laserfiche.WebAccess.BreadCrumbService.GetPathNodesToRoot(B,H,E,C)}},setEntry:function(B,F,E){var D=this;if(this._repository==B&&this._id==F&&!E){return }this._repository=B;this._id=F;if(this._id==-1){if(this.THROBBER_PATH){this._outerinfodiv.style.backgroundImage="url("+this.THROBBER_PATH+")"}else{this._outerinfodiv.style.backgroundImage="url("+this.ASSETS_PATH+"Assets/images/throbber-small.gif)"}this._clearChildren();D._changePath([{id:1,label:B},{id:-1,label:"Recycle Bin",iconPath:this.ASSETS_PATH+"Assets/images/icons/recycle.gif"}],B)}else{function C(G){var H=G;D._changePath(H,B)}function A(G){alert(G.get_message())}if(this.THROBBER_PATH){this._outerinfodiv.style.backgroundImage="url("+this.THROBBER_PATH+")"}else{this._outerinfodiv.style.backgroundImage="url("+this.ASSETS_PATH+"Assets/images/throbber-small.gif)"}this._clearChildren();Laserfiche.WebAccess.BreadCrumbService.GetPathNodesToRoot(B,F-0,C,A)}},_clearChildren:function(){while(this._nobreak.childNodes.length>0){this._nobreak.removeChild(this._nobreak.childNodes[0])}},_changePath:function(R,P){var C=this;C._pathNodes=R;this._clearChildren();var J="";var H=R.length;if(this._MetadataDisplay){this._nobreak.appendChild(document.createTextNode("Metadata for "))}var L=1;if(top.myFolderTree&&top.myFolderTree._store){var M=top.myFolderTree._store._getItemByIdentity("1:"+P);if(M&&M.tunnelid&&(M.tunnelid[0]!=0)){L=M.tunnelid[0]}}var Q=-1;for(var K=0;K<H;K++){var G=parseInt(R[K].id);if(G==L){Q=K;break}}var A=false;for(var K=0;K<H;K++){var I=R[K];var G=parseInt(I.id);var E=I.label;if(Q>K&&Q!=-1){continue}if(A){J+="\\";var B=document.createElement("img");B.src=this.ASSETS_PATH+"Assets/images/arrows/rightblk.gif";B.style.marginLeft="4px";var O=document.createElement("span");O.appendChild(document.createTextNode("\\"));O.style.visibility="hidden";O.style.fontSize="1px";this._nobreak.appendChild(B);this._nobreak.appendChild(O)}J+=E;if(K<H-1){var D=document.createElement("a");var F=J;D.appendChild(document.createTextNode(E));D.href="javascript:void(0);";D.onclick=this.GetOnClickHandler(F,G,L);this._nobreak.appendChild(D)}else{var N=I.iconPath;this._outerinfodiv.style.backgroundImage="url("+this.ASSETS_PATH+N+")";this._nobreak.appendChild(document.createTextNode(E))}A=true}if(this._controller&&this._controller.set_entryPath){this._controller.set_entryPath(J)}this._outerinfodiv.title=J},GetOnEntryOpened:function(){var A=this;return function(B){if(B.args.openedDocument){A._MetadataDisplay=false;A.setEntry(B.args.repository,B.args.openedDocument.id)}}},GetOnMetadataOpened:function(){var A=this;return function(D){A._MetadataDisplay=true;var C=D.args.repository;var B=D.args.ids||D.args.getSelectedItems().items;if(B&&B.length){if(B.length==1){A.setEntry(C,B[0].id||B[0])}else{A._clearChildren();A._nobreak.appendChild(document.createTextNode("Metadata for multiple entries"));A._id=null}}}},GetOnFolderOpened:function(){var A=this;return function(B){A._MetadataDisplay=false;if(B.args.openedFolder){A.setEntry(B.args.repository,B.args.openedFolder.id)}}},GetOnModeChanged:function(){var A=this;return function(C){var B=C.args;switch(B.mode){case 0:A.GetOnFolderOpened()({args:C.args.context});break;case 1:A.GetOnEntryOpened()({args:C.args.context});break;case 2:A.GetOnMetadataOpened()({args:C.args.context});break;case 3:break;case 4:break;case 5:A._id=null;A._clearChildren();A._outerinfodiv.style.backgroundImage="url("+A.ASSETS_PATH+"Assets/images/buttons/searchResults.gif)";A._nobreak.appendChild(document.createTextNode("Search Results"));break}}},GetOnClickHandler:function(B,D,C){var A=this;return function(){if(A.onclick){A.onclick(B,D,C)}}}};LF.EntryPickerBreadCrumbCtrl=function(B,A){this.ASSETS_PATH="../";this.THROBBER_PATH="../Assets/images/throbber-small_lt.gif";this._init(B);this._pathToRoot=[];this.listener=new LF.Listener("BreadcrumbListener");this.GetOnFolderOpened=function(){var C=this;return function(E){if(E.args.openedFolder){var F=E.args.openedFolder.id;var D=E.args.repository;C.setEntry(D,F)}}};this.GetOnEntryOpened=this.GetOnFolderOpened;this.MetadataOpened=this.GetOnFolderOpened;this.listener.setHandler("EntryOpened",this.GetOnEntryOpened());this.listener.setHandler("FolderOpened",this.GetOnFolderOpened());this.listener.setHandler("MetadataOpened",this.GetOnMetadataOpened());this.set_controller(A)};LF.EntryPickerBreadCrumbCtrl.prototype=LF.BreadCrumbCtrl.prototype;if(Laserfiche==undefined||Laserfiche==null){Laserfiche={}}dojo.declare("Laserfiche.Command",null,{constructor:function(B,A){this._receiver=B;this._context=A},_getSource:function(A){return this._context.getSelectedItems(A)},_getTarget:function(){var A=[];switch(this._context.focusedControl.getType()){case"ENTRY_LISTING":A=this._context.focusedControl.getLastSelectedItem();break;case"FOLDER_TREE":A=this._context.focusedControl.getLastSelectedItem();break;case"THUMBNAIL_CONTROL":A=this._context.focusedControl.getLastSelectedItem();break}return A}});dojo.declare("Laserfiche.CutCommand",[Laserfiche.Command],{execute:function(B){var C=this;var A={command:"CUT",repository:C._context.repository,source:C._getSource(B)};this._receiver.action(A)}});dojo.declare("Laserfiche.CopyCommand",[Laserfiche.Command],{execute:function(B){var C=this;var A={command:"COPY",repository:C._context.repository,source:C._getSource(B)};this._receiver.action(A)}});dojo.declare("Laserfiche.PasteCommand",[Laserfiche.Command],{execute:function(){var B=this;var A={command:"PASTE",repository:B._context.repository,target:B._getTarget()};this._receiver.action(A)}});dojo.declare("Laserfiche.PasteShortCutCommand",[Laserfiche.Command],{execute:function(){var B=this;var A={command:"PASTE_SHORTCUT",repository:B._context.repository,target:B._getTarget()};this._receiver.action(A)}});dojo.declare("Laserfiche.PasteFoldersOnlyCommand",[Laserfiche.Command],{execute:function(){var B=this;var A={command:"PASTE_FOLDERS_ONLY",repository:B._context.repository,target:B._getTarget()};this._receiver.action(A)}});dojo.declare("Laserfiche.MainCopyPasteReceiver",null,{constructor:function(A){this._mainController=A;this._inArgs={};this._outArgs={}},isInArgsEmpty:function(A){return !A||!(this._inArgs[A])},pullInArgs:function(C){var A=this;function D(F){if(F){var E={command:Laserfiche.ClipboardCommand[F.command],repository:C,source:{type:Laserfiche.ClipboardItemType[F.type],items:F.items}};A._inArgs[C]=E}}function B(E){}Laserfiche.WebAccess.ClipboardService.GetClipboard(C,D,B)},GetOnPasteValid:function(){var A=this;return function(B,D){var E=String.format("{0}?{1}={2}","Dialogs/ClipboardConfirm.aspx","r",D.repository);var C=top.getAvailableDlg();C.OpenDialog(E,120,300,false);C.onclose=function(F){if(F){Laserfiche.WebAccess.ClipboardService.ExecuteClipboardCommand(D.repository,F,A.GetOnOpSuccess(),A.GetOnOpFailed(),D)}}}},GetOnPasteInvalid:function(){return function(A,B){alert("Paste operation invalid")}},GetOnOpSuccess:function(){var A=this;return function(B,C){if(B){var D=C.target;A._mainController.entriesChanged({repository:C.repository,entryList:[D.item.id||D.item.docid||0]})}}},GetOnOpFailed:function(A,C){var B=this;return function(D){}},action:function(A){if(A||A.command){switch(A.command){case"CUT":this._inArgs[A.repository]=A;Laserfiche.WebAccess.ClipboardService.SetClipboard(A.repository,A.command,A.source);break;case"COPY":this._inArgs[A.repository]=A;Laserfiche.WebAccess.ClipboardService.SetClipboard(A.repository,A.command,A.source);break;case"PASTE":this._outArgs[A.repository]=A;Laserfiche.WebAccess.ClipboardService.SetClipboardTarget(A.repository,A.command,A.target,this.GetOnPasteValid(),this.GetOnPasteInvalid(),A);break;case"PASTE_SHORTCUT":this._outArgs[A.repository]=A;Laserfiche.WebAccess.ClipboardService.SetClipboardTarget(A.repository,A.command,A.target,this.GetOnPasteValid(),this.GetOnPasteInvalid(),A);break;case"PASTE_FOLDERS_ONLY":this._outArgs[A.repository]=A;Laserfiche.WebAccess.ClipboardService.SetClipboardTarget(A.repository,A.command,A.target,this.GetOnPasteValid(),this.GetOnPasteInvalid(),A);break;default:alert("Receiver: Unknown command");break}}}});Laserfiche.ClipboardCommand=["CUT","COPY","PASTE","PASTE_SHORTCUT","PASTE_FOLDERS_ONLY"];Laserfiche.ClipboardItemType=["ENTRIES","PAGES","ANNOTATIONS"];Type.registerNamespace("Laserfiche.Drawing");Laserfiche.Drawing.ColorPicker=function(A,B){this.color=0;this.icon=A;this.title=B};Laserfiche.Drawing.ColorPicker.prototype={setColor:function(B){var A=this;A.color=B;if(A.colorDisplayDiv){A.colorDisplayDiv.style.backgroundColor="#"+Laserfiche.Color.Util.IntToHex(B)}},selectColor:function(B){var A=this;A.setColor(B);if(A.onSelectedColorChanged){A.onSelectedColorChanged(B)}},draw:function(B,E,D){var K=this;var H=B.document||B.ownerDocument;if(typeof (D)=="undefined"||!D){D="Assets/images/"}var L=H.createElement("div");L.style.clear="both";L.title=K.title;L.style.width="45px";L.style.margin="2px";L.style.paddingTop="2px";var A=H.createElement("div");A.style.cssFloat="left";A.style.styleFloat="left";A.style.margin="2px";A.style.position="relative";var J=H.createElement("img");J.src=K.icon;A.appendChild(J);L.appendChild(A);var F=H.createElement("div");F.style.cssFloat="left";F.style.styleFloat="left";F.style.margin="2px";F.style.position="relative";var I=H.createElement("div");I.style.backgroundColor=Laserfiche.Color.Util.IntToHex(K.color);I.style.top="0px";I.style.left="0px";I.style.width="16px";I.style.height="16px";I.style.position="absolute";I.style.overflow="hidden";K.colorDisplayDiv=I;F.appendChild(I);var G=H.createElement("img");G.src=String.format("{0}{1}",D,"colorframe.gif");G.style.position="absolute";G.style.top="0px";G.style.left="0px";G.style.zIndex=5;G.onmousedown=function(){K.toggleColorDropdown()};F.appendChild(G);var C=H.createElement("div");C.style.position="absolute";C.style.zIndex=10;C.style.backgroundColor="white";C.style.top="16px";C.style.left="0px";C.style.border="1px solid black";C.style.display="none";K.buildColorTable(C,E);F.appendChild(C);L.appendChild(F);B.appendChild(L)},toggleColorDropdown:function(){var A=this;A.colordropdown.style.display=A.colordropdown.style.display==""?"none":""},buildColorTable:function(B,E){var I=this;var F=B.document||B.ownerDocument;if(I.colorTable){I.colorTable=null}var H=F.createElement("table");var M=null;var K=null;var L=0;var A=0;var J=E.Columns;for(var G=0;G<E.Values.length;G++){A=G%J;if(A==0){M=H.insertRow(L);L++}K=M.insertCell(A);var D=F.createElement("div");D.style.backgroundColor="#"+E.Values[G];D.style.height="12px";D.style.width="12px";D.style.border="1px inset";D.style.overflow="hidden";D.title=E.Names[G];D.onmousedown=function(){I.selectColor(Laserfiche.Color.Util.BackgroundToInt(this.style.backgroundColor));I.colordropdown.style.display="none"};K.appendChild(D)}var C=(J-A);if(C>1){K.colspan=C}B.appendChild(H);I.colordropdown=B}};Laserfiche.Drawing.ColorPicker.registerClass("Laserfiche.Drawing.ColorPicker");Type.registerNamespace("Laserfiche.Drawing.Palettes");Laserfiche.Drawing.Palettes.BasicColors={Values:new Array("FF8080","FFFF80","80FF00","00FF80","80FFFF","80FFFF","FF80C0","FF80FF","FF0000","FFFF00","80FF00","00FF40","00FFFF","0080C0","8080C0","FF00FF","804040","FF8040","00FF00","008080","004080","8080FF","800040","F00080","800000","FF8000","008000","008040","0000FF","0000A0","800080","8000FF","400000","804000","004000","004040","000080","000040","400040","400080","000000","808000","808040","808080","408080","C0C0C0","400040","FFFFFF"),Names:new Array("FF8080","FFFF80","80FF00","00FF80","80FFFF","80FFFF","FF80C0","FF80FF","Red","Yellow","80FF00","00FF40","Aqua","0080C0","8080C0","Fuchsia","804040","FF8040","Lime","Teal","004080","8080FF","800040","F00080","Maroon","FF8000","Green","008040","Blue","0000A0","Purple","8000FF","400000","804000","004000","004040","Navy","000040","400040","400080","Black","Olive","808040","Gray","408080","Silver","400040","White"),HasTransparent:true,Columns:8};Laserfiche.Drawing.Palettes.RedactionColors={Values:new Array("000000","FFFFFF"),Names:new Array("Black","White"),HasTransparent:false,Columns:2};Laserfiche.Drawing.Palettes.StickyNoteColors={Values:new Array("FFFF00","FF8000","FF80FF","FF0000","00FF00","80FFFF","0080FF","C040FF"),Names:new Array("Yellow","Orange","Pink","Red","Green","Light Blue","Blue","Purple"),HasTransparent:false,Columns:4};Laserfiche.Drawing.Palettes.StampColors={Values:new Array("000000","FF0000","00C000","0000FF","FFFF00","808080"),Names:new Array("Black","Red","Green","Blue","Yellow","Gray"),HasTransparent:false,Columns:3};Laserfiche.Drawing.ColorMixer=function(){this.currentPicker=null;this.visible=false};Laserfiche.Drawing.ColorMixer.prototype={setColor:function(B){var A=this;A.color=B},selectColor:function(B){var A=this;A.setColor(B);if(A.onSelectedColorChanged){A.onSelectedColorChanged(B)}},selectPicker:function(B){var A=this;A.currentPicker=B;A.onSelectedColorChanged=function(C){A.currentPicker.setColor(C)};cmbobj.setColor(B.color)},draw:function(A){if(visible){return }visible=true}};Laserfiche.Drawing.ColorMixer.registerClass("Laserfiche.Drawing.ColorMixer");Type.registerNamespace("Laserfiche.Color.Util");Laserfiche.Color.Util.ConvertHexByteToInt=function(C){var A=0;for(var B=0;B<C.length;B++){A=A*16;switch(C.charAt(B)){case"A":case"a":A=A+10;break;case"B":case"b":A=A+11;break;case"C":case"c":A=A+12;break;case"D":case"d":A=A+13;break;case"E":case"e":A=A+14;break;case"F":case"f":A=A+15;break;default:A=A+parseInt(C.charAt(B))}}return A};Laserfiche.Color.Util.ConvertIntByteToHex=function(B){var D="";var A=B;while(A>0){var C=A%16;switch(C){case 10:D="A"+D;break;case 11:D="B"+D;break;case 12:D="C"+D;break;case 13:D="D"+D;break;case 14:D="E"+D;break;case 15:D="F"+D;break;default:D=C+D}A=(A-C)/16}while(D.length<2){D="0"+D}return D};Laserfiche.Color.Util.IntToHex=function(B){var A=B;var C=A%256;A=(A-C)/256;var E=A%256;A=(A-E)/256;var D=A%256;return""+Laserfiche.Color.Util.ConvertIntByteToHex(C)+Laserfiche.Color.Util.ConvertIntByteToHex(E)+Laserfiche.Color.Util.ConvertIntByteToHex(D);var A=B};Laserfiche.Color.Util.HexToInt=function(C){var B=C;if(C.charAt(0)=="#"){B=C.substring(1,7)}var E=Laserfiche.Color.Util.ConvertHexByteToInt(B.substring(0,2));var D=Laserfiche.Color.Util.ConvertHexByteToInt(B.substring(2,4));var A=Laserfiche.Color.Util.ConvertHexByteToInt(B.substring(4,6));return A*65536+D*256+E};Laserfiche.Color.Util.BackgroundToInt=function(C){if(C.charAt(0)=="r"){var B=C.substring(4,C.length-1).split(",");var E=parseInt(B[0]);var D=parseInt(B[1]);var A=parseInt(B[2]);return A*65536+D*256+E}else{return Laserfiche.Color.Util.HexToInt(C)}};Laserfiche.Color.Util.RGBtoHSL=function(I,G,B){var E=Math.min(I,Math.min(G,B));var F=Math.max(I,Math.max(G,B));var A=(F+E)/2;var D=0;var C=0;if(F!=E){if(A<0.5){D=(F-E)/(F+E)}else{D=(F-E)/(2-F-E)}if(I==F){C=(G-B)/(F-E)}else{if(G==F){C=2+(B-I)/(F-E)}else{if(B==F){C=4+(I-G)/(F-E)}}}if(C<0){C=C+6}C=C/6}return{H:C,S:D,L:A}};Laserfiche.Color.Util.HSLtoRGB=function(F,E,A){var D=A;var C=A;var J=A;var I,H;if(E!=0){if(A<0.5){H=A*(1+E)}else{H=A+E-A*E}I=2*A-H;D=Laserfiche.Color.Util.HueToRGB(I,H,F+(1/3));C=Laserfiche.Color.Util.HueToRGB(I,H,F);J=Laserfiche.Color.Util.HueToRGB(I,H,F-(1/3))}return{R:D,G:C,B:J}};Laserfiche.Color.Util.HueToRGB=function(C,B,A){if(A<0){A+=1}if(A>1){A-=1}if((6*A)<1){return(C+(B-C)*6*A)}if((2*A)<1){return(B)}if((3*A)<2){return(C+(B-C)*((2/3)-A)*6)}return C};Laserfiche.Color.Util.RGBtoHSV=function(I,G,B){var E=Math.min(I,Math.min(G,B));var F=Math.max(I,Math.max(G,B));var A=F;var D=0;var C=0;if(F!=0){D=1-(E/F)}if(F!=E){if(I==F){C=(G-B)/(F-E)}else{if(G==F){C=2+(B-I)/(F-E)}else{if(B==F){C=4+(I-G)/(F-E)}}}if(C<0){C=C+6}C=C/6}return{H:C,S:D,V:A}};if(!top.LF){top.LF={}}LF.CurrentUserCtrl=function(B,A){this._init(B);this.listener=new LF.Listener("UserControlListener");this.listener.setHandler("RepositoryChanged",this.GetOnRepositoryChanged());this.listener.setHandler("Logout",this.GetOnRepositoryChanged());this.listener.setHandler("LogoutAll",this.GetOnRepositoryChanged());this.listener.setHandler("Login",this.GetOnRepositoryChanged());this.set_controller(A)};LF.CurrentUserCtrl.prototype={_init:function(A){this._root=A;this._root.className="WhoAmI";this._main=document.createElement("span");this._image=document.createElement("img");this._image.setAttribute("src","transparent.gif");this._name=document.createElement("span");this._main.appendChild(this._image);this._main.appendChild(this._name);this._root.appendChild(this._main)},set_controller:function(A){this._controller=A;A.subscribe("RepositoryChanged",this.listener);A.subscribe("Logout",this.listener);A.subscribe("LogoutAll",this.listener);A.subscribe("Login",this.listener);this.changeName(A._context.user,A._context.repository)},changeName:function(A,B){this._root.className="WhoAmI";if(A==""){this._main.className="NotLoggedIn";this._name.innerHTML="Not Connected"}else{this._main.className="LoggedIn";this._name.innerHTML=A+"@"+B}},GetOnRepositoryChanged:function(){var A=this;return function(D){var B=D.args.user;var C=D.args.repository;A.changeName(B,C)}}};Type.registerNamespace("LF");LF.CustomizeColumnsCtrl=function(grid,tree,bttnAdd,bttnRemove,bttnUp,bttnDown,targetType,parentPageView,parentPage){var _thisObj=this;var _grid=grid;var _tree=tree;var _bttnAdd=bttnAdd;var _bttnRemove=bttnRemove;var _bttnUp=bttnUp;var _bttnDown=bttnDown;var _targetType=targetType;var _parentPageView=parentPageView;var _settingsViewObj=parentPage;var _Column_Types=["Type","SystemType","RecycleBinType","FieldName","Width"];var _Column_Defaults=[0,0,0,"",0];var _isDirty=false;function _preventPost(e){e.returnValue=false;if(e.preventDefault){e.preventDefault()}e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation()}}function _onJSLoad(){try{if(_bttnAdd!=null&&typeof (_bttnAdd)=="string"){_bttnAdd=$get(_bttnAdd)}if(_bttnRemove!=null&&typeof (_bttnRemove)=="string"){_bttnRemove=$get(_bttnRemove)}if(_bttnUp!=null&&typeof (_bttnUp)=="string"){_bttnUp=$get(_bttnUp)}if(_bttnDown!=null&&typeof (_bttnDown)=="string"){_bttnDown=$get(_bttnDown)}if(_grid!=null&&typeof (_grid)=="string"){_grid=eval(_grid)}if(_tree!=null&&typeof (_tree)=="string"){_tree=eval(_tree)}if(_settingsViewObj!=null&&typeof (_settingsViewObj)=="string"){_settingsViewObj=eval(_settingsViewObj)}}catch(err){}}function _beginUpdate(){_grid.beginUpdate();_tree.beginUpdate()}function _endUpdate(){_grid.endUpdate();_tree.endUpdate()}function _onUp(sender,eventArgs){_preventPost(sender);_onJSLoad();_beginUpdate();var gridTable=_grid.get_table();var _selectedItems=_grid.getSelectedItems();if(_selectedItems==null||_selectedItems.length==0){return false}var curIndex=_selectedItems[0].get_index();if(curIndex==0){return false}_moveUp(curIndex);_grid.select(gridTable.getRow(curIndex-1));_endUpdate();_isDirty=true}function _onDown(sender,eventArgs){_preventPost(sender);_onJSLoad();_beginUpdate();var gridTable=_grid.get_table();var _selectedItems=_grid.getSelectedItems();if(_selectedItems==null||_selectedItems.length==0){return false}var curIndex=_selectedItems[0].get_index();if(curIndex==gridTable.getRowCount()-1){return false}_moveUp(curIndex+1);_grid.select(gridTable.getRow(curIndex+1));_endUpdate();_isDirty=true}function _onRemove(sender,eventArgs){_preventPost(sender);_onJSLoad();var gridTable=_grid.get_table();var _selectedItems=_grid.getSelectedItems();if(_selectedItems==null||_selectedItems.length==0){return }if(_selectedItems[0].index==0){return }_beginUpdate();_grid.deleteItem(_selectedItems[0]);_endUpdate();_isDirty=true}function _checkMembershipInList(data){var gridTable=_grid.get_table();for(var i=0;i<gridTable.getRowCount();i++){var gridItem=gridTable.getRow(i);var match=true;for(var j=0;j<data.length;j++){var val1=gridItem.getMemberAt(j).get_value();var val2=data[j];if(gridTable.get_columns()[j].get_dataField()=="Width"){continue}if(!val1&&!val2){continue}if(val1!=val2){match=false;break}}if(match){return true}}}function _onAdd(sender,eventArgs){var newNodeData=null;var gridDataArray=null;_preventPost(sender);_onJSLoad();if(_tree.get_selectedNode()&&_tree.get_selectedNode().get_value()){newNodeData=_tree.get_selectedNode().get_value();gridDataArray=newNodeData.split(",")}else{return }if(_checkMembershipInList(gridDataArray)){alert(GetString("ITEM_ALREADY_IN_LIST"));return }_beginUpdate();var gridTable=_grid.get_table();var insertedGridItem;var _selectedItems=_grid.getSelectedItems();if(_selectedItems==null||_selectedItems.length==0){insertedGridItem=gridTable.addEmptyRow()}else{var curIndex=_selectedItems[0].get_index();if(curIndex==(gridTable.getRowCount()-1)){insertedGridItem=gridTable.addEmptyRow()}else{insertedGridItem=gridTable.addEmptyRow(curIndex+1)}}if(insertedGridItem!=null){for(var j=0;j<gridDataArray.length;j++){insertedGridItem.setValue(j,gridDataArray[j])}_grid.select(insertedGridItem,false)}_endUpdate();_isDirty=true}function _get_columnArray(){var retVal=[];var gridTable=_grid.get_table();var rowCount=gridTable.getRowCount();for(var i=0;i<rowCount;i++){var curGridItem=gridTable.getRow(i);var curCol={};for(var j=0;j<_Column_Types.length;j++){var curCurHeader=_Column_Types[j];curCol[curCurHeader]=curGridItem.getMember(curCurHeader).get_value();if(!curCol[curCurHeader]){curCol[curCurHeader]=_Column_Defaults[j]}}retVal.push(curCol)}return retVal}function _moveUp_Orig(curIndex){var gridTable=_grid.get_table();_beginUpdate();gridTable.addEmptyRow(curIndex-1);var prevGridItem=gridTable.getRow(curIndex-1);var curGridItem=gridTable.getRow(curIndex);var nextGridItem=gridTable.getRow(curIndex+1);for(var i=0;i<nextGridItem.Data.length;i++){prevGridItem.setValue(i,nextGridItem.Data[i])}_grid.deleteItem(nextGridItem);_endUpdate()}function _moveUp(curIndex){var gridTable=_grid.get_table();_beginUpdate();var prevGridItem=gridTable.getRow(curIndex-1);var curGridItem=gridTable.getRow(curIndex);var tempData=[];for(var i=0;i<prevGridItem.Data.length;i++){tempData[i]=prevGridItem.Data[i]}for(var i=0;i<curGridItem.Data.length;i++){prevGridItem.setValue(i,curGridItem.Data[i])}for(var i=0;i<tempData.length;i++){curGridItem.setValue(i,tempData[i])}_endUpdate();_isDirty=true}this.initialize=function(e,args){_onJSLoad();$addHandler(_bttnUp,"click",_onUp);$addHandler(_bttnDown,"click",_onDown);$addHandler(_bttnAdd,"click",_onAdd);$addHandler(_bttnRemove,"click",_onRemove)};this.dispose=function(e,args){$clearHandlers(_bttnUp);$clearHandlers(_bttnDown);$clearHandlers(_bttnAdd);$clearHandlers(_bttnRemove);_grid=null;_tree=null;_bttnAdd=null;_bttnRemove=null;_bttnUp=null;_bttnDown=null};this.onApply=function(onApplySuccess,onApplyFailed){if(!_isDirty){return onApplySuccess()}var columnArray=_get_columnArray();var repoName=null;if(_settingsViewObj){repoName=_settingsViewObj.get_curRepoName()}if(columnArray&&repoName){if(_targetType=="Browse"){Laserfiche.WebAccess.ColumnListingService.UpdateFolderDisplay(repoName,columnArray,onApplySuccess,onApplyFailed)}else{if(_targetType=="RecycleBin"){Laserfiche.WebAccess.ColumnListingService.UpdateRecycleBinDisplay(repoName,columnArray,onApplySuccess,onApplyFailed)}else{if(_targetType=="Search"){Laserfiche.WebAccess.ColumnListingService.UpdateSearchDisplay(repoName,columnArray,onApplySuccess,onApplyFailed)}}}}_isDirty=false};this.register=function(){if(_settingsViewObj){_onJSLoad();_settingsViewObj.registerControl(_thisObj)}}};LF.CustomizeColumnsCtrl.registerClass("LF.CustomizeColumnsCtrl");Type.registerNamespace("Laserfiche.Exception");Laserfiche.Exception.IsConnectionLost=function(A){var B=A&&A.get_exceptionType&&A.get_exceptionType();var C=A&&A.get_message&&A.get_message();return(B=="Laserfiche.WebAccess.Common.ConnectionException"||C=="Invalid Connection")};Laserfiche.Exception.DocViewConnectionLostFunc=function(){alert("Your connection was lost.  Document changes can no longer be saved.  Please log in to revert document to original state.");var A=function(){var B=function(){var F=top.docviewControl;F.set_pagenum(F.get_pagenum())};var E=function(F){alert((F&&F.get_message&&F.get_message())||"An error occurred.")};var D=top.myAppController._context.openedDocument.id;var C=top.myAppController._context.repository;Laserfiche.WebAccess.DocumentService.OpenEntry(D-0,C,false,B,E)};top.lostConnectionHandler.onLostConnection(top.myAppController._context.repository,A,null)};Laserfiche.Exception.LostConnectionHandler=function(){this.handler=function(){};this.set_handler=function(A){this.handler=A};this.onLostConnection=function(A,C,B){this.handler(A,C,B)}};dojo.provide("LinkedAnnotation.LinkedAnnotationBox");dojo.require("dijit.Editor");dojo.require("dijit._editor.range");top.TYPE_ALLOW_ENABLE=24;top.START_INDEX=0;top.NEWLN_LENGTH=2;dijit._editor.RichText.prototype._onBlur=function(B){var A=this.getValue(true);if(A!=this.savedContent){this.onChange(A);this.savedContent=A}if(dojo.isMoz&&this.iframe){try{this.iframe.contentDocument.title=this._localizedIframeTitles.iframeEditTitle}catch(B){}}};dojo.declare("LinkedAnnotation.LinkedAnnotationBox",dijit.Editor,{constructor:function(){this._toolbar=null;this._suppressAnnotationCreation=false;this._acobj=null;this._annotations=[];this._contexthits=[];this._validAnnotationTypes=[Laserfiche.AnnotationTypes.ANN_HIGHLIGHT,Laserfiche.AnnotationTypes.ANN_BLACKOUT,Laserfiche.AnnotationTypes.ANN_STRIKEOUT,Laserfiche.AnnotationTypes.ANN_UNDERLINE];this._convertToLFAnnType={hilite:Laserfiche.AnnotationTypes.ANN_HIGHLIGHT,redact:Laserfiche.AnnotationTypes.ANN_BLACKOUT,strike:Laserfiche.AnnotationTypes.ANN_STRIKEOUT,underline:Laserfiche.AnnotationTypes.ANN_UNDERLINE};this._anntypeToString={};this._anntypeToString[Laserfiche.AnnotationTypes.ANN_HIGHLIGHT]="highlight";this._anntypeToString[Laserfiche.AnnotationTypes.ANN_BLACKOUT]="redaction";this._anntypeToString[Laserfiche.AnnotationTypes.ANN_STRIKEOUT]="strikeout";this._anntypeToString[Laserfiche.AnnotationTypes.ANN_UNDERLINE]="underline";this._disableTextEdit=true;this._disabledBackgroundColor="#DCE1F5";this._enabledBackgroundColor="#FFFFFF";this._textValueChanged=false;this.ContextMenuCmd={NONE:0,DELETE_ANNOTATION:1,DELETE_TEXT_ANNOTATION:2,DELETE_IMAGE_ANNOTATION:3,LINK_IMAGE_ANNOTATION:4,ENABLE_EDIT_TEXT:5,DISABLED_EDIT_TEXT:6,APPLY_ANNOTATION:7,SAVE_TEXT:8,REVERT_TEXT:9},this._recordChanges=false;this._curTextHashValue=top.Hasher.getHashValue("");this._hashValueInitialized=false;dojo.connect(dijit._editor.RichText.prototype,"_onBlur",this,this.getOnBlurFunc())},getOnBlurFunc:function(){var A=this;return function(){if(A._disableTextEdit){return }}},getRecordChanges:function(){return this._recordChanges},setRecordChanges:function(A){this._recordChanges=A},getCurrentBGColor:function(){return(this._disableTextEdit?this._disabledBackgroundColor:this._enabledBackgroundColor)},getContextMenu:function(L,D,J){var B=this;var G=top.hasFeature(B._acobj._reponame,"EditText")&&!top.myAppController._lastSecParams.VolReadOnly;var K=false;var F=false;var H=top.myAppController._lastSecIdArray;var A=top.myAppController._lastSecParams.Rights;if(dojo.indexOf(H,B._acobj._docid-0)!=-1){K=(A.indexOf("MCn")!=-1)&&!A.VolReadOnly;F=(A.indexOf("Ann")!=-1)&&!A.VolReadOnly}if(D){if(!F){return[]}var I=B._acobj.ContextMenu.getItems(top.TYPE_LINKEDBOX_ANNOTATIONS,top.myAppController);dojo.forEach(I,function(N){N.id|=(B.ContextMenuCmd.APPLY_ANNOTATION<<16)});return I}if(!J||!J.length){if(!G||!K){return[]}if(L){return[{title:"Edit Text",id:(this.ContextMenuCmd.ENABLE_EDIT_TEXT)<<16,iconClass:""}]}else{if(B.hasTextChanged()){return[{title:"Toggle Edit Text",id:(this.ContextMenuCmd.ENABLE_EDIT_TEXT)<<16,iconClass:""},{title:"Discard text changes",id:(this.ContextMenuCmd.REVERT_TEXT)<<16,iconClass:""}]}else{return[{title:"Disable Editing",id:(this.ContextMenuCmd.DISABLED_EDIT_TEXT)<<16,iconClass:""}]}}}else{if(L){if(!F){return[]}var E=new Array();var C=B._anntypeToString[J[0]._type]||"unknown";var M=((J[0]._rectangles&&J[0]._rectangles.length)||(J[0]._wordlines&&J[0]._wordlines.length));if(!M){E.push({title:"Delete",id:((B.ContextMenuCmd.DELETE_ANNOTATION)<<16)+0,iconClass:""});E.push({title:"Link",id:((B.ContextMenuCmd.LINK_IMAGE_ANNOTATION)<<16)+0,iconClass:""})}else{E.push({title:"Delete Both Annotations",id:((B.ContextMenuCmd.DELETE_ANNOTATION)<<16)+0,iconClass:""});E.push({title:"Delete Text Annotation only",id:((B.ContextMenuCmd.DELETE_TEXT_ANNOTATION)<<16)+0,iconClass:""});E.push({title:"Delete Image Annotation only",id:((B.ContextMenuCmd.DELETE_IMAGE_ANNOTATION)<<16)+0,iconClass:""})}return E}else{return[{title:"Disable Editing",id:this.ContextMenuCmd.DISABLED_EDIT_TEXT,iconClass:""}]}}},onModeSet:function(E){var A=this;var B=A.getSelectionStart();if(isNaN(B)){return }var C=A.getSelectionEnd();if(isNaN(C)){return }if(B==C){return }var D=A.getSelection();if(!D){return }if(!dojo.trim(D)){return }switch(E){case Laserfiche.Modes.MODE_HIGHLIGHT:A.execCommand("hilitecolor");break;case Laserfiche.Modes.MODE_BLACKOUT:A.execCommand("redaction");break;case Laserfiche.Modes.MODE_UNDERLINE:A.execCommand("underline");break;case Laserfiche.Modes.MODE_STRIKEOUT:A.execCommand("strikethrough");break;default:break}},setAnnotationsControl:function(A){this._acobj=A},isSupportedCommand:function(A){if(A=="redaction"||A=="hilitecolor"||A=="strikethrough"||A=="underline"||A=="removeAnn"||A=="removeFormat"){return true}return false},calculateUndoCommand:function(C,B){var A=null;switch(C){case Laserfiche.AnnotationTypes.ANN_HIGHLIGHT:case Laserfiche.AnnotationTypes.ANN_BLACKOUT:A="hilitecolor";B="inherit";break;case Laserfiche.AnnotationTypes.ANN_STRIKEOUT:A="strikethrough";break;case Laserfiche.AnnotationTypes.ANN_UNDERLINE:A="underline";break}return{cmd:A,color:B}},translateTypeToCmd:function(B){var A=B;switch(B){case Laserfiche.AnnotationTypes.ANN_HIGHLIGHT:A="hilitecolor";break;case Laserfiche.AnnotationTypes.ANN_BLACKOUT:A="redaction";break;case Laserfiche.AnnotationTypes.ANN_STRIKEOUT:A="strikethrough";break;case Laserfiche.AnnotationTypes.ANN_UNDERLINE:A="underline";break}return A},isOverlapped:function(B,A){if(!B.hasOwnProperty("start")||!B.hasOwnProperty("end")||!A.hasOwnProperty("start")||!A.hasOwnProperty("end")){return false}if((B.start<=A.start&&B.end<=A.start)||(A.start<=B.start&&A.end<=B.start)){return false}else{return true}},setupDefaultShortcuts:function(){var B=this;var A=function(D,C){return arguments.length==1?function(){this.execCommand(D)}:function(){this.execCommand(D,C)}};this.addKeyHandler("r",this.KEY_CTRL,function(){A("redaction")});this.addKeyHandler("h",this.KEY_CTRL,function(){A("hilitecolor")});this.addKeyHandler("s",this.KEY_CTRL,function(){A("strikethrough")});this.addKeyHandler("u",this.KEY_CTRL,function(){A("underline")});this.addKeyHandler("d",this.KEY_CTRL,function(){A("removeAnn")})},postCreate:function(){this.inherited("postCreate",arguments);this.set_disableTextEdit(true);dojo.style(this.editNode,"fontSize","14px");dojo.style(this.editNode,"lineHeight","18px");dojo.style(this.editNode,"padding","5px")},onKeyPress:function(A){if(A){if(this._disableTextEdit){if(dojo.stopEvent){dojo.stopEvent(A)}if(A.preventBubble){A.preventBubble()}if(A.preventCapture){A.preventCapture()}if(A.preventDefault){A.preventDefault()}if(A.stopPropagation){A.stopPropagation()}}else{this._keyPressTextEdit=true}return false}},set_imageBlockAnnReadOnly:function(A){if(dojo.exists("_acobj",this)){this._acobj._readonlyBlockAnn=A;if(this._acobj._readonlyBlockAnn){this._acobj.setDirty()}}},set_imageTextEditing:function(A){if(dojo.exists("_acobj",this)){this._acobj._isTextEditing=A}},set_disableTextEdit:function(B){if(B){dojo.style(this.editNode,"backgroundColor",this._disabledBackgroundColor);var A=this.hasTextChanged();this.set_imageBlockAnnReadOnly(A);this.set_imageTextEditing(false)}else{dojo.style(this.editNode,"backgroundColor",this._enabledBackgroundColor);this.set_imageTextEditing(true)}this._disableTextEdit=!!B},execCommand:function(E,C){var D;if(!this.isSupportedCommand(E)){return }this.focus();var F=this._normalizeCommand(E);if((F=="redaction")&&(dojo.isMoz)){this.document.execCommand("useCSS",false,true);this.document.execCommand("styleWithCSS",false,true);if(C==0){this.document.execCommand("forecolor",false,"#B0B0B0");D=this.document.execCommand("hilitecolor",false,"#303030")}else{D=this.document.execCommand("hilitecolor",false,"#C0C0C0")}this.document.execCommand("useCSS",false,false);this.document.execCommand("styleWithCSS",false,false)}else{if((F=="redaction")&&(dojo.isIE)){if(C==0){this.document.execCommand("forecolor",false,"#B0B0B0");D=this.document.execCommand("backcolor",false,"#303030")}else{D=this.document.execCommand("backcolor",false,"#C0C0C0")}}else{if((F=="hilitecolor")&&(dojo.isMoz)){this.document.execCommand("useCSS",false,true);this.document.execCommand("styleWithCSS",false,true);var B=C;if(typeof (B)=="number"){B=this._RGBfromInt(B)}if(B){var A=this.calculateContrastColor(B);this.document.execCommand("forecolor",false,A);D=this.document.execCommand(F,false,B)}else{D=this.document.execCommand(F,false,"yellow")}this.document.execCommand("useCSS",false,false);this.document.execCommand("styleWithCSS",false,false)}else{if((dojo.isIE)&&(F=="backcolor")){var B=C;if(typeof (B)=="number"){B=this._RGBfromInt(B)}if(B){var A=this.calculateContrastColor(B);this.document.execCommand("forecolor",false,A);D=this.document.execCommand(F,false,B)}else{D=this.document.execCommand(F,false,"yellow")}}else{this.inherited("execCommand",arguments)}}}}if(!this._suppressAnnotationCreation){this.createLinkedAnnotation(E,C)}return true},showStatus:function(C,A){var B=this._walkForStartEnd();if(B){var D=" Cmd: ";D+=(!!C)?C:" ";D+=" Args: ";D+=(!!A)?A.toString():"";D+=" startPos: ";D+=B.selStart?B.selStart:"?";D+=" endPos: ";D+=B.selEnd?B.selEnd:"?";if(this._acobj&&this._acobj.set_statusMessage){this._acobj.set_statusMessage(D)}}},registerContextHandlers:function(){dojo.connect(this.editNode,"oncontextmenu",this.GetOnContextHandlers())},getAnnControlAnnotation:function(C){var B=this._acobj._annotations;for(var A in B){if(B.hasOwnProperty(A)){if(B[A].id==C){return B[A]}}}return null},EnableTextEdit:function(){if(this._disableTextEdit){if(this._acobj.HasBlockAnnChanges()){alert("You must save your annotation changes before editing the text.")}else{this.set_disableTextEdit(false)}}else{this.set_disableTextEdit(true)}},OnEditorHide:function(){if(dojo.exists("_contextmenu",this)){this._contextmenu.Hide()}},DiscardTextChanges:function(){if(this.hasTextChanged()){this.RevertText()}else{this.DisableTextEdit()}},DisableTextEdit:function(){this.set_disableTextEdit(true)},RevertText:function(){this.set_disableTextEdit(true);this._acobj.set_page(this._acobj._pageid)},GetOnContextHandlers:function(){function B(D,F){var G=D&65535;var C=(D>>16)&65535;switch(C){case A.ContextMenuCmd.NONE:break;case A.ContextMenuCmd.DELETE_ANNOTATION:A._acobj.RemoveAnnotation(F[G].id,true);break;case A.ContextMenuCmd.DELETE_TEXT_ANNOTATION:A._acobj.RemoveTextAnnOnly(F[G].id,true);break;case A.ContextMenuCmd.DELETE_IMAGE_ANNOTATION:A._acobj.RemoveImageAnnOnly(F[G].id,true);break;case A.ContextMenuCmd.LINK_IMAGE_ANNOTATION:var E=A.getAnnControlAnnotation(F[G].id);if(!E){return }Laserfiche.WebAccess.AnnotationsService.GetCoveredWordsByStartEnd(E._control._reponame,E._control._docid,E._control._pageid,E._startChar,E._endChar,E.RenderLinkedAnnotationOnImage(A._recordChanges),E.GetCoveredWordsErrorFunc());break;case A.ContextMenuCmd.ENABLE_EDIT_TEXT:A.EnableTextEdit();break;case A.ContextMenuCmd.DISABLED_EDIT_TEXT:A.DisableTextEdit();break;case A.ContextMenuCmd.SAVE_TEXT:A.saveText();break;case A.ContextMenuCmd.REVERT_TEXT:A.RevertText();break;case A.ContextMenuCmd.APPLY_ANNOTATION:switch(G){case top.LinkedAnnCommands.HILITE:A.execCommand("hilitecolor");break;case top.LinkedAnnCommands.REDACT:A.execCommand("redaction");break;case top.LinkedAnnCommands.UNDERLINE:A.execCommand("underline");break;case top.LinkedAnnCommands.STRIKETHROUGH:A.execCommand("strikethrough");break}break}}var A=this;return(function(O){if(dojo.exists("_contextmenu",A)){A._contextmenu.Hide()}dojo.stopEvent(O);A._menuscontainer=document.createElement("div");A._menuscontainer.style.position="absolute";document.body.appendChild(A._menuscontainer);var F=A.getSelectionPosIndex();var I=A._acobj._annotations;var D=[];for(var E in I){if(I.hasOwnProperty(E)){var J=dojo.delegate(I[E]);var N={start:J._startChar||-1,end:J._endChar||-1};if(A.isOverlapped(F,N)){D.push(J)}}}var G=A.getSelection();var L=null;L=A.getContextMenu(A._disableTextEdit,G,D);if(!L||L.length==0){return }var C=top.SimpleMenu.CreateMenu(L,A._menuscontainer);C._bRawCoor=true;var M=dojo.coords(A._menuscontainer);var K=dojo.coords(A.domNode);A._contextmenu=C;var H=(typeof window.innerHeight!="undefined"?window.innerHeight:document.body.offsetHeight);C.Show(K.x+O.clientX-6,K.y+O.clientY-H,true,dojo.isFF);C.onselect=function(){B(C.value,D);C.Hide()};C.onhide=function(){C.DeleteMenu();A._contextmenu=null}})},createLinkedAnnotation:function(E,C){if(!this._suppressAnnotationCreation){var F=null;var B=null;var D=this._walkForStartEnd();if(D){if(E=="redaction"){F=Laserfiche.Modes.MODE_BLACKOUT;B=0}else{if(E=="hilitecolor"){F=Laserfiche.Modes.MODE_HIGHLIGHT;B=(C&&this._intFromRGB(C))||65535}else{if(E=="strikethrough"){F=Laserfiche.Modes.MODE_STRIKEOUT;B=0}else{if(E=="underline"){F=Laserfiche.Modes.MODE_UNDERLINE;B=0}}}}var A=new Laserfiche.BlockAnnotation(this._acobj,this._acobj._surface,this._acobj.GetNextAnnotationID(),F,true);A.set_startEndIndex(D.selStart,D.selEnd,this._recordChanges);A.set_color(B);this.addAnnotation({start:A._startChar,end:A._endChar,annType:A._type,color:A.get_color(),id:A.id},false);this._acobj.StoreAnnotation(A);if(this._acobj._appController.Settings.LinkNewAnnotations){Laserfiche.WebAccess.AnnotationsService.GetCoveredWordsByStartEnd(A._control._reponame,A._control._docid,A._control._pageid,D.selStart,D.selEnd,A.RenderLinkedAnnotationOnImage(true),A.GetCoveredWordsErrorFunc())}}}},getRangeObj:function(){var B=this;var A=B.document.defaultView||B.document.parentWindow;if(dojo.isMoz){return dijit.range.getSelection(A)}else{if(dojo.isIE){return dijit.range.getSelection(A).getRangeAt(0)}else{return null}}},hasText:function(){return(!!this.editNode.childNodes.length)},getText:function(){var A="";function B(C){if(dojo.isString(C)){A+=C.replace(/&nbsp;/g," ")}else{if(dojo.isObject(C)){if(C.nodeType==3){A+=C.data.replace(/&nbsp;/g," ")}else{if(C.nodeType==1){if(C.tagName=="BR"){A+="\r\n"}else{dojo.forEach(C.childNodes,B)}}}}}return }if(this.editNode){dojo.forEach(this.editNode.childNodes,B);A=A.replace(/\u00A0/g," ")}return A},getHints:function(){var C=0;var E={hilite:[],redact:[],strike:[],underline:[]};function D(K,H){if(dojo.isString(K)){var L=K.replace(/&nbsp;/g," ");C+=L.length}else{if(dojo.isObject(K)){if(K.nodeType==3){var L=K.data.replace(/&nbsp;/g," ");C+=L.length}else{if(K.nodeType==1){if(K.tagName=="BR"){C+=2}else{var I=dojo.delegate(H);var N=new dojo.Color(dojo.style(K,"backgroundColor"));var O=false;var M=false;var J=false;var G=false;if(!I.inU&&!!(K.tagName=="U")){E.underline.push(C);O=true}if(!I.inS&&!!(K.tagName=="STRIKE")){E.strike.push(C);M=true}if(!I.inR&&!!(N.toHex()=="#000000")){E.redact.push(C);J=true}if(!I.inH&&!(N.toHex()=="#ffffff"||N.toHex()=="#000000")){E.hilite.push(C);G=true}I.inU=I.inU||!!(K.tagName=="U");I.inS=I.inS||!!(K.tagName=="STRIKE");I.inR=I.inR||!!(N.toHex()=="#000000");I.inH=I.inH||!(N.toHex()=="#ffffff"||N.toHex()=="#000000");dojo.forEach(K.childNodes,function(P){D(P,I)});if(O){E.underline.push(C)}if(M){E.strike.push(C)}if(J){E.redact.push(C)}if(G){E.hilite.push(C);E.hilite.push(N.toHex())}}}}}}return }var B={inR:false,inH:false,inS:false,inU:false};dojo.forEach(this.editNode.childNodes,function(G){D(G,B)});var F=this._annListToRegion(E,this.getText());var A=this._convertRegionsToAnnHelp(F);return A},_convertRegionsToAnnHelp:function(D){var B=[];var A=this;for(var C in D){if(D.hasOwnProperty(C)){dojo.forEach(D[C],function(F){var E=dojo.exists("color",F)?new dojo.Color().setColor(F.color).toRgb():[0,0,0];B.push({annType:A._convertToLFAnnType[C]-0||0,start:F.startPos,end:F.endPos,color:E,disabled:false})})}}return B},_annListToRegion:function(G,K){function J(P,L,O){if(!dojo.isString(K)||O.length<L){return false}if(P>=L){return true}var M=O.substring(P,L);var N=!!(/^[\r\n]*$/.test(M));return N}function I(O,M,N){var L=1;while(dojo.isArray(O)&&L<O.length-2){if(J(O[L],O[L+1],M)){O.splice(L,2);if(N){N.splice(Math.floor(L/2),1)}}else{L+=2}}}function F(L){if(!L||!dojo.isArray(L)||!L.length){return[]}var M=[];dojo.forEach(L,function(Q,P,N){if(P%2==0&&(N.length>=P+2)){var O={startPos:N[P],endPos:N[P+1]};M.push(O)}});return M}function H(L,N){if(!L||!dojo.isArray(L)||!L.length){return[]}var M=[];dojo.forEach(L,function(R,P,O){while(R.endPos-R.startPos>2){var Q=N.substring(R.endPos-2,R.endPos);var S=!!(/^[\r\n]*$/.test(Q));if(S){R.endPos-=2}else{break}}});return M}function B(L){if(!L||!dojo.isArray(L)||!L.length){return }dojo.forEach(L,function(O,N,M){O.endPos-=1});return }var D={};for(var A in G){if(G.hasOwnProperty(A)){if(A=="hilite"){var C=dojo.filter(G[A],function(N,M,L){return(M%3==2)});var E=dojo.filter(G[A],function(N,M,L){return(M%3!=2)});I(E,K,C);D[A]=F(E);H(D[A],K);B(D[A]);dojo.forEach(D[A],function(N,M,L){N.color=C[M]})}else{I(G[A],K);D[A]=F(G[A]);H(D[A],K);B(D[A])}}}return D},saveText:function(){var B=this;function C(D){B._acobj.set_page(B._acobj._pageid)}function A(E){var D=dojo.string.substitute("${0}:\n${1}",["Error saving text",E.get_message()]);alert(D)}if(B.hasTextChanged()){Laserfiche.WebAccess.DocumentService.SetTextByID(B._acobj._reponame,B._acobj._docid,B._acobj._pageid,this.getText(),this.getHints(),C,A)}},getSelection:function(){var C=this;var B=C.document.defaultView||C.document.parentWindow;var A=dijit.range.getSelection(B);if(dojo.isIE){return A.getRangeAt(0)._getIERange().text}if(dojo.isMoz){return A.toString()}return""},getSelectionStart:function(){var A=this._walkForStartEnd();return((A&&typeof (A.selStart=="number"))?A.selStart:NaN)},getSelectionEnd:function(){var A=this._walkForStartEnd();return((A&&typeof (A.selEnd=="number"))?A.selEnd:NaN)},getSelectionPosIndex:function(){var C=this.getRangeObj();if(dojo.exists("anchorNode",C)){var B=this.getCharPosFromNodeOffset(C.anchorNode,C.anchorOffset);var A=this.getCharPosFromNodeOffset(C.focusNode,C.focusOffset)}if(dojo.exists("startContainer",C)){var B=this.getCharPosFromNodeOffset(C.startContainer,C.startOffset);var A=this.getCharPosFromNodeOffset(C.endContainer,C.endOffset)}return{start:Math.min(B,A),end:Math.max(B,A)}},_walkForStartEnd:function(){function E(L){if(L&&L.nodeType&&L.nodeType==3){if(L==A){I=B+F}if(L==C){G=B+H}B+=L.data.length}else{if(L&&L.nodeType&&L.nodeType==1&&(L.nodeName=="BR"||L.tagName=="BR")){if(L==A){I=B}if(L==C){G=B}B+=top.NEWLN_LENGTH}}}function J(M,L){L(M);M=M.firstChild;while(M&&(I==-1||G==-1)){J(M,L);M=M.nextSibling}}var D=this;var K=D.getRangeObj();var A=K.startContainer||K.anchorNode;var C=K.endContainer||K.focusNode;var F=K.startOffset||K.anchorOffset||0;var H=K.endOffset||K.focusOffset||0;if(!A||!C){return null}if(A.tagName=="BODY"){A=A.childNodes[F]}else{if(A.tagName=="FONT"||A.tagName=="STRIKE"||A.tagName=="U"){A=A.childNodes[F-1]}}if(C.tagName=="BODY"){C=C.childNodes[H]}else{if(C.tagName=="FONT"||C.tagName=="STRIKE"||C.tagName=="U"){C=C.childNodes[H-1]}}var I=-1;var G=-1;var B=top.START_INDEX;J(D.editNode,E);if(I==-1){if(console&&console.log){console.log("Error: startPos==%d",I)}}return{"selStart":I,"selEnd":G}},getCharPosFromNodeOffset:function(D,A){function F(H){var I=G;if(H==D){B=G+A;return true}if(H&&H.nodeType&&H.nodeType==3){G+=H.data.length}else{if(H&&H.nodeType&&H.nodeType==1&&(H.nodeName=="BR"||H.tagName=="BR")){G+=top.NEWLN_LENGTH}else{return false}}}function E(I,H){if(H(I)){return true}I=I.firstChild;while(I){if(E(I,H)){return true}I=I.nextSibling}}var C=this;var G=top.START_INDEX;var B=G;E(C.editNode,F);return B},getNodeOffsetObject:function(D){function F(H){var I=G;if(H&&H.nodeType&&H.nodeType==3){G+=H.data.length}else{if(H&&H.nodeType&&H.nodeType==1&&(H.nodeName=="BR"||H.tagName=="BR")){G+=top.NEWLN_LENGTH}else{return }}if(D>=I&&D<G){A=H;C=(D-I);if(H.nodeType==1&&(H.nodeName=="BR"||H.tagName=="BR")){C=0}}}function E(I,H){var J=H(I);I=I.firstChild;while(I&&!A){E(I,H);I=I.nextSibling}}var B=this;var G=top.START_INDEX;var A=null;var C=null;E(B.editNode,F);return{"rangeNode":A,"rangeOffset":C}},startVisibilityWorkaround:function(){var B=this;var C=B.srcNodeRef;var A=C.parentNode;if(A.style&&A.style.display=="none"){A.style.zIndex=-100;A.style.display="";if(dojo.isIE){B.focus()}return true}return false},endVisibilityWorkaround:function(){var C=this;if(dojo.isMoz){var B=C.window.getSelection()}var D=C.srcNodeRef;var A=D.parentNode;A.style.zIndex=100;A.style.display="none"},ieSetStart:function(D,G,F){var B=G;if(G.nodeType==3){var C=F;var A=null;var E=true;while(B.previousSibling){switch(B.previousSibling.nodeType){case 1:A=B.previousSibling;E=false;break;case 3:C+=B.previousSibling.data.length;break}if(A!=null){break}B=B.previousSibling}if(A==null){A=G.parentNode;E=true}D.moveToElementText(A);D.collapse(E);D.move("Character",C)}else{if(G.nodeType==1){if(G.tagName=="BR"){if(G.previousSibling){return this.ieSetStart(D,G.previousSibling,0)}else{D.moveToElementText(G.parentNode);D.collapse(E);return D}}switch(G.childNodes.item(F).nodeType){case 1:case 3:return this.ieSetStart(D,G.childNodes.item(F),0);break;default:alert("error")}}}return D},ieSetEnd:function(E,A,G){var C=A;if(A.nodeType==3){var D=A.data.length-G;var B=null;var F=false;while(C.nextSibling){switch(C.nextSibling.nodeType){case 1:B=C.nextSibling;F=true;break;case 3:D+=C.nextSibling.data.length;break}if(B!=null){break}C=C.nextSibling}if(B==null){B=A.parentNode;F=false}E.moveToElementText(B);E.collapse(F);E.move("Character",-D)}else{if(A.nodeType==1){if(A.tagName=="BR"){if(A.nextSibling){return this.ieSetEnd(E,A.nextSibling,0)}else{E.moveToElementText(A.parentNode);E.collapse(F);return E}}switch(A.childNodes.item(G).nodeType){case 3:return this.ieSetEnd(E,A.childNodes.item(G),0);break;default:}}}return E},setCurrentHashValue:function(A){this._curTextHashValue=A;this._hashValueInitialized=true},hasTextChanged:function(){if(!this._hashValueInitialized){return false}if(!this._textValueChanged&&this.editNode){this._textValueChanged=(this._curTextHashValue!=top.Hasher.getHashValue(this.getText()))}return this._textValueChanged},clearAnnotations:function(){this._annotations=[]},addContextHits:function(A){this._contexthits.push(A)},addAnnotation:function(E,A){var B=this;var D=function(F){return(F==E.annType)};if(!dojo.some(this._validAnnotationTypes,D)){return }if(E.id){if(!dojo.some(B._annotations,function(F){return(F.id==E.id)})){this._annotations.push(E)}else{var C=dojo.filter(B._annotations,function(F){return(F.id==E.id)});C[0].start=E.start;C[0].end=E.end;E.id=E.id.toString()}if(!!A){setTimeout(function(){B.annotateTextRegion(E)},100)}}},removeAnnotation:function(D,A){var B=this;if(typeof (D)=="object"){var E=D.id.toString()}else{var E=D.toString()}for(var C=0;C<this._annotations.length;C++){if(this._annotations[C].id==E){if(A){B.unannotateTextRegion(B._annotations[C])}this._annotations.splice(C,1);return true}}return false},renderContextHits:function(A){var B=this;B._contexthits=A;dojo.forEach(A,function(C){B.boldRegion(C)})},clearContextHits:function(){var A=this;dojo.forEach(A._contexthits,function(B){A.boldRegion(B)});A._contexthits=[]},hideText:function(){dojo.style(this.editNode.parentNode,"background","#DCE1F5 none repeat scroll 0%");dojo.style(this.editNode,"opacity","0");dojo.style(this.editNode,"background","transparent")},unhideText:function(){dojo.style(this.editNode,"opacity","100");dojo.style(this.editNode,"backgroundColor","#DCE1F5")},renderAnnotations:function(B){var C=this;function A(){var D=C.editNode.scrollTop;C.editNode.innerHTML=C.editNode._originalInnerHTML||"";dojo.forEach(C._annotations,function(E){C.annotateTextRegion(E)});dojo.forEach(C._contexthits,function(E){C.boldRegion(E)});C.editNode.scrollTop=D;if(B){B()}}if(!!C.iframe&&!!C.iframe.contentDocument&&!!C.iframe.contentDocument.title){setTimeout(A,0)}else{if(!!C.iframe&&!!C.iframe.contentWindow&&!!C.iframe.contentWindow.document){C.iframe.contentDocument=C.iframe.contentWindow.document;setTimeout(A,0)}else{setTimeout(function(){C.renderAnnotations()},250)}}},unannotateTextRegion:function(B){var A=this.calculateUndoCommand(B.annType,B.color);B.annType=A.cmd;B.color=A.color;this.annotateTextRegion(B)},annotateTextRegion:function(M){var L=M.start;var N=M.end+1;var D=M.annType;var K=M.color;if(L<0||N<0){return }function F(){var O=H.document.body.createTextRange();O.collapse(true);try{O.select()}catch(P){}document.selection._selectedRange=O}function E(O){if(!O||!O.rangeNode){if(console&&console.log){console.log("_normalizeNodeOffsetObject failed");return }}if(O.rangeNode.tagName=="BR"||O.rangeNode.nodeName=="BR"){O.rangeOffset=0}}var H=this;if(dojo.isMoz){var B=H.window.getSelection();if(!B){setTimeout(function(){H.annotateTextRegion(M)},0);return }}D=H.translateTypeToCmd(D);var J=this.getNodeOffsetObject(L);var C=this.getNodeOffsetObject(N);E(J);E(C);var G={};if(dojo.isMoz){var G=H.document.createRange();G.setStart(J.rangeNode,J.rangeOffset);G.setEnd(C.rangeNode,C.rangeOffset)}else{if(dojo.isIE){var G=H.document.body.createTextRange();var A=H.document.body.createTextRange();H.ieSetStart(G,J.rangeNode,J.rangeOffset);H.ieSetEnd(A,C.rangeNode,C.rangeOffset);G.setEndPoint("EndToStart",A);try{G.select()}catch(I){}document.selection._selectedRange=G}}if(dojo.isMoz){var B=H.window.getSelection();B.removeAllRanges();B.addRange(G);H._suppressAnnotationCreation=true;H.execCommand(D,K);H._suppressAnnotationCreation=false;B.removeAllRanges()}else{if(dojo.isIE){try{G.select()}catch(I){}H._suppressAnnotationCreation=true;H.execCommand(D,K);H._suppressAnnotationCreation=false;F()}}},boldRegion:function(K){function D(M){if(!M||!M.rangeNode){if(console&&console.log){console.log("_normalizeNodeOffsetObject failed");return }}if(M.rangeNode.tagName=="BR"||M.rangeNode.nodeName=="BR"){M.rangeOffset=0}}function E(){var M=G.document.body.createTextRange();M.collapse(true);try{M.select()}catch(N){}document.selection._selectedRange=M}var G=this;var J=K.start;var L=K.end+1;if(J<0||L<0){return }if(dojo.isMoz){var B=G.window.getSelection();if(!B){setTimeout(function(){G.boldRegion(K)},0);return }}var I=this.getNodeOffsetObject(J);var C=this.getNodeOffsetObject(L);D(I);D(C);var F={};if(dojo.isMoz){var F=G.document.createRange();F.setStart(I.rangeNode,I.rangeOffset);F.setEnd(C.rangeNode,C.rangeOffset)}else{if(dojo.isIE){var F=G.document.body.createTextRange();var A=G.document.body.createTextRange();G.ieSetStart(F,I.rangeNode,I.rangeOffset);G.ieSetEnd(A,C.rangeNode,C.rangeOffset);F.setEndPoint("EndToStart",A);try{F.select()}catch(H){}document.selection._selectedRange=F}}if(dojo.isMoz){var B=G.window.getSelection();B.removeAllRanges();B.addRange(F);G._suppressAnnotationCreation=true;G.document.execCommand("bold",false,null);G._suppressAnnotationCreation=false;B.removeAllRanges()}else{if(dojo.isIE){try{F.select()}catch(H){}G._suppressAnnotationCreation=true;G.document.execCommand("bold",false,null);G._suppressAnnotationCreation=false;E()}}},calculateContrastColor:function(A){if(A=="inherit"){return"#000000"}var D=this._intFromRGB(A);var F=D%256;D=(D-F)/256;var C=D%256;D=(D-C)/256;var B=D;var E=(Math.max(B,Math.max(C,F))+Math.min(B,Math.min(C,F)))/2;return(E<120)?"#FFFFFF":"#000000"},_intFromRGB:function(A){if(A){var B=A.match(/RGB\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/);if(B){return(parseInt(B[1],10)+parseInt(B[2],10)*256+parseInt(B[3])*256*256)}}return null},_RGBfromInt:function(A){return String.format("RGB({2},{1},{0})",(A&16711680)>>16,(A&65280)>>8,A&255)}});if(!top.LF){top.LF={}}LF.Notifier={};LF.Notifier.InterfaceMembers={initializeEvents:function(){this.events={};this.eventsFirstClass={}},registerEventType:function(A){if(!this.events[A]){this.events[A]={};this.eventsFirstClass[A]={}}},hasEventType:function(A){if(this.events[A]){return true}return false},getEventTypes:function(){var B=new Array();var A=0;for(name in this.events){B[A]=name;A++}return B},subscribe:function(C,E,B){var A=E.id;var D=B?this.eventsFirstClass:this.events;var F=D[C];if(F){if(!F[A]){F[A]=E}}},unsubscribe:function(C,E,B){var A=E.id;var D=B?this.eventsFirstClass:this.events;var F=D[C];if(F){if(F[A]){delete F[A]}}},_notify:function(C,A){var B={type:C,src:this,args:A};var D=this.eventsFirstClass[C];for(listenerid in D){D[listenerid].notify(B)}D=this.events[C];for(listenerid in D){D[listenerid].notify(B)}}};LF.Notifier.applyInterface=function(B){var A=LF.Notifier.InterfaceMembers;for(member in A){B.prototype[member]=A[member]}};LF.Listener=function(A){this.id=A;this.handlers={};this._active=true};LF.Listener.prototype={setHandler:function(A,B){this.handlers[A]=B},notify:function(B){if(!this._active){return }var A=this.handlers[B.type];if(A){A(B)}},turnOff:function(){this._active=false},turnOn:function(){this._active=true}};if(typeof (Laserfiche)=="undefined"){Laserfiche={}}Laserfiche.MetadataCoordinator=function(A){var B=this;this._repoName=null;this._entryInfoArray=null;this._ctrlID=A;this._eventHandler=new Sys.EventHandlerList();this.initializeEvents();this.registerEventType("onSelectionChanging");this.registerEventType("onSelectionChanged");this.registerEventType("childControlChanged");this._controller=null;this.listener=new LF.Listener("MetadataCoordinator"+this._ctrlID);this.metadataFlags=15;this._entryArray=[];this.clearChanges()};Laserfiche.MetadataCoordinator.prototype={get_metadataViewControl:function(){return metadataviewControl},addSelectedEntryListener:function(){this.listener.setHandler("SelectedEntryChanged",this.GetOnSelectedEntryChanged());this.listener.setHandler("EntryOpened",this.GetOnEntryOpened())},addMetadataOpenedListener:function(){this.listener.setHandler("EntryOpened",this.GetOnEntryOpened());this.listener.setHandler("MetadataOpened",this.GetOnMetadataOpened());this.listener.setHandler("ModeChanged",this.GetOnModeChanged())},set_controller:function(A,C){var B=this;this._controller=A;A.subscribe("SelectedEntryChanged",this.listener,!!C);A.subscribe("EntryOpened",this.listener,!!C)},set_controller2:function(A,C){var B=this;this._controller=A;A.subscribe("EntryOpened",this.listener,!!C);A.subscribe("MetadataOpened",this.listener,!!C);A.subscribe("ModeChanged",this.listener,!!C)},refresh:function(){var D=this;function B(){D.clearChanges();D.setNewEntries(D._repoName,D._entryArray,true)}function F(G){top.lostConnectionHandler.onLostConnection(G,B,function(){})}function A(G,I,H){if(G){B()}else{F(I.repository)}}function E(H,I,G){if(Laserfiche.Exception.IsConnectionLost(H)){F(I.repository)}}var C={repository:D._repoName};Laserfiche.WebAccess.DocumentService.HasDbConnection(D._repoName,A,E,C)},setNewEntries:function(B,H,I){I=!!I;var C=H;var E=this;var D=function(J){E.get_metadataViewControl().setAvailableMetadata(true,true,!!J.links,!!J.versions);E._notify("onSelectionChanged",{metadata:J,repository:B,entries:H})};var A=function(J){if(top.console&&top.console.error){top.console.error(dojo.string.substitute("Attempt to retreive metadata failed for ${0}",[H.join(",")]))}};this._repoName=B;var F=true;if(this._entryArray.length!=H.length){F=false}else{for(var G=0;G<this._entryArray.length;G++){if(this._entryArray[G]!=H[G]){F=false;break}}}if(!F||I){this._entryArray=H;E._notify("onSelectionChanging",{});Laserfiche.WebAccess.MetadataService.GetMetadata(B,C,this.metadataFlags,D,A)}},reset:function(){this.clearChanges();this._entryArray=[]},clearChanges:function(){this.mcChanges=new Laserfiche.WebAccess.Common.MetadataChanges();this.mcChanges.newTemplateId=0;this.mcChanges.removeTemplate=false;this.mcChanges.fieldChanges=[];this.mcChanges.tagChanges=[];this.mcChanges.linkChanges=[]},getChanges:function(H,D,C,G){var E=new Laserfiche.WebAccess.Common.MetadataChanges();E.newTemplateId=0;E.removeTemplate=false;E.fieldChanges=[];E.tagChanges=[];E.linkChanges=[];if(H){var F=H.getChanges();E.newTemplateId=F.templateFieldChanges.templateId;E.removeTemplate=F.templateFieldChanges.removeTemplate;E.fieldChanges=F.templateFieldChanges.fieldChanges;E.fieldChanges=E.fieldChanges.concat(F.supplementalFieldChanges)}if(D){var B=D.getChanges();E.tagChanges=B}if(C){var A=C.getChanges();E.linkChanges=A}return E},compileChanges:function(D,B,A,C){this.mcChanges=this.getChanges(D,B,A,C)},update:function(){var D=this;var F=D.mcChanges;var E=function(){D.updateSuccessfulHandler()};var A=function(H){D.updateFailedHandler(H)};var G=D.getEntryIdArray();var B=function(I,J,H){var K=function(){Laserfiche.WebAccess.MetadataService.UpdateMetadata(J.repository,J.entries,J.changes,J.onLoginSuccess,function(){})};if(Laserfiche.Exception.IsConnectionLost(I)){top.lostConnectionHandler.onLostConnection(J.repository,K,function(){})}else{J.onFailed(I)}};var C={re