
    (function ($) {$.ui = $.ui || {};$.extend($.ui, {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, arguments) {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, arguments);}}}}, cssCache: {}, css: function (name) {if ($.ui.cssCache[name]) {return $.ui.cssCache[name];}var tmp = $("<div class=\"ui-resizable-gen\">").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];}, disableSelection: function (e) {e.unselectable = "on";e.onselectstart = function () {return false;};if (e.style) {e.style.MozUserSelect = "none";}}, enableSelection: function (e) {e.unselectable = "off";e.onselectstart = function () {return true;};if (e.style) {e.style.MozUserSelect = "";}}, hasScroll: function (e, a) {var scroll = /top/.test(a || "top") ? "scrollTop" : "scrollLeft", has = false;if (e[scroll] > 0) {return true;}e[scroll] = 1;has = e[scroll] > 0 ? true : false;e[scroll] = 0;return has;}});$.each(["Left", "Top"], function (i, name) {if (!$.fn["scroll" + name]) {$.fn["scroll" + name] = function (v) {return v != undefined ? this.each(function () {this == window || this == document ? window.scrollTo(name == "Left" ? v : $(window).scrollLeft(), name == "Top" ? v : $(window).scrollTop()) : (this["scroll" + name] = v);}) : this[0] == window || this[0] == document ? self[(name == "Left" ? "pageXOffset" : "pageYOffset")] || $.boxModel && document.documentElement["scroll" + name] || document.body["scroll" + name] : this[0]["scroll" + name];};}});var _remove = $.fn.remove;$.fn.extend({position: function () {var offset = this.offset();var offsetParent = this.offsetParent();var parentOffset = offsetParent.offset();return {top: offset.top - num(this[0], "marginTop") - parentOffset.top - num(offsetParent, "borderTopWidth"), left: offset.left - num(this[0], "marginLeft") - parentOffset.left - num(offsetParent, "borderLeftWidth")};}, offsetParent: function () {var offsetParent = this[0].offsetParent;while (offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, "position") == "static")) {offsetParent = offsetParent.offsetParent;}return $(offsetParent);}, mouseInteraction: function (o) {return this.each(function () {new ($.ui.mouseInteraction)(this, o);});}, removeMouseInteraction: function (o) {return this.each(function () {if ($.data(this, "ui-mouse")) {$.data(this, "ui-mouse").destroy();}});}, remove: function () {jQuery("*", this).add(this).trigger("remove");return _remove.apply(this, arguments);}});
function num(el, prop) {return parseInt($.curCSS(el.jquery ? el[0] : el, prop, true)) || 0;}

