﻿//selectbox
jQuery.fn.extend({ selectbox: function(options) { return this.each(function() { new jQuery.SelectBox(this, options) }) } }); jQuery.SelectBox = function(selectobj, options) { var opt = options || {}; opt.inputClass = opt.inputClass || "selectbox"; opt.containerClass = opt.containerClass || "selectbox-wrapper"; opt.hoverClass = opt.hoverClass || "selected"; opt.debug = opt.debug || false; var elm_id = selectobj.id; var active = -1; var inFocus = false; var hasfocus = 0; var $select = $(selectobj); var $container = setupContainer(opt); var $input = setupInput(opt); $select.hide().before($input).before($container); init(); $input.click(function() { if (!inFocus) { $container.toggle() } }).focus(function() { if ($container.not(':visible')) { inFocus = true; $container.show() } }).keydown(function(event) { switch (event.keyCode) { case 38: event.preventDefault(); moveSelect(-1); break; case 40: event.preventDefault(); moveSelect(1); break; case 13: event.preventDefault(); setCurrent(); hideMe(); break } }).blur(function() { if ($container.is(':visible') && hasfocus > 0) { if (opt.debug) { } else { hideMe() } } }); function hideMe() { hasfocus = 0; $container.hide() } function init() { $container.append(getSelectOptions($input.attr('id'))).hide(); var width = $input.css('width'); $container.width(width) } function setupContainer(options) { var container = document.createElement("div"); $container = $(container); $container.attr('id', elm_id + '_container'); $container.addClass(options.containerClass); return $container } function setupInput(options) { var input = document.createElement("input"); var $input = $(input); $input.attr("id", elm_id + "_input"); $input.attr("type", "text"); $input.addClass(options.inputClass); $input.attr("autocomplete", "off"); $input.attr("readonly", "readonly"); $input.attr("tabIndex", $select.attr("tabindex")); return $input } function moveSelect(step) { var lis = $("li", $container); if (!lis) return; active += step; if (active < 0) { active = 0 } else if (active >= lis.size()) { active = lis.size() - 1 } lis.removeClass(opt.hoverClass); $(lis[active]).addClass(opt.hoverClass) } function setCurrent() { var li = $("li." + opt.hoverClass, $container).get(0); var ar = ('' + li.id).split('_'); var el = ar[ar.length - 1]; $select.val(el); $input.val($(li).html()); return true } function getCurrentSelected() { return $select.val() } function getCurrentValue() { return $input.val() } function getSelectOptions(parentid) { var select_options = new Array(); var ul = document.createElement('ul'); $select.children('option').each(function() { var li = document.createElement('li'); li.setAttribute('id', parentid + '_' + $(this).val()); li.innerHTML = $(this).html(); if ($(this).is(':selected')) { $input.val($(this).html()); $(li).addClass(opt.hoverClass) } ul.appendChild(li); $(li).mouseover(function(event) { hasfocus = 1; jQuery(event.target, $container).addClass(opt.hoverClass) }).mouseout(function(event) { hasfocus = -1; jQuery(event.target, $container).removeClass(opt.hoverClass) }).click(function(event) { $(this).addClass(opt.hoverClass); setCurrent(); hideMe() }) }); return ul } };

