-var limit = document.getElementById('limit');
-var span = document.getElementById('span_limit');
-var old_limit = 0;
+/**
+ * JavaScript for ext-surfbar - member booking script
+ * --------------------------------------------------------------------
+ * Copyright (c) 2003 - 2009 by Roland Haeder
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team
+ * For more information visit: http://mxchange.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
-function FocusLimitedNo () {
+var limit = document.getElementById('limit');
+var span = document.getElementById('span_limit');
+var limited_no = document.getElementById('limited_no');
+var limited_yes = document.getElementById('limited_yes');
+
+var old_limit = 0;
+
+function focusLimitedNo () {
if ((limit.value > 0) && (limit.value != '-')) {
old_limit = limit.value;
}
+ limited_no.focus();
+ limited_yes.blur();
limit.disabled = true;
limit.setAttribute('class', 'disabled');
- limit.style.textAlign = 'center';
limit.value = '-';
+ return true;
}
-function FocusLimitedYes () {
+function focusLimitedYes () {
limit.disabled = false;
- limit.setAttribute('class', 'member_normal');
+ limit.setAttribute('class', 'form_field');
limit.style.textAlign = 'left';
if (old_limit > 0) {
limit.value = old_limit;
limit.value = '';
}
limit.focus();
+ return true;
+}
+
+function changeLimited () {
+ if ((limit.value == '') || (limit.value == 0)) {
+ focusLimitedNo();
+ }
+ return true;
+}
+
+function focusLimit () {
+ limited_yes.focus();
+ limited_no.blur();
+ limit.focus();
+ if (limit.value == '-') {
+ limit.value = '';
+ }
+ return true;
}
-function SubmitForm () {
+function blurLimit () {
+ if ((limit.value == '') || (limit.value == 0)) {
+ limit.value = '-';
+ }
+ return true;
+}
+
+function submitForm () {
if (limit.value == '-') {
limit.value = 0;
}
return true;
}
-function ResetForm () {
+function resetForm () {
old_limit = 0;
- FocusLimitedNo();
+ focusLimitedNo();
return true;
}
-FocusLimitedNo();
+focusLimitedNo();
+document.getElementById('url').focus();
+
+// Register all event listeners
+$('#book').submit(function() {
+ return submitForm();
+});
+
+$('#reset').click(function() {
+ return resetForm();
+});
+
+$('#limit').click(function() {
+ return focusLimit();
+});
+
+$('#limit').blur(function() {
+ return blurLimit();
+});
+
+$('#limit').change(function() {
+ return changeLimited();
+});
+
+$('#limited_no').click(function() {
+ return focusLimitedNo();
+});
+
+$('#limited_yes').click(function() {
+ return focusLimitedYes();
+});