; (function($) {
    var _remove = $.fn.remove, isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9); $.ui = { version: "1.6rc5", 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) { 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); }, cssCache: {}, css: function(name) {
        if ($.ui.cssCache[name]) { return $.ui.cssCache[name]; }
        var tmp = $('<div class="ui-gen"></div>').addClass(name).css({ position: 'absolute', top: '-5000px', left: '-5000px', display: 'block' }).appendTo('body'); $.ui.cssCache[name] = !!((!(/auto|default/).test(tmp.css('cursor')) || (/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) || !(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))); try { $('body').get(0).removeChild(tmp.get(0)); } catch (e) { }
        return $.ui.cssCache[name];
    }, 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]); }, tabbable: function(elem) {
        var nodeName = elem.nodeName.toLowerCase(); function isVisible(element) { return !($(element).is(':hidden') || $(element).parents(':hidden').length); }
        return (elem.tabIndex >= 0 && (('a' == nodeName && elem.href) || (/input|select|textarea|button/.test(nodeName) && 'hidden' != elem.type && !elem.disabled)) && isVisible(elem));
    } 
    }); 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))); (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(); }); this._init(); }; $[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; 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; 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) {
        (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()); 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 = true; 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); (function($) {
    $.widget("ui.accordion", { _init: function() {
        var options = this.options; if (options.navigation) { var current = this.element.find("a").filter(options.navigationFilter); if (current.length) { if (current.filter(options.header).length) { options.active = current; } else { options.active = current.parent().parent().prev(); current.addClass("ui-accordion-current"); } } }
        this.element.addClass("ui-accordion ui-widget ui-helper-reset"); var groups = this.element.children().addClass("ui-accordion-group"); var headers = options.headers = groups.find("> :first-child").addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion", function() { $(this).addClass('ui-state-hover'); }).bind("mouseleave.accordion", function() { $(this).removeClass('ui-state-hover'); }); headers.next().wrap("<div></div>").addClass("ui-accordion-content").parent().addClass("ui-accordion-content-wrap ui-helper-reset ui-widget-content ui-corner-bottom"); var active = options.active = findActive(headers, options.active).toggleClass("ui-state-default").toggleClass("ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top"); active.parent().addClass(options.selectedClass); $("<span/>").addClass("ui-icon " + this.options.icons.header).prependTo(headers); active.find(".ui-icon").toggleClass(this.options.icons.header).toggleClass(this.options.icons.headerSelected); if ($.browser.msie) { this.element.find('a').css('zoom', '1'); }
        this.resize(); this.element.attr('role', 'tablist'); var self = this; options.headers.attr('role', 'tab').bind('keydown', function(event) { return self._keydown(event); }).next().attr('role', 'tabpanel'); options.headers.not(options.active || "").attr('aria-expanded', 'false').attr("tabIndex", "-1").next().hide(); if (!options.active.length) { options.headers.eq(0).attr('tabIndex', '0'); } else { options.active.attr('aria-expanded', 'true').attr("tabIndex", "0"); }
        if (!$.browser.safari)
            options.headers.find('a').attr('tabIndex', '-1'); if (options.event) { this.element.bind((options.event) + ".accordion", clickHandler); } 
    }, destroy: function() { this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role").unbind(".accordion"); $.removeData(this.element[0], "accordion"); var groups = this.element.children().removeClass("ui-accordion-group " + this.options.selectedClass); var headers = this.options.headers.unbind(".accordion").removeClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabindex"); headers.find("a").removeAttr("tabindex"); headers.children(".ui-icon").remove(); headers.next().children().removeClass("ui-accordion-content").each(function() { $(this).parent().replaceWith(this); }) },
        
    resize: function() { var options = this.options, maxHeight; if (options.fillSpace) { maxHeight = this.element.parent().height(); options.headers.each(function() { maxHeight -= $(this).outerHeight(); }); var maxPadding = 0; options.headers.next().each(function() { maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height()); }).height(maxHeight - maxPadding).css('overflow', 'auto'); } else if (options.autoHeight) { maxHeight = 0; options.headers.next().each(function() { maxHeight = Math.max(maxHeight, $(this).outerHeight()); }).height(maxHeight); } }, activate: function(index) { clickHandler.call(this.element[0], { target: findActive(this.options.headers, index)[0] }); } 
    }); function scopeCallback(callback, scope) { return function() { return callback.apply(scope, arguments); }; }; function completed(cancel) {
        if (!$.data(this, "accordion")) { return; }
        var instance = $.data(this, "accordion"); var options = instance.options; options.running = cancel ? 0 : --options.running; if (options.running) { return; }
        if (options.clearStyle) { options.toShow.add(options.toHide).css({ height: "", overflow: "" }); }
        instance._trigger('change', null, options.data);
    }
    function toggle(toShow, toHide, data, clickedActive, down) {
        var options = $.data(this, "accordion").options; options.toShow = toShow; options.toHide = toHide; options.data = data; var complete = scopeCallback(completed, this); $.data(this, "accordion")._trigger("changestart", null, options.data); options.running = toHide.size() === 0 ? toShow.size() : toHide.size(); if (options.animated) {
            var animOptions = {}; if (!options.alwaysOpen && clickedActive) { animOptions = { toShow: $([]), toHide: toHide, complete: complete, down: down, autoHeight: options.autoHeight || options.fillSpace }; } else { animOptions = { toShow: toShow, toHide: toHide, complete: complete, down: down, autoHeight: options.autoHeight || options.fillSpace }; }
            if (!options.proxied) { options.proxied = options.animated; }
            if (!options.proxiedDuration) { options.proxiedDuration = options.duration; }
            options.animated = $.isFunction(options.proxied) ? options.proxied(animOptions) : options.proxied; options.duration = $.isFunction(options.proxiedDuration) ? options.proxiedDuration(animOptions) : options.proxiedDuration; var animations = $.ui.accordion.animations, duration = options.duration, easing = options.animated; if (!animations[easing]) { animations[easing] = function(options) { this.slide(options, { easing: easing, duration: duration || 700 }); }; }
            animations[easing](animOptions);
        } else {
            if (!options.alwaysOpen && clickedActive) { toShow.toggle(); } else { toHide.hide(); toShow.show(); }
            complete(true);
        }
        toHide.prev().attr('aria-expanded', 'false').attr("tabIndex", "-1"); toShow.prev().attr('aria-expanded', 'true').attr("tabIndex", "0").focus(); ;
    }
    function clickHandler(event) {
        var options = $.data(this, "accordion").options; if (options.disabled) { return false; }
        if (!event.target && !options.alwaysOpen) { options.active.parent().toggleClass(options.selectedClass); var toHide = options.active.next(), data = { options: options, newHeader: $([]), oldHeader: options.active, newContent: $([]), oldContent: toHide }, toShow = (options.active = $([])); toggle.call(this, toShow, toHide, data); return false; }
        var clicked = $(event.target); clicked = $(clicked.parents(options.header)[0] || clicked); var clickedActive = clicked[0] == options.active[0]; if (options.running || (options.alwaysOpen && clickedActive)) { return false; }
        if (!clicked.is(options.header)) { return; }
        options.active.parent().toggleClass(options.selectedClass); options.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").find(".ui-icon").removeClass(options.icons.headerSelected).addClass(options.icons.header); if (!clickedActive) { clicked.parent().addClass(options.selectedClass); clicked.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").find(".ui-icon").removeClass(options.icons.header).addClass(options.icons.headerSelected); }
        var toShow = clicked.next(), toHide = options.active.next(), data = { options: options, newHeader: clickedActive && !options.alwaysOpen ? $([]) : clicked, oldHeader: options.active, newContent: clickedActive && !options.alwaysOpen ? $([]) : toShow, oldContent: toHide }, down = options.headers.index(options.active[0]) > options.headers.index(clicked[0]); options.active = clickedActive ? $([]) : clicked; toggle.call(this, toShow, toHide, data, clickedActive, down); return false;
    }; function findActive(headers, selector) { return selector ? typeof selector == "number" ? headers.filter(":eq(" + selector + ")") : headers.not(headers.not(selector)) : selector === false ? $([]) : headers.filter(":eq(0)"); }
    $.extend($.ui.accordion, { version: "1.6rc5", defaults: { autoHeight: true, alwaysOpen: true, animated: 'slide', event: "click", header: "a", icons: { header: "ui-icon-triangle-1-e", headerSelected: "ui-icon-triangle-1-s" }, navigationFilter: function() { return this.href.toLowerCase() == location.href.toLowerCase(); }, running: 0, selectedClass: "ui-accordion-selected" }, animations: { slide: function(options, additions) {
        options = $.extend({ easing: "swing", duration: 300 }, options, additions); if (!options.toHide.size()) { options.toShow.animate({ height: "show" }, options); return; }
        var hideHeight = options.toHide.height(), showHeight = options.toShow.height(), difference = showHeight / hideHeight, overflow = options.toShow.css('overflow'); options.toShow.css({ height: 0, overflow: 'hidden' }).show(); options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({ height: "hide" }, { step: function(now) {
            var current = (hideHeight - now) * difference; if ($.browser.msie || $.browser.opera) { current = Math.ceil(current); }
            options.toShow.height(current);
        }, duration: options.duration, easing: options.easing, complete: function() {
            if (!options.autoHeight) { options.toShow.css("height", "auto"); }
            options.toShow.css({ overflow: overflow }); options.complete();
        } 
        });
    }, bounceslide: function(options) { this.slide(options, { easing: options.down ? "easeOutBounce" : "swing", duration: options.down ? 1000 : 200 }); }, easeslide: function(options) { this.slide(options, { easing: "easeinout", duration: 700 }); } }
    });
})(jQuery); (function($) {
    var setDataSwitch = { dragStart: "start.draggable", drag: "drag.draggable", dragStop: "stop.draggable", maxHeight: "maxHeight.resizable", minHeight: "minHeight.resizable", maxWidth: "maxWidth.resizable", minWidth: "minWidth.resizable", resizeStart: "start.resizable", resize: "drag.resizable", resizeStop: "stop.resizable" }; $.widget("ui.dialog", { _init: function() {
        this.originalTitle = this.element.attr('title'); this.options.title = this.options.title || this.originalTitle; var self = this, options = this.options, title = options.title || '&nbsp;', titleId = $.ui.dialog.getTitleId(this.element), uiDialog = (this.uiDialog = $('<div/>')).appendTo(document.body).hide().addClass('ui-dialog ' + 'ui-widget ' + 'ui-widget-content ' + 'ui-corner-all ' +
options.dialogClass).css({ position: 'absolute', overflow: 'hidden', zIndex: options.zIndex }).attr('tabIndex', -1).css('outline', 0).keydown(function(ev) { (options.closeOnEscape && ev.keyCode && ev.keyCode == $.ui.keyCode.ESCAPE && self.close()); }).attr({ role: 'dialog', 'aria-labelledby': titleId }).mousedown(function() { self.moveToTop(); }), uiDialogContent = this.element.show().removeAttr('title').addClass('ui-dialog-content ' + 'ui-widget-content').appendTo(uiDialog), uiDialogTitlebar = (this.uiDialogTitlebar = $('<div></div>')).addClass('ui-dialog-titlebar ' + 'ui-widget-header ' + 'ui-corner-all ' + 'ui-helper-clearfix').prependTo(uiDialog), uiDialogTitlebarClose = $('<a href="#"/>').addClass('ui-dialog-titlebar-close ' + 'ui-corner-all').attr('role', 'button').hover(function() { uiDialogTitlebarClose.addClass('ui-state-hover'); }, function() { uiDialogTitlebarClose.removeClass('ui-state-hover'); }).focus(function() { uiDialogTitlebarClose.addClass('ui-state-focus'); }).blur(function() { uiDialogTitlebarClose.removeClass('ui-state-focus'); }).mousedown(function(ev) { ev.stopPropagation(); }).click(function() { self.close(); return false; }).appendTo(uiDialogTitlebar), uiDialogTitlebarCloseText = (this.uiDialogTitlebarCloseText = $('<span/>')).addClass('ui-icon ' + 'ui-icon-closethick').text(options.closeText).appendTo(uiDialogTitlebarClose), uiDialogTitle = $('<span/>').addClass('ui-dialog-title').attr('id', titleId).html(title).prependTo(uiDialogTitlebar), uiDialogButtonPane = (this.uiDialogButtonPane = $('<div></div>')).addClass('ui-dialog-buttonpane ' + 'ui-widget-content ' + 'ui-helper-clearfix').appendTo(uiDialog); uiDialogTitlebar.find("*").add(uiDialogTitlebar).disableSelection(); (options.draggable && $.fn.draggable && this._makeDraggable()); (options.resizable && $.fn.resizable && this._makeResizable()); this._createButtons(options.buttons); this._isOpen = false; (options.bgiframe && $.fn.bgiframe && uiDialog.bgiframe()); (options.autoOpen && this.open());
    }, destroy: function() { (this.overlay && this.overlay.destroy()); this.uiDialog.hide(); this.element.unbind('.dialog').removeData('dialog').removeClass('ui-dialog-content ui-widget-content').hide().appendTo('body'); this.uiDialog.remove(); (this.originalTitle && this.element.attr('title', this.originalTitle)); }, close: function() {
        if (false === this._trigger('beforeclose')) { return; }
        (this.overlay && this.overlay.destroy()); this.uiDialog.hide(this.options.hide).unbind('keypress.ui-dialog'); this._trigger('close'); $.ui.dialog.overlay.resize(); this._isOpen = false; $(this.uiDialog, this.overlay).remove(); this.element.remove();
    }, isOpen: function() { return this._isOpen; }, moveToTop: function(force) {
        if ((this.options.modal && !force) || (!this.options.stack && !this.options.modal)) { return this._trigger('focus'); }
        var maxZ = this.options.zIndex, options = this.options; $('.ui-dialog:visible').each(function() { maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10) || options.zIndex); }); (this.overlay && this.overlay.$el.css('z-index', ++maxZ)); var saveScroll = { scrollTop: this.element.attr('scrollTop'), scrollLeft: this.element.attr('scrollLeft') }; this.uiDialog.css('z-index', ++maxZ); this.element.attr(saveScroll); this._trigger('focus');
    }, open: function() {
        if (this._isOpen) { return; }
        this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null; 
        (this.uiDialog.next().length && this.uiDialog.appendTo('body')); 
        this._size(); 
        this._position(this.options.position); 
        this.uiDialog.show(this.options.show); 
        this.moveToTop(true); 
        (this.options.modal && this.uiDialog.bind('keypress.ui-dialog', function(event) {
            if (event.keyCode != $.ui.keyCode.TAB) { return; }
            var tabbables = $(':tabbable', this), first = tabbables.filter(':first')[0], last = tabbables.filter(':last')[0]; if (event.target == last && !event.shiftKey) { setTimeout(function() { first.focus(); }, 1); } else if (event.target == first && event.shiftKey) { setTimeout(function() { last.focus(); }, 1); } 
        })); this.uiDialog.find(':tabbable:first').focus(); this._trigger('open'); this._isOpen = true;
    }, _createButtons: function(buttons) { 
    		var self = this, 
    			hasButtons = false, 
    			uiDialogButtonPane = this.uiDialogButtonPane; 
    		uiDialogButtonPane.empty().hide(); 
    		$.each(buttons, function() { 
    			return !(hasButtons = true); 
    		}); 
    		if (hasButtons) { 
    			uiDialogButtonPane.show(); 
    			$.each(buttons, function(name, fn) 
    					{ $('<button type="button"></button>').addClass('ui-state-default ' + 'ui-corner-all').text(name).click(function() { fn.apply(self.element[0], arguments); }).hover(function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); }).focus(function() { $(this).addClass('ui-state-focus'); }).blur(function() { $(this).removeClass('ui-state-focus'); }).appendTo(uiDialogButtonPane); }); } }, _makeDraggable: function() { var self = this, options = this.options; this.uiDialog.draggable({ cancel: '.ui-dialog-content', helper: options.dragHelper, handle: '.ui-dialog-titlebar', containment: 'document', start: function() { (options.dragStart && options.dragStart.apply(self.element[0], arguments)); }, drag: function() { (options.drag && options.drag.apply(self.element[0], arguments)); }, stop: function() { (options.dragStop && options.dragStop.apply(self.element[0], arguments)); $.ui.dialog.overlay.resize(); } }); }, _makeResizable: function(handles) { handles = (handles === undefined ? this.options.resizable : handles); var self = this, options = this.options, resizeHandles = typeof handles == 'string' ? handles : 'n,e,s,w,se,sw,ne,nw'; this.uiDialog.resizable({ cancel: '.ui-dialog-content', alsoResize: this.element, helper: options.resizeHelper, maxWidth: options.maxWidth, maxHeight: options.maxHeight, minWidth: options.minWidth, minHeight: options.minHeight, start: function() { (options.resizeStart && options.resizeStart.apply(self.element[0], arguments)); }, resize: function() { (options.resize && options.resize.apply(self.element[0], arguments)); }, handles: resizeHandles, stop: function() { (options.resizeStop && options.resizeStop.apply(self.element[0], arguments)); $.ui.dialog.overlay.resize(); } }).find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se'); }, _position: function(pos) {
        var wnd = $(window), 
        	doc = $(document), 
        	pTop = doc.scrollTop(), 
        	pLeft = doc.scrollLeft(), 
        	minTop = pTop; 
        if ($.inArray(pos, ['center', 'top', 'right', 'bottom', 'left']) >= 0) 
        	pos = [pos == 'right' || pos == 'left' ? pos : 'center', pos == 'top' || pos == 'bottom' ? pos : 'middle']; 
      
        if (pos.constructor != Array) 
        	pos = ['center', 'middle'];
        if (pos[0].constructor == Number) 
        	pLeft += pos[0]; 
        else 
        { 
        	switch (pos[0]) { 
        		case 'left': 
        			pLeft += 0; 
        			break; 
        		case 'right': 
        			pLeft += wnd.width() - this.uiDialog.outerWidth(); 
        			break; 
        		default: 
        			case 'center': 
        				pLeft += (wnd.width() - this.uiDialog.outerWidth()) / 2; 
        	} 
        }
        if (pos[1].constructor == Number) 
        	pTop += pos[1]; 
        else 
        { 
        	switch (pos[1]) { 
        		case 'top': 
        			pTop += 0; 
        			break; 
        		case 'bottom': 
        			pTop += wnd.height() - this.uiDialog.outerHeight(); 
        			break; 
        		default: 
        			case 'middle': 
        				pTop += (wnd.height() - this.uiDialog.outerHeight()) / 20; 
        	} 
        }
        pTop = Math.max(pTop, minTop); 
        this.uiDialog.css({ top: pTop, left: pLeft });
        
    }, _setData: function(key, value) {
        (setDataSwitch[key] && this.uiDialog.data(setDataSwitch[key], value)); switch (key) { case "buttons": this._createButtons(value); break; case "closeText": this.uiDialogTitlebarCloseText.text(value); break; case "draggable": (value ? this._makeDraggable() : this.uiDialog.draggable('destroy')); break; case "height": this.uiDialog.height(value); break; case "position": this._position(value); break; case "resizable": var uiDialog = this.uiDialog, isResizable = this.uiDialog.is(':data(resizable)'); (isResizable && !value && uiDialog.resizable('destroy')); (isResizable && typeof value == 'string' && uiDialog.resizable('option', 'handles', value)); (isResizable || this._makeResizable(value)); break; case "title": $(".ui-dialog-title", this.uiDialogTitlebar).html(value || '&nbsp;'); break; case "width": this.uiDialog.width(value); break; }
        $.widget.prototype._setData.apply(this, arguments);
    }, _size: function() { var options = this.options; this.element.css({ height: 0, minHeight: 0, width: 'auto' }); var nonContentHeight = this.uiDialog.css({ height: 'auto', width: options.width }).height(); this.element.css({ /*minHeight:options.minHeight-nonContentHeight,*/height: options.height == 'auto' ? 'auto' : options.height - nonContentHeight }); } 
    }); $.extend($.ui.dialog, { version: "1.6rc5", defaults: { autoOpen: true, bgiframe: false, buttons: {}, closeOnEscape: true, closeText: 'close', draggable: true, height: 'auto', minHeight: 150, minWidth: 150, modal: false, overlay: {}, position: 'center', resizable: true, stack: true, width: 300, zIndex: 1000 }, getter: 'isOpen', uuid: 0, getTitleId: function($el) { return 'ui-dialog-title-' + ($el.attr('id') || ++this.uuid); }, overlay: function(dialog) { this.$el = $.ui.dialog.overlay.create(dialog); } }); $.extend($.ui.dialog.overlay, { instances: [], events: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','), function(event) { return event + '.dialog-overlay'; }).join(' '), create: function(dialog) {
        if (this.instances.length === 0) {
            setTimeout(function() {
                $('a, :input').bind($.ui.dialog.overlay.events, function() {
                    var allow = false; var $dialog = $(this).parents('.ui-dialog'); if ($dialog.length) { var $overlays = $('.ui-dialog-overlay'); if ($overlays.length) { var maxZ = parseInt($overlays.css('z-index'), 10); $overlays.each(function() { maxZ = Math.max(maxZ, parseInt($(this).css('z-index'), 10)); }); allow = parseInt($dialog.css('z-index'), 10) > maxZ; } else { allow = true; } }
                    return allow;
                });
            }, 1); $(document).bind('keydown.dialog-overlay', function(event) { (dialog.options.closeOnEscape && event.keyCode && event.keyCode == $.ui.keyCode.ESCAPE && dialog.close()); }); $(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);
        }

        var $el = $('<div></div>').appendTo(document.body).addClass('ui-dialog-overlay').css($.extend({ borderWidth: 0, margin: 0, padding: 0, position: 'absolute', top: 0, left: 0, width: this.width(), height: this.height() }, dialog.options.overlay)); (dialog.options.bgiframe && $.fn.bgiframe && $el.bgiframe()); this.instances.push($el); return $el;
    }, destroy: function($el) {
        this.instances.splice($.inArray(this.instances, $el), 1); if (this.instances.length === 0) { $('a, :input').add([document, window]).unbind('.dialog-overlay'); }
        $el.remove();
    },

        height: function() {
            if ($.browser.msie && $.browser.version < 7) {
                var scrollHeight = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight);
                var offsetHeight = Math.max(document.documentElement.offsetHeight, document.body.offsetHeight);
                if (scrollHeight < offsetHeight) {
                    return $(window).height() + 'px';
                } else {
                    return scrollHeight + 'px';
                }
            } else {
                return $(document).height() + 'px';
            }
        },
        width: function() {
            if ($.browser.msie && $.browser.version < 7) {
                var scrollWidth = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth);
                var offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
                if (scrollWidth < offsetWidth) {
                    return $(window).width() + 'px';
                } else {
                    return scrollWidth + 'px';
                }
            } else {
                return $(document).width() + 'px';
                    }
        },
        resize: function() {
            var $overlays = $([]);

            $.each($.ui.dialog.overlay.instances,
	function() {
	    $overlays = $overlays.add(this);
	});
            $overlays.css({ width: 0, height: 0 }).css({ width: $.ui.dialog.overlay.width(), height: $.ui.dialog.overlay.height() });
        } 
    }); $.extend($.ui.dialog.overlay.prototype, { destroy: function() { $.ui.dialog.overlay.destroy(this.$el); } });
})(jQuery); (function($) {
    $.widget("ui.slider", $.extend({}, $.ui.mouse, { _init: function() {
        var self = this, o = this.options; this._keySliding = false; this._handleIndex = null; this.orientation = o.orientation == 'auto' ? (this.element[0].offsetWidth / this.element[0].offsetHeight > 1 ? 'horizontal' : 'vertical') : o.orientation; 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"
+ " ui-widget-header"); (o.range == "min") && (this.orientation == "horizontal") && this.range.css({ left: 0 }); (o.range == "max") && (this.orientation == "horizontal") && this.range.css({ right: 0 }); (o.range == "min") && (this.orientation == "vertical") && this.range.css({ bottom: 0 }); (o.range == "max") && (this.orientation == "vertical") && this.range.css({ top: 0 });
        }
        if ($(".ui-slider-handle", this.element).length == 0)
            $('<a href="#"></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="#"></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() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); }).focus(function() { self.handles.removeClass('ui-state-focus'); $(this).addClass('ui-state-focus'); }).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 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: if (!self._keySliding) { self._keySliding = true; $(this).addClass("ui-state-active"); self._start(event); }
            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: newVal = curVal + step; break; case $.ui.keyCode.DOWN: case $.ui.keyCode.LEFT: newVal = curVal - step; break; }
    //self._slide(event, index, newVal);
}); this._refreshValue();
    }, destroy: function() {
        this.handles.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._start(event); this.elementSize = { width: this.element.outerWidth(), height: this.element.outerHeight() }; this.elementOffset = this.element.offset(); var position = { x: event.pageX, y: event.pageY }; var normValue = this._normValueFromMouse(position); var distance = this._valueMax(), 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; } }); self._handleIndex = index; closestHandle.addClass("ui-state-active").focus(); 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._change(event); this._handleIndex = null; return false; }, _normValueFromMouse: function(position) {
        var pixelTotal, pixelMouse; if ('horizontal' == this.orientation) { pixelTotal = this.elementSize.width; pixelMouse = position.x - this.elementOffset.left; } else { pixelTotal = this.elementSize.height; pixelMouse = position.y - this.elementOffset.top; }
        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 normValue;
    }, _start: function(event) { this._trigger("start", event, { value: this.value() }); }, _slide: function(event, index, newVal) {
        if (this.options.values && this.options.values.length) {
            var handle = this.handles[index]; var otherVal = this.values(index ? 0 : 1); if ((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: handle, value: newVal, values: newValues }); var otherVal = this.values(index ? 0 : 1); if (allowed !== false) { this.values(index, newVal); } } 
        } else {
            if (newVal != this.value()) {
                var allowed = this._trigger("slide", event, { value: newVal }); if (allowed !== false)
                    this._setData('value', newVal);
            } 
        } 
    }, _stop: function(event) { this._trigger("stop", event, { value: this.value() }); }, _change: function(event) { this._trigger("change", event, { value: this.value() }); }, value: function(newValue) {
        if (arguments.length) { this._setData("value", newValue); this._change(); }
        return this._value();
    }, values: function(index, newValue) {
        if (arguments.length > 1) { this.options.values[index] = newValue; this._refreshValue(); this._change(); }
        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) { $.widget.prototype._setData.apply(this, arguments); switch (key) { case 'orientation': this.orientation = this.options.orientation == 'auto' ? (this.element[0].offsetWidth / this.element[0].offsetHeight > 1 ? 'horizontal' : 'vertical') : this.options.orientation; this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-" + this._orientation()); this._refreshValue(); break; case 'value': this._refreshValue(); 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() {
        var oRange = this.options.range; if (this.options.values && this.options.values.length) {
            var self = this, vp0, vp1; this.handles.each(function(i, j) {
                var valPercent = (self.values(i) - self._valueMin()) / (self._valueMax() - self._valueMin()) * 100; $(this).css(self.orientation == 'horizontal' ? 'left' : 'bottom', valPercent + '%'); if (self.options.range === true) { if (self.orientation == 'horizontal') { (i == 0) && self.range.css('left', valPercent + '%'); (i == 1) && self.range.css('width', (valPercent - lastValPercent) + '%'); } else { (i == 0) && self.range.css('bottom', (valPercent) + '%'); (i == 1) && self.range.css('height', (valPercent - lastValPercent) + '%'); } }
                lastValPercent = valPercent;
            });
        } else { var valPercent = (this.value() - this._valueMin()) / (this._valueMax() - this._valueMin()) * 100; this.handle.css(this.orientation == 'horizontal' ? 'left' : 'bottom', valPercent + '%'); (oRange == "min") && (this.orientation == "horizontal") && this.range.css({ left: 0, width: valPercent + '%' }); (oRange == "max") && (this.orientation == "horizontal") && this.range.css({ left: valPercent + '%', width: (100 - valPercent) + '%' }); (oRange == "min") && (this.orientation == "vertical") && this.range.css({ top: (100 - valPercent) + '%', height: valPercent + '%' }); (oRange == "max") && (this.orientation == "vertical") && this.range.css({ bottom: valPercent + '%', height: (100 - valPercent) + '%' }); } 
    } 
    })); $.extend($.ui.slider, { getter: "value values", version: "1.6rc5", eventPrefix: "slide", defaults: { delay: 0, distance: 0, max: 100, min: 0, orientation: 'auto', range: false, step: 1, value: 0, values: null} });
})(jQuery); (function($) {
    $.widget("ui.tabs", { _init: function() { this._tabify(true); }, destroy: function() {
        var o = this.options; this.list.unbind('.tabs').removeClass(o.navClass).removeData('tabs'); this.$tabs.each(function() {
            var href = $.data(this, 'href.tabs'); if (href)
                this.href = href; var $this = $(this).unbind('.tabs'); $.each(['href', 'load', 'cache'], function(i, prefix) { $this.removeData(prefix + '.tabs'); });
        }); this.$lis.unbind('.tabs').add(this.$panels).each(function() {
            if ($.data(this, 'destroy.tabs'))
                $(this).remove(); else
                $(this).removeClass([o.tabClass, o.selectedClass, o.deselectableClass, o.disabledClass, o.panelClass, o.hideClass].join(' '));
        }); if (o.cookie)
            this._cookie(null, o.cookie);
    }, _setData: function(key, value) {
        if ((/^selected/).test(key))
            this.select(value); else { this.options[key] = value; this._tabify(); } 
    }, length: function() { return this.$tabs.length; }, _tabId: function(a) { return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') || this.options.idPrefix + $.data(a); }, _sanitizeSelector: function(hash) { return hash.replace(/:/g, '\\:'); }, _cookie: function() { var cookie = this.cookie || (this.cookie = 'ui-tabs-' + $.data(this.list[0])); return $.cookie.apply(null, [cookie].concat($.makeArray(arguments))); }, _tabify: function(init) {
        this.list = this.element.is('div') ? this.element.children('ul:first, ol:first').eq(0) : this.element; this.$lis = $('li:has(a[href])', this.list); this.$tabs = this.$lis.map(function() { return $('a', this)[0]; }); this.$panels = $([]); var self = this, o = this.options; this.$tabs.each(function(i, a) {
            if (a.hash && a.hash.replace('#', ''))
                self.$panels = self.$panels.add(self._sanitizeSelector(a.hash)); else if ($(a).attr('href') != '#') {
                $.data(a, 'href.tabs', a.href); $.data(a, 'load.tabs', a.href); var id = self._tabId(a); a.href = '#' + id; var $panel = $('#' + id); if (!$panel.length) { $panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass).insertAfter(self.$panels[i - 1] || self.list); $panel.data('destroy.tabs', true); }
                self.$panels = self.$panels.add($panel);
            }
            else
                o.disabled.push(i + 1);
        }); if (init) {
            if (this.element.is('div')) { this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all'); }
            this.list.addClass(o.navClass); this.$lis.addClass(o.tabClass); this.$panels.addClass(o.panelClass); if (o.selected === undefined) {
                if (location.hash) { this.$tabs.each(function(i, a) { if (a.hash == location.hash) { o.selected = i; return false; } }); }
                else if (o.cookie) { var index = parseInt(self._cookie(), 10); if (index && self.$tabs[index]) o.selected = index; }
                else if (self.$lis.filter('.' + o.selectedClass).length)
                    o.selected = self.$lis.index(self.$lis.filter('.' + o.selectedClass)[0]);
            }
            o.selected = o.selected === null || o.selected !== undefined ? o.selected : 0; o.disabled = $.unique(o.disabled.concat($.map(this.$lis.filter('.' + o.disabledClass), function(n, i) { return self.$lis.index(n); }))).sort(); if ($.inArray(o.selected, o.disabled) != -1)
                o.disabled.splice($.inArray(o.selected, o.disabled), 1); this.$panels.addClass(o.hideClass); this.$lis.removeClass(o.selectedClass); if (o.selected !== null && this.$tabs.length) {
                this.$panels.eq(o.selected).removeClass(o.hideClass); var classes = [o.selectedClass]; if (o.deselectable) classes.push(o.deselectableClass); this.$lis.eq(o.selected).addClass(classes.join(' ')); var onShow = function() { self._trigger('show', null, self.ui(self.$tabs[o.selected], self.$panels[o.selected])); }; if ($.data(this.$tabs[o.selected], 'load.tabs'))
                    this.load(o.selected, onShow); else onShow();
            }
            var handleState = function(state, el) { if (el.is(':not(.' + o.disabledClass + ')')) el.toggleClass('ui-state-' + state); }; this.$lis.bind('mouseover.tabs mouseout.tabs', function() { handleState('hover', $(this)); }); this.$tabs.bind('focus.tabs blur.tabs', function() { handleState('focus', $(this).parents('li:first')); }); $(window).bind('unload', function() { self.$lis.add(self.$tabs).unbind('.tabs'); self.$lis = self.$tabs = self.$panels = null; });
        }
        else
            o.selected = this.$lis.index(this.$lis.filter('.' + o.selectedClass)[0]); if (o.cookie) this._cookie(o.selected, o.cookie); for (var i = 0, li; li = this.$lis[i]; i++)
            $(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass); if (o.cache === false) this.$tabs.removeData('cache.tabs'); var hideFx, showFx; if (o.fx) {
            if (o.fx.constructor == Array) { hideFx = o.fx[0]; showFx = o.fx[1]; }
            else hideFx = showFx = o.fx;
        }
        function resetStyle($el, fx) { $el.css({ display: '' }); if ($.browser.msie && fx.opacity) $el[0].style.removeAttribute('filter'); }
        var showTab = showFx ? function(clicked, $show) { $show.animate(showFx, showFx.duration || 'normal', function() { $show.removeClass(o.hideClass); resetStyle($show, showFx); self._trigger('show', null, self.ui(clicked, $show[0])); }); } : function(clicked, $show) { $show.removeClass(o.hideClass); self._trigger('show', null, self.ui(clicked, $show[0])); }; var hideTab = hideFx ? function(clicked, $hide, $show) { $hide.animate(hideFx, hideFx.duration || 'normal', function() { $hide.addClass(o.hideClass); resetStyle($hide, hideFx); if ($show) showTab(clicked, $show, $hide); }); } : function(clicked, $hide, $show) { $hide.addClass(o.hideClass); if ($show) showTab(clicked, $show); }; function switchTab(clicked, $li, $hide, $show) { var classes = [o.selectedClass]; if (o.deselectable) classes.push(o.deselectableClass); $li.removeClass('ui-state-default').addClass(classes.join(' ')).siblings().removeClass(classes.join(' ')).addClass('ui-state-default'); hideTab(clicked, $hide, $show); }
        this.$tabs.unbind('.tabs').bind(o.event + '.tabs', function() {
            var $li = $(this).parents('li:eq(0)'), $hide = self.$panels.filter(':visible'), $show = $(self._sanitizeSelector(this.hash)); if (($li.hasClass('ui-state-active') && !o.deselectable) || $li.hasClass(o.disabledClass) || $(this).hasClass(o.loadingClass) || self._trigger('select', null, self.ui(this, $show[0])) === false) { this.blur(); return false; }
            o.selected = self.$tabs.index(this); if (o.deselectable) { if ($li.hasClass('ui-state-active')) { self.options.selected = null; $li.removeClass([o.selectedClass, o.deselectableClass].join(' ')).addClass('ui-state-default'); self.$panels.stop(); hideTab(this, $hide); this.blur(); return false; } else if (!$hide.length) { self.$panels.stop(); var a = this; self.load(self.$tabs.index(this), function() { $li.addClass([o.selectedClass, o.deselectableClass].join(' ')).removeClass('ui-state-default'); showTab(a, $show); }); this.blur(); return false; } }
            if (o.cookie) self._cookie(o.selected, o.cookie); self.$panels.stop(); if ($show.length) { var a = this; self.load(self.$tabs.index(this), $hide.length ? function() { switchTab(a, $li, $hide, $show); } : function() { $li.addClass(o.selectedClass).removeClass('ui-state-default'); showTab(a, $show); }); } else
                throw 'jQuery UI Tabs: Mismatching fragment identifier.'; if ($.browser.msie) this.blur(); return false;
        }); if (o.event != 'click') this.$tabs.bind('click.tabs', function() { return false; });
    }, add: function(url, label, index) {
        if (index == undefined)
            index = this.$tabs.length; var o = this.options; var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)); $li.addClass(o.tabClass).data('destroy.tabs', true); var id = url.indexOf('#') == 0 ? url.replace('#', '') : this._tabId($('a:first-child', $li)[0]); var $panel = $('#' + id); if (!$panel.length) { $panel = $(o.panelTemplate).attr('id', id).addClass(o.hideClass).data('destroy.tabs', true); }
        $panel.addClass(o.panelClass); if (index >= this.$lis.length) { $li.appendTo(this.list); $panel.appendTo(this.list[0].parentNode); }
        else { $li.insertBefore(this.$lis[index]); $panel.insertBefore(this.$panels[index]); }
        o.disabled = $.map(o.disabled, function(n, i) { return n >= index ? ++n : n }); this._tabify(); if (this.$tabs.length == 1) { $li.addClass(o.selectedClass); $panel.removeClass(o.hideClass); var href = $.data(this.$tabs[0], 'load.tabs'); if (href) this.load(index, href); }
        this._trigger('add', null, this.ui(this.$tabs[index], this.$panels[index]));
    }, remove: function(index) {
        var o = this.options, $li = this.$lis.eq(index).remove(), $panel = this.$panels.eq(index).remove(); if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)
            this.select(index + (index + 1 < this.$tabs.length ? 1 : -1)); o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }), function(n, i) { return n >= index ? --n : n }); this._tabify(); this._trigger('remove', null, this.ui($li.find('a')[0], $panel[0]));
    }, enable: function(index) {
        var o = this.options; if ($.inArray(index, o.disabled) == -1)
            return; var $li = this.$lis.eq(index).removeClass(o.disabledClass); if ($.browser.safari) { $li.css('display', 'inline-block'); setTimeout(function() { $li.css('display', 'block'); }, 0); }
        o.disabled = $.grep(o.disabled, function(n, i) { return n != index; }); this._trigger('enable', null, this.ui(this.$tabs[index], this.$panels[index]));
    }, disable: function(index) { var self = this, o = this.options; if (index != o.selected) { this.$lis.eq(index).addClass(o.disabledClass); o.disabled.push(index); o.disabled.sort(); this._trigger('disable', null, this.ui(this.$tabs[index], this.$panels[index])); } }, select: function(index) {
        if (typeof index == 'string')
            index = this.$tabs.index(this.$tabs.filter('[href$=' + index + ']')[0]); this.$tabs.eq(index).trigger(this.options.event + '.tabs');
    }, load: function(index, callback) {
        var self = this, o = this.options, $a = this.$tabs.eq(index), a = $a[0], bypassCache = callback == undefined || callback === false, url = $a.data('load.tabs'); callback = callback || function() { }; if (!url || !bypassCache && $.data(a, 'cache.tabs')) { callback(); return; }
        var inner = function(parent) { var $parent = $(parent), $inner = $parent.find('*:last'); return $inner.length && $inner.is(':not(img)') && $inner || $parent; }; var cleanup = function() {
            self.$tabs.filter('.' + o.loadingClass).removeClass(o.loadingClass).each(function() {
                if (o.spinner)
                    inner(this).parent().html(inner(this).data('label.tabs'));
            }); self.xhr = null;
        }; if (o.spinner) { var label = inner(a).html(); inner(a).wrapInner('<em></em>').find('em').data('label.tabs', label).html(o.spinner); }
        var ajaxOptions = $.extend({}, o.ajaxOptions, { url: url, success: function(r, s) {
            $(self._sanitizeSelector(a.hash)).html(r); cleanup(); if (o.cache)
                $.data(a, 'cache.tabs', true); self._trigger('load', null, self.ui(self.$tabs[index], self.$panels[index])); try { o.ajaxOptions.success(r, s); }
            catch (er) { }
            callback();
        } 
        }); if (this.xhr) { this.xhr.abort(); cleanup(); }
        $a.addClass(o.loadingClass); self.xhr = $.ajax(ajaxOptions);
    }, url: function(index, url) { this.$tabs.eq(index).removeData('cache.tabs').data('load.tabs', url); }, ui: function(tab, panel) { return { options: this.options, tab: tab, panel: panel, index: this.$tabs.index(tab) }; } 
    }); $.extend($.ui.tabs, { version: '1.6rc5', getter: 'length', defaults: { ajaxOptions: null, cache: false, cookie: null, deselectable: false, deselectableClass: 'ui-tabs-deselectable', disabled: [], disabledClass: 'ui-state-disabled', event: 'click', fx: null, hideClass: 'ui-tabs-hide', idPrefix: 'ui-tabs-', loadingClass: 'ui-tabs-loading', navClass: 'ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all', tabClass: 'ui-state-default ui-corner-top', panelClass: 'ui-tabs-panel ui-widget-content ui-corner-bottom', panelTemplate: '<div></div>', selectedClass: 'ui-tabs-selected ui-state-active', spinner: 'Loading&#8230;', tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'} }); $.extend($.ui.tabs.prototype, { rotation: null, rotate: function(ms, continuing) {
        continuing = continuing || false; var self = this, t = this.options.selected; function start() { self.rotation = setInterval(function() { t = ++t < self.$tabs.length ? t : 0; self.select(t); }, ms); }
        function stop(event) { if (!event || event.clientX) { clearInterval(self.rotation); } }
        if (ms) {
            start(); if (!continuing)
                this.$tabs.bind(this.options.event + '.tabs', stop); else
                this.$tabs.bind(this.options.event + '.tabs', function() { stop(); t = self.options.selected; start(); });
        }
        else { stop(); this.$tabs.unbind(this.options.event + '.tabs', stop); } 
    } 
    });
})(jQuery);
