',
ww = wheels[i],
w = ww.values ? ww : convert(ww),
l = 1,
labels = w.labels || [],
values = w.values,
keys = w.keys || values;
$.each(values, function (j, v) {
if (l % 20 == 0) {
html += '
' + (!modal ? '
' : '
') + '
',
isMinw = $.isArray(s.minWidth),
isMaxw = $.isArray(s.maxWidth),
isFixw = $.isArray(s.fixedWidth);
$.each(s.wheels, function (i, wg) { // Wheel groups
html += '
';
});
html += '
';
if (modal && hasButtons) {
html += '
';
$.each(buttons, function (i, b) {
b = (typeof b === 'string') ? that.buttons[b] : b;
html += '
' + b.text + '';
});
html += '
';
}
html += '
';
dw = $(html);
persp = $('.dw-persp', dw);
overlay = $('.dwo', dw);
visible = true;
scrollToPos();
event('onMarkupReady', [dw]);
// Show
if (modal) {
ms.activeInstance = that;
dw.appendTo(s.context);
if (anim && !prevAnim) {
dw.addClass('dw-trans');
// Remove animation class
setTimeout(function () {
dw.removeClass('dw-trans').find('.dw').removeClass(mAnim);
}, 350);
}
} else if (elm.is('div')) {
elm.html(dw);
} else {
dw.insertAfter(elm);
}
event('onMarkupInserted', [dw]);
if (modal) {
// Enter / ESC
$(window).on('keydown.dw', function (e) {
if (e.keyCode == 13) {
that.select();
} else if (e.keyCode == 27) {
that.cancel();
}
});
// Prevent scroll if not specified otherwise
if (s.scrollLock) {
dw.on('touchmove', function (e) {
if (lock) {
e.preventDefault();
}
});
}
// Disable inputs to prevent bleed through (Android bug) and set autocomplete to off (for Firefox)
$('input,select,button', doc).each(function () {
if (!this.disabled) {
if ($(this).attr('autocomplete')) {
$(this).data('autocomplete', $(this).attr('autocomplete'));
}
$(this).addClass('dwtd').prop('disabled', true).attr('autocomplete', 'off');
}
});
attachPosition('scroll.dw', true);
}
// Set position
that.position();
attachPosition('orientationchange.dw resize.dw', false);
// Events
dw.on('DOMMouseScroll mousewheel', '.dwwl', onScroll)
.on('keydown', '.dwwl', onKeyDown)
.on('keyup', '.dwwl', onKeyUp)
.on('selectstart mousedown', prevdef) // Prevents blue highlight on Android and text selection in IE
.on('click', '.dwb-e', prevdef)
.on('keydown', '.dwb-e', function (e) {
if (e.keyCode == 32) { // Space
e.preventDefault();
e.stopPropagation();
$(this).click();
}
});
setTimeout(function () {
// Init buttons
$.each(buttons, function (i, b) {
that.tap($('.dwb' + i, dw), function (e) {
b = (typeof b === 'string') ? that.buttons[b] : b;
b.handler.call(this, e, that);
});
});
if (s.closeOnOverlay) {
that.tap(overlay, function () {
that.cancel();
});
}
dw.on(START_EVENT, '.dwwl', onStart).on(START_EVENT, '.dwb-e', onBtnStart);
}, 300);
event('onShow', [dw, v]);
};
/**
* Hides the scroller instance.
*/
that.hide = function (prevAnim, btn, force) {
// If onClose handler returns false, prevent hide
if (!visible || (!force && event('onClose', [v, btn]) === false)) {
return false;
}
// Re-enable temporary disabled fields
$('.dwtd', doc).each(function () {
$(this).prop('disabled', false).removeClass('dwtd');
if ($(this).data('autocomplete')) {
$(this).attr('autocomplete', $(this).data('autocomplete'));
} else {
$(this).removeAttr('autocomplete');
}
});
// Hide wheels and overlay
if (dw) {
var doAnim = modal && anim && !prevAnim;
if (doAnim) {
dw.addClass('dw-trans').find('.dw').addClass('dw-' + anim + ' dw-out');
}
if (prevAnim) {
dw.remove();
} else {
setTimeout(function () {
dw.remove();
if (activeElm) {
preventShow = true;
activeElm.focus();
}
}, doAnim ? 350 : 1);
}
// Stop positioning on window resize
wndw.off('.dw');
}
delete ms.activeInstance;
pixels = {};
visible = false;
};
/**
* Set button handler.
*/
that.select = function () {
if (that.hide(false, 'set') !== false) {
setVal(true, true, 0, true);
event('onSelect', [that.val]);
}
};
/**
* Show mobiscroll on focus and click event of the parameter.
* @param {jQuery} elm - Events will be attached to this element.
* @param {Function} [beforeShow=undefined] - Optional function to execute before showing mobiscroll.
*/
that.attachShow = function (elm, beforeShow) {
elmList.push(elm);
if (s.display !== 'inline') {
elm.on((s.showOnFocus ? 'focus.dw' : '') + (s.showOnTap ? ' click.dw' : ''), function (ev) {
if ((ev.type !== 'focus' || (ev.type === 'focus' && !preventShow)) && !tap) {
if (beforeShow) {
beforeShow();
}
activeElm = elm;
that.show();
}
setTimeout(function () {
preventShow = false;
}, 300); // With jQuery < 1.9 focus is fired twice in IE
});
}
};
/**
* Cancel and hide the scroller instance.
*/
that.cancel = function () {
if (that.hide(false, 'cancel') !== false) {
event('onCancel', [that.val]);
}
};
/**
* Scroller initialization.
*/
that.init = function (ss) {
// Get theme defaults
theme = ms.themes[ss.theme || s.theme];
// Get language defaults
lang = ms.i18n[ss.lang || s.lang];
extend(settings, ss); // Update original user settings
event('onThemeLoad', [lang, settings]);
extend(s, lang, theme, userdef, settings);
// Add default buttons
s.buttons = s.buttons || ['set', 'cancel'];
// Hide header text in inline mode by default
s.headerText = s.headerText === undefined ? (s.display !== 'inline' ? '{value}' : false) : s.headerText;
that.settings = s;
// Unbind all events (if re-init)
elm.off('.dw');
var preset = ms.presets[s.preset];
if (preset) {
pres = preset.call(e, that);
extend(s, pres, settings); // Load preset settings
}
// Set private members
m = Math.floor(s.rows / 2);
hi = s.height;
anim = s.animate;
modal = s.display !== 'inline';
buttons = s.buttons;
wndw = $(s.context == 'body' ? window : s.context);
doc = $(s.context)[0];
if (!s.setText) {
buttons.splice($.inArray('set', buttons), 1);
}
if (!s.cancelText) {
buttons.splice($.inArray('cancel', buttons), 1);
}
if (s.button3) {
buttons.splice($.inArray('set', buttons) + 1, 0, { text: s.button3Text, handler: s.button3 });
}
that.context = wndw;
that.live = !modal || ($.inArray('set', buttons) == -1);
that.buttons.set = { text: s.setText, css: 'dwb-s', handler: that.select };
that.buttons.cancel = { text: (that.live) ? s.closeText : s.cancelText, css: 'dwb-c', handler: that.cancel };
that.buttons.clear = { text: s.clearText, css: 'dwb-cl', handler: function () {
that.trigger('onClear', [dw]);
elm.val('');
if (!that.live) {
that.hide(false, 'clear');
}
}};
hasButtons = buttons.length > 0;
if (visible) {
that.hide(true, false, true);
}
if (modal) {
read();
if (input) {
// Set element readonly, save original state
if (readOnly === undefined) {
readOnly = e.readOnly;
}
e.readOnly = true;
}
that.attachShow(elm);
} else {
that.show();
}
if (input) {
elm.on('change.dw', function () {
if (!preventChange) {
that.setValue(elm.val(), false, 0.2);
}
preventChange = false;
});
}
};
/**
* Sets one ore more options.
*/
that.option = function (opt, value) {
var obj = {};
if (typeof opt === 'object') {
obj = opt;
} else {
obj[opt] = value;
}
that.init(obj);
};
/**
* Destroys the mobiscroll instance.
*/
that.destroy = function () {
that.hide(true, false, true);
// Remove all events from elements
$.each(elmList, function (i, v) {
v.off('.dw');
});
// Remove events from window
$(window).off('.dwa');
// Reset original readonly state
if (input) {
e.readOnly = readOnly;
}
// Delete scroller instance
delete instances[e.id];
event('onDestroy', []);
};
/**
* Returns the mobiscroll instance.
*/
that.getInst = function () {
return that;
};
/**
* Returns the closest valid cell.
*/
that.getValidCell = getValid;
/**
* Triggers a mobiscroll event.
*/
that.trigger = event;
instances[e.id] = that;
that.values = null;
that.val = null;
that.temp = null;
that.buttons = {};
that._selectedValues = {};
that.init(settings);
}
function setTap() {
tap = true;
setTimeout(function () {
tap = false;
}, 300);
}
function constrain(val, min, max) {
return Math.max(min, Math.min(val, max));
}
function convert(w) {
var ret = {
values: [],
keys: []
};
$.each(w, function (k, v) {
ret.keys.push(k);
ret.values.push(v);
});
return ret;
}
var activeElm,
move,
tap,
preventShow,
ms = $.mobiscroll,
instances = ms.instances,
util = ms.util,
prefix = util.prefix,
pr = util.jsPrefix,
has3d = util.has3d,
getCoord = util.getCoord,
testTouch = util.testTouch,
empty = function () {},
prevdef = function (e) { e.preventDefault(); },
extend = $.extend,
START_EVENT = 'touchstart mousedown',
MOVE_EVENT = 'touchmove mousemove',
END_EVENT = 'touchend mouseup',
userdef = ms.userdef,
defaults = extend(ms.defaults, {
// Options
width: 70,
height: 40,
rows: 3,
delay: 300,
disabled: false,
readonly: false,
closeOnOverlay: true,
showOnFocus: true,
showOnTap: true,
showLabel: true,
wheels: [],
theme: '',
display: 'modal',
mode: 'scroller',
preset: '',
lang: 'en-US',
context: 'body',
scrollLock: true,
tap: true,
btnWidth: true,
speedUnit: 0.0012,
timeUnit: 0.1,
formatResult: function (d) {
return d.join(' ');
},
parseValue: function (value, inst) {
var val = value.split(' '),
ret = [],
i = 0,
keys;
$.each(inst.settings.wheels, function (j, wg) {
$.each(wg, function (k, w) {
w = w.values ? w : convert(w);
keys = w.keys || w.values;
if ($.inArray(val[i], keys) !== -1) {
ret.push(val[i]);
} else {
ret.push(keys[0]);
}
i++;
});
});
return ret;
}
});
// English language module
ms.i18n.en = ms.i18n['en-US'] = {
setText: 'Set',
selectedText: 'Selected',
closeText: 'Close',
cancelText: 'Cancel',
clearText: 'Clear'
};
// Prevent re-show on window focus
$(window).on('focus', function () {
if (activeElm) {
preventShow = true;
}
});
$(document).on('mouseover mouseup mousedown click', function (e) { // Prevent standard behaviour on body click
if (tap) {
e.stopPropagation();
e.preventDefault();
return false;
}
});
})(jQuery);
;
/*jslint eqeq: true, plusplus: true, undef: true, sloppy: true, vars: true, forin: true */
(function ($) {
var ms = $.mobiscroll,
date = new Date(),
defaults = {
startYear: date.getFullYear() - 100,
endYear: date.getFullYear() + 1,
shortYearCutoff: '+10',
showNow: false,
stepHour: 1,
stepMinute: 1,
stepSecond: 1,
separator: ' ',
ampmText: ' '
},
/**
* @class Mobiscroll.datetime
* @extends Mobiscroll
* Mobiscroll Datetime component
*/
preset = function (inst) {
var that = $(this),
html5def = {},
format;
// Force format for html5 date inputs (experimental)
if (that.is('input')) {
switch (that.attr('type')) {
case 'date':
format = 'yy-mm-dd';
break;
case 'datetime':
format = 'yy-mm-ddTHH:ii:ssZ';
break;
case 'datetime-local':
format = 'yy-mm-ddTHH:ii:ss';
break;
case 'month':
format = 'yy-mm';
html5def.dateOrder = 'mmyy';
break;
case 'time':
format = 'HH:ii:ss';
break;
}
// Check for min/max attributes
var min = that.attr('min'),
max = that.attr('max');
if (min) {
html5def.minDate = ms.parseDate(format, min);
}
if (max) {
html5def.maxDate = ms.parseDate(format, max);
}
}
// Set year-month-day order
var i,
k,
keys,
values,
wg,
start,
end,
invalid,
hasTime,
orig = $.extend({}, inst.settings),
s = $.extend(inst.settings, defaults, html5def, orig),
offset = 0,
wheels = [],
ord = [],
o = {},
f = { y: 'getFullYear', m: 'getMonth', d: 'getDate', h: getHour, i: getMinute, s: getSecond, a: getAmPm },
p = s.preset,
dord = s.dateOrder,
tord = s.timeWheels,
regen = dord.match(/D/),
ampm = tord.match(/a/i),
hampm = tord.match(/h/),
hformat = p == 'datetime' ? s.dateFormat + s.separator + s.timeFormat : p == 'time' ? s.timeFormat : s.dateFormat,
defd = new Date(),
stepH = s.stepHour,
stepM = s.stepMinute,
stepS = s.stepSecond,
mind = s.minDate || new Date(s.startYear, 0, 1),
maxd = s.maxDate || new Date(s.endYear, 11, 31, 23, 59, 59);
format = format || hformat;
if (p.match(/date/i)) {
// Determine the order of year, month, day wheels
$.each(['y', 'm', 'd'], function (j, v) {
i = dord.search(new RegExp(v, 'i'));
if (i > -1) {
ord.push({ o: i, v: v });
}
});
ord.sort(function (a, b) { return a.o > b.o ? 1 : -1; });
$.each(ord, function (i, v) {
o[v.v] = i;
});
wg = [];
for (k = 0; k < 3; k++) {
if (k == o.y) {
offset++;
values = [];
keys = [];
start = mind.getFullYear();
end = maxd.getFullYear();
for (i = start; i <= end; i++) {
keys.push(i);
values.push(dord.match(/yy/i) ? i : (i + '').substr(2, 2));
}
addWheel(wg, keys, values, s.yearText);
} else if (k == o.m) {
offset++;
values = [];
keys = [];
for (i = 0; i < 12; i++) {
var str = dord.replace(/[dy]/gi, '').replace(/mm/, i < 9 ? '0' + (i + 1) : i + 1).replace(/m/, (i + 1));
keys.push(i);
values.push(str.match(/MM/) ? str.replace(/MM/, '
' + s.monthNames[i] + '') : str.replace(/M/, '
' + s.monthNamesShort[i] + ''));
}
addWheel(wg, keys, values, s.monthText);
} else if (k == o.d) {
offset++;
values = [];
keys = [];
for (i = 1; i < 32; i++) {
keys.push(i);
values.push(dord.match(/dd/i) && i < 10 ? '0' + i : i);
}
addWheel(wg, keys, values, s.dayText);
}
}
wheels.push(wg);
}
if (p.match(/time/i)) {
hasTime = true;
// Determine the order of hours, minutes, seconds wheels
ord = [];
$.each(['h', 'i', 's', 'a'], function (i, v) {
i = tord.search(new RegExp(v, 'i'));
if (i > -1) {
ord.push({ o: i, v: v });
}
});
ord.sort(function (a, b) {
return a.o > b.o ? 1 : -1;
});
$.each(ord, function (i, v) {
o[v.v] = offset + i;
});
wg = [];
for (k = offset; k < offset + 4; k++) {
if (k == o.h) {
offset++;
values = [];
keys = [];
for (i = 0; i < (hampm ? 12 : 24); i += stepH) {
keys.push(i);
values.push(hampm && i == 0 ? 12 : tord.match(/hh/i) && i < 10 ? '0' + i : i);
}
addWheel(wg, keys, values, s.hourText);
} else if (k == o.i) {
offset++;
values = [];
keys = [];
for (i = 0; i < 60; i += stepM) {
keys.push(i);
values.push(tord.match(/ii/) && i < 10 ? '0' + i : i);
}
addWheel(wg, keys, values, s.minuteText);
} else if (k == o.s) {
offset++;
values = [];
keys = [];
for (i = 0; i < 60; i += stepS) {
keys.push(i);
values.push(tord.match(/ss/) && i < 10 ? '0' + i : i);
}
addWheel(wg, keys, values, s.secText);
} else if (k == o.a) {
offset++;
var upper = tord.match(/A/);
addWheel(wg, [0, 1], upper ? [s.amText.toUpperCase(), s.pmText.toUpperCase()] : [s.amText, s.pmText], s.ampmText);
}
}
wheels.push(wg);
}
function get(d, i, def) {
if (o[i] !== undefined) {
return +d[o[i]];
}
if (def !== undefined) {
return def;
}
return defd[f[i]] ? defd[f[i]]() : f[i](defd);
}
function addWheel(wg, k, v, lbl) {
wg.push({
values: v,
keys: k,
label: lbl
});
}
function step(v, st) {
return Math.floor(v / st) * st;
}
function getHour(d) {
var hour = d.getHours();
hour = hampm && hour >= 12 ? hour - 12 : hour;
return step(hour, stepH);
}
function getMinute(d) {
return step(d.getMinutes(), stepM);
}
function getSecond(d) {
return step(d.getSeconds(), stepS);
}
function getAmPm(d) {
return ampm && d.getHours() > 11 ? 1 : 0;
}
function getDate(d) {
var hour = get(d, 'h', 0);
return new Date(get(d, 'y'), get(d, 'm'), get(d, 'd', 1), get(d, 'a', 0) ? hour + 12 : hour, get(d, 'i', 0), get(d, 's', 0));
}
function getIndex(t, v) {
return $('.dw-li', t).index($('.dw-li[data-val="' + v + '"]', t));
}
function getValidIndex(t, v, max, add) {
if (v < 0) {
return 0;
}
if (v > max) {
return $('.dw-li', t).length;
}
return getIndex(t, v) + add;
}
// Extended methods
// ---
/**
* Sets the selected date
*
* @param {Date} d Date to select.
* @param {Boolean} [fill=false] Also set the value of the associated input element. Default is true.
* @param {Number} [time=0] Animation time to scroll to the selected date.
* @param {Boolean} [temp=false] Set temporary value only.
* @param {Boolean} [change=fill] Trigger change on input element.
*/
inst.setDate = function (d, fill, time, temp, change) {
var i;
// Set wheels
for (i in o) {
inst.temp[o[i]] = d[f[i]] ? d[f[i]]() : f[i](d);
}
inst.setValue(inst.temp, fill, time, temp, change);
};
/**
* Returns the currently selected date.
*
* @param {Boolean} [temp=false] If true, return the currently shown date on the picker, otherwise the last selected one.
* @return {Date}
*/
inst.getDate = function (temp) {
return getDate(temp ? inst.temp : inst.values);
};
inst.convert = function (obj) {
var x = obj;
if (!$.isArray(obj)) { // Convert from old format
x = [];
$.each(obj, function (i, o) {
$.each(o, function (j, o) {
if (i === 'daysOfWeek') {
if (o.d) {
o.d = 'w' + o.d;
} else {
o = 'w' + o;
}
}
x.push(o);
});
});
}
return x;
};
inst.format = hformat;
inst.buttons.now = { text: s.nowText, css: 'dwb-n', handler: function () { inst.setDate(new Date(), false, 0.3, true, true); } };
if (s.showNow) {
s.buttons.splice($.inArray('set', s.buttons) + 1, 0, 'now');
}
invalid = s.invalid ? inst.convert(s.invalid) : false;
// ---
return {
wheels: wheels,
headerText: s.headerText ? function (v) {
return ms.formatDate(hformat, getDate(inst.temp), s);
} : false,
formatResult: function (d) {
return ms.formatDate(format, getDate(d), s);
},
parseValue: function (val) {
var d = ms.parseDate(format, val, s),
i,
result = [];
// Set wheels
for (i in o) {
result[o[i]] = d[f[i]] ? d[f[i]]() : f[i](d);
}
return result;
},
validate: function (dw, i, time, dir) {
var temp = inst.temp, //.slice(0),
mins = { y: mind.getFullYear(), m: 0, d: 1, h: 0, i: 0, s: 0, a: 0 },
maxs = { y: maxd.getFullYear(), m: 11, d: 31, h: step(hampm ? 11 : 23, stepH), i: step(59, stepM), s: step(59, stepS), a: 1 },
steps = { h: stepH, i: stepM, s: stepS, a: 1 },
y = get(temp, 'y'),
m = get(temp, 'm'),
minprop = true,
maxprop = true;
$.each(['y', 'm', 'd', 'a', 'h', 'i', 's'], function (x, i) {
if (o[i] !== undefined) {
var min = mins[i],
max = maxs[i],
maxdays = 31,
val = get(temp, i),
t = $('.dw-ul', dw).eq(o[i]);
if (i == 'd') {
maxdays = 32 - new Date(y, m, 32).getDate();
max = maxdays;
if (regen) {
$('.dw-li', t).each(function () {
var that = $(this),
d = that.data('val'),
w = new Date(y, m, d).getDay(),
str = dord.replace(/[my]/gi, '').replace(/dd/, d < 10 ? '0' + d : d).replace(/d/, d);
$('.dw-i', that).html(str.match(/DD/) ? str.replace(/DD/, '
' + s.dayNames[w] + '') : str.replace(/D/, '
' + s.dayNamesShort[w] + ''));
});
}
}
if (minprop && mind) {
min = mind[f[i]] ? mind[f[i]]() : f[i](mind);
}
if (maxprop && maxd) {
max = maxd[f[i]] ? maxd[f[i]]() : f[i](maxd);
}
if (i != 'y') {
var i1 = getIndex(t, min),
i2 = getIndex(t, max);
$('.dw-li', t).removeClass('dw-v').slice(i1, i2 + 1).addClass('dw-v');
if (i == 'd') { // Hide days not in month
$('.dw-li', t).removeClass('dw-h').slice(maxdays).addClass('dw-h');
}
}
if (val < min) {
val = min;
}
if (val > max) {
val = max;
}
if (minprop) {
minprop = val == min;
}
if (maxprop) {
maxprop = val == max;
}
// Disable some days
if (invalid && i == 'd') {
var d, j, k, v,
first = new Date(y, m, 1).getDay(),
idx = [];
for (j = 0; j < invalid.length; j++) {
d = invalid[j];
v = d + '';
if (!d.start) {
if (d.getTime) { // Exact date
if (d.getFullYear() == y && d.getMonth() == m) {
idx.push(d.getDate() - 1);
}
} else if (!v.match(/w/i)) { // Day of month
v = v.split('/');
if (v[1]) {
if (v[0] - 1 == m) {
idx.push(v[1] - 1);
}
} else {
idx.push(v[0] - 1);
}
} else { // Day of week
v = +v.replace('w', '');
for (k = v - first; k < maxdays; k += 7) {
if (k >= 0) {
idx.push(k);
}
}
}
}
}
$.each(idx, function (i, v) {
$('.dw-li', t).eq(v).removeClass('dw-v');
});
val = inst.getValidCell(val, t, dir).val;
}
// Set modified value
temp[o[i]] = val;
}
});
// Invalid times
if (hasTime && invalid) {
var dd, v, val, str, parts1, parts2, j, v1, v2, i1, i2, prop1, prop2, target, add, remove,
spec = {},
d = get(temp, 'd'),
day = new Date(y, m, d),
w = ['a', 'h', 'i', 's'];
$.each(invalid, function (i, obj) {
if (obj.start) {
obj.apply = false;
dd = obj.d;
v = dd + '';
str = v.split('/');
if (dd && ((dd.getTime && y == dd.getFullYear() && m == dd.getMonth() && d == dd.getDate()) || // Exact date
(!v.match(/w/i) && ((str[1] && d == str[1] && m == str[0] - 1) || (!str[1] && d == str[0]))) || // Day of month
(v.match(/w/i) && day.getDay() == +v.replace('w', '')) // Day of week
)) {
obj.apply = true;
spec[day] = true; // Prevent applying generic rule on day, if specific exists
}
}
});
$.each(invalid, function (i, obj) {
if (obj.start && (obj.apply || (!obj.d && !spec[day]))) {
parts1 = obj.start.split(':');
parts2 = obj.end.split(':');
for (j = 0; j < 3; j++) {
if (parts1[j] === undefined) {
parts1[j] = 0;
}
if (parts2[j] === undefined) {
parts2[j] = 59;
}
parts1[j] = +parts1[j];
parts2[j] = +parts2[j];
}
parts1.unshift(parts1[0] > 11 ? 1 : 0);
parts2.unshift(parts2[0] > 11 ? 1 : 0);
if (hampm) {
if (parts1[1] >= 12) {
parts1[1] = parts1[1] - 12;
}
if (parts2[1] >= 12) {
parts2[1] = parts2[1] - 12;
}
}
prop1 = true;
prop2 = true;
$.each(w, function (i, v) {
if (o[v] !== undefined) {
val = get(temp, v);
add = 0;
remove = 0;
i1 = 0;
i2 = undefined;
target = $('.dw-ul', dw).eq(o[v]);
// Look ahead if next wheels should be disabled completely
for (j = i + 1; j < 4; j++) {
if (parts1[j] > 0) {
add = steps[v];
}
if (parts2[j] < maxs[w[j]]) {
remove = steps[v];
}
}
// Calculate min and max values
v1 = step(parts1[i] + add, steps[v]);
v2 = step(parts2[i] - remove, steps[v]);
if (prop1) {
i1 = getValidIndex(target, v1, maxs[v], 0);
}
if (prop2) {
i2 = getValidIndex(target, v2, maxs[v], 1);
}
// Disable values
if (prop1 || prop2) {
$('.dw-li', target).slice(i1, i2).removeClass('dw-v');
}
// Get valid value
val = inst.getValidCell(val, target, dir).val;
prop1 = prop1 && val == step(parts1[i], steps[v]);
prop2 = prop2 && val == step(parts2[i], steps[v]);
// Set modified value
temp[o[v]] = val;
}
});
}
});
}
}
};
};
ms.i18n.en = $.extend(ms.i18n.en, {
dateFormat: 'mm/dd/yy',
dateOrder: 'mmddy',
timeWheels: 'hhiiA',
timeFormat: 'hh:ii A',
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
monthText: 'Month',
dayText: 'Day',
yearText: 'Year',
hourText: 'Hours',
minuteText: 'Minutes',
secText: 'Seconds',
amText: 'am',
pmText: 'pm',
nowText: 'Now'
});
$.each(['date', 'time', 'datetime'], function (i, v) {
ms.presets[v] = preset;
ms.presetShort(v);
});
/**
* Format a date into a string value with a specified format.
* @param {String} format Output format.
* @param {Date} date Date to format.
* @param {Object} [settings={}] Settings.
* @return {String} Returns the formatted date string.
*/
ms.formatDate = function (format, date, settings) {
if (!date) {
return null;
}
var s = $.extend({}, defaults, settings),
look = function (m) { // Check whether a format character is doubled
var n = 0;
while (i + 1 < format.length && format.charAt(i + 1) == m) {
n++;
i++;
}
return n;
},
f1 = function (m, val, len) { // Format a number, with leading zero if necessary
var n = '' + val;
if (look(m)) {
while (n.length < len) {
n = '0' + n;
}
}
return n;
},
f2 = function (m, val, s, l) { // Format a name, short or long as requested
return (look(m) ? l[val] : s[val]);
},
i,
output = '',
literal = false;
for (i = 0; i < format.length; i++) {
if (literal) {
if (format.charAt(i) == "'" && !look("'")) {
literal = false;
} else {
output += format.charAt(i);
}
} else {
switch (format.charAt(i)) {
case 'd':
output += f1('d', date.getDate(), 2);
break;
case 'D':
output += f2('D', date.getDay(), s.dayNamesShort, s.dayNames);
break;
case 'o':
output += f1('o', (date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
break;
case 'm':
output += f1('m', date.getMonth() + 1, 2);
break;
case 'M':
output += f2('M', date.getMonth(), s.monthNamesShort, s.monthNames);
break;
case 'y':
output += (look('y') ? date.getFullYear() : (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
break;
case 'h':
var h = date.getHours();
output += f1('h', (h > 12 ? (h - 12) : (h == 0 ? 12 : h)), 2);
break;
case 'H':
output += f1('H', date.getHours(), 2);
break;
case 'i':
output += f1('i', date.getMinutes(), 2);
break;
case 's':
output += f1('s', date.getSeconds(), 2);
break;
case 'a':
output += date.getHours() > 11 ? s.pmText : s.amText;
break;
case 'A':
output += date.getHours() > 11 ? s.pmText.toUpperCase() : s.amText.toUpperCase();
break;
case "'":
if (look("'")) {
output += "'";
} else {
literal = true;
}
break;
default:
output += format.charAt(i);
}
}
}
return output;
};
/**
* Extract a date from a string value with a specified format.
* @param {String} format Input format.
* @param {String} value String to parse.
* @param {Object} [settings={}] Settings.
* @return {Date} Returns the extracted date.
*/
ms.parseDate = function (format, value, settings) {
var s = $.extend({}, defaults, settings),
def = s.defaultValue || new Date();
if (!format || !value) {
return def;
}
value = (typeof value == 'object' ? value.toString() : value + '');
var shortYearCutoff = s.shortYearCutoff,
year = def.getFullYear(),
month = def.getMonth() + 1,
day = def.getDate(),
doy = -1,
hours = def.getHours(),
minutes = def.getMinutes(),
seconds = 0, //def.getSeconds(),
ampm = -1,
literal = false, // Check whether a format character is doubled
lookAhead = function (match) {
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
if (matches) {
iFormat++;
}
return matches;
},
getNumber = function (match) { // Extract a number from the string value
lookAhead(match);
var size = (match == '@' ? 14 : (match == '!' ? 20 : (match == 'y' ? 4 : (match == 'o' ? 3 : 2)))),
digits = new RegExp('^\\d{1,' + size + '}'),
num = value.substr(iValue).match(digits);
if (!num) {
return 0;
}
iValue += num[0].length;
return parseInt(num[0], 10);
},
getName = function (match, s, l) { // Extract a name from the string value and convert to an index
var names = (lookAhead(match) ? l : s),
i;
for (i = 0; i < names.length; i++) {
if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
iValue += names[i].length;
return i + 1;
}
}
return 0;
},
checkLiteral = function () {
iValue++;
},
iValue = 0,
iFormat;
for (iFormat = 0; iFormat < format.length; iFormat++) {
if (literal) {
if (format.charAt(iFormat) == "'" && !lookAhead("'")) {
literal = false;
} else {
checkLiteral();
}
} else {
switch (format.charAt(iFormat)) {
case 'd':
day = getNumber('d');
break;
case 'D':
getName('D', s.dayNamesShort, s.dayNames);
break;
case 'o':
doy = getNumber('o');
break;
case 'm':
month = getNumber('m');
break;
case 'M':
month = getName('M', s.monthNamesShort, s.monthNames);
break;
case 'y':
year = getNumber('y');
break;
case 'H':
hours = getNumber('H');
break;
case 'h':
hours = getNumber('h');
break;
case 'i':
minutes = getNumber('i');
break;
case 's':
seconds = getNumber('s');
break;
case 'a':
ampm = getName('a', [s.amText, s.pmText], [s.amText, s.pmText]) - 1;
break;
case 'A':
ampm = getName('A', [s.amText, s.pmText], [s.amText, s.pmText]) - 1;
break;
case "'":
if (lookAhead("'")) {
checkLiteral();
} else {
literal = true;
}
break;
default:
checkLiteral();
}
}
}
if (year < 100) {
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
(year <= (typeof shortYearCutoff != 'string' ? shortYearCutoff : new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10)) ? 0 : -100);
}
if (doy > -1) {
month = 1;
day = doy;
do {
var dim = 32 - new Date(year, month - 1, 32).getDate();
if (day <= dim) {
break;
}
month++;
day -= dim;
} while (true);
}
hours = (ampm == -1) ? hours : ((ampm && hours < 12) ? (hours + 12) : (!ampm && hours == 12 ? 0 : hours));
var date = new Date(year, month - 1, day, hours, minutes, seconds);
if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day) {
return def; // Invalid date
}
return date;
};
})(jQuery);
;
/*jslint eqeq: true, plusplus: true, undef: true, sloppy: true, vars: true, forin: true */
(function ($) {
var defaults = {
inputClass: '',
invalid: [],
rtl: false,
showInput: true,
group: false,
groupLabel: 'Groups'
};
$.mobiscroll.presetShort('select');
$.mobiscroll.presets.select = function (inst) {
var orig = $.extend({}, inst.settings),
s = $.extend(inst.settings, defaults, orig),
elm = $(this),
multiple = elm.prop('multiple'),
id = this.id + '_dummy',
option = multiple ? (elm.val() ? elm.val()[0] : $('option', elm).attr('value')) : elm.val(),
group = elm.find('option[value="' + option + '"]').parent(),
prev = group.index() + '',
gr = prev,
prevent,
l1 = $('label[for="' + this.id + '"]').attr('for', id),
l2 = $('label[for="' + id + '"]'),
label = s.label !== undefined ? s.label : (l2.length ? l2.text() : elm.attr('name')),
invalid = [],
origValues = [],
main = {},
grIdx,
optIdx,
timer,
input,
roPre = s.readonly,
w;
function genWheels() {
var cont,
wg = 0,
values = [],
keys = [],
w = [[]];
if (s.group) {
if (s.rtl) {
wg = 1;
}
$('optgroup', elm).each(function (i) {
values.push($(this).attr('label'));
keys.push(i);
});
w[wg] = [{
values: values,
keys: keys,
label: s.groupLabel
}];
cont = group;
wg += (s.rtl ? -1 : 1);
} else {
cont = elm;
}
values = [];
keys = [];
$('option', cont).each(function () {
var v = $(this).attr('value');
values.push($(this).text());
keys.push(v);
if ($(this).prop('disabled')) {
invalid.push(v);
}
});
w[wg] = [{
values: values,
keys: keys,
label: label
}];
return w;
}
function setVal(v, fill, change) {
var value = [];
if (multiple) {
var sel = [],
i = 0;
for (i in inst._selectedValues) {
sel.push(main[i]);
value.push(i);
}
input.val(sel.join(', '));
} else {
input.val(v);
value = fill ? inst.values[optIdx] : null;
}
if (fill) {
elm.val(value);
if (change) {
prevent = true;
elm.change();
}
}
}
function onTap(li) {
if (multiple && li.hasClass('dw-v') && li.closest('.dw').find('.dw-ul').index(li.closest('.dw-ul')) == optIdx) {
var val = li.attr('data-val'),
selected = li.hasClass('dw-msel');
if (selected) {
li.removeClass('dw-msel').removeAttr('aria-selected');
delete inst._selectedValues[val];
} else {
li.addClass('dw-msel').attr('aria-selected', 'true');
inst._selectedValues[val] = val;
}
if (inst.live) {
setVal(val, true, true);
}
return false;
}
}
// if groups is true and there are no groups fall back to no grouping
if (s.group && !$('optgroup', elm).length) {
s.group = false;
}
if (!s.invalid.length) {
s.invalid = invalid;
}
if (s.group) {
if (s.rtl) {
grIdx = 1;
optIdx = 0;
} else {
grIdx = 0;
optIdx = 1;
}
} else {
grIdx = -1;
optIdx = 0;
}
$('#' + id).remove();
input = $('
');
if (s.showInput) {
input.insertBefore(elm);
}
$('option', elm).each(function () {
main[$(this).attr('value')] = $(this).text();
});
inst.attachShow(input);
var v = elm.val() || [],
i = 0;
for (i; i < v.length; i++) {
inst._selectedValues[v[i]] = v[i];
}
setVal(main[option]);
elm.off('.dwsel').on('change.dwsel', function () {
if (!prevent) {
inst.setValue(multiple ? elm.val() || [] : [elm.val()], true);
}
prevent = false;
}).addClass('dw-hsel').attr('tabindex', -1).closest('.ui-field-contain').trigger('create');
// Extended methods
// ---
if (!inst._setValue) {
inst._setValue = inst.setValue;
}
inst.setValue = function (d, fill, time, temp, change) {
var value,
v = $.isArray(d) ? d[0] : d;
option = v !== undefined ? v : $('option', elm).attr('value');
if (multiple) {
inst._selectedValues = {};
var i = 0;
for (i; i < d.length; i++) {
inst._selectedValues[d[i]] = d[i];
}
}
if (s.group) {
group = elm.find('option[value="' + option + '"]').parent();
gr = group.index();
value = s.rtl ? [option, group.index()] : [group.index(), option];
if (gr !== prev) { // Need to regenerate wheels, if group changed
s.wheels = genWheels();
inst.changeWheel([optIdx]);
prev = gr + '';
}
} else {
value = [option];
}
inst._setValue(value, fill, time, temp, change);
// Set input/select values
if (fill) {
var changed = multiple ? true : option !== elm.val();
setVal(main[option], changed, change);
}
};
inst.getValue = function (temp) {
var val = temp ? inst.temp : inst.values;
return val[optIdx];
};
// ---
return {
width: 50,
wheels: w,
headerText: false,
multiple: multiple,
anchor: input,
formatResult: function (d) {
return main[d[optIdx]];
},
parseValue: function () {
var v = elm.val() || [],
i = 0;
if (multiple) {
inst._selectedValues = {};
for (i; i < v.length; i++) {
inst._selectedValues[v[i]] = v[i];
}
}
option = multiple ? (elm.val() ? elm.val()[0] : $('option', elm).attr('value')) : elm.val();
group = elm.find('option[value="' + option + '"]').parent();
gr = group.index();
prev = gr + '';
return s.group && s.rtl ? [option, gr] : s.group ? [gr, option] : [option];
},
validate: function (dw, i, time) {
if (i === undefined && multiple) {
var v = inst._selectedValues,
j = 0;
$('.dwwl' + optIdx + ' .dw-li', dw).removeClass('dw-msel').removeAttr('aria-selected');
for (j in v) {
$('.dwwl' + optIdx + ' .dw-li[data-val="' + v[j] + '"]', dw).addClass('dw-msel').attr('aria-selected', 'true');
}
}
if (i === grIdx) {
gr = inst.temp[grIdx];
if (gr !== prev) {
group = elm.find('optgroup').eq(gr);
gr = group.index();
option = group.find('option').eq(0).val();
option = option || elm.val();
s.wheels = genWheels();
if (s.group) {
inst.temp = s.rtl ? [option, gr] : [gr, option];
s.readonly = [s.rtl, !s.rtl];
clearTimeout(timer);
timer = setTimeout(function () {
inst.changeWheel([optIdx], undefined, true);
s.readonly = roPre;
prev = gr + '';
}, time * 1000);
return false;
}
} else {
s.readonly = roPre;
}
} else {
option = inst.temp[optIdx];
}
var t = $('.dw-ul', dw).eq(optIdx);
$.each(s.invalid, function (i, v) {
$('.dw-li[data-val="' + v + '"]', t).removeClass('dw-v');
});
},
onBeforeShow: function (dw) {
if (multiple && s.counter) {
s.headerText = function () {
var length = 0;
$.each(inst._selectedValues, function () {
length++;
});
return length + " " + s.selectedText;
};
}
s.wheels = genWheels();
if (s.group) {
inst.temp = s.rtl ? [option, group.index()] : [group.index(), option];
}
},
onClear: function (dw) {
inst._selectedValues = {};
input.val('');
$('.dwwl' + optIdx + ' .dw-li', dw).removeClass('dw-msel').removeAttr('aria-selected');
},
onMarkupReady: function (dw) {
dw.addClass('dw-select');
$('.dwwl' + grIdx, dw).on('mousedown touchstart', function () {
clearTimeout(timer);
});
if (multiple) {
dw.addClass('dwms');
$('.dwwl', dw).eq(optIdx).addClass('dwwms').attr('aria-multiselectable', 'true');
$('.dwwl', dw).on('keydown', function (e) {
if (e.keyCode == 32) { // Space
e.preventDefault();
e.stopPropagation();
onTap($('.dw-sel', this));
}
});
origValues = $.extend({}, inst._selectedValues);
}
},
onValueTap: onTap,
onSelect: function (v) {
setVal(v, true, true);
if (s.group) {
inst.values = null;
}
},
onCancel: function () {
if (s.group) {
inst.values = null;
}
if (!inst.live && multiple) {
inst._selectedValues = $.extend({}, origValues);
}
},
onChange: function (v) {
if (inst.live && !multiple) {
input.val(v);
prevent = true;
elm.val(inst.temp[optIdx]).change();
}
},
onDestroy: function () {
input.remove();
elm.removeClass('dw-hsel').removeAttr('tabindex');
}
};
};
})(jQuery);
;
(function ($) {
$.mobiscroll.themes.jqm = {
jqmBorder: 'a',
jqmBody: 'c',
jqmHeader: 'b',
jqmWheel: 'd',
jqmClickPick: 'c',
jqmSet: 'b',
jqmCancel: 'c',
disabledClass: 'ui-disabled',
activeClass: 'ui-btn-active',
activeTabInnerClass: 'ui-btn-active',
onThemeLoad: function (lang, s) {
var cal = s.jqmBody || 'c',
txt = s.jqmEventText || 'b',
bubble = s.jqmEventBubble || 'a';
s.dayClass = 'ui-body-a ui-body-' + cal;
s.validDayClass = 'ui-state-default ui-btn ui-btn-up-' + cal;
s.calendarClass = 'ui-body-a ui-body-' + cal;
s.weekNrClass = 'ui-body-a ui-body-' + cal;
s.eventTextClass = 'ui-btn-up-' + txt;
s.eventBubbleClass = 'ui-body-' + bubble;
},
onEventBubbleShow: function (evd, evc) {
$('.dw-cal-event-list', evc).attr('data-role', 'listview');
evc.page().trigger('create');
},
onMarkupInserted: function (elm, inst) {
var s = inst.settings;
$('.dw', elm).removeClass('dwbg').addClass('ui-selectmenu ui-overlay-shadow ui-corner-all ui-body-' + s.jqmBorder);
$('.dwbc .dwb', elm).attr('data-role', 'button').attr('data-mini', 'true').attr('data-theme', s.jqmCancel);
$('.dwb-s .dwb', elm).attr('data-theme', s.jqmSet);
$('.dwwb', elm).attr('data-role', 'button').attr('data-theme', s.jqmClickPick);
$('.dwv', elm).addClass('ui-header ui-bar-' + s.jqmHeader);
$('.dwwr', elm).addClass('ui-body-' + s.jqmBody);
$('.dwpm .dwwl', elm).addClass('ui-body-' + s.jqmWheel);
$('.dwpm .dwl', elm).addClass('ui-body-' + s.jqmBody);
// Calendar base
$('.dw-cal-tabs', elm).attr('data-role', 'navbar');
$('.dw-cal-prev .dw-cal-btn-txt', elm).attr('data-role', 'button').attr('data-icon', 'arrow-l').attr('data-iconpos', 'notext');
$('.dw-cal-next .dw-cal-btn-txt', elm).attr('data-role', 'button').attr('data-icon', 'arrow-r').attr('data-iconpos', 'notext');
// Calendar events
$('.dw-cal-events', elm).attr('data-role', 'page');
// Rangepicker
$('.dw-dr', elm).attr('data-role', 'button').attr('data-mini', 'true');
elm.trigger('create');
}
};
})(jQuery);
;
var pageID,version,CKEDITOR_BASEPATH="/ckeditor/";$s=function(a){return document.getElementById(a)};$$s=function(a){if(document.getElementsByClassName)return document.getElementsByClassName(a)};$$$s=function(a){return document.getElementsByName(a)};String.prototype.sha256=function(){return sha256_digest(this.salt+this)};var isMobile=/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?true:false;
$.validator.setDefaults({onkeyup:false,onclick:false,onfocusout:false,focusCleanup:false,focusInvalid:true,errorClass:"invalid",validClass:"valid",errorPlacement:function(){},ignoreTitle:true,highlight:function(a,b,c){$(a).addClass(b).removeClass(c);(a=$(a.form).find("label[for='"+$(a).attr("name")+"']"))&&a.length>0&&a.addClass(b+"Label")},unhighlight:function(a,b,c){var d=$(a.form).find("label[for='"+$(a).attr("name")+"']");d&&d.length>0&&d.removeClass(b+"Label");$(a).removeClass(b).addClass(c)},
showErrors:function(a){var b="\n\t\t
There were errors with your form. Please make sure you have filled in all required fields with the proper info.\n\t\t
Click anywhere to hide this message\n\t\t
\n\t\t\t
",c="";$.each(a,function(d,f){var e=$$$s(d)[0].id;e=typeof e!=="undefined"&&e.length>0&&$("label[for='"+e+"']")&&$("label[for='"+e+"']").length>0?$("label[for='"+e+"']").html():$("[name='"+d+"']").attr("title")?$("[name='"+
d+"']").attr("title"):$("[name='"+d+"']").attr("name")?$("[name='"+d+"']").attr("name").split(" ")[0]:"";c+="\n\t\t\t\t- "+e+""+f+"
"});b+=c+"\n\t\t\t
\n\t\t
";c.length&&buildModal("formError-"+this.currentForm.id,b,null,true,true,1,null,null,440);this.defaultShowErrors()},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",phoneUS:"Please enter a valid phone number.",date:"Please enter a valid date.",
dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:$.validator.format("Please enter no more than {0} characters."),minlength:$.validator.format("Please enter at least {0} characters."),rangelength:$.validator.format("Please enter a value between {0} and {1} characters long."),
range:$.validator.format("Please enter a value between {0} and {1}."),max:$.validator.format("Please enter a value less than or equal to {0}."),min:$.validator.format("Please enter a value greater than or equal to {0}.")},ignore:[]});$.validator.addMethod("time",function(a,b){return this.optional(b)||/^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?([\s]?[AaPp][Mm])?$/i.test(a)},"Please enter a time in the format HH:MM. AM/PM is optional.");
$.validator.addMethod("defaultInvalid",function(a,b){return b.value!=b.defaultValue},"This field is required.");
function buildModal(a,b,c,d,f,e,g,h,i,j,l){if(e!==0&&e!==1&&e.length===0)e=0;g=g||3E3;c=c||document.body;l=l||"";cls=a.indexOf("formError")!=-1?"formError "+a:"common";b=$("
").append($("
").append($(b)));$(c).append(b);b=d?$(window).width():$(c).outerWidth();l=d?$(window).height():$(c).outerHeight();f=f?"fixed":"absolute";$("#"+a).css({display:"none",height:l+"px",left:"0px",position:f,top:"0px",width:b+"px",zIndex:"9999"}).fadeIn();
f=h||(d?$(window).height()*(2/3):$(c).outerHeight()*(2/3));c=i||(d?$(window).width()*(2/3):$(c).outerWidth()*(2/3));$("#"+a+" .modalInner").css({height:"auto",maxHeight:f+"px",left:"0px",overflow:"hidden",paddingBottom:"40px",position:"fixed",left:($("#"+a).width()-c)/2+"px",top:($("#"+a).height()-f)/2+"px",width:c+"px"});f=h==null?$("#"+a+" .modalInner").outerHeight():f;$("#"+a+" .modalInner").css({height:"0px"}).animate({height:f+"px"},500);if(isNaN(e))$(e).on("click",function(){$("#"+a).fadeOut().remove()}).children().click(function(k){k.stopPropagation()});
else if(e)if(e===2){$(".modalInner").append($('
X
'));$(".modalClose").on("click",function(){$(this).parent().parent().fadeOut().remove()})}else $("#"+a).on("click",function(){$(this).fadeOut().remove()});else window.setTimeout(function(){$("#"+a).fadeOut().remove()},g);if(j){j.cancelBubble=true;j.stopPropagation&&j.stopPropagation()}}function isset(a){if("string"===typeof a)a=window[a];return"undefined"!==typeof a&&null!==a}
function emptystring(a){return!isset(a)||a.length==0}function repSubstr(a,b,c){return a.split(b).join(c)}function timeConvertMysql(a){var b=a.split(":"),c=b[0],d=false;if(a.match(/am/i))d=c+":"+b[1].slice(0,b[1].indexOf(" ",0))+":00";else if(a.match(/pm/i)){c=parseInt(c)+12;d=c+":"+b[1].slice(0,b[1].indexOf(" ",0))+":00"}return d}function isNumeric(a){return!isNaN(parseInt(a,10))}
function sendFormValues(a){$(".modal-formError").fadeOut().remove();var b=ajaxObj();if(a.validate().form()){var c="";c=a.serialize();c=c.split("&");for(var d=[],f=[],e=0;e<=c.length-1;e++){var g=c[e].split("=");if($.inArray(g[0],f)!==-1)d[$.inArray(g[0],f)]=d[$.inArray(g[0],f)]+","+g[1];else{f.push(g[0]);param=$("[name='"+g[0]+"']").attr("title")?encodeURI($("[name='"+g[0]+"']").attr("title")):g[0];d.push(param+"="+g[1])}}d.push("scriptSend=1");c=d.join("&");b.formObj=a;b.onreadystatechange=function(){if(b.readyState===
4){buildModal("formSuccess","
Your information has been submitted!
Click anywhere to hide this message.",null,true,true,1,null,null,440);a[0].reset();return true}};ajaxPost(b,"/public/sendForm.php",c,true,1,null,false);return false}}function ajaxObj(){var a=false;try{a=new XMLHttpRequest}catch(b){alert("Your browser does not support AJAX")}return a}
function ajaxPost(a,b,c,d,f,e,g,h){d=isset(d)?d:true;f=isset(f)?f:true;e=isset(e)?e:"application/x-www-form-urlencoded";g=isset(g)?g:true;h=h||false;historyBool=isset(window.historyBool)?window.historyBool:true;var i="",j,l;try{if(g&&historyBool){for(var k=arguments.callee.caller;k;)if(getParentFunctionCall(k)){l=k;k=getParentFunctionCall(k)}else break;var n=k.toString(),p=n.substr(n.indexOf("{",0)+1),r=p.substr(0,p.indexOf("(",0));k="";var t=l.arguments,o=t.length;for(l=0;l
0){j=c.replace(/[&]?(function=[a-zA-Z_%]*)/,"");j=j.replace(/[&]?(pageID=[-]?[0-9]*)/,"");j=j.replace(/^\&/,"");j=encodeURIComponent(j);i=j.length>0?pageArray[pageID].name+"?"+j:pageArray[pageID].name}historyBool=false;j={ajaxRunFunction:r+"("+k+")",hisUrlParams:i};if(j.ajaxRunFunction!=History.getState().data.ajaxRunFunction)History.pushState(j,"",i);else{History.replaceState(j,"",i);historyBool=true}}}catch(u){alert("stealth history track error:"+u)}if(h){a.ajaxPost=
{responseText:'{"priKeyID":'+pageID+"}"};a.onreadystatechange();a.abort()}else if(f){a.open("POST",b,d);a.setRequestHeader("Content-type",e);a.setRequestHeader("Content-length",c.length);a.setRequestHeader("Connection","close");try{a.send(c)}catch(q){a.status=404}}else{if(b.indexOf("?")===-1)c="?"+c;a.open("GET",b+c,d);a.send(null);try{a.send(null)}catch(m){a.status=404}}}function getParentFunctionCall(a){return a.caller?a.caller:false}
function fieldEscape(a){try{return escape(htmlentities(a))}catch(b){alert(b)}}function ckFieldEscape(a){return CKEDITOR.instances[a].getData()}function htmlentities(a){return a.replace(/&/g,"&").replace(//g,">")}
function loadSinglePageSite(){var a=pageArray[pageID].pageOrder,b=[],c=[],d;for(d in pageArray)if(parseInt(d)!=pageID)if(pageArray[d].pageOrder0?b.pop():-1;if(a===-1)a=c.length>0?c.shift():-1;d=a;for(var f=-1;b.length>0||c.length>0;){f=pageArray[d].pageOrder0?c.shift():b.length>0?b.pop():null:b.length>0?b.pop():c.length>0?c.shift():null;if(f!==null){if(!emptystring(pageArray[d].postUpdate))pageArray[d].tempPost=
pageArray[d].postUpdate;pageArray[d].postUpdate="upc("+f+",null,false);"}if(b.length<=0&&c.length<=0){if(!emptystring(pageArray[f].postUpdate))pageArray[f].tempPost=pageArray[f].postUpdate;pageArray[f].postUpdate="if($s('li')){$('#li').fadeOut(400);}pageID = "+pageID+";"}else d=f;if(b.length===0&&c.length===0)emptystring(pageArray[pageID].postUpdate)||(pageArray[f].postUpdate+=pageArray[pageID].postUpdate)}upc(a,null,false)}}
function upt(a){var b=ajaxObj(),c="function=getRecordByID&pID="+a;b.onreadystatechange=function(){if(b.readyState===4){$(".pageText").html(JSON.parse(b.responseText).prodIndex0.pageCode);document.title=$(document.createElement("div")).html(JSON.parse(b.responseText).prodIndex0.pageTitle).text();pageID=a}};ajaxPost(b,"/cmsAPI/pages/pages.php",c,true,0,false,true)}
function upc(a,b,c){if(b)b=repSubstr(b,"?","");window.scrollTo(0,0);typeof pageAjax!=="undefined"&&pageAjax.abort();b=b?"function=getPage&pageID="+a+"&"+b:"function=getPage&pageID="+a;c=isset(c)?c:a!==pageID;prevPage=pageID;pageID=a;a=prevPage;for(var d in pageInterTime){try{clearTimeout(pageInterTime[d])}catch(f){}try{clearInterval(pageInterTime[d])}catch(e){}delete pageInterTime[d]}pageAjax=ajaxObj();pageAjax.hideEffectComplete=false;pageAjax.histTrack=c;$s("li")&&$("#li").fadeTo(400,1,"swing");
singlePageSite?upcDoUpdate():$(".pcpy").stop().fadeTo(400,0,"swing",function(){pageAjax.hideEffectComplete=true;typeof pageAjax.responseText!=="unknown"&&pageAjax.responseText.length>0&&upcDoUpdate()});pageAjax.onreadystatechange=function(){pageAjax.readyState===4&&pageAjax.hideEffectComplete&&upcDoUpdate()};ajaxPost(pageAjax,"/cmsAPI/pages/pages.php",b,true,0,false,c,singlePageSite&&pageArray[pageID].pageLoaded);(new Function(pageArray[prevPage].preUpdate))()}
function upcDoUpdate(){if(!singlePageSite)for(;$s("moduleScript");)$("#moduleScript").remove();pageAjax.readyState===4&&updatePage()}
function updatePage(){pageAjax.pageData=JSON.parse(pageAjax.responseText);if(!pageArray[pageAjax.pageData.priKeyID].pageLoaded)if(navigator.appVersion.indexOf("MSIE")!=-1)for(var a=document.styleSheets.length,b=0;b ");if(singlePageSite){pageArray[prevPage].pageOrder