$.ui.mouseInteraction = function (element, options) {var self = this;this.element = element;$.data(this.element, "ui-mouse", this);this.options = $.extend({}, options);$(element).bind("mousedown.draggable", function () {return self.click.apply(self, arguments);});if ($.browser.msie) {$(element).attr("unselectable", "on");}$(element).mouseup(function () {if (self.timer) {clearInterval(self.timer);}});};$.extend($.ui.mouseInteraction.prototype, {destroy: function () {$(this.element).unbind("mousedown.draggable");}, trigger: function () {return this.click.apply(this, arguments);}, click: function (e) {if (e.which != 1 || $.inArray(e.target.nodeName.toLowerCase(), this.options.dragPrevention || []) != -1 || (this.options.condition && !this.options.condition.apply(this.options.executor || this, [e, this.element]))) {return true;}var self = this;var initialize = function () {self._MP = {left: e.pageX, top: e.pageY};$(document).bind("mouseup.draggable", function () {return self.stop.apply(self, arguments);});$(document).bind("mousemove.draggable", function () {return self.drag.apply(self, arguments);});if (!self.initalized && Math.abs(self._MP.left - e.pageX) >= self.options.distance || Math.abs(self._MP.top - e.pageY) >= self.options.distance) {if (self.options.start) {self.options.start.call(self.options.executor || self, e, self.element);}if (self.options.drag) {self.options.drag.call(self.options.executor || self, e, this.element);}self.initialized = true;}};if (this.options.delay) {if (this.timer) {clearInterval(this.timer);}this.timer = setTimeout(initialize, this.options.delay);} else {initialize();}return false;}, stop: function (e) {var o = this.options;if (!this.initialized) {return $(document).unbind("mouseup.draggable").unbind("mousemove.draggable");}if (this.options.stop) {this.options.stop.call(this.options.executor || this, e, this.element);}$(document).unbind("mouseup.draggable").unbind("mousemove.draggable");this.initialized = false;return false;}, drag: function (e) {var o = this.options;if ($.browser.msie && !e.button) {return this.stop.apply(this, [e]);}if (!this.initialized && (Math.abs(this._MP.left - e.pageX) >= o.distance || Math.abs(this._MP.top - e.pageY) >= o.distance)) {if (this.options.start) {this.options.start.call(this.options.executor || this, e, this.element);}this.initialized = true;} else {if (!this.initialized) {return false;}}if (o.drag) {o.drag.call(this.options.executor || this, e, this.element);}return false;}});}(jQuery));
    (function ($) {$.fn.extend({draggable: function (options) {var args = Array.prototype.slice.call(arguments, 1);return this.each(function () {if (typeof options == "string") {var drag = $.data(this, "draggable");if (drag) {drag[options].apply(drag, args);}} else if (!$.data(this, "draggable")) {new ($.ui.draggable)(this, options);}});}});$.ui.draggable = function (element, options) {var self = this;this.element = $(element);$.data(element, "draggable", this);this.element.addClass("ui-draggable");this.options = $.extend({}, options);var o = this.options;$.extend(o, {helper: o.ghosting == true ? "clone" : o.helper || "original", handle: o.handle ? $(o.handle, element)[0] ? $(o.handle, element) : this.element : this.element, appendTo: o.appendTo || "parent"});$(element).bind("setData.draggable", function (event, key, value) {self.options[key] = value;}).bind("getData.draggable", function (event, key) {return self.options[key];});$(o.handle).mouseInteraction({executor: this, delay: o.delay, distance: o.distance || 1, dragPrevention: o.cancel || o.cancel === "" ? o.cancel.toLowerCase().split(",") : ["input", "textarea", "button", "select", "option"], start: this.start, stop: this.stop, drag: this.drag, condition: function (e) {return !(e.target.className.indexOf("ui-resizable-handle") != -1 || this.options.disabled);}});if (o.helper == "original" && (this.element.css("position") == "static" || this.element.css("position") == "")) {this.element.css("position", "relative");}if (o.cursorAt && o.cursorAt.constructor == Array) {o.cursorAt = {left: o.cursorAt[0], top: o.cursorAt[1]};}};$.extend($.ui.draggable.prototype, {plugins: {}, ui: function (e) {return {helper: this.helper, position: this.position, absolutePosition: this.positionAbs, instance: this, options: this.options, element: this.element};}, propagate: function (n, e) {$.ui.plugin.call(this, n, [e, this.ui()]);return this.element.triggerHandler(n == "drag" ? n : "drag" + n, [e, this.ui()], this.options[n]);}, destroy: function () {if (!$.data(this.element[0], "draggable")) {return;}this.options.handle.removeMouseInteraction();this.element.removeClass("ui-draggable ui-draggable-disabled").removeData("draggable").unbind(".draggable");}, enable: function () {this.element.removeClass("ui-draggable-disabled");this.options.disabled = false;}, disable: function () {this.element.addClass("ui-draggable-disabled");this.options.disabled = true;}, setContrains: function (minLeft, maxLeft, minTop, maxTop) {this.minLeft = minLeft;this.maxLeft = maxLeft;this.minTop = minTop;this.maxTop = maxTop;this.constrainsSet = true;}, checkConstrains: function () {if (!this.constrainsSet) {return;}if (this.position.left < this.minLeft) {this.position.left = this.minLeft;}if (this.position.left > this.maxLeft - this.helperProportions.width) {this.position.left = this.maxLeft - this.helperProportions.width;}if (this.position.top < this.minTop) {this.position.top = this.minTop;}if (this.position.top > this.maxTop - this.helperProportions.height) {this.position.top = this.maxTop - this.helperProportions.height;}}, recallOffset: function (e) {var elementPosition = {left: this.elementOffset.left - this.offsetParentOffset.left, top: this.elementOffset.top - this.offsetParentOffset.top};var r = this.helper.css("position") == "relative";this.originalPosition = {left: r ? parseInt(this.helper.css("left"), 10) || 0 : elementPosition.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), top: r ? parseInt(this.helper.css("top"), 10) || 0 : elementPosition.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)};this.offset = {left: this._pageX - this.originalPosition.left, top: this._pageY - this.originalPosition.top};}, start: function (e) {var o = this.options;if ($.ui.ddmanager) {$.ui.ddmanager.current = this;}this.helper = typeof o.helper == "function" ? $(o.helper.apply(this.element[0], [e])) : o.helper == "clone" ? this.element.clone().appendTo((o.appendTo == "parent" ? this.element[0].parentNode : o.appendTo)) : this.element;if (this.helper[0] != this.element[0]) {this.helper.css("position", "absolute");}if (!this.helper.parents("body").length) {this.helper.appendTo((o.appendTo == "parent" ? this.element[0].parentNode : o.appendTo));}this.offsetParent = function (cp) {while (cp) {if (cp.style && /(absolute|relative|fixed)/.test($.css(cp, "position"))) {return $(cp);}cp = cp.parentNode ? cp.parentNode : null;}return $("body");}(this.helper[0].parentNode);this.elementOffset = this.element.offset();this.offsetParentOffset = this.offsetParent.offset();var elementPosition = {left: this.elementOffset.left - this.offsetParentOffset.left, top: this.elementOffset.top - this.offsetParentOffset.top};this._pageX = e.pageX;this._pageY = e.pageY;this.clickOffset = {left: e.pageX - this.elementOffset.left, top: e.pageY - this.elementOffset.top};var r = this.helper.css("position") == "relative";this.originalPosition = {left: r ? parseInt(this.helper.css("left"), 10) || 0 : elementPosition.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft), top: r ? parseInt(this.helper.css("top"), 10) || 0 : elementPosition.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)};if (this.element.css("position") == "fixed") {this.originalPosition.top -= this.offsetParent[0] == document.body ? $(document).scrollTop() : this.offsetParent[0].scrollTop;this.originalPosition.left -= this.offsetParent[0] == document.body ? $(document).scrollLeft() : this.offsetParent[0].scrollLeft;}this.offset = {left: e.pageX - this.originalPosition.left, top: e.pageY - this.originalPosition.top};if (this.element[0] != this.helper[0]) {this.offset.left += parseInt(this.element.css("marginLeft"), 10) || 0;this.offset.top += parseInt(this.element.css("marginTop"), 10) || 0;}this.propagate("start", e);this.helperProportions = {width: this.helper.outerWidth(), height: this.helper.outerHeight()};if ($.ui.ddmanager && !o.dropBehaviour) {$.ui.ddmanager.prepareOffsets(this, e);}if (o.cursorAt) {if (o.cursorAt.top != undefined || o.cursorAt.bottom != undefined) {this.offset.top -= this.clickOffset.top - (o.cursorAt.top != undefined ? o.cursorAt.top : this.helperProportions.height - o.cursorAt.bottom);this.clickOffset.top = o.cursorAt.top != undefined ? o.cursorAt.top : this.helperProportions.height - o.cursorAt.bottom;}if (o.cursorAt.left != undefined || o.cursorAt.right != undefined) {this.offset.left -= this.clickOffset.left - (o.cursorAt.left != undefined ? o.cursorAt.left : this.helperProportions.width - o.cursorAt.right);this.clickOffset.left = o.cursorAt.left != undefined ? o.cursorAt.left : this.helperProportions.width - o.cursorAt.right;}}return false;}, clear: function () {if ($.ui.ddmanager) {$.ui.ddmanager.current = null;}this.helper = null;}, stop: function (e) {if ($.ui.ddmanager && !this.options.dropBehaviour) {$.ui.ddmanager.drop(this, e);}this.propagate("stop", e);if (this.cancelHelperRemoval) {return false;}if (this.options.helper != "original") {this.helper.remove();}this.clear();return false;}, drag: function (e) {this.position = {top: e.pageY - this.offset.top, left: e.pageX - this.offset.left};this.positionAbs = {left: e.pageX - this.clickOffset.left, top: e.pageY - this.clickOffset.top};this.checkConstrains();this.position = this.propagate("drag", e) || this.position;this.checkConstrains();$(this.helper).css({left: this.position.left + "px", top: this.position.top + "px"});if ($.ui.ddmanager) {$.ui.ddmanager.drag(this, e);}return false;}});$.ui.plugin.add("draggable", "cursor", {start: function (e, ui) {var t = $("body");if (t.css("cursor")) {ui.options._cursor = t.css("cursor");}t.css("cursor", ui.options.cursor);}, stop: function (e, ui) {if (ui.options._cursor) {$("body").css("cursor", ui.options._cursor);}}});$.ui.plugin.add("draggable", "zIndex", {start: function (e, ui) {var t = $(ui.helper);if (t.css("zIndex")) {ui.options._zIndex = t.css("zIndex");}t.css("zIndex", ui.options.zIndex);}, stop: function (e, ui) {if (ui.options._zIndex) {$(ui.helper).css("zIndex", ui.options._zIndex);}}});$.ui.plugin.add("draggable", "opacity", {start: function (e, ui) {var t = $(ui.helper);if (t.css("opacity")) {ui.options._opacity = t.css("opacity");}t.css("opacity", ui.options.opacity);}, stop: function (e, ui) {if (ui.options._opacity) {$(ui.helper).css("opacity", ui.options._opacity);}}});$.ui.plugin.add("draggable", "revert", {stop: function (e, ui) {var self = ui.instance, helper = $(self.helper);self.cancelHelperRemoval = true;$(ui.helper).animate({left: self.originalPosition.left, top: self.originalPosition.top}, parseInt(ui.options.revert, 10) || 500, function () {if (ui.options.helper != "original") {helper.remove();}if (!helper) {self.clear();}});}});$.ui.plugin.add("draggable", "iframeFix", {start: function (e, ui) {var o = ui.options;if (ui.instance.slowMode) {return;}if (o.iframeFix.constructor == Array) {for (var i = 0; i < o.iframeFix.length; i++) {var co = $(o.iframeFix[i]).offset({border: false});$("<div class=\"DragDropIframeFix\"\" style=\"background: #fff;\"></div>").css("width", $(o.iframeFix[i])[0].offsetWidth + "px").css("height", $(o.iframeFix[i])[0].offsetHeight + "px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top + "px").css("left", co.left + "px").appendTo("body");}} else {$("iframe").each(function () {var co = $(this).offset({border: false});$("<div class=\"DragDropIframeFix\" style=\"background: #fff;\"></div>").css("width", this.offsetWidth + "px").css("height", this.offsetHeight + "px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top + "px").css("left", co.left + "px").appendTo("body");});}}, stop: function (e, ui) {if (ui.options.iframeFix) {$("div.DragDropIframeFix").each(function () {this.parentNode.removeChild(this);});}}});$.ui.plugin.add("draggable", "containment", {start: function (e, ui) {var o = ui.options;var self = ui.instance;if ((o.containment.left != undefined || o.containment.constructor == Array) && !o._containment) {return;}if (!o._containment) {o._containment = o.containment;}if (o._containment == "parent") {o._containment = this[0].parentNode;}if (o._containment == "document") {o.containment = [0, 0, $(document).width(), $(document).height() || document.body.parentNode.scrollHeight];} else {var ce = $(o._containment)[0];var co = $(o._containment).offset();o.containment = [co.left, co.top, co.left + (ce.offsetWidth || ce.scrollWidth), co.top + (ce.offsetHeight || ce.scrollHeight)];}var c = o.containment;ui.instance.setContrains(c[0] - (self.offset.left - self.clickOffset.left), c[2] - (self.offset.left - self.clickOffset.left), c[1] - (self.offset.top - self.clickOffset.top), c[3] - (self.offset.top - self.clickOffset.top));}});$.ui.plugin.add("draggable", "grid", {drag: function (e, ui) {var o = ui.options;var newLeft = ui.instance.originalPosition.left + Math.round((e.pageX - ui.instance._pageX) / o.grid[0]) * o.grid[0];var newTop = ui.instance.originalPosition.top + Math.round((e.pageY - ui.instance._pageY) / o.grid[1]) * o.grid[1];ui.instance.position.left = newLeft;ui.instance.position.top = newTop;}});$.ui.plugin.add("draggable", "axis", {drag: function (e, ui) {var o = ui.options;if (o.constraint) {o.axis = o.constraint;}switch (o.axis) {case "x":ui.instance.position.top = ui.instance.originalPosition.top;break;case "y":ui.instance.position.left = ui.instance.originalPosition.left;break;default:;}}});$.ui.plugin.add("draggable", "scroll", {start: function (e, ui) {var o = ui.options;o.scrollSensitivity = o.scrollSensitivity || 20;o.scrollSpeed = o.scrollSpeed || 20;ui.instance.overflowY = function (el) {do {if (/auto|scroll/.test(el.css("overflow")) || /auto|scroll/.test(el.css("overflow-y"))) {return el;}el = el.parent();} while (el[0].parentNode);return $(document);}(this);ui.instance.overflowX = function (el) {do {if (/auto|scroll/.test(el.css("overflow")) || /auto|scroll/.test(el.css("overflow-x"))) {return el;}el = el.parent();} while (el[0].parentNode);return $(document);}(this);}, drag: function (e, ui) {var o = ui.options;var i = ui.instance;if (i.overflowY[0] != document && i.overflowY[0].tagName != "HTML") {if (i.overflowY[0].offsetHeight - (ui.position.top - i.overflowY[0].scrollTop + i.clickOffset.top) < o.scrollSensitivity) {i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;}if ((ui.position.top - i.overflowY[0].scrollTop + i.clickOffset.top) < o.scrollSensitivity) {i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;}} else {if (e.pageY - $(document).scrollTop() < o.scrollSensitivity) {$(document).scrollTop($(document).scrollTop() - o.scrollSpeed);}if ($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity) {$(document).scrollTop($(document).scrollTop() + o.scrollSpeed);}}if (i.overflowX[0] != document && i.overflowX[0].tagName != "HTML") {if (i.overflowX[0].offsetWidth - (ui.position.left - i.overflowX[0].scrollLeft + i.clickOffset.left) < o.scrollSensitivity) {i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;}if ((ui.position.top - i.overflowX[0].scrollLeft + i.clickOffset.left) < o.scrollSensitivity) {i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;}} else {if (e.pageX - $(document).scrollLeft() < o.scrollSensitivity) {$(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);}if ($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity) {$(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);}}ui.instance.recallOffset(e);}});$.ui.plugin.add("draggable", "snap", {start: function (e, ui) {ui.instance.snapElements = [];$(ui.options.snap === true ? ".ui-draggable" : ui.options.snap).each(function () {var $t = $(this);var $o = $t.offset();if (this != ui.instance.element[0]) {ui.instance.snapElements.push({item: this, width: $t.outerWidth(), height: $t.outerHeight(), top: $o.top, left: $o.left});}});}, drag: function (e, ui) {var d = ui.options.snapTolerance || 20;var x1 = ui.absolutePosition.left, x2 = x1 + ui.instance.helperProportions.width, y1 = ui.absolutePosition.top, y2 = y1 + ui.instance.helperProportions.height;for (var i = ui.instance.snapElements.length - 1; i >= 0; i--) {var l = ui.instance.snapElements[i].left, r = l + ui.instance.snapElements[i].width, t = ui.instance.snapElements[i].top, b = t + ui.instance.snapElements[i].height;if (!(l - d < x1 && x1 < r + d && t - d < y1 && y1 < b + d || l - d < x1 && x1 < r + d && t - d < y2 && y2 < b + d || l - d < x2 && x2 < r + d && t - d < y1 && y1 < b + d || l - d < x2 && x2 < r + d && t - d < y2 && y2 < b + d)) {continue;}if (ui.options.snapMode != "inner") {var ts = Math.abs(t - y2) <= 20;var bs = Math.abs(b - y1) <= 20;var ls = Math.abs(l - x2) <= 20;var rs = Math.abs(r - x1) <= 20;if (ts) {ui.position.top = t - ui.instance.offset.top + ui.instance.clickOffset.top - ui.instance.helperProportions.height;}if (bs) {ui.position.top = b - ui.instance.offset.top + ui.instance.clickOffset.top;}if (ls) {ui.position.left = l - ui.instance.offset.left + ui.instance.clickOffset.left - ui.instance.helperProportions.width;}if (rs) {ui.position.left = r - ui.instance.offset.left + ui.instance.clickOffset.left;}}if (ui.options.snapMode != "outer") {var ts = Math.abs(t - y1) <= 20;var bs = Math.abs(b - y2) <= 20;var ls = Math.abs(l - x1) <= 20;var rs = Math.abs(r - x2) <= 20;if (ts) {ui.position.top = t - ui.instance.offset.top + ui.instance.clickOffset.top;}if (bs) {ui.position.top = b - ui.instance.offset.top + ui.instance.clickOffset.top - ui.instance.helperProportions.height;}if (ls) {ui.position.left = l - ui.instance.offset.left + ui.instance.clickOffset.left;}if (rs) {ui.position.left = r - ui.instance.offset.left + ui.instance.clickOffset.left - ui.instance.helperProportions.width;}}}}});$.ui.plugin.add("draggable", "connectToSortable", {start: function (e, ui) {ui.instance.sortable = $.data($(ui.options.connectToSortable)[0], "sortable");ui.instance.sortableOffset = ui.instance.sortable.element.offset();ui.instance.sortableOuterWidth = ui.instance.sortable.element.outerWidth();ui.instance.sortableOuterHeight = ui.instance.sortable.element.outerHeight();if (ui.instance.sortable.options.revert) {ui.instance.sortable.shouldRevert = true;}}, stop: function (e, ui) {var inst = ui.instance.sortable;if (inst.isOver) {inst.isOver = 0;ui.instance.cancelHelperRemoval = true;inst.cancelHelperRemoval = false;if (inst.shouldRevert) {inst.options.revert = true;}inst.stop(e);inst.options.helper = "original";}}, drag: function (e, ui) {var inst = ui.instance.sortable;ui.instance.position.absolute = ui.absolutePosition;if (inst.intersectsWith.call(ui.instance, {left: ui.instance.sortableOffset.left, top: ui.instance.sortableOffset.top, width: ui.instance.sortableOuterWidth, height: ui.instance.sortableOuterHeight})) {if (!inst.isOver) {inst.isOver = 1;var height = inst.options.placeholderElement ? $(inst.options.placeholderElement, $(inst.options.items, inst.element)).innerHeight() : $(inst.options.items, inst.element).innerHeight();var width = inst.options.placeholderElement ? $(inst.options.placeholderElement, $(inst.options.items, inst.element)).innerWidth() : $(inst.options.items, inst.element).innerWidth();inst.currentItem = $(this).clone().appendTo(inst.element);inst.options.helper = function () {return ui.helper[0];};inst.start(e);inst.clickOffset.top = ui.instance.clickOffset.top;inst.clickOffset.left = ui.instance.clickOffset.left;inst.offset.left -= ui.absolutePosition.left - inst.position.absolute.left;inst.offset.top -= ui.absolutePosition.top - inst.position.absolute.top;inst.helperProportions = {width: width, height: height};ui.helper.animate({height: height, width: width}, 500);ui.instance.propagate("toSortable", e);}if (inst.currentItem) {inst.drag(e);}} else {if (inst.isOver) {inst.isOver = 0;inst.cancelHelperRemoval = true;inst.options.revert = false;inst.stop(e);inst.options.helper = "original";inst.currentItem.remove();inst.placeholder.remove();ui.helper.animate({height: this.innerHeight(), width: this.innerWidth()}, 500);ui.instance.propagate("fromSortable", e);}}}});}(jQuery));
    (function ($) {$.fn.extend({resizable: function (options, data) {var args = Array.prototype.slice.call(arguments, 1);return this.each(function () {if (typeof options == "string") {var resize = $.data(this, "resizable");if (resize) {resize[options].apply(resize, args);}} else if (!$(this).is(".ui-resizable")) {new ($.ui.resizable)(this, options);}});}});$.ui.resizable = function (element, options) {var self = this;this.element = $(element);$.data(element, "resizable", this);var elpos = this.element.css("position");this.element.addClass("ui-resizable").css({position: /static/.test(elpos) ? "relative" : elpos});this.options = $.extend({preventDefault: true, transparent: false, minWidth: 10, minHeight: 10, aspectRatio: false, disableSelection: true, preserveCursor: true, autohide: false, knobHandles: false}, options);this.options._aspectRatio = !!this.options.aspectRatio;this.options.proxy = this.options.proxy || this.options.ghost ? "proxy" : null;this.options.proxy = this.options.proxy || this.options.animate ? "proxy" : null;this.options.knobHandles = this.options.knobHandles === true ? "ui-resizable-knob-handle" : this.options.knobHandles;$(element).bind("setData.resizable", function (event, key, value) {self.options[key] = value;}).bind("getData.resizable", function (event, key) {return self.options[key];});var o = this.options;var aBorder = "1px solid #DEDEDE";o.defaultTheme = {'ui-resizable': {display: "block"}, 'ui-resizable-handle': {position: "absolute", background: "#F2F2F2", fontSize: "0.1px"}, 'ui-resizable-n': {cursor: "n-resize", height: "4px", left: "0px", right: "0px", borderTop: aBorder}, 'ui-resizable-s': {cursor: "s-resize", height: "4px", left: "0px", right: "0px", borderBottom: aBorder}, 'ui-resizable-e': {cursor: "e-resize", width: "4px", top: "0px", bottom: "0px", borderRight: aBorder}, 'ui-resizable-w': {cursor: "w-resize", width: "4px", top: "0px", bottom: "0px", borderLeft: aBorder}, 'ui-resizable-se': {cursor: "se-resize", width: "4px", height: "4px", borderRight: aBorder, borderBottom: aBorder}, 'ui-resizable-sw': {cursor: "sw-resize", width: "4px", height: "4px", borderBottom: aBorder, borderLeft: aBorder}, 'ui-resizable-ne': {cursor: "ne-resize", width: "4px", height: "4px", borderRight: aBorder, borderTop: aBorder}, 'ui-resizable-nw': {cursor: "nw-resize", width: "4px", height: "4px", borderLeft: aBorder, borderTop: aBorder}};o.knobTheme = {'ui-resizable-handle': {background: "#F2F2F2", border: "1px solid #808080", height: "8px", width: "8px"}, 'ui-resizable-n': {cursor: "n-resize", top: "-4px", left: "45%"}, 'ui-resizable-s': {cursor: "s-resize", bottom: "-4px", left: "45%"}, 'ui-resizable-e': {cursor: "e-resize", right: "-4px", top: "45%"}, 'ui-resizable-w': {cursor: "w-resize", left: "-4px", top: "45%"}, 'ui-resizable-se': {cursor: "se-resize", right: "-4px", bottom: "-4px"}, 'ui-resizable-sw': {cursor: "sw-resize", left: "-4px", bottom: "-4px"}, 'ui-resizable-nw': {cursor: "nw-resize", left: "-4px", top: "-4px"}, 'ui-resizable-ne': {cursor: "ne-resize", right: "-4px", top: "-4px"}};if (!o.proxy && (this.element.css("position") == "static" || this.element.css("position") === "")) {this.element.css("position", "relative");}o._nodeName = element.nodeName;if (o._nodeName.match(/textarea|input|select|button|img/i)) {var el = this.element;if (/relative/.test(el.css("position")) && $.browser.opera) {el.css({position: "relative", top: "auto", left: "auto"});}el.wrap($("<div class=\"ui-wrapper\" style=\"overflow: hidden;\"></div>").css({position: el.css("position"), width: el.outerWidth(), height: el.outerHeight(), top: el.css("top"), left: el.css("left")}));var oel = this.element;element = element.parentNode;this.element = $(element);this.element.css({marginLeft: oel.css("marginLeft"), marginTop: oel.css("marginTop"), marginRight: oel.css("marginRight"), marginBottom: oel.css("marginBottom")});oel.css({marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});if ($.browser.safari && o.preventDefault) {oel.css("resize", "none");}o.proportionallyResize = oel.css({position: "static", zoom: 1, display: "block"});this.element.css({margin: oel.css("margin")});this._proportionallyResize();}if (!o.handles) {o.handles = !$(".ui-resizable-handle", element).length ? "e,s,se" : {n: ".ui-resizable-n", e: ".ui-resizable-e", s: ".ui-resizable-s", w: ".ui-resizable-w", se: ".ui-resizable-se", sw: ".ui-resizable-sw", ne: ".ui-resizable-ne", nw: ".ui-resizable-nw"};}if (o.handles.constructor == String) {if (o.handles == "all") {o.handles = "n,e,s,w,se,sw,ne,nw";}var n = o.handles.split(",");o.handles = {};o.zIndex = o.zIndex || 1000;var insertionsDefault = {handle: "position: absolute; display: none; overflow:hidden;", n: "top: 0pt; width:100%;", e: "right: 0pt; height:100%;", s: "bottom: 0pt; width:100%;", w: "left: 0pt; height:100%;", se: "bottom: 0pt; right: 0px;", sw: "bottom: 0pt; left: 0px;", ne: "top: 0pt; right: 0px;", nw: "top: 0pt; left: 0px;"};for (var i = 0; i < n.length; i++) {var handle = jQuery.trim(n[i]), dt = o.defaultTheme, hname = "ui-resizable-" + handle, loadDefault = !$.ui.css(hname) && !o.knobHandles, userKnobClass = $.ui.css("ui-resizable-knob-handle"), allDefTheme = $.extend(dt[hname], dt['ui-resizable-handle']), allKnobTheme = $.extend(o.knobTheme[hname], !userKnobClass ? o.knobTheme['ui-resizable-handle'] : {});var applyZIndex = /sw|se|ne|nw/.test(handle) ? {zIndex: ++o.zIndex} : {};var defCss = loadDefault ? insertionsDefault[handle] : "", axis = $(["<div class=\"ui-resizable-handle ", hname, "\" style=\"", defCss, insertionsDefault.handle, "\"></div>"].join("")).css(applyZIndex);o.handles[handle] = ".ui-resizable-" + handle;this.element.append(axis.css(loadDefault ? allDefTheme : {}).css(o.knobHandles ? allKnobTheme : {}).addClass(o.knobHandles ? "ui-resizable-knob-handle" : "").addClass(o.knobHandles));}if (o.knobHandles) {this.element.addClass("ui-resizable-knob").css(!$.ui.css("ui-resizable-knob") ? {} : {});}}this._renderAxis = function (target) {target = target || this.element;for (var i in o.handles) {if (o.handles[i].constructor == String) {o.handles[i] = $(o.handles[i], element).show();}if (o.transparent) {o.handles[i].css({opacity: 0});}if (this.element.is(".ui-wrapper") && o._nodeName.match(/textarea|input|select|button/i)) {var axis = $(o.handles[i], element), padWrapper = 0;padWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();var padPos = ["padding", /ne|nw|n/.test(i) ? "Top" : /se|sw|s/.test(i) ? "Bottom" : /^e$/.test(i) ? "Right" : "Left"].join("");if (!o.transparent) {target.css(padPos, padWrapper);}this._proportionallyResize();}if (!$(o.handles[i]).length) {continue;}}};this._renderAxis(this.element);o._handles = $(".ui-resizable-handle", self.element);if (o.disableSelection) {o._handles.each(function (i, e) {$.ui.disableSelection(e);});}o._handles.mouseover(function () {if (!o.resizing) {if (this.className) {var axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);}self.axis = o.axis = axis && axis[1] ? axis[1] : "se";}});if (o.autohide) {o._handles.hide();$(self.element).addClass("ui-resizable-autohide").hover(function () {$(this).removeClass("ui-resizable-autohide");o._handles.show();}, function () {if (!o.resizing) {$(this).addClass("ui-resizable-autohide");o._handles.hide();}});}this.element.mouseInteraction({executor: this, delay: 0, distance: 0, dragPrevention: ["input", "textarea", "button", "select", "option"], start: this.start, stop: this.stop, drag: this.drag, condition: function (e) {if (this.disabled) {return false;}for (var i in this.options.handles) {if ($(this.options.handles[i])[0] == e.target) {return true;}}return false;}});};$.extend($.ui.resizable.prototype, {plugins: {}, ui: function () {return {instance: this, axis: this.options.axis, options: this.options};}, _renderProxy: function () {var el = this.element, o = this.options;this.elementOffset = el.offset();if (o.proxy) {this.helper = this.helper || $("<div style=\"overflow:hidden;\"></div>");var ie6 = $.browser.msie && $.browser.version < 7, ie6offset = ie6 ? 1 : 0, pxyoffset = ie6 ? 2 : -1;this.helper.addClass(o.proxy).css({width: el.outerWidth() + pxyoffset, height: el.outerHeight() + pxyoffset, position: "absolute", left: this.elementOffset.left - ie6offset + "px", top: this.elementOffset.top - ie6offset + "px", zIndex: ++o.zIndex});this.helper.appendTo("body");if (o.disableSelection) {$.ui.disableSelection(this.helper.get(0));}} else {this.helper = el;}}, propagate: function (n, e) {$.ui.plugin.call(this, n, [e, this.ui()]);this.element.triggerHandler(n == "resize" ? n : ["resize", n].join(""), [e, this.ui()], this.options[n]);}, destroy: function () {var el = this.element, wrapped = el.children(".ui-resizable").get(0), _destroy = function (exp) {$(exp).removeClass("ui-resizable ui-resizable-disabled").removeMouseInteraction().removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove();};_destroy(el);if (el.is(".ui-wrapper") && wrapped) {el.parent().append($(wrapped).css({position: el.css("position"), width: el.outerWidth(), height: el.outerHeight(), top: el.css("top"), left: el.css("left")})).end().remove();_destroy(wrapped);}}, enable: function () {this.element.removeClass("ui-resizable-disabled");this.disabled = false;}, disable: function () {this.element.addClass("ui-resizable-disabled");this.disabled = true;}, start: function (e) {var o = this.options, iniPos = this.element.position(), el = this.element, num = function (v) {return parseInt(v, 10) || 0;}, ie6 = $.browser.msie && $.browser.version < 7;o.resizing = true;o.documentScroll = {top: $(document).scrollTop(), left: $(document).scrollLeft()};if (el.is(".ui-draggable") || /absolute/.test(el.css("position"))) {var sOffset = $.browser.msie && !o.containment && /absolute/.test(el.css("position")) && !/relative/.test(el.parent().css("position"));var dscrollt = sOffset ? o.documentScroll.top : 0, dscrolll = sOffset ? o.documentScroll.left : 0;el.css({position: "absolute", top: iniPos.top + dscrollt, left: iniPos.left + dscrolll});}if (/relative/.test(el.css("position")) && $.browser.opera) {el.css({position: "relative", top: "auto", left: "auto"});}this._renderProxy();var curleft = num(this.helper.css("left")), curtop = num(this.helper.css("top"));this.offset = this.helper.offset();this.position = {left: curleft, top: curtop};this.size = o.proxy || ie6 ? {width: el.outerWidth(), height: el.outerHeight()} : {width: el.width(), height: el.height()};this.originalSize = o.proxy || ie6 ? {width: el.outerWidth(), height: el.outerHeight()} : {width: el.width(), height: el.height()};this.originalPosition = {left: curleft, top: curtop};this.sizeDiff = {width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height()};this.originalMousePosition = {left: e.pageX, top: e.pageY};o.aspectRatio = (typeof o.aspectRatio == "number") ? o.aspectRatio : this.originalSize.height / this.originalSize.width || 1;if (o.preserveCursor) {$("body").css("cursor", this.axis + "-resize");}this.propagate("start", e);return false;}, stop: function (e) {this.options.resizing = false;var o = this.options, num = function (v) {return parseInt(v, 10) || 0;}, self = this;if (o.proxy) {var pr = o.proportionallyResize, ista = pr && /textarea/i.test(pr.get(0).nodeName), soffseth = ista && $.ui.hasScroll(pr.get(0), "left") ? 0 : self.sizeDiff.height, soffsetw = ista ? 0 : self.sizeDiff.width;var style = {width: self.size.width - soffsetw, height: self.size.height - soffseth}, left = parseInt(self.element.css("left"), 10) + (self.position.left - self.originalPosition.left), top = parseInt(self.element.css("top"), 10) + (self.position.top - self.originalPosition.top);if (!o.animate) {this.element.css($.extend(style, {top: top, left: left}));}if (o.proxy && !o.animate) {this._proportionallyResize();}this.helper.remove();}if (o.preserveCursor) {$("body").css("cursor", "auto");}this.propagate("stop", e);return false;}, drag: function (e) {var el = this.helper, o = this.options, props = {}, self = this, smp = this.originalMousePosition, a = this.axis;var dx = e.pageX - smp.left || 0, dy = e.pageY - smp.top || 0;var trigger = this.change[a];if (!trigger) {return false;}var data = trigger.apply(this, [e, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;if (o._aspectRatio || e.shiftKey) {data = this._updateRatio(data, e);}data = this._respectSize(data, e);this.propagate("resize", e);el.css({top: this.position.top + "px", left: this.position.left + "px", width: this.size.width + "px", height: this.size.height + "px"});if (!o.proxy && o.proportionallyResize) {this._proportionallyResize();}this._updateCache(data);return false;}, _updateCache: function (data) {var o = this.options;this.offset = this.helper.offset();if (data.left) {this.position.left = data.left;}if (data.top) {this.position.top = data.top;}if (data.height) {this.size.height = data.height;}if (data.width) {this.size.width = data.width;}}, _updateRatio: function (data, e) {var o = this.options, cpos = this.position, csize = this.size, a = this.axis;if (data.height) {data.width = Math.round(csize.height / o.aspectRatio);} else if (data.width) {data.height = Math.round(csize.width * o.aspectRatio);}if (a == "sw") {data.left = cpos.left + (csize.width - data.width);data.top = null;}if (a == "nw") {data.top = cpos.top + (csize.height - data.height);data.left = cpos.left + (csize.width - data.width);}return data;}, _respectSize: function (data, e) {var el = this.helper, o = this.options, pRatio = o._aspectRatio || e.shiftKey, a = this.axis, ismaxw = data.width && o.maxWidth && o.maxWidth < data.width, ismaxh = data.height && o.maxHeight && o.maxHeight < data.height, isminw = data.width && o.minWidth && o.minWidth > data.width, isminh = data.height && o.minHeight && o.minHeight > data.height;if (isminw) {data.width = o.minWidth;}if (isminh) {data.height = o.minHeight;}if (ismaxw) {data.width = o.maxWidth;}if (ismaxh) {data.height = o.maxHeight;}var dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;var cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);if (isminw && cw) {data.left = dw - o.minWidth;}if (ismaxw && cw) {data.left = dw - o.maxWidth;}if (isminh && ch) {data.top = dh - o.minHeight;}if (ismaxh && ch) {data.top = dh - o.maxHeight;}var isNotwh = !data.width && !data.height;if (isNotwh && !data.left && data.top) {data.top = null;} else if (isNotwh && !data.top && data.left) {data.left = null;}return data;}, _proportionallyResize: function () {var o = this.options;if (!o.proportionallyResize) {return;}var prel = o.proportionallyResize, el = this.helper || this.element;if (!o.borderDif) {var b = [prel.css("borderTopWidth"), prel.css("borderRightWidth"), prel.css("borderBottomWidth"), prel.css("borderLeftWidth")], p = [prel.css("paddingTop"), prel.css("paddingRight"), prel.css("paddingBottom"), prel.css("paddingLeft")];o.borderDif = $.map(b, function (v, i) {var border = parseInt(v, 10) || 0, padding = parseInt(p[i], 10) || 0;return border + padding;});}prel.css({height: (el.height() - o.borderDif[0] - o.borderDif[2]) + "px", width: (el.width() - o.borderDif[1] - o.borderDif[3]) + "px"});}, change: {e: function (e, dx, dy) {return {width: this.originalSize.width + dx};}, w: function (e, dx, dy) {var o = this.options, cs = this.originalSize, sp = this.originalPosition;return {left: sp.left + dx, width: cs.width - dx};}, n: function (e, dx, dy) {var o = this.options, cs = this.originalSize, sp = this.originalPosition;return {top: sp.top + dy, height: cs.height - dy};}, s: function (e, dx, dy) {return {height: this.originalSize.height + dy};}, se: function (e, dx, dy) {return $.extend(this.change.s.apply(this, arguments), this.change.e.apply(this, [e, dx, dy]));}, sw: function (e, dx, dy) {return $.extend(this.change.s.apply(this, arguments), this.change.w.apply(this, [e, dx, dy]));}, ne: function (e, dx, dy) {return $.extend(this.change.n.apply(this, arguments), this.change.e.apply(this, [e, dx, dy]));}, nw: function (e, dx, dy) {return $.extend(this.change.n.apply(this, arguments), this.change.w.apply(this, [e, dx, dy]));}}});$.ui.plugin.add("resizable", "containment", {start: function (e, ui) {var o = ui.options, self = ui.instance, el = self.element;var oc = o.containment, ce = (oc instanceof jQuery) ? oc.get(0) : /parent/.test(oc) ? el.parent().get(0) : oc;if (!ce) {return;}if (/document/.test(oc) || oc == document) {self.containerOffset = {left: 0, top: 0};self.parentData = {element: $(document), left: 0, top: 0, width: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight};} else {self.containerOffset = $(ce).offset(), self.containerSize = {height: $(ce).innerHeight(), width: $(ce).innerWidth()};var co = self.containerOffset, ch = self.containerSize.height, cw = self.containerSize.width, width = $.ui.hasScroll(ce, "left") ? ce.scrollWidth : cw, height = $.ui.hasScroll(ce) ? ce.scrollHeight : ch;self.parentData = {element: ce, left: co.left, top: co.top, width: width, height: height};}}, resize: function (e, ui) {var o = ui.options, self = ui.instance, ps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position, pRatio = o._aspectRatio || e.shiftKey;if (cp.left < (o.proxy ? co.left : 0)) {self.size.width = self.size.width + (o.proxy ? self.position.left - co.left : self.position.left);if (pRatio) {self.size.height = self.size.width * o.aspectRatio;}self.position.left = o.proxy ? co.left : 0;}if (cp.top < (o.proxy ? co.top : 0)) {self.size.height = self.size.height + (o.proxy ? self.position.top - co.top : self.position.top);if (pRatio) {self.size.width = self.size.height / o.aspectRatio;}self.position.top = o.proxy ? co.top : 0;}var woset = (o.proxy ? self.offset.left - co.left : self.position.left) + self.sizeDiff.width, hoset = (o.proxy ? self.offset.top - co.top : self.position.top) + self.sizeDiff.height;if (woset + self.size.width >= self.parentData.width) {self.size.width = self.parentData.width - woset;if (pRatio) {self.size.height = self.size.width * o.aspectRatio;}}if (hoset + self.size.height >= self.parentData.height) {self.size.height = self.parentData.height - hoset;if (pRatio) {self.size.width = self.size.height / o.aspectRatio;}}}});$.ui.plugin.add("resizable", "grid", {resize: function (e, ui) {var o = ui.options, self = ui.instance, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || e.shiftKey;o.grid = typeof o.grid == "number" ? [o.grid, o.grid] : o.grid;var ox = Math.round((cs.width - os.width) / o.grid[0]) * o.grid[0], oy = Math.round((cs.height - os.height) / o.grid[1]) * o.grid[1];if (/^(se|s|e)$/.test(a)) {self.size.width = os.width + ox;self.size.height = os.height + oy;} else if (/^(ne)$/.test(a)) {self.size.width = os.width + ox;self.size.height = os.height + oy;self.position.top = op.top - oy;} else if (/^(sw)$/.test(a)) {self.size.width = os.width + ox;self.size.height = os.height + oy;self.position.left = op.left - ox;} else {self.size.width = os.width + ox;self.size.height = os.height + oy;self.position.top = op.top - oy;self.position.left = op.left - ox;}}});$.ui.plugin.add("resizable", "animate", {stop: function (e, ui) {var o = ui.options, self = ui.instance;var pr = o.proportionallyResize, ista = pr && /textarea/i.test(pr.get(0).nodeName), soffseth = ista && $.ui.hasScroll(pr.get(0), "left") ? 0 : self.sizeDiff.height, soffsetw = ista ? 0 : self.sizeDiff.width;var style = {width: self.size.width - soffsetw, height: self.size.height - soffseth}, left = parseInt(self.element.css("left"), 10) + (self.position.left - self.originalPosition.left), top = parseInt(self.element.css("top"), 10) + (self.position.top - self.originalPosition.top);self.element.animate($.extend(style, {top: top, left: left}), {duration: o.animateDuration || "slow", easing: o.animateEasing || "swing", step: function () {if (pr) {pr.css({width: self.element.css("width"), height: self.element.css("height")});}}});}});$.ui.plugin.add("resizable", "ghost", {start: function (e, ui) {var o = ui.options, self = ui.instance, pr = o.proportionallyResize, cs = self.size;if (!pr) {self.ghost = self.element.clone();} else {self.ghost = pr.clone();}self.ghost.css({opacity: 0.25, display: "block", position: "relative", height: cs.height, width: cs.width, margin: 0, left: 0, top: 0}).addClass("ui-resizable-ghost").addClass(typeof o.ghost == "string" ? o.ghost : "");self.ghost.appendTo(self.helper);}, resize: function (e, ui) {var o = ui.options, self = ui.instance, pr = o.proportionallyResize;if (self.ghost) {self.ghost.css({position: "relative", height: self.size.height, width: self.size.width});}}, stop: function (e, ui) {var o = ui.options, self = ui.instance, pr = o.proportionallyResize;if (self.ghost && self.helper) {self.helper.get(0).removeChild(self.ghost.get(0));}}});}(jQuery));