//ui.core
; jQuery.ui || (function($) { var _remove = $.fn.remove, isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9); $.ui = { version: "1.7.2", plugin: { add: function(module, option, set) { var proto = $.ui[module].prototype; for (var i in set) { proto.plugins[i] = proto.plugins[i] || []; proto.plugins[i].push([option, set[i]]) } }, call: function(instance, name, args) { var set = instance.plugins[name]; if (!set || !instance.element[0].parentNode) { return } for (var i = 0; i < set.length; i++) { if (instance.options[set[i][0]]) { set[i][1].apply(instance.element, args) } } } }, contains: function(a, b) { return document.compareDocumentPosition ? a.compareDocumentPosition(b) & 16 : a !== b && a.contains(b) }, hasScroll: function(el, a) { if ($(el).css('overflow') == 'hidden') { return false } var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop', has = false; if (el[scroll] > 0) { return true } el[scroll] = 1; has = (el[scroll] > 0); el[scroll] = 0; return has }, isOverAxis: function(x, reference, size) { return (x > reference) && (x < (reference + size)) }, isOver: function(y, x, top, left, height, width) { return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width) }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, NUMPAD_ADD: 107, NUMPAD_DECIMAL: 110, NUMPAD_DIVIDE: 111, NUMPAD_ENTER: 108, NUMPAD_MULTIPLY: 106, NUMPAD_SUBTRACT: 109, PAGE_DOWN: 34, PAGE_UP: 33, PERIOD: 190, RIGHT: 39, SHIFT: 16, SPACE: 32, TAB: 9, UP: 38} }; if (isFF2) { var attr = $.attr, removeAttr = $.fn.removeAttr, ariaNS = "http://www.w3.org/2005/07/aaa", ariaState = /^aria-/, ariaRole = /^wairole:/; $.attr = function(elem, name, value) { var set = value !== undefined; return (name == 'role' ? (set ? attr.call(this, elem, name, "wairole:" + value) : (attr.apply(this, arguments) || "").replace(ariaRole, "")) : (ariaState.test(name) ? (set ? elem.setAttributeNS(ariaNS, name.replace(ariaState, "aaa:"), value) : attr.call(this, elem, name.replace(ariaState, "aaa:"))) : attr.apply(this, arguments))) }; $.fn.removeAttr = function(name) { return (ariaState.test(name) ? this.each(function() { this.removeAttributeNS(ariaNS, name.replace(ariaState, "")) }) : removeAttr.call(this, name)) } } $.fn.extend({ remove: function() { $("*", this).add(this).each(function() { $(this).triggerHandler("remove") }); return _remove.apply(this, arguments) }, enableSelection: function() { return this.attr('unselectable', 'off').css('MozUserSelect', '').unbind('selectstart.ui') }, disableSelection: function() { return this.attr('unselectable', 'on').css('MozUserSelect', 'none').bind('selectstart.ui', function() { return false }) }, scrollParent: function() { var scrollParent; if (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) { scrollParent = this.parents().filter(function() { return (/(relative|absolute|fixed)/).test($.curCSS(this, 'position', 1)) && (/(auto|scroll)/).test($.curCSS(this, 'overflow', 1) + $.curCSS(this, 'overflow-y', 1) + $.curCSS(this, 'overflow-x', 1)) }).eq(0) } else { scrollParent = this.parents().filter(function() { return (/(auto|scroll)/).test($.curCSS(this, 'overflow', 1) + $.curCSS(this, 'overflow-y', 1) + $.curCSS(this, 'overflow-x', 1)) }).eq(0) } return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent } }); $.extend($.expr[':'], { data: function(elem, i, match) { return !!$.data(elem, match[3]) }, focusable: function(element) { var nodeName = element.nodeName.toLowerCase(), tabIndex = $.attr(element, 'tabindex'); return (/input|select|textarea|button|object/.test(nodeName) ? !element.disabled : 'a' == nodeName || 'area' == nodeName ? element.href || !isNaN(tabIndex) : !isNaN(tabIndex)) && !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length }, tabbable: function(element) { var tabIndex = $.attr(element, 'tabindex'); return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable') } }); function getter(namespace, plugin, method, args) { function getMethods(type) { var methods = $[namespace][plugin][type] || []; return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods) } var methods = getMethods('getter'); if (args.length == 1 && typeof args[0] == 'string') { methods = methods.concat(getMethods('getterSetter')) } return ($.inArray(method, methods) != -1) } $.widget = function(name, prototype) { var namespace = name.split(".")[0]; name = name.split(".")[1]; $.fn[name] = function(options) { var isMethodCall = (typeof options == 'string'), args = Array.prototype.slice.call(arguments, 1); if (isMethodCall && options.substring(0, 1) == '_') { return this } if (isMethodCall && getter(namespace, name, options, args)) { var instance = $.data(this[0], name); return (instance ? instance[options].apply(instance, args) : undefined) } return this.each(function() { var instance = $.data(this, name); (!instance && !isMethodCall && $.data(this, name, new $[namespace][name](this, options))._init()); (instance && isMethodCall && $.isFunction(instance[options]) && instance[options].apply(instance, args)) }) }; $[namespace] = $[namespace] || {}; $[namespace][name] = function(element, options) { var self = this; this.namespace = namespace; this.widgetName = name; this.widgetEventPrefix = $[namespace][name].eventPrefix || name; this.widgetBaseClass = namespace + '-' + name; this.options = $.extend({}, $.widget.defaults, $[namespace][name].defaults, $.metadata && $.metadata.get(element)[name], options); this.element = $(element).bind('setData.' + name, function(event, key, value) { if (event.target == element) { return self._setData(key, value) } }).bind('getData.' + name, function(event, key) { if (event.target == element) { return self._getData(key) } }).bind('remove', function() { return self.destroy() }) }; $[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype); $[namespace][name].getterSetter = 'option' }; $.widget.prototype = { _init: function() { }, destroy: function() { this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled').removeAttr('aria-disabled') }, option: function(key, value) { var options = key, self = this; if (typeof key == "string") { if (value === undefined) { return this._getData(key) } options = {}; options[key] = value } $.each(options, function(key, value) { self._setData(key, value) }) }, _getData: function(key) { return this.options[key] }, _setData: function(key, value) { this.options[key] = value; if (key == 'disabled') { this.element[value ? 'addClass' : 'removeClass'](this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled').attr("aria-disabled", value) } }, enable: function() { this._setData('disabled', false) }, disable: function() { this._setData('disabled', true) }, _trigger: function(type, event, data) { var callback = this.options[type], eventName = (type == this.widgetEventPrefix ? type : this.widgetEventPrefix + type); event = $.Event(event); event.type = eventName; if (event.originalEvent) { for (var i = $.event.props.length, prop; i; ) { prop = $.event.props[--i]; event[prop] = event.originalEvent[prop] } } this.element.trigger(event, data); return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false || event.isDefaultPrevented()) } }; $.widget.defaults = { disabled: false }; $.ui.mouse = { _mouseInit: function() { var self = this; this.element.bind('mousedown.' + this.widgetName, function(event) { return self._mouseDown(event) }).bind('click.' + this.widgetName, function(event) { if (self._preventClickEvent) { self._preventClickEvent = false; event.stopImmediatePropagation(); return false } }); if ($.browser.msie) { this._mouseUnselectable = this.element.attr('unselectable'); this.element.attr('unselectable', 'on') } this.started = false }, _mouseDestroy: function() { this.element.unbind('.' + this.widgetName); ($.browser.msie && this.element.attr('unselectable', this._mouseUnselectable)) }, _mouseDown: function(event) { event.originalEvent = event.originalEvent || {}; if (event.originalEvent.mouseHandled) { return } (this._mouseStarted && this._mouseUp(event)); this._mouseDownEvent = event; var self = this, btnIsLeft = (event.which == 1), elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false); if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { return true } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { self.mouseDelayMet = true }, this.options.delay) } if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { this._mouseStarted = (this._mouseStart(event) !== false); if (!this._mouseStarted) { event.preventDefault(); return true } } this._mouseMoveDelegate = function(event) { return self._mouseMove(event) }; this._mouseUpDelegate = function(event) { return self._mouseUp(event) }; $(document).bind('mousemove.' + this.widgetName, this._mouseMoveDelegate).bind('mouseup.' + this.widgetName, this._mouseUpDelegate); ($.browser.safari || event.preventDefault()); event.originalEvent.mouseHandled = true; return true }, _mouseMove: function(event) { if ($.browser.msie && !event.button) { return this._mouseUp(event) } if (this._mouseStarted) { this._mouseDrag(event); return event.preventDefault() } if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, event) !== false); (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)) } return !this._mouseStarted }, _mouseUp: function(event) { $(document).unbind('mousemove.' + this.widgetName, this._mouseMoveDelegate).unbind('mouseup.' + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = (event.target == this._mouseDownEvent.target); this._mouseStop(event) } return false }, _mouseDistanceMet: function(event) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - event.pageX), Math.abs(this._mouseDownEvent.pageY - event.pageY)) >= this.options.distance) }, _mouseDelayMet: function(event) { return this.mouseDelayMet }, _mouseStart: function(event) { }, _mouseDrag: function(event) { }, _mouseStop: function(event) { }, _mouseCapture: function(event) { return true } }; $.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0} })(jQuery);

