// Compressed version of www/js/multi.js www/js/newstore.js.
function dispatch(A){clearPage();if(!(siteInfo.anonymous||user)){Mold.cast(getPage(),template("site/noanon"))}else{if(!A){showStoreList()}else{if(A=="users"){userList()}else{showMessage("Resource '"+A+"' not found.",true,true)}}}}connect(window,"load",function(){defineMoldInstructions();initUser(function(){loadInfo(function(){dhtmlHistory.initialize(doDispatch)})})});function loadInfo(C){fetchJSON("site/info",[],B,A);function B(D){siteInfo=D;siteInfo.showStoreList=true;initLayout();C()}function A(D,E){initLayout();showDialog("Could not connect to server ("+D+"). Retry?",refresh,null,true,true)}}function showStoreList(){fetchJSON("site/stores",[],B,A);Mold.cast(getPage(),template("message/loading"));function B(C){Mold.cast(getPage(),template("site/stores"),C)}function A(C){clearPage();failMessage("Loading store list",C)}}function setGoogleKey(A){activityPost("site/googlekey",[A],"Saving key",function(){siteInfo.googleKey=A},false)}function setPrologEnabled(A){activityPost("site/prolog",[A],"Changing Prolog setting",function(){siteInfo.prolog=A},false)}function setAnonymousAccess(A){activityPost("site/access",[A,siteInfo.newAccounts],"Changing anonymous setting",function(){siteInfo.anonymous=A},false)}function setNewAccounts(A){activityPost("site/access",[siteInfo.anonymous,A],"Changing new account setting",function(){siteInfo.newAccounts=A},false)}function setSiteTimeout(B){var A=Number(B);if(isNaN(A)||A<=0){showMessage("'"+B+"' is not a valid amount of seconds.",false,true)}else{activityPost("site/timeout",[A],"Saving timeout",function(){siteInfo.timeout=A},false)}}function newLocalStore(A,B,C){activityPost("site/store/local/add",[A,B,C],"Adding store")}function newEmptyStore(A,B){activityPost("site/store/empty/add",[A,B],"Adding store")}function newRemoteStore(B,C,E,A,D){A=Number(A);if(isNaN(A)||A<=0){showMessage("The port must be a positive integer.",true,true)}else{activityPost("site/store/remote/add",[B,C,E,A,D],"Adding store")}}function newFederatedStore(A,B){activityPost("site/store/federated/add",[A,B],"Adding store")}function deleteStore(A){showDialog("Close store '"+A+"'?",B,null,false,false);function B(){activityPost("site/store/delete",[A],"Closing store")}}function disableStore(A){activityPost("site/store/disable",[A],"Disabling store")}function enableStore(A){activityPost("site/store/enable",[A],"Enabling store")};