+/*
+ * stafforg: crew organizaion app
+ * author: hackbard@hackdaworld.org
+ *
+ */
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+var stafforg = {
+ init: function() {
+ document.addEventListener('deviceready',this.startup,false);
+ window.addEventListener('orientationchange',function() {
+ setTimeout(function() {
+ cl("orientation change ...");
+ },200);
+ });
+ },
+ startup: function() {
+ cl("starting stafforg app ...");
+ // ui
+ stafforg.activate_subapp('start');
+ $('.startbtn').click(function(event) {
+ cl("clicked "+event.target.id);
+ stafforg.event_action(event,'start');
+ });
+ // db
+ },
+ dbcb: function() {
+ },
+ activate_subapp: function(sapp) {
+ $('.startbtn').each(function() {
+ var sappname=this.id.replace(/^sel/,'');
+ var sappid='#'+sappname;
+ $(sappid).css('height','100%');
+ if(sappname==sapp)
+ $(sappid).css('display','block');
+ else
+ $(sappid).css('display','none');
+ });
+ if(sapp=='start') {
+ var sappid='#'+sapp;
+ $(sappid).css('height','100%');
+ $(sappid).css('display','block');
+ }
+ },
+ event_action: function() {
+ }
+};
+
+$(document).ready(function() {
+ if('cordova' in window) {
+ stafforg.init();
+ }
+ else {
+ stafforg.startup();
+ }
+});
+