//ui slider
(function($) { $.widget("ui.slider", $.extend({}, $.ui.mouse, { _init: function() { var self = this, o = this.options; this._keySliding = false; this._handleIndex = null; this._detectOrientation(); this._mouseInit(); this.element.addClass("ui-slider" + " ui-slider-" + this.orientation + " ui-widget" + " ui-widget-content" + " ui-corner-all"); this.range = $([]); if (o.range) { if (o.range === true) { this.range = $('<div></div>'); if (!o.values) o.values = [this._valueMin(), this._valueMin()]; if (o.values.length && o.values.length != 2) { o.values = [o.values[0], o.values[0]] } } else { this.range = $('<div></div>') } this.range.appendTo(this.element).addClass("ui-slider-range"); if (o.range == "min" || o.range == "max") { this.range.addClass("ui-slider-range-" + o.range) } this.range.addClass("ui-widget-header") } if ($(".ui-slider-handle", this.element).length == 0) $('<a href="#">1</a>').appendTo(this.element).addClass("ui-slider-handle"); if (o.values && o.values.length) { while ($(".ui-slider-handle", this.element).length < o.values.length) $('<a href="#">1</a>').appendTo(this.element).addClass("ui-slider-handle") } this.handles = $(".ui-slider-handle", this.element).addClass("ui-state-default" + " ui-corner-all"); this.handle = this.handles.eq(0); this.handles.add(this.range).filter("a").click(function(event) { event.preventDefault() }).hover(function() { if (!o.disabled) { $(this).addClass('ui-state-hover') } }, function() { $(this).removeClass('ui-state-hover') }).focus(function() { if (!o.disabled) { $(".ui-slider .ui-state-focus").removeClass('ui-state-focus'); $(this).addClass('ui-state-focus') } else { $(this).blur() } }).blur(function() { $(this).removeClass('ui-state-focus') }); this.handles.each(function(i) { $(this).data("index.ui-slider-handle", i) }); this.handles.keydown(function(event) { var ret = true; var index = $(this).data("index.ui-slider-handle"); if (self.options.disabled) return; switch (event.keyCode) { case $.ui.keyCode.HOME: case $.ui.keyCode.END: case $.ui.keyCode.UP: case $.ui.keyCode.RIGHT: case $.ui.keyCode.DOWN: case $.ui.keyCode.LEFT: ret = false; if (!self._keySliding) { self._keySliding = true; $(this).addClass("ui-state-active"); self._start(event, index) } break } var curVal, newVal, step = self._step(); if (self.options.values && self.options.values.length) { curVal = newVal = self.values(index) } else { curVal = newVal = self.value() } switch (event.keyCode) { case $.ui.keyCode.HOME: newVal = self._valueMin(); break; case $.ui.keyCode.END: newVal = self._valueMax(); break; case $.ui.keyCode.UP: case $.ui.keyCode.RIGHT: if (curVal == self._valueMax()) return; newVal = curVal + step; break; case $.ui.keyCode.DOWN: case $.ui.keyCode.LEFT: if (curVal == self._valueMin()) return; newVal = curVal - step; break } self._slide(event, index, newVal); return ret }).keyup(function(event) { var index = $(this).data("index.ui-slider-handle"); if (self._keySliding) { self._stop(event, index); self._change(event, index); self._keySliding = false; $(this).removeClass("ui-state-active") } }); this._refreshValue() }, destroy: function() { this.handles.remove(); this.range.remove(); this.element.removeClass("ui-slider" + " ui-slider-horizontal" + " ui-slider-vertical" + " ui-slider-disabled" + " ui-widget" + " ui-widget-content" + " ui-corner-all").removeData("slider").unbind(".slider"); this._mouseDestroy() }, _mouseCapture: function(event) { var o = this.options; if (o.disabled) return false; this.elementSize = { width: 560, height: 17 }; this.elementOffset = this.element.offset(); var position = { x: event.pageX, y: event.pageY }; var normValue = this._normValueFromMouse(position); var distance = this._valueMax() - this._valueMin() + 1, closestHandle; var self = this, index; this.handles.each(function(i) { var thisDistance = Math.abs(normValue - self.values(i)); if (distance > thisDistance) { distance = thisDistance; closestHandle = $(this); index = i } }); if (o.range == true && this.values(1) == o.min) { closestHandle = $(this.handles[++index]) } this._start(event, index); self._handleIndex = index; closestHandle.addClass("ui-state-active").focus(); var offset = closestHandle.offset(); var mouseOverHandle = !$(event.target).parents().andSelf().is('.ui-slider-handle'); this._clickOffset = mouseOverHandle ? { left: 0, top: 0} : { left: event.pageX - offset.left - (closestHandle.width() / 2), top: event.pageY - offset.top - (closestHandle.height() / 2) - (parseInt(closestHandle.css('borderTopWidth'), 10) || 0) - (parseInt(closestHandle.css('borderBottomWidth'), 10) || 0) + (parseInt(closestHandle.css('marginTop'), 10) || 0) }; normValue = this._normValueFromMouse(position); this._slide(event, index, normValue); return true }, _mouseStart: function(event) { return true }, _mouseDrag: function(event) { var position = { x: event.pageX, y: event.pageY }; var normValue = this._normValueFromMouse(position); this._slide(event, this._handleIndex, normValue); return false }, _mouseStop: function(event) { this.handles.removeClass("ui-state-active"); this._stop(event, this._handleIndex); this._change(event, this._handleIndex); this._handleIndex = null; this._clickOffset = null; return false }, _detectOrientation: function() { this.orientation = this.options.orientation == 'vertical' ? 'vertical' : 'horizontal' }, _normValueFromMouse: function(position) { var pixelTotal, pixelMouse; if ('horizontal' == this.orientation) { pixelTotal = this.elementSize.width; pixelMouse = position.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0) } else { pixelTotal = this.elementSize.height; pixelMouse = position.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0) } var percentMouse = (pixelMouse / pixelTotal); if (percentMouse > 1) percentMouse = 1; if (percentMouse < 0) percentMouse = 0; if ('vertical' == this.orientation) percentMouse = 1 - percentMouse; var valueTotal = this._valueMax() - this._valueMin(), valueMouse = percentMouse * valueTotal, valueMouseModStep = valueMouse % this.options.step, normValue = this._valueMin() + valueMouse - valueMouseModStep; if (valueMouseModStep > (this.options.step / 2)) normValue += this.options.step; return parseFloat(normValue.toFixed(5)) }, _start: function(event, index) { var uiHash = { handle: this.handles[index], value: this.value() }; if (this.options.values && this.options.values.length) { uiHash.value = this.values(index); uiHash.values = this.values() } this._trigger("start", event, uiHash) }, _slide: function(event, index, newVal) { var handle = this.handles[index]; if (this.options.values && this.options.values.length) { var otherVal = this.values(index ? 0 : 1); if ((this.options.values.length == 2 && this.options.range === true) && ((index == 0 && newVal > otherVal) || (index == 1 && newVal < otherVal))) { newVal = otherVal } if (newVal != this.values(index)) { var newValues = this.values(); newValues[index] = newVal; var allowed = this._trigger("slide", event, { handle: this.handles[index], value: newVal, values: newValues }); var otherVal = this.values(index ? 0 : 1); if (allowed !== false) { this.values(index, newVal, (event.type == 'mousedown' && this.options.animate), true) } } } else { if (newVal != this.value()) { var allowed = this._trigger("slide", event, { handle: this.handles[index], value: newVal }); if (allowed !== false) { this._setData('value', newVal, (event.type == 'mousedown' && this.options.animate)) } } } }, _stop: function(event, index) { var uiHash = { handle: this.handles[index], value: this.value() }; if (this.options.values && this.options.values.length) { uiHash.value = this.values(index); uiHash.values = this.values() } this._trigger("stop", event, uiHash) }, _change: function(event, index) { var uiHash = { handle: this.handles[index], value: this.value() }; if (this.options.values && this.options.values.length) { uiHash.value = this.values(index); uiHash.values = this.values() } this._trigger("change", event, uiHash) }, value: function(newValue) { if (arguments.length) { this._setData("value", newValue); this._change(null, 0) } return this._value() }, values: function(index, newValue, animated, noPropagation) { if (arguments.length > 1) { this.options.values[index] = newValue; this._refreshValue(animated); if (!noPropagation) this._change(null, index) } if (arguments.length) { if (this.options.values && this.options.values.length) { return this._values(index) } else { return this.value() } } else { return this._values() } }, _setData: function(key, value, animated) { $.widget.prototype._setData.apply(this, arguments); switch (key) { case 'disabled': if (value) { this.handles.filter(".ui-state-focus").blur(); this.handles.removeClass("ui-state-hover"); this.handles.attr("disabled", "disabled") } else { this.handles.removeAttr("disabled") } case 'orientation': this._detectOrientation(); this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-" + this.orientation); this._refreshValue(animated); break; case 'value': this._refreshValue(animated); break } }, _step: function() { var step = this.options.step; return step }, _value: function() { var val = this.options.value; if (val < this._valueMin()) val = this._valueMin(); if (val > this._valueMax()) val = this._valueMax(); return val }, _values: function(index) { if (arguments.length) { var val = this.options.values[index]; if (val < this._valueMin()) val = this._valueMin(); if (val > this._valueMax()) val = this._valueMax(); return val } else { return this.options.values } }, _valueMin: function() { var valueMin = this.options.min; return valueMin }, _valueMax: function() { var valueMax = this.options.max; return valueMax }, _refreshValue: function(animate) { var oRange = this.options.range, o = this.options, self = this; if (this.options.values && this.options.values.length) { var vp0, vp1; this.handles.each(function(i, j) { var valPercent = (self.values(i) - self._valueMin()) / (self._valueMax() - self._valueMin()) * 100; var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%'; $(this).stop(1, 1)[animate ? 'animate' : 'css'](_set, o.animate); if (self.options.range === true) { if (self.orientation == 'horizontal') { (i == 0) && self.range.stop(1, 1)[animate ? 'animate' : 'css']({ left: valPercent + '%' }, o.animate); (i == 1) && self.range[animate ? 'animate' : 'css']({ width: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate }) } else { (i == 0) && self.range.stop(1, 1)[animate ? 'animate' : 'css']({ bottom: (valPercent) + '%' }, o.animate); (i == 1) && self.range[animate ? 'animate' : 'css']({ height: (valPercent - lastValPercent) + '%' }, { queue: false, duration: o.animate }) } } lastValPercent = valPercent }) } else { var value = this.value(), valueMin = this._valueMin(), valueMax = this._valueMax(), valPercent = valueMax != valueMin ? (value - valueMin) / (valueMax - valueMin) * 93 : 0; var _set = {}; _set[self.orientation == 'horizontal' ? 'left' : 'bottom'] = valPercent + '%'; this.handle.stop(1, 1)[animate ? 'animate' : 'css'](_set, o.animate); (oRange == "min") && (this.orientation == "horizontal") && this.range.stop(1, 1)[animate ? 'animate' : 'css']({ width: valPercent + '%' }, o.animate); (oRange == "max") && (this.orientation == "horizontal") && this.range[animate ? 'animate' : 'css']({ width: (100 - valPercent) + '%' }, { queue: false, duration: o.animate }); (oRange == "min") && (this.orientation == "vertical") && this.range.stop(1, 1)[animate ? 'animate' : 'css']({ height: valPercent + '%' }, o.animate); (oRange == "max") && (this.orientation == "vertical") && this.range[animate ? 'animate' : 'css']({ height: (100 - valPercent) + '%' }, { queue: false, duration: o.animate }) } } })); $.extend($.ui.slider, { getter: "value values", version: "1.7.2", eventPrefix: "slide", defaults: { animate: false, delay: 0, distance: 0, max: 100, min: 0, orientation: 'horizontal', range: false, step: 1, value: 0, values: null} }) })(jQuery);

//jquery cycle
(function($) { var ver = "2.72"; if ($.support == undefined) { $.support = { opacity: !($.browser.msie) }; } function debug(s) { if ($.fn.cycle.debug) { log(s); } } function log() { if (window.console && window.console.log) { window.console.log("[cycle] " + Array.prototype.join.call(arguments, " ")); } } $.fn.cycle = function(options, arg2) { var o = { s: this.selector, c: this.context }; if (this.length === 0 && options != "stop") { if (!$.isReady && o.s) { log("DOM not ready, queuing slideshow"); $(function() { $(o.s, o.c).cycle(options, arg2); }); return this; } log("terminating; zero elements found by selector" + ($.isReady ? "" : " (DOM not ready)")); return this; } return this.each(function() { var opts = handleArguments(this, options, arg2); if (opts === false) { return; } if (this.cycleTimeout) { clearTimeout(this.cycleTimeout); } this.cycleTimeout = this.cyclePause = 0; var $cont = $(this); var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children(); var els = $slides.get(); if (els.length < 2) { log("terminating; too few slides: " + els.length); return; } var opts2 = buildOptions($cont, $slides, els, opts, o); if (opts2 === false) { return; } var startTime = opts2.continuous ? 10 : getTimeout(opts2.currSlide, opts2.nextSlide, opts2, !opts2.rev); if (startTime) { startTime += (opts2.delay || 0); if (startTime < 10) { startTime = 10; } debug("first timeout: " + startTime); this.cycleTimeout = setTimeout(function() { go(els, opts2, 0, !opts2.rev); }, startTime); } }); }; function handleArguments(cont, options, arg2) { if (cont.cycleStop == undefined) { cont.cycleStop = 0; } if (options === undefined || options === null) { options = {}; } if (options.constructor == String) { switch (options) { case "stop": cont.cycleStop++; if (cont.cycleTimeout) { clearTimeout(cont.cycleTimeout); } cont.cycleTimeout = 0; $(cont).removeData("cycle.opts"); return false; case "pause": cont.cyclePause = 1; return false; case "resume": cont.cyclePause = 0; if (arg2 === true) { options = $(cont).data("cycle.opts"); if (!options) { log("options not found, can not resume"); return false; } if (cont.cycleTimeout) { clearTimeout(cont.cycleTimeout); cont.cycleTimeout = 0; } go(options.elements, options, 1, 1); } return false; case "prev": case "next": var opts = $(cont).data("cycle.opts"); if (!opts) { log('options not found, "prev/next" ignored'); return false; } $.fn.cycle[options](opts); return false; default: options = { fx: options }; } return options; } else { if (options.constructor == Number) { var num = options; options = $(cont).data("cycle.opts"); if (!options) { log("options not found, can not advance slide"); return false; } if (num < 0 || num >= options.elements.length) { log("invalid slide index: " + num); return false; } options.nextSlide = num; if (cont.cycleTimeout) { clearTimeout(cont.cycleTimeout); cont.cycleTimeout = 0; } if (typeof arg2 == "string") { options.oneTimeFx = arg2; } go(options.elements, options, 1, num >= options.currSlide); return false; } } return options; } function removeFilter(el, opts) { if (!$.support.opacity && opts.cleartype && el.style.filter) { try { el.style.removeAttribute("filter"); } catch (smother) { } } } function buildOptions($cont, $slides, els, options, o) { var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {}); if (opts.autostop) { opts.countdown = opts.autostopCount || els.length; } var cont = $cont[0]; $cont.data("cycle.opts", opts); opts.$cont = $cont; opts.stopCount = cont.cycleStop; opts.elements = els; opts.before = opts.before ? [opts.before] : []; opts.after = opts.after ? [opts.after] : []; opts.after.unshift(function() { opts.busy = 0; }); if (!$.support.opacity && opts.cleartype) { opts.after.push(function() { removeFilter(this, opts); }); } if (opts.continuous) { opts.after.push(function() { go(els, opts, 0, !opts.rev); }); } saveOriginalOpts(opts); if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) { clearTypeFix($slides); } if ($cont.css("position") == "static") { $cont.css("position", "relative"); } if (opts.width) { $cont.width(opts.width); } if (opts.height && opts.height != "auto") { $cont.height(opts.height); } if (opts.startingSlide) { opts.startingSlide = parseInt(opts.startingSlide); } if (opts.random) { opts.randomMap = []; for (var i = 0; i < els.length; i++) { opts.randomMap.push(i); } opts.randomMap.sort(function(a, b) { return Math.random() - 0.5; }); opts.randomIndex = 0; opts.startingSlide = opts.randomMap[0]; } else { if (opts.startingSlide >= els.length) { opts.startingSlide = 0; } } opts.currSlide = opts.startingSlide = opts.startingSlide || 0; var first = opts.startingSlide; $slides.css({ position: "absolute", top: 0, left: 0 }).hide().each(function(i) { var z = first ? i >= first ? els.length - (i - first) : first - i : els.length - i; $(this).css("z-index", z); }); $(els[first]).css("opacity", 1).show(); removeFilter(els[first], opts); if (opts.fit && opts.width) { $slides.width(opts.width); } if (opts.fit && opts.height && opts.height != "auto") { $slides.height(opts.height); } var reshape = opts.containerResize && !$cont.innerHeight(); if (reshape) { var maxw = 0, maxh = 0; for (var j = 0; j < els.length; j++) { var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight(); if (!w) { w = e.offsetWidth; } if (!h) { h = e.offsetHeight; } maxw = w > maxw ? w : maxw; maxh = h > maxh ? h : maxh; } if (maxw > 0 && maxh > 0) { $cont.css({ width: maxw + "px", height: maxh + "px" }); } } if (opts.pause) { $cont.hover(function() { this.cyclePause++; }, function() { this.cyclePause--; }); } if (supportMultiTransitions(opts) === false) { return false; } var requeue = false; options.requeueAttempts = options.requeueAttempts || 0; $slides.each(function() { var $el = $(this); this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height(); this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width(); if ($el.is("img")) { var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete); var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete); var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete); var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete); if (loadingIE || loadingFF || loadingOp || loadingOther) { if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { log(options.requeueAttempts, " - img slide not loaded, requeuing slideshow: ", this.src, this.cycleW, this.cycleH); setTimeout(function() { $(o.s, o.c).cycle(options); }, opts.requeueTimeout); requeue = true; return false; } else { log("could not determine size of image: " + this.src, this.cycleW, this.cycleH); } } } return true; }); if (requeue) { return false; } opts.cssBefore = opts.cssBefore || {}; opts.animIn = opts.animIn || {}; opts.animOut = opts.animOut || {}; $slides.not(":eq(" + first + ")").css(opts.cssBefore); if (opts.cssFirst) { $($slides[first]).css(opts.cssFirst); } if (opts.timeout) { opts.timeout = parseInt(opts.timeout); if (opts.speed.constructor == String) { opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed); } if (!opts.sync) { opts.speed = opts.speed / 2; } while ((opts.timeout - opts.speed) < 250) { opts.timeout += opts.speed; } } if (opts.easing) { opts.easeIn = opts.easeOut = opts.easing; } if (!opts.speedIn) { opts.speedIn = opts.speed; } if (!opts.speedOut) { opts.speedOut = opts.speed; } opts.slideCount = els.length; opts.currSlide = opts.lastSlide = first; if (opts.random) { opts.nextSlide = opts.currSlide; if (++opts.randomIndex == els.length) { opts.randomIndex = 0; } opts.nextSlide = opts.randomMap[opts.randomIndex]; } else { opts.nextSlide = opts.startingSlide >= (els.length - 1) ? 0 : opts.startingSlide + 1; } if (!opts.multiFx) { var init = $.fn.cycle.transitions[opts.fx]; if ($.isFunction(init)) { init($cont, $slides, opts); } else { if (opts.fx != "custom" && !opts.multiFx) { log("unknown transition: " + opts.fx, "; slideshow terminating"); return false; } } } var e0 = $slides[first]; if (opts.before.length) { opts.before[0].apply(e0, [e0, e0, opts, true]); } if (opts.after.length > 1) { opts.after[1].apply(e0, [e0, e0, opts, true]); } if (opts.next) { $(opts.next).bind(opts.prevNextEvent, function() { return advance(opts, opts.rev ? -1 : 1); }); } if (opts.prev) { $(opts.prev).bind(opts.prevNextEvent, function() { return advance(opts, opts.rev ? 1 : -1); }); } if (opts.pager) { buildPager(els, opts); } exposeAddSlide(opts, els); return opts; } function saveOriginalOpts(opts) { opts.original = { before: [], after: [] }; opts.original.cssBefore = $.extend({}, opts.cssBefore); opts.original.cssAfter = $.extend({}, opts.cssAfter); opts.original.animIn = $.extend({}, opts.animIn); opts.original.animOut = $.extend({}, opts.animOut); $.each(opts.before, function() { opts.original.before.push(this); }); $.each(opts.after, function() { opts.original.after.push(this); }); } function supportMultiTransitions(opts) { var i, tx, txs = $.fn.cycle.transitions; if (opts.fx.indexOf(",") > 0) { opts.multiFx = true; opts.fxs = opts.fx.replace(/\s*/g, "").split(","); for (i = 0; i < opts.fxs.length; i++) { var fx = opts.fxs[i]; tx = txs[fx]; if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) { log("discarding unknown transition: ", fx); opts.fxs.splice(i, 1); i--; } } if (!opts.fxs.length) { log("No valid transitions named; slideshow terminating."); return false; } } else { if (opts.fx == "all") { opts.multiFx = true; opts.fxs = []; for (p in txs) { tx = txs[p]; if (txs.hasOwnProperty(p) && $.isFunction(tx)) { opts.fxs.push(p); } } } } if (opts.multiFx && opts.randomizeEffects) { var r1 = Math.floor(Math.random() * 20) + 30; for (i = 0; i < r1; i++) { var r2 = Math.floor(Math.random() * opts.fxs.length); opts.fxs.push(opts.fxs.splice(r2, 1)[0]); } debug("randomized fx sequence: ", opts.fxs); } return true; } function exposeAddSlide(opts, els) { opts.addSlide = function(newSlide, prepend) { var $s = $(newSlide), s = $s[0]; if (!opts.autostopCount) { opts.countdown++; } els[prepend ? "unshift" : "push"](s); if (opts.els) { opts.els[prepend ? "unshift" : "push"](s); } opts.slideCount = els.length; $s.css("position", "absolute"); $s[prepend ? "prependTo" : "appendTo"](opts.$cont); if (prepend) { opts.currSlide++; opts.nextSlide++; } if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) { clearTypeFix($s); } if (opts.fit && opts.width) { $s.width(opts.width); } if (opts.fit && opts.height && opts.height != "auto") { $slides.height(opts.height); } s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height(); s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width(); $s.css(opts.cssBefore); if (opts.pager) { $.fn.cycle.createPagerAnchor(els.length - 1, s, $(opts.pager), els, opts); } if ($.isFunction(opts.onAddSlide)) { opts.onAddSlide($s); } else { $s.hide(); } }; } $.fn.cycle.resetState = function(opts, fx) { fx = fx || opts.fx; opts.before = []; opts.after = []; opts.cssBefore = $.extend({}, opts.original.cssBefore); opts.cssAfter = $.extend({}, opts.original.cssAfter); opts.animIn = $.extend({}, opts.original.animIn); opts.animOut = $.extend({}, opts.original.animOut); opts.fxFn = null; $.each(opts.original.before, function() { opts.before.push(this); }); $.each(opts.original.after, function() { opts.after.push(this); }); var init = $.fn.cycle.transitions[fx]; if ($.isFunction(init)) { init(opts.$cont, $(opts.elements), opts); } }; function go(els, opts, manual, fwd) { if (manual && opts.busy && opts.manualTrump) { $(els).stop(true, true); opts.busy = false; } if (opts.busy) { return; } var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide]; if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual) { return; } if (!manual && !p.cyclePause && ((opts.autostop && (--opts.countdown <= 0)) || (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) { if (opts.end) { opts.end(opts); } return; } if (manual || !p.cyclePause) { var fx = opts.fx; curr.cycleH = curr.cycleH || $(curr).height(); curr.cycleW = curr.cycleW || $(curr).width(); next.cycleH = next.cycleH || $(next).height(); next.cycleW = next.cycleW || $(next).width(); if (opts.multiFx) { if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length) { opts.lastFx = 0; } fx = opts.fxs[opts.lastFx]; opts.currFx = fx; } if (opts.oneTimeFx) { fx = opts.oneTimeFx; opts.oneTimeFx = null; } $.fn.cycle.resetState(opts, fx); if (opts.before.length) { $.each(opts.before, function(i, o) { if (p.cycleStop != opts.stopCount) { return; } o.apply(next, [curr, next, opts, fwd]); }); } var after = function() { $.each(opts.after, function(i, o) { if (p.cycleStop != opts.stopCount) { return; } o.apply(next, [curr, next, opts, fwd]); }); }; if (opts.nextSlide != opts.currSlide) { opts.busy = 1; if (opts.fxFn) { opts.fxFn(curr, next, opts, after, fwd); } else { if ($.isFunction($.fn.cycle[opts.fx])) { $.fn.cycle[opts.fx](curr, next, opts, after); } else { $.fn.cycle.custom(curr, next, opts, after, manual && opts.fastOnEvent); } } } opts.lastSlide = opts.currSlide; if (opts.random) { opts.currSlide = opts.nextSlide; if (++opts.randomIndex == els.length) { opts.randomIndex = 0; } opts.nextSlide = opts.randomMap[opts.randomIndex]; } else { var roll = (opts.nextSlide + 1) == els.length; opts.nextSlide = roll ? 0 : opts.nextSlide + 1; opts.currSlide = roll ? els.length - 1 : opts.nextSlide - 1; } if (opts.pager) { $.fn.cycle.updateActivePagerLink(opts.pager, opts.currSlide); } } var ms = 0; if (opts.timeout && !opts.continuous) { ms = getTimeout(curr, next, opts, fwd); } else { if (opts.continuous && p.cyclePause) { ms = 10; } } if (ms > 0) { p.cycleTimeout = setTimeout(function() { go(els, opts, 0, !opts.rev); }, ms); } } $.fn.cycle.updateActivePagerLink = function(pager, currSlide) { $(pager).find("a").removeClass("activeSlide").filter("a:eq(" + currSlide + ")").addClass("activeSlide"); }; function getTimeout(curr, next, opts, fwd) { if (opts.timeoutFn) { var t = opts.timeoutFn(curr, next, opts, fwd); while ((t - opts.speed) < 250) { t += opts.speed; } debug("calculated timeout: " + t + "; speed: " + opts.speed); if (t !== false) { return t; } } return opts.timeout; } $.fn.cycle.next = function(opts) { advance(opts, opts.rev ? -1 : 1); }; $.fn.cycle.prev = function(opts) { advance(opts, opts.rev ? 1 : -1); }; function advance(opts, val) { var els = opts.elements; var p = opts.$cont[0], timeout = p.cycleTimeout; if (timeout) { clearTimeout(timeout); p.cycleTimeout = 0; } if (opts.random && val < 0) { opts.randomIndex--; if (--opts.randomIndex == -2) { opts.randomIndex = els.length - 2; } else { if (opts.randomIndex == -1) { opts.randomIndex = els.length - 1; } } opts.nextSlide = opts.randomMap[opts.randomIndex]; } else { if (opts.random) { if (++opts.randomIndex == els.length) { opts.randomIndex = 0; } opts.nextSlide = opts.randomMap[opts.randomIndex]; } else { opts.nextSlide = opts.currSlide + val; if (opts.nextSlide < 0) { if (opts.nowrap) { return false; } opts.nextSlide = els.length - 1; } else { if (opts.nextSlide >= els.length) { if (opts.nowrap) { return false; } opts.nextSlide = 0; } } } } if ($.isFunction(opts.prevNextClick)) { opts.prevNextClick(val > 0, opts.nextSlide, els[opts.nextSlide]); } go(els, opts, 1, val >= 0); return false; } function buildPager(els, opts) { var $p = $(opts.pager); $.each(els, function(i, o) { $.fn.cycle.createPagerAnchor(i, o, $p, els, opts); }); $.fn.cycle.updateActivePagerLink(opts.pager, opts.startingSlide); } $.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) { var a; if ($.isFunction(opts.pagerAnchorBuilder)) { a = opts.pagerAnchorBuilder(i, el); } else { a = '<a href="#">' + (i + 1) + "</a>"; } if (!a) { return; } var $a = $(a); if ($a.parents("body").length === 0) { var arr = []; if ($p.length > 1) { $p.each(function() { var $clone = $a.clone(true); $(this).append($clone); arr.push($clone); }); $a = $(arr); } else { $a.appendTo($p); } } $a.bind(opts.pagerEvent, function(e) { e.preventDefault(); opts.nextSlide = i; var p = opts.$cont[0], timeout = p.cycleTimeout; if (timeout) { clearTimeout(timeout); p.cycleTimeout = 0; } if ($.isFunction(opts.pagerClick)) { opts.pagerClick(opts.nextSlide, els[opts.nextSlide]); } go(els, opts, 1, opts.currSlide < i); return false; }); if (opts.pagerEvent != "click") { $a.click(function() { return false; }); } if (opts.pauseOnPagerHover) { $a.hover(function() { opts.$cont[0].cyclePause++; }, function() { opts.$cont[0].cyclePause--; }); } }; $.fn.cycle.hopsFromLast = function(opts, fwd) { var hops, l = opts.lastSlide, c = opts.currSlide; if (fwd) { hops = c > l ? c - l : opts.slideCount - l; } else { hops = c < l ? l - c : l + opts.slideCount - c; } return hops; }; function clearTypeFix($slides) { function hex(s) { s = parseInt(s).toString(16); return s.length < 2 ? "0" + s : s; } function getBg(e) { for (; e && e.nodeName.toLowerCase() != "html"; e = e.parentNode) { var v = $.css(e, "background-color"); if (v.indexOf("rgb") >= 0) { var rgb = v.match(/\d+/g); return "#" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); } if (v && v != "transparent") { return v; } } return "#ffffff"; } $slides.each(function() { $(this).css("background-color", getBg(this)); }); } $.fn.cycle.commonReset = function(curr, next, opts, w, h, rev) { $(opts.elements).not(curr).hide(); opts.cssBefore.opacity = 1; opts.cssBefore.display = "block"; if (w !== false && next.cycleW > 0) { opts.cssBefore.width = next.cycleW; } if (h !== false && next.cycleH > 0) { opts.cssBefore.height = next.cycleH; } opts.cssAfter = opts.cssAfter || {}; opts.cssAfter.display = "none"; $(curr).css("zIndex", opts.slideCount + (rev === true ? 1 : 0)); $(next).css("zIndex", opts.slideCount + (rev === true ? 0 : 1)); }; $.fn.cycle.custom = function(curr, next, opts, cb, speedOverride) { var $l = $(curr), $n = $(next); var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut; $n.css(opts.cssBefore); if (speedOverride) { if (typeof speedOverride == "number") { speedIn = speedOut = speedOverride; } else { speedIn = speedOut = 1; } easeIn = easeOut = null; } var fn = function() { $n.animate(opts.animIn, speedIn, easeIn, cb); }; $l.animate(opts.animOut, speedOut, easeOut, function() { if (opts.cssAfter) { $l.css(opts.cssAfter); } if (!opts.sync) { fn(); } }); if (opts.sync) { fn(); } }; $.fn.cycle.transitions = { fade: function($cont, $slides, opts) { $slides.not(":eq(" + opts.currSlide + ")").css("opacity", 0); opts.before.push(function(curr, next, opts) { $.fn.cycle.commonReset(curr, next, opts); opts.cssBefore.opacity = 0; }); opts.animIn = { opacity: 1 }; opts.animOut = { opacity: 0 }; opts.cssBefore = { top: 0, left: 0 }; } }; $.fn.cycle.ver = function() { return ver; }; $.fn.cycle.defaults = { fx: "fade", timeout: 4000, timeoutFn: null, continuous: 0, speed: 1000, speedIn: null, speedOut: null, next: null, prev: null, prevNextClick: null, prevNextEvent: "click", pager: null, pagerClick: null, pagerEvent: "click", pagerAnchorBuilder: null, before: null, after: null, end: null, easing: null, easeIn: null, easeOut: null, shuffle: null, animIn: null, animOut: null, cssBefore: null, cssAfter: null, fxFn: null, height: "auto", startingSlide: 0, sync: 1, random: 0, fit: 0, containerResize: 1, pause: 0, pauseOnPagerHover: 0, autostop: 0, autostopCount: 0, delay: 0, slideExpr: null, cleartype: !$.support.opacity, cleartypeNoBg: false, nowrap: 0, fastOnEvent: 0, randomizeEffects: 1, rev: 0, manualTrump: true, requeueOnImageNotLoaded: true, requeueTimeout: 250 }; })(jQuery);

