"use strict"; var ITEM_OFFSET = parseInt(37); (function (a, b, c, d) { d = c.fn.iPhonePickerRefresh = function () { return this.each(function () { if (this.tagName == "SELECT") { d.refresh(c(this)) } }) }; c.extend(d, { refresh: function (a) { var d = a[0].id; var e = a[0].options.selectedIndex; if (c("#uipv_main_" + d)[0] != undefined && e > 0) { var f = "uipv_content_" + d; var g = b.round(e * ITEM_OFFSET); c("#" + f).scrollTo(g) } } }) })(window, Math, jQuery); (function (a, b, c) { c = b.fn.iPhonePicker = function (a) { a = a || {}; return this.each(function () { if (this.tagName == "SELECT") { c.init(b(this), a) } }) }; b.extend(c, { init: function (a, d) { d = b.extend({ width: "", imgRoot: "http://www.marinovanderheijden.nl/Images/UIPickerView" }, d); var e = {}; e.target = a; e.options = d; e.options.imgRoot = (e.options.imgRoot + "/").replace("\\", "/").replace("//", "/"); a.css({ display: "none" }); if (b("#uipv_main_" + a[0].id)[0] == undefined) { c.addNiftyControl(e) } else { c.resetControl(e) } }, stripSizePostFix: function (a) { if (a.length > 2 && a.substring(a.length - 2) == "px") a = a.substring(0, a.length - 2); return parseInt(a) }, addNiftyControl: function (a) { var d = a.target[0].id; var e = b("#" + d); var f = "uipv_main_" + d; var g = "uipv_content_" + d; var h = "uipv_ul_" + d; b("
", { id: f }).insertAfter(e); b("", { id: g }).appendTo("#" + f); b("", { id: "uipv_left_" + d }).appendTo("#" + f); b("", { id: "uipv_top_" + d }).appendTo("#" + f); b("", { id: "uipv_right_" + d }).appendTo("#" + f); b("", { id: "uipv_bottom_" + d }).appendTo("#" + f); b("", { id: "uipv_bar_" + d }).appendTo("#" + f); var i = a.options.width == "" ? c.stripSizePostFix(b("#" + d).css("width")) + 12 : c.stripSizePostFix(a.options.width); if (!(i >= 20 && i <= 2e3)) { i = 80 } var j = b("#" + d).attr("class"); if (j && j != "") { b("#" + f).attr("class", j) } b("#" + f).css({ width: i + "px", height: "160px", position: "relative", "float": "left" }); b("#" + g).css({ width: i - 8 + "px", height: "152px", "font-family": "Arial", "font-weight": "bold", "font-size": "11px", "z-index": "13", position: "absolute", "float": "left", margin: "2px 4px 2px 4px", overflow: "hidden", "-webkit-user-select": "none", "-khtml-user-select": "none", "-moz-user-select": "none", "-o-user-select": "none", "user-select": "none" }); b("#uipv_left_" + d).css({ width: "4px", height: "160px", background: "transparent url(" + a.options.imgRoot + "uipv_left_bg.png) no-repeat top", "float": "left", position: "absolute", margin: "0px", "z-index": "12" }); b("#uipv_top_" + d).css({ width: i - 8 + "px", height: "80px", background: "transparent url(" + a.options.imgRoot + "uipv_top_bg.png) repeat-x top", "float": "left", position: "absolute", "margin-left": "4px", "z-index": "12" }); b("#uipv_bottom_" + d).css({ width: i - 8 + "px", height: "80px", background: "transparent url(" + a.options.imgRoot + "uipv_bottom_bg.png) repeat-x top", "float": "left", position: "absolute", "margin-top": "80px", "margin-left": "4px", "z-index": "12" }); b("#uipv_right_" + d).css({ width: "4px", height: "160px", background: "transparent url(" + a.options.imgRoot + "uipv_right_bg.png) no-repeat top", "float": "right", position: "absolute", "margin-left": i - 4 + "px", "z-index": "12" }); b("#uipv_bar_" + d).css({ width: i - 8 + "px", height: "45px", background: "transparent url(" + a.options.imgRoot + "uipv_bar_bg.png) repeat-x top", "float": "left", position: "absolute", "margin-top": "58px", "margin-left": "4px", "z-index": "12" }); b("", { id: "uipv_contenthead_" + d }).appendTo("#" + g); b("#uipv_contenthead_" + d).css({ height: "61px", width: i - 8 + "px" }); b("", { id: h }).appendTo("#" + g); b("#" + h).css({ margin: "0px", padding: "0px" }); b("", { id: "uipv_contentfoot_" + d }).appendTo("#" + g); b("#uipv_contentfoot_" + d).css({ height: "54px", width: i - 8 + "px" }); c.selectable(b("#" + g)[0], false); if (a.target[0].options.length > 0) { for (var k = 0; k < a.target[0].options.length; k++) { var l = a.target[0].options[k]; b("", { id: h + "_" + l.value, value: l.value, text: l.text }).appendTo("#" + h); b("#" + h + "_" + l.value).css({ height: "37px", "line-height": "37px", "text-align": "center", display: "block", padding: "0px", margin: "0px" }) } b("#" + g).iPhonePickerOverscroll({ selectedIndex: a.target[0].options.selectedIndex, parentId: d, itemCount: a.target[0].options.length }) } }, setStyle: function (a, b, c) { b = b.replace(/-(\w)/g, function (a, b) { return b.toUpperCase() }); if (a.style[b]) { a.style[b] = c } }, selectable: function (a, b) { c.setStyle(a, "user-select", b ? "" : "none"); c.setStyle(a, "-moz-user-select", b ? "" : "none"); c.setStyle(a, "-khtml-user-select", b ? "" : "none"); a.onselectstart = b ? null : function () { return false }; a.setAttribute("unselectable", b ? "" : "on", 0) } }) })(window, jQuery); (function (a, b, c, d) { d = c.fn.iPhonePickerOverscroll = function (a) { a = a || {}; return this.each(function () { d.init(c(this), a) }) }; c.fn.removeIPhonePickerOverscroll = function (a) { return this.each(function () { var a = c(this).data(d.removerKey); if (c.isFunction(a)) { a() } }) }; c.extend(d, { events: { wheel: "mousewheel DOMMouseScroll", start: "select mousedown touchstart", drag: "mousemove touchmove", end: "mouseup mouseleave touchend", ignored: "dragstart drag", click: "click" }, div: "", removerKey: "overscroll-remover", data: {}, constants: { driftFrequency: 40, driftSequences: 22, driftDecay: 1.25, driftTimeout: 100, timeout: 400, captureThreshold: 3, wheelDelta: 37, scrollDelta: 25, thumbThickness: 6, thumbOpacity: .7, topOffset: 62, textSize: 11 }, checkIosDevice: function () { if (d.isIOS === undefined) { d.isIOS = /iP((hone)|(ad)|(od))/.test(navigator.platform) } return d.isIOS }, init: function (a, e) { d.data = { sizing: d.getSizing(a) }; e = c.extend({ selectedIndex: 0, parentId: "", itemCount: 0, showThumbs: false, wheelDirection: "vertical", cursor: "pointer", wheelDelta: d.constants.wheelDelta, scrollDelta: d.constants.scrollDelta, direction: "multi", cancelOn: "", reset: false }, e); if (e.direction !== "multi" && e.direction !== e.wheelDirection) { e.wheelDirection = e.direction } e.scrollDelta = b.abs(e.scrollDelta); e.wheelDelta = b.abs(e.wheelDelta); a.css({ position: "absolute", overflow: "hidden", cursor: e.cursor }); if (!e.reset) { a.removeIPhonePickerOverscroll(); a.data(d.removerKey, d.remover(a)); a.bind(d.events.wheel, d.data, d.wheel).bind(d.events.start, d.data, d.start).bind(d.events.end, d.data, d.stop).bind(d.events.ignored, false); if (e.showThumbs) { d.data.thumbs = {}; if (d.data.sizing.container.scrollWidth > 0 && e.direction !== "vertical") { d.data.thumbs.horizontal = c(d.div).css(d.getThumbCss(d.data.sizing.thumbs.horizontal)).fadeTo(0, 0); a.prepend(d.data.thumbs.horizontal) } if (d.data.sizing.container.scrollHeight > 0 && e.direction !== "horizontal") { d.data.thumbs.vertical = c(d.div).css(d.getThumbCss(d.data.sizing.thumbs.vertical)).fadeTo(0, 0); a.prepend(d.data.thumbs.vertical) } } } d.data.target = a; d.data.options = e; if (e.selectedIndex > 0) { d.scrollToIndex(d.data, e.selectedIndex, true) } }, remover: function (a) { return function () { a.css({ overflow: "auto", cursor: "default" }).unbind(d.events.wheel, d.wheel).unbind(d.events.start, d.data, d.start).unbind(d.events.end, d.data, d.stop).unbind(d.events.ignored, false).unbind(d.events.click, d.data, d.click); if (d.data.thumbs) { if (d.data.thumbs.horizontal) { d.data.thumbs.horizontal.remove() } if (d.data.thumbs.vertical) { d.data.thumbs.vertical.remove() } } } }, triggerEvent: function (a) { d.data.target.trigger("overscroll:" + a) }, toggleThumbs: function (a, b) { if (a.thumbs) { if (b) { if (a.thumbs.vertical) { a.thumbs.vertical.stop(true, true).fadeTo("fast", d.constants.thumbOpacity) } if (a.thumbs.horizontal) { a.thumbs.horizontal.stop(true, true).fadeTo("fast", d.constants.thumbOpacity) } } else { if (a.thumbs.vertical) { a.thumbs.vertical.fadeTo("fast", 0) } if (a.thumbs.horizontal) { a.thumbs.horizontal.fadeTo("fast", 0) } var c = d.selectedIndex(a.target[0]); d.scrollToIndex(a, c) } } }, scrollToIndex: function (a, e, f) { if (e == "undefined" || e == null) { e = a.options.selectedIndex } var g = b.round(e * ITEM_OFFSET); c(a.target[0]).scrollTo(g); if (!f && !a.options.reset) { d.setValue(a) } }, setValue: function (a) { if (a == null) a = d.data; var b = a.options.reset ? a.options.selectedIndex : d.selectedIndex(a.target[0]); jQuery("select#" + a.options.parentId + " option[selected]").removeAttr("selected"); jQuery("select#" + a.options.parentId + " option[index=" + b + "]").attr("selected", "selected"); if (!a.options.reset) { c("#" + a.options.parentId).trigger(jQuery.Event("change")) } }, selectedIndex: function (a) { var b = Math.round(a.scrollTop / ITEM_OFFSET); return b }, setPosition: function (a, b, c) { b.x = a.pageX; b.y = a.pageY; b.time = d.time(); b.index = c; return b }, wheel: function (b, c) { d.clearInterval(b.data.target); if (b.wheelDelta) { c = b.wheelDelta / (a.opera ? -120 : 120) } if (b.detail) { c = -b.detail / 3 } if (!b.data.wheelCapture) { b.data.wheelCapture = { timeout: null }; d.toggleThumbs(b.data, true); b.data.target.stop(true, true).data("dragging", true) } c *= b.data.options.wheelDelta; if (b.data.options.wheelDirection === "horizontal") { this.scrollLeft -= c } else { this.scrollTop -= c } d.moveThumbs(b, this.scrollLeft, this.scrollTop); if (b.data.wheelCapture.timeout) { clearTimeout(b.data.wheelCapture.timeout) } b.data.wheelCapture.timeout = setTimeout(function (a) { b.data.wheelCapture = undefined; d.toggleThumbs(b.data, false); b.data.target.data("dragging", false) }, d.constants.timeout); if (!b) { b = window.event } if (b.preventDefault) { b.preventDefault() } b.returnValue = false; d.setValue(b.data) }, moveThumbs: function (a, b, c, d, e, f, g) { if (a.data.options.showThumbs) { d = a.data.thumbs; e = a.data.sizing; if (d.horizontal) { f = b * (1 + e.container.width / e.container.scrollWidth); g = c + e.thumbs.horizontal.top; d.horizontal.css("margin", g + "px 0 0 " + f + "px") } if (d.vertical) { f = b + e.thumbs.vertical.left; g = c * (1 + e.container.height / e.container.scrollHeight); d.vertical.css("margin", g + "px 0 0 " + f + "px") } } }, click: function (a, b) { d.clearInterval(a.data.target); var e = a.pageY - c(b).offset().top; if (e < 60 || e > 105) { var f = e < 60; var g = d.selectedIndex(a.data.target[0]); if (f && g > 0 || !f && g < a.data.options.itemCount - 1) { var h = f ? g - 1 : g + 1; a.data.position = d.setPosition(a, {}); a.data.capture = d.setPosition(a, {}, 2); a.data.capture.y += f ? -6 : 8; d.drift(b, a, function (b) { b.target.data("dragging", false); d.toggleThumbs(b, false); d.scrollToIndex(a.data, h) }) } } }, start: function (a) { d.clearInterval(a.data.target); a.data.startTarget = c(a.target); if (!a.data.startTarget.is(a.data.options.cancelOn)) { d.normalizeEvent(a); a.data.target.bind(d.events.drag, a.data, d.drag).stop(true, true).data("dragging", false).data("dragged", false); a.data.position = d.setPosition(a, {}); a.data.capture = d.setPosition(a, {}, 2); d.triggerEvent("dragstart", a.data) } }, drag: function (a, b, c, e, f) { d.normalizeEvent(a); a.data.target.data("dragged", true); if (!a.data.target.data("dragging")) { d.toggleThumbs(a.data, true) } if (a.data.options.direction !== "vertical") { this.scrollLeft -= a.pageX - a.data.position.x } if (a.data.options.direction !== "horizontal") { this.scrollTop -= a.pageY - a.data.position.y } d.moveThumbs(a, this.scrollLeft, this.scrollTop); d.setPosition(a, a.data.position); if (--a.data.capture.index <= 0) { a.data.target.data("dragging", true); d.setPosition(a, a.data.capture, d.constants.captureThreshold) } }, normalizeEvent: function (a) { if (d.checkIosDevice()) { var b = a.originalEvent.changedTouches[0]; a.pageX = b.pageX; a.pageY = b.pageY } }, time: function () { return (new Date).getTime() }, deferClick: function (a) { var b = a.data("events"); if (b && b.click && b.click.length) { b = b.click.slice(); a.unbind("click").one("click", function (d) { d.preventDefault(); c.each(b, function (b, c) { a.click(c) }) }) } }, stop: function (a, b, e, f) { if (a.data.position) { a.data.target.unbind(d.events.drag, d.drag); d.triggerEvent("dragend", a.data); if (a.data.target.data("dragging")) { d.drift(this, a, function (b) { b.target.data("dragging", false); d.toggleThumbs(b, false); var c = d.selectedIndex(a.data.target[0]); d.scrollToIndex(a.data, c) }) } else if (a.data.target.data("dragged")) { d.toggleThumbs(a.data, false) } else { d.click(a, this) } if (a.data.target.data("dragged") && c(a.target).is(a.data.startTarget)) { a.data.target.data("dragged", false); d.deferClick(a.data.startTarget); a.data.startTarget = null } a.data.capture = a.data.position = undefined } }, clearInterval: function (b) { b = c(b); var d = b.data("overscroll-interval"); if (d) { a.clearInterval(d) } b.data("overscroll-interval", null) }, setInterval: function (a, b) { d.clearInterval(a); c(a).data("overscroll-interval", b) }, drift: function (b, c, e) { if (d.time() - c.data.capture.time > d.constants.driftTimeout) { return e.call(null, c.data) } d.normalizeEvent(c); var f = c.data.options.scrollDelta * (c.pageX - c.data.capture.x), g = c.data.options.scrollDelta * (c.pageY - c.data.capture.y), h = b.scrollLeft, i = b.scrollTop, j = f / d.constants.driftSequences, k = g / d.constants.driftSequences, l = d.constants.driftDecay; if (c.data.options.direction !== "vertical") { h -= f } if (c.data.options.direction !== "horizontal") { i -= g } d.triggerEvent("driftstart", c.data); d.setInterval(b, a.setInterval(function () { var a = true, f = 1, g = -1; if (k > f && b.scrollTop > i || k < g && b.scrollTop < i) { a = false; b.scrollTop -= k; k /= l } if (j > f && b.scrollLeft > h || j < g && b.scrollLeft < h) { a = false; b.scrollLeft -= j; j /= l } d.moveThumbs(c, b.scrollLeft, b.scrollTop); if (a) { d.clearInterval(b); d.triggerEvent("driftend", c.data); e.call(null, c.data) } }, d.constants.driftFrequency)) }, getSizing: function (a) { var b = {}, c = a.get(0); b.container = { width: a.width(), height: a.height() }; b.container.scrollWidth = c.scrollWidth == b.container.width ? 0 : c.scrollWidth; b.container.scrollHeight = c.scrollHeight == b.container.height ? 0 : c.scrollHeight; b.thumbs = { horizontal: { width: b.container.width * b.container.width / b.container.scrollWidth, height: d.constants.thumbThickness, corner: d.constants.thumbThickness / 2, left: 0, top: b.container.height - d.constants.thumbThickness }, vertical: { width: d.constants.thumbThickness, height: b.container.height * b.container.height / b.container.scrollHeight, corner: d.constants.thumbThickness / 2, left: b.container.width - d.constants.thumbThickness, top: 0} }; return b }, getThumbCss: function (a) { return { position: "absolute", "background-color": "black", width: a.width + "px", height: a.height + "px", margin: a.top + "px 0 0 " + a.left + "px", "-moz-border-radius": a.corner + "px", "-webkit-border-radius": a.corner + "px", "border-radius": a.corner + "px", "z-index": "1"} } }) })(window, Math, jQuery); (function (a) { function c(a) { return typeof a == "object" ? a : { top: a, left: a} } var b = a.scrollTo = function (b, c, d) { a(window).scrollTo(b, c, d) }; b.defaults = { axis: "xy", duration: parseFloat(a.fn.jquery) >= 1.3 ? 0 : 1 }; b.window = function (b) { return a(window)._scrollable() }; a.fn._scrollable = function () { return this.map(function () { var b = this, c = !b.nodeName || a.inArray(b.nodeName.toLowerCase(), ["iframe", "#document", "html", "body"]) != -1; if (!c) return b; var d = (b.contentWindow || b).document || b.ownerDocument || b; return a.browser.safari || d.compatMode == "BackCompat" ? d.body : d.documentElement }) }; a.fn.scrollTo = function (d, e, f) { if (typeof e == "object") { f = e; e = 0 } if (typeof f == "function") f = { onAfter: f }; if (d == "max") d = 9e9; f = a.extend({}, b.defaults, f); e = e || f.speed || f.duration; f.queue = f.queue && f.axis.length > 1; if (f.queue) e /= 2; f.offset = c(f.offset); f.over = c(f.over); return this._scrollable().each(function () { function m(a) { h.animate(k, e, f.easing, a && function () { a.call(this, d, f) }) } var g = this, h = a(g), i = d, j, k = {}, l = h.is("html,body"); switch (typeof i) { case "number": case "string": if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(i)) { i = c(i); break } i = a(i, this); case "object": if (i.is || i.style) j = (i = a(i)).offset() } a.each(f.axis.split(""), function (a, c) { var d = c == "x" ? "Left" : "Top", e = d.toLowerCase(), n = "scroll" + d, o = g[n], p = b.max(g, c); if (j) { k[n] = j[e] + (l ? 0 : o - h.offset()[e]); if (f.margin) { k[n] -= parseInt(i.css("margin" + d)) || 0; k[n] -= parseInt(i.css("border" + d + "Width")) || 0 } k[n] += f.offset[e] || 0; if (f.over[e]) k[n] += i[c == "x" ? "width" : "height"]() * f.over[e] } else { var q = i[e]; k[n] = q.slice && q.slice(-1) == "%" ? parseFloat(q) / 100 * p : q } if (/^\d+$/.test(k[n])) k[n] = k[n] <= 0 ? 0 : Math.min(k[n], p); if (!a && f.queue) { if (o != k[n]) m(f.onAfterFirst); delete k[n] } }); m(f.onAfter); }).end() }; b.max = function (b, c) { var d = c == "x" ? "Width" : "Height", e = "scroll" + d; if (!a(b).is("html,body")) return b[e] - a(b)[d.toLowerCase()](); var f = "client" + d, g = b.ownerDocument.documentElement, h = b.ownerDocument.body; return Math.max(g[e], h[e]) - Math.min(g[f], h[f]) }; })(jQuery)