function isdefined(variable) { return (typeof (window[variable]) == "undefined") ? false : true } $(".cinex ul li:first").addClass("first"); $(".cinex ul li:last").addClass("last"); $('.cinex').corner("10px;"); $('.quicktkts').corner("bottom 5px"); $('.cinex ul li.first').corner("tl 5px").corner("bl 5px"); $('.cinex ul li.last').corner("tr 5px").corner("br 5px"); var promosection = 1; var currentpage = 1; var totalpages = 1; var pagesize = 1000; var hpdata = null; $(".pn2 a").addClass("on"); LoadHeroData('nowshowing'); function setPromoSection(section) { CloseTrailer(); promosection = section; currentpage = 1; $(".pn a").removeClass("on"); $(".pn" + section + " a").addClass("on"); $(".moviebins").empty(); ShowLoader(true); switch (section) { case 1: LoadHeroData('newthisweek'); break; case 2: LoadHeroData('nowshowing'); break; case 3: LoadHeroData('comingsoon'); break; case 4: LoadHeroData('advancesales'); break; default: break } } $("#prevpage").click(function(event) { event.preventDefault(); var value = $('#slider').slider('option', 'value'); if (value == 1) return; $('#slider').slider('option', 'value', value - 1); UpdateMovieBlock($('#slider').slider('option', 'value')) }); $("#nextpage").click(function(event) { event.preventDefault(); var value = $('#slider').slider('option', 'value'); if (value == numitems + 1) return; $('#slider').slider('option', 'value', value + 1); UpdateMovieBlock($('#slider').slider('option', 'value')) }); function UpdateMovieBlock(newValue) { var value = newValue; leftperc = (value - 1) / (numitems); clearTimeout(loadingTimer); var scrollToHere = Math.round(leftperc * binSize); $(".binhldr").stop().scrollTo(scrollToHere, 500, { axis: 'x', offset: -262, onAfter: function() { loadingTimer = setTimeout(LoadVisible, 500) } }) } var binSize = null; function UpdatePager() { return; if (currentpage == 1) { $("#prevpage").addClass("off") } else { } if (currentpage == totalpages) { } else { } } var totalnum; var numitems = 8; function ShowLoader(show) { if (show) { $(".heroloader").show(); $(".scrollhldr").hide() } else { $(".heroloader").hide(); $(".scrollhldr").fadeIn("fast") } } function ShowEmptyHero() { $(".scrollhldr").hide(); $(".binhldr").append("<div class='emptyhero'>Sorry no films are available.</div>") } var loadingTimer = null; function LoadVisible() { found = 0; $.each($(".binhldr li "), function(i, item) { offsetLeftAmount = ($(item).offset().left - 369); if (found <= 5 && offsetLeftAmount >= -250) { found++; img = $(item).find('img.mov'); if ($(img[0]).attr('lazysrc') != $(img[0]).attr('src')) { $(img[0]).attr('src', $(img[0]).attr('lazysrc')) } } }) } function BindScroller() { $(".emptyhero").remove(); $(".binhldr").scrollTo(0, 0, { axis: 'x' }); $(".ui-slider-handle").css("left", "0%"); totalnum = hpdata.items.length; totalpages = Math.ceil(totalnum / pagesize); startindex = 1; endindex = totalnum; var startindex = (((currentpage * pagesize) - pagesize) + 1); var endindex = (currentpage * pagesize); if (endindex >= totalnum) { endindex = totalnum } $(".moviebins").empty(); ShowLoader(false); numitems = endindex - startindex; var flvicon; if (totalnum < 1) { ShowEmptyHero(); return } var imageTag = null; i = 0; for (var i in hpdata.items) { flvicon = hpdata.items[i].flv.length > 0 ? '<span class="play"></span>' : ''; if (i < 5) { imageTag = '<img alt="' + hpdata.items[i].nme + '" class="mov" lazysrc="' + hpdata.items[i].bnrimg + '" src="' + hpdata.items[i].bnrimg + '" id="movpic-' + hpdata.items[i].vistaid + '" />' } else { imageTag = '<img alt="' + hpdata.items[i].nme + '" class="mov" lazysrc="' + hpdata.items[i].bnrimg + '" width="145" height="215" src="/lib/img/loading.gif" id="movpic-' + hpdata.items[i].vistaid + '" />' } $(".moviebins").append('<li><div class="bintop">' + flvicon + '<input type="hidden" id="flvurl" value="' + hpdata.items[i].flv + '" />' + imageTag + '</div>' + '<div class="binmid"><img src="' + hpdata.items[i].rtngimg + '" alt="' + hpdata.items[i].rtngtxt + '" class="classif" /><span class="mvttl">' + (hpdata.items[i].nme.length > 38 ? (hpdata.items[i].nme.substring(0, 38) + '...') : hpdata.items[i].nme) + '</span></div>' + '<div class="morebuy"><div style="height:15px;padding-top:7px;"></div> ' + '<div><a href="' + hpdata.items[i].itemlink + '"><img src="lib/img/btns/btnNoreinfo.jpg" alt="MORE INFO" /></a>' + ((promosection == 3 && (hpdata.items[i].comingsoononsale == "false")) ? '' : '<a href="/vista/visSelect.aspx?visSearchBy=mov&visMovieName=' + hpdata.items[i].nme + '"><img src="lib/img/btns/btnBuyTkts.jpg" alt="BUY TICKETS" /></a></div>') + '</div></li>') } if (totalnum < 5) { $(".scrollhldr").hide() } $("ul.moviebins li div img.mov").mouseover(function() { $("ul.moviebins li div span.pt1").remove(); $("ul.moviebins li div span.pt2").remove(); if ($(this).parent().find("#flvurl").val().length > 0) { $(this).parent().append("<span class='pt1'></span>"); $(this).parent().append("<span class='pt2'></span>"); var pt1 = $(this).parent().find(".pt1"); $(pt1).fadeTo(0, .44); $(this).parent().find(".pt2").ifixpng(); $(this).parent().find(".pt2").click(function() { EmbedTrailer($(this).parent().parent(), $(this).parent().find("#flvurl").val()) }); $(this).parent().find(".pt2").mouseleave(function() { $("ul.moviebins li div span.pt1").remove(); $("ul.moviebins li div span.pt2").remove() }) } }); var width = 0; $.each($(".binhldr li"), function(i, item) { width += 154 }); $(".binhldr ul").width(width); var minnum = 1; $("#slider").slider("destroy"); var child; var leftperc = 0; var leftpx = 0; var ismove = false; binSize = $(".moviebins").width() - $(".binhldr").width(); $("#slider").slider({ value: 1, min: 1, max: numitems + 1, step: 1, slide: function(event, ui) { UpdateMovieBlock(ui.value) } }); var offset = 0; $(".sliderbtns").empty(); var x = 1; for (var i = startindex; i <= endindex; i++) { offset = (((i - 1) - ((currentpage - 1) * pagesize)) / (endindex - ((currentpage - 1) * pagesize))) * 100; offset = pagesize != minnum ? ((x - minnum) / ((numitems + 1) - minnum) * 93) : 0; displayNumber = i; if (numitems >= 26 && numitems < 50 && i % 2 == 0) displayNumber = ''; if (i != 1 && numitems >= 50 && numitems < 100) { if (i % 5 == 0) displayNumber = i; else displayNumber = '' } if (i != 1 && numitems >= 100) { if (i % 10 == 0) displayNumber = i; else displayNumber = '' } displayNumber = '&nbsp;'; $(".sliderbtns").append("<span class='nummovies' style='left:" + offset + "%'>" + displayNumber + "</span>"); x++ } $(".ui-slider-handle").text((pagesize * (currentpage - 1)) + 1); $(".ui-slider-handle").text(' '); $(".scroller span").click(function() { var clickid = $(this).attr("id").replace('feat_', ''); $(".binhldr").stop(); $(".binhldr").scrollTo('li:eq(' + clickid + ')', 1600, { axis: 'x', easing: 'easeOutQuart', offset: -157 }) }); $("#prevpage").removeClass("off"); UpdatePager() } function CloseTrailer() { $("#movflv").css("left", "-5000px"); if (totalnum > 4) { $(".scrollhldr").show() } $(".flvdetail").remove(); $("#movflv").empty().append("<div id='flashcontent'><a target='_blank' href='http://get.adobe.com/flashplayer/'>Please upgrade your flash player to view this trailer</a><a href='javascript:CloseTrailer();'>back to movie list</a></div>") } function EmbedTrailer(obj, flvurl) { $("#movflv").css("left", "0px"); $("#movflv").css("top", "2px"); $(".scrollhldr").hide(); var vars = { flvurl: flvurl }; var params = { scale: 'noScale', salign: 'lt', menu: 'false', allowFullScreen: 'true', wmode: 'transparent', allowScriptAccess: "always" }; var attributes = { id: 'hoyts_player' }; swfobject.embedSWF("/lib/swf/HoytsVideoPlayer.swf", "flashcontent", "479", "319", "9", "/lib/swf/expressInstall.swf", vars, params, attributes); $("#movflv").append("<div class='flvdetail'></div>"); var li = $(obj).clone(); $(".flvdetail").html(li.html()); $(".flvdetail span.pt2").remove(); $(".flvdetail span.pt1").remove(); $(".flvdetail div span.play").remove() } function LoadHeroData(type) { var today = new Date(); var cb = today.getFullYear().toString() + today.getMonth().toString() + today.getDate().toString(); $.ajax({ type: "GET", dataType: "json", url: "/gateway/" + type + ".json?cb=" + cb, processData: true, success: function(data) { hpdata = data; BindScroller() }, beforeSend: function(xhr) { }, error: function(xhr) { }, complete: function() { } }) } $('.evimghldr').cycle({ fx: 'fade', timeout: 10000, pause: 1, speed: 1000, cleartype: 0, easing: 'easeInOutCubic', pager: '.evpager .pgr', before: function(currSlideElement, nextSlideElement, options, forwardFlag) { var img = $(nextSlideElement).find('img'); $(img).attr("src", $(img).attr("lazysrc")) }, next: '#next2', prev: '#prev2' }); $("#prev2").fadeIn("fast"); $("#next2").fadeIn("fast");