summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/local/www/javascript')
-rw-r--r--src/usr/local/www/javascript/autosuggest.js337
-rw-r--r--src/usr/local/www/javascript/base64.js142
-rw-r--r--src/usr/local/www/javascript/carp_status/carp_status.js5
-rw-r--r--src/usr/local/www/javascript/chosen/chosen-sprite.pngbin0 -> 1866 bytes
-rw-r--r--src/usr/local/www/javascript/chosen/chosen.css317
-rw-r--r--src/usr/local/www/javascript/chosen/chosen.jquery.js755
-rw-r--r--src/usr/local/www/javascript/chosen/chosen.jquery.min.js9
-rw-r--r--src/usr/local/www/javascript/chosen/chosen.proto.js765
-rw-r--r--src/usr/local/www/javascript/chosen/chosen.proto.min.js9
-rw-r--r--src/usr/local/www/javascript/chosen/coffee/chosen.jquery.coffee633
-rw-r--r--src/usr/local/www/javascript/chosen/coffee/chosen.proto.coffee629
-rw-r--r--src/usr/local/www/javascript/datepicker/css/datepicker.css178
-rw-r--r--src/usr/local/www/javascript/datepicker/js/blank.html6
-rw-r--r--src/usr/local/www/javascript/datepicker/js/datepicker.js1111
-rwxr-xr-xsrc/usr/local/www/javascript/datepicker/media/bg_header.jpgbin0 -> 1792 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/datepicker/media/bullet1.gifbin0 -> 55 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/datepicker/media/bullet2.gifbin0 -> 262 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/datepicker/media/cal.gifbin0 -> 127 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/datepicker/media/gradient-e5e5e5-ffffff.gifbin0 -> 526 bytes
-rw-r--r--src/usr/local/www/javascript/domTT/LICENSE202
-rw-r--r--src/usr/local/www/javascript/domTT/behaviour.js254
-rw-r--r--src/usr/local/www/javascript/domTT/domLib.js706
-rw-r--r--src/usr/local/www/javascript/domTT/domTT.js1132
-rw-r--r--src/usr/local/www/javascript/domTT/fadomatic.js180
-rw-r--r--src/usr/local/www/javascript/filter_log.js168
-rw-r--r--src/usr/local/www/javascript/firebug-lite.js1000
-rw-r--r--src/usr/local/www/javascript/firewall_nat_edit/autosuggest.js337
-rw-r--r--src/usr/local/www/javascript/firewall_nat_edit/disablekeys.js6
-rw-r--r--src/usr/local/www/javascript/firewall_nat_edit/firewall_nat_edit.js203
-rw-r--r--src/usr/local/www/javascript/firewall_nat_edit/suggestions.js33
-rw-r--r--src/usr/local/www/javascript/firewall_rules_edit/autosuggest.js337
-rw-r--r--src/usr/local/www/javascript/firewall_rules_edit/disablekeys.js6
-rw-r--r--src/usr/local/www/javascript/firewall_rules_edit/firewall_rules_edit.js237
-rw-r--r--src/usr/local/www/javascript/firewall_rules_edit/suggestions.js33
-rw-r--r--src/usr/local/www/javascript/firewall_shaper_edit/autosuggest.js337
-rw-r--r--src/usr/local/www/javascript/firewall_shaper_edit/disablekeys.js6
-rw-r--r--src/usr/local/www/javascript/firewall_shaper_edit/firewall_shaper_edit.js37
-rw-r--r--src/usr/local/www/javascript/firewall_shaper_edit/suggestions.js33
-rw-r--r--src/usr/local/www/javascript/global.js43
-rw-r--r--src/usr/local/www/javascript/index/ajax.js196
-rw-r--r--src/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js253
-rw-r--r--src/usr/local/www/javascript/jquery-1.11.1.min.js4
-rw-r--r--src/usr/local/www/javascript/jquery-migrate-1.2.1.min.js2
-rw-r--r--src/usr/local/www/javascript/jquery-ui-timepicker-addon/css/jquery-ui-timepicker-addon.css7
-rw-r--r--src/usr/local/www/javascript/jquery-ui-timepicker-addon/js/jquery-ui-timepicker-addon.js1326
-rwxr-xr-xsrc/usr/local/www/javascript/jquery.ipv4v6ify.js140
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_diagonals-thick_18_b81900_40x40.pngbin0 -> 260 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_diagonals-thick_20_666666_40x40.pngbin0 -> 251 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_flat_0_aaaaaa_40x100.pngbin0 -> 180 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_flat_0_eeeeee_40x100.pngbin0 -> 180 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_flat_10_000000_40x100.pngbin0 -> 178 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_flat_55_c0402a_40x100.pngbin0 -> 213 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_flat_55_eeeeee_40x100.pngbin0 -> 180 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_glass_100_f6f6f6_1x400.pngbin0 -> 104 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_glass_100_f8f8f8_1x400.pngbin0 -> 105 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_glass_100_fdf5ce_1x400.pngbin0 -> 125 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_glass_35_dddddd_1x400.pngbin0 -> 109 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_glass_60_eeeeee_1x400.pngbin0 -> 110 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_glass_65_ffffff_1x400.pngbin0 -> 105 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_gloss-wave_35_f6a828_500x100.pngbin0 -> 3762 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_highlight-soft_100_eeeeee_1x100.pngbin0 -> 90 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_highlight-soft_75_ffe45c_1x100.pngbin0 -> 129 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_inset-hard_75_999999_1x100.pngbin0 -> 114 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-bg_inset-soft_50_c9c9c9_1x100.pngbin0 -> 96 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_222222_256x240.pngbin0 -> 4369 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_228ef1_256x240.pngbin0 -> 4369 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_3383bb_256x240.pngbin0 -> 4369 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_454545_256x240.pngbin0 -> 4369 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_70b2e1_256x240.pngbin0 -> 4369 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_999999_256x240.pngbin0 -> 4369 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_ef8c08_256x240.pngbin0 -> 4369 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_fbc856_256x240.pngbin0 -> 5355 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_ffd27a_256x240.pngbin0 -> 4369 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/jquery/images/ui-icons_ffffff_256x240.pngbin0 -> 4369 bytes
-rw-r--r--src/usr/local/www/javascript/jquery/jquery-ui-1.11.1.min.js13
-rw-r--r--src/usr/local/www/javascript/load_balancer_pool_edit/pool.js191
-rw-r--r--src/usr/local/www/javascript/load_balancer_relay_protocol_edit/load_balancer_relay_protocol_edit.js56
-rw-r--r--src/usr/local/www/javascript/niftyjsCode.js174
-rw-r--r--src/usr/local/www/javascript/numericupdown/css/numericupdown.css40
-rwxr-xr-xsrc/usr/local/www/javascript/numericupdown/images/down.gifbin0 -> 60 bytes
-rwxr-xr-xsrc/usr/local/www/javascript/numericupdown/images/up.gifbin0 -> 60 bytes
-rw-r--r--src/usr/local/www/javascript/numericupdown/js/numericupdown.js287
-rw-r--r--src/usr/local/www/javascript/pi.js682
-rw-r--r--src/usr/local/www/javascript/row_helper.js97
-rw-r--r--src/usr/local/www/javascript/row_helper_dynamic.js98
-rw-r--r--src/usr/local/www/javascript/row_toggle.js66
-rw-r--r--src/usr/local/www/javascript/scriptaculous/builder.js136
-rw-r--r--src/usr/local/www/javascript/scriptaculous/controls.js965
-rw-r--r--src/usr/local/www/javascript/scriptaculous/dragdrop.js974
-rw-r--r--src/usr/local/www/javascript/scriptaculous/effects.js1123
-rw-r--r--src/usr/local/www/javascript/scriptaculous/prototype.js6079
-rw-r--r--src/usr/local/www/javascript/scriptaculous/scriptaculous.js68
-rw-r--r--src/usr/local/www/javascript/scriptaculous/slider.js275
-rw-r--r--src/usr/local/www/javascript/scriptaculous/sound.js59
-rw-r--r--src/usr/local/www/javascript/scriptaculous/unittest.js568
-rw-r--r--src/usr/local/www/javascript/sorttable.js584
-rw-r--r--src/usr/local/www/javascript/suggestions.js33
-rw-r--r--src/usr/local/www/javascript/ticker.js73
-rw-r--r--src/usr/local/www/javascript/wizard/autosuggest.js337
-rw-r--r--src/usr/local/www/javascript/wizard/disablekeys.js6
-rw-r--r--src/usr/local/www/javascript/wizard/suggestions.js33
101 files changed, 25131 insertions, 0 deletions
diff --git a/src/usr/local/www/javascript/autosuggest.js b/src/usr/local/www/javascript/autosuggest.js
new file mode 100644
index 0000000..d9b5ac0
--- /dev/null
+++ b/src/usr/local/www/javascript/autosuggest.js
@@ -0,0 +1,337 @@
+
+/**
+ * An autosuggest textbox control.
+ * @class
+ * @scope public
+ */
+function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
+ oProvider /*:SuggestionProvider*/) {
+
+ /**
+ * The currently selected suggestions.
+ * @scope private
+ */
+ this.cur /*:int*/ = -1;
+
+ /**
+ * The dropdown list layer.
+ * @scope private
+ */
+ this.layer = null;
+
+ /**
+ * Suggestion provider for the autosuggest feature.
+ * @scope private.
+ */
+ this.provider /*:SuggestionProvider*/ = oProvider;
+
+ /**
+ * The textbox to capture.
+ * @scope private
+ */
+ this.textbox /*:HTMLInputElement*/ = oTextbox;
+
+ //initialize the control
+ this.init();
+
+}
+
+/**
+ * Autosuggests one or more suggestions for what the user has typed.
+ * If no suggestions are passed in, then no autosuggest occurs.
+ * @scope private
+ * @param aSuggestions An array of suggestion strings.
+ * @param bTypeAhead If the control should provide a type ahead suggestion.
+ */
+AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/,
+ bTypeAhead /*:boolean*/) {
+
+ //make sure there's at least one suggestion
+ if (aSuggestions.length > 0) {
+ if (bTypeAhead) {
+ this.typeAhead(aSuggestions[0]);
+ }
+
+ this.showSuggestions(aSuggestions);
+ } else {
+ this.hideSuggestions();
+ }
+};
+
+/**
+ * Creates the dropdown layer to display multiple suggestions.
+ * @scope private
+ */
+AutoSuggestControl.prototype.createDropDown = function () {
+
+ var oThis = this;
+
+ //create the layer and assign styles
+ this.layer = document.createElement("div");
+ this.layer.className = "suggestions";
+ this.layer.style.visibility = "hidden";
+ this.layer.style.width = this.textbox.offsetWidth;
+
+ //when the user clicks on the a suggestion, get the text (innerHTML)
+ //and place it into a textbox
+ this.layer.onmousedown =
+ this.layer.onmouseup =
+ this.layer.onmouseover = function (oEvent) {
+ oEvent = oEvent || window.event;
+ oTarget = oEvent.target || oEvent.srcElement;
+
+ if (oEvent.type == "mousedown") {
+ oThis.textbox.value = oTarget.firstChild.nodeValue;
+ oThis.hideSuggestions();
+ } else if (oEvent.type == "mouseover") {
+ oThis.highlightSuggestion(oTarget);
+ } else {
+ oThis.textbox.focus();
+ }
+ };
+
+
+ document.body.appendChild(this.layer);
+};
+
+/**
+ * Gets the left coordinate of the textbox.
+ * @scope private
+ * @return The left coordinate of the textbox in pixels.
+ */
+AutoSuggestControl.prototype.getLeft = function () /*:int*/ {
+
+ var oNode = this.textbox;
+ var iLeft = 0;
+
+ while(oNode.tagName != "BODY") {
+ iLeft += oNode.offsetLeft;
+ oNode = oNode.offsetParent;
+ }
+
+ return iLeft;
+};
+
+/**
+ * Gets the top coordinate of the textbox.
+ * @scope private
+ * @return The top coordinate of the textbox in pixels.
+ */
+AutoSuggestControl.prototype.getTop = function () /*:int*/ {
+
+ var oNode = this.textbox;
+ var iTop = 0;
+
+ while(oNode.tagName != "BODY") {
+ iTop += oNode.offsetTop;
+ oNode = oNode.offsetParent;
+ }
+
+ return iTop;
+};
+
+/**
+ * Handles three keydown events.
+ * @scope private
+ * @param oEvent The event object for the keydown event.
+ */
+AutoSuggestControl.prototype.handleKeyDown = function (oEvent /*:Event*/) {
+
+ switch(oEvent.keyCode) {
+ case 38: //up arrow
+ this.previousSuggestion();
+ break;
+ case 40: //down arrow
+ this.nextSuggestion();
+ break;
+ case 13: //enter
+ this.hideSuggestions();
+ break;
+ }
+
+};
+
+/**
+ * Handles keyup events.
+ * @scope private
+ * @param oEvent The event object for the keyup event.
+ */
+AutoSuggestControl.prototype.handleKeyUp = function (oEvent /*:Event*/) {
+
+ var iKeyCode = oEvent.keyCode;
+
+ //for backspace (8) and delete (46), shows suggestions without typeahead
+ if (iKeyCode == 8 || iKeyCode == 46) {
+ this.provider.requestSuggestions(this, false);
+
+ //make sure not to interfere with non-character keys
+ } else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode < 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {
+ //ignore
+ } else {
+ //request suggestions from the suggestion provider with typeahead
+ this.provider.requestSuggestions(this, true);
+ }
+};
+
+/**
+ * Hides the suggestion dropdown.
+ * @scope private
+ */
+AutoSuggestControl.prototype.hideSuggestions = function () {
+ this.layer.style.visibility = "hidden";
+};
+
+/**
+ * Highlights the given node in the suggestions dropdown.
+ * @scope private
+ * @param oSuggestionNode The node representing a suggestion in the dropdown.
+ */
+AutoSuggestControl.prototype.highlightSuggestion = function (oSuggestionNode) {
+
+ for (var i=0; i < this.layer.childNodes.length; i++) {
+ var oNode = this.layer.childNodes[i];
+ if (oNode == oSuggestionNode) {
+ oNode.className = "current";
+ } else if (oNode.className == "current") {
+ oNode.className = "";
+ }
+ }
+};
+
+/**
+ * Initializes the textbox with event handlers for
+ * auto suggest functionality.
+ * @scope private
+ */
+AutoSuggestControl.prototype.init = function () {
+
+ //save a reference to this object
+ var oThis = this;
+
+ //assign the onkeyup event handler
+ this.textbox.onkeyup = function (oEvent) {
+
+ //check for the proper location of the event object
+ if (!oEvent) {
+ oEvent = window.event;
+ }
+
+ //call the handleKeyUp() method with the event object
+ oThis.handleKeyUp(oEvent);
+ };
+
+ //assign onkeydown event handler
+ this.textbox.onkeydown = function (oEvent) {
+
+ //check for the proper location of the event object
+ if (!oEvent) {
+ oEvent = window.event;
+ }
+
+ //call the handleKeyDown() method with the event object
+ oThis.handleKeyDown(oEvent);
+ };
+
+ //assign onblur event handler (hides suggestions)
+ this.textbox.onblur = function () {
+ oThis.hideSuggestions();
+ };
+
+ //create the suggestions dropdown
+ this.createDropDown();
+};
+
+/**
+ * Highlights the next suggestion in the dropdown and
+ * places the suggestion into the textbox.
+ * @scope private
+ */
+AutoSuggestControl.prototype.nextSuggestion = function () {
+ var cSuggestionNodes = this.layer.childNodes;
+
+ if (cSuggestionNodes.length > 0 && this.cur < cSuggestionNodes.length-1) {
+ var oNode = cSuggestionNodes[++this.cur];
+ this.highlightSuggestion(oNode);
+ this.textbox.value = oNode.firstChild.nodeValue;
+ }
+};
+
+/**
+ * Highlights the previous suggestion in the dropdown and
+ * places the suggestion into the textbox.
+ * @scope private
+ */
+AutoSuggestControl.prototype.previousSuggestion = function () {
+ var cSuggestionNodes = this.layer.childNodes;
+
+ if (cSuggestionNodes.length > 0 && this.cur > 0) {
+ var oNode = cSuggestionNodes[--this.cur];
+ this.highlightSuggestion(oNode);
+ this.textbox.value = oNode.firstChild.nodeValue;
+ }
+};
+
+/**
+ * Selects a range of text in the textbox.
+ * @scope public
+ * @param iStart The start index (base 0) of the selection.
+ * @param iLength The number of characters to select.
+ */
+AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*:int*/) {
+
+ //use text ranges for Internet Explorer
+ if (this.textbox.createTextRange) {
+ var oRange = this.textbox.createTextRange();
+ oRange.moveStart("character", iStart);
+ oRange.moveEnd("character", iLength - this.textbox.value.length);
+ oRange.select();
+
+ //use setSelectionRange() for Mozilla
+ } else if (this.textbox.setSelectionRange) {
+ this.textbox.setSelectionRange(iStart, iLength);
+ }
+
+ //set focus back to the textbox
+ this.textbox.focus();
+};
+
+/**
+ * Builds the suggestion layer contents, moves it into position,
+ * and displays the layer.
+ * @scope private
+ * @param aSuggestions An array of suggestions for the control.
+ */
+AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/) {
+
+ var oDiv = null;
+ this.layer.innerHTML = ""; //clear contents of the layer
+
+ for (var i=0; i < aSuggestions.length; i++) {
+ oDiv = document.createElement("div");
+ oDiv.appendChild(document.createTextNode(aSuggestions[i]));
+ this.layer.appendChild(oDiv);
+ }
+
+ this.layer.style.left = this.getLeft() + "px";
+ this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
+ this.layer.style.width = this.textbox.offsetWidth + "px";
+ this.layer.style.visibility = "visible";
+
+};
+
+/**
+ * Inserts a suggestion into the textbox, highlighting the
+ * suggested part of the text.
+ * @scope private
+ * @param sSuggestion The suggestion for the textbox.
+ */
+AutoSuggestControl.prototype.typeAhead = function (sSuggestion /*:String*/) {
+
+ //check for support of typeahead functionality
+ if (this.textbox.createTextRange || this.textbox.setSelectionRange){
+ var iLen = this.textbox.value.length;
+ this.textbox.value = sSuggestion;
+ this.selectRange(iLen, sSuggestion.length);
+ }
+};
+
diff --git a/src/usr/local/www/javascript/base64.js b/src/usr/local/www/javascript/base64.js
new file mode 100644
index 0000000..48d5f33
--- /dev/null
+++ b/src/usr/local/www/javascript/base64.js
@@ -0,0 +1,142 @@
+/**
+ *
+ * Base64 encode / decode
+ * http://www.webtoolkit.info/
+ * http://www.webtoolkit.info/licence
+ **/
+
+var Base64 = {
+
+ // private property
+ _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
+
+ // public method for encoding
+ encode : function (input) {
+ var output = "";
+ var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
+ var i = 0;
+
+ input = Base64._utf8_encode(input);
+
+ while (i < input.length) {
+
+ chr1 = input.charCodeAt(i++);
+ chr2 = input.charCodeAt(i++);
+ chr3 = input.charCodeAt(i++);
+
+ enc1 = chr1 >> 2;
+ enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
+ enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
+ enc4 = chr3 & 63;
+
+ if (isNaN(chr2)) {
+ enc3 = enc4 = 64;
+ } else if (isNaN(chr3)) {
+ enc4 = 64;
+ }
+
+ output = output +
+ this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
+ this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
+
+ }
+
+ return output;
+ },
+
+ // public method for decoding
+ decode : function (input) {
+ var output = "";
+ var chr1, chr2, chr3;
+ var enc1, enc2, enc3, enc4;
+ var i = 0;
+
+ input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
+
+ while (i < input.length) {
+
+ enc1 = this._keyStr.indexOf(input.charAt(i++));
+ enc2 = this._keyStr.indexOf(input.charAt(i++));
+ enc3 = this._keyStr.indexOf(input.charAt(i++));
+ enc4 = this._keyStr.indexOf(input.charAt(i++));
+
+ chr1 = (enc1 << 2) | (enc2 >> 4);
+ chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
+ chr3 = ((enc3 & 3) << 6) | enc4;
+
+ output = output + String.fromCharCode(chr1);
+
+ if (enc3 != 64) {
+ output = output + String.fromCharCode(chr2);
+ }
+ if (enc4 != 64) {
+ output = output + String.fromCharCode(chr3);
+ }
+
+ }
+
+ output = Base64._utf8_decode(output);
+
+ return output;
+
+ },
+
+ // private method for UTF-8 encoding
+ _utf8_encode : function (string) {
+ string = string.replace(/\r\n/g,"\n");
+ var utftext = "";
+
+ for (var n = 0; n < string.length; n++) {
+
+ var c = string.charCodeAt(n);
+
+ if (c < 128) {
+ utftext += String.fromCharCode(c);
+ }
+ else if((c > 127) && (c < 2048)) {
+ utftext += String.fromCharCode((c >> 6) | 192);
+ utftext += String.fromCharCode((c & 63) | 128);
+ }
+ else {
+ utftext += String.fromCharCode((c >> 12) | 224);
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
+ utftext += String.fromCharCode((c & 63) | 128);
+ }
+
+ }
+
+ return utftext;
+ },
+
+ // private method for UTF-8 decoding
+ _utf8_decode : function (utftext) {
+ var string = "";
+ var i = 0;
+ var c = c1 = c2 = 0;
+
+ while ( i < utftext.length ) {
+
+ c = utftext.charCodeAt(i);
+
+ if (c < 128) {
+ string += String.fromCharCode(c);
+ i++;
+ }
+ else if((c > 191) && (c < 224)) {
+ c2 = utftext.charCodeAt(i+1);
+ string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
+ i += 2;
+ }
+ else {
+ c2 = utftext.charCodeAt(i+1);
+ c3 = utftext.charCodeAt(i+2);
+ string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
+ i += 3;
+ }
+
+ }
+
+ return string;
+ }
+
+}; \ No newline at end of file
diff --git a/src/usr/local/www/javascript/carp_status/carp_status.js b/src/usr/local/www/javascript/carp_status/carp_status.js
new file mode 100644
index 0000000..c14201d
--- /dev/null
+++ b/src/usr/local/www/javascript/carp_status/carp_status.js
@@ -0,0 +1,5 @@
+
+window.onLoad = function () {
+ NiftyCheck();
+ Rounded("div#mainlevel","all","#FFF","#eeeeee","smooth");
+};
diff --git a/src/usr/local/www/javascript/chosen/chosen-sprite.png b/src/usr/local/www/javascript/chosen/chosen-sprite.png
new file mode 100644
index 0000000..6ec9bbf
--- /dev/null
+++ b/src/usr/local/www/javascript/chosen/chosen-sprite.png
Binary files differ
diff --git a/src/usr/local/www/javascript/chosen/chosen.css b/src/usr/local/www/javascript/chosen/chosen.css
new file mode 100644
index 0000000..d2b1eb4
--- /dev/null
+++ b/src/usr/local/www/javascript/chosen/chosen.css
@@ -0,0 +1,317 @@
+div.chzn-container {
+ font-size: 13px;
+ position: relative;
+}
+
+div.chzn-container input {
+ background: #fff;
+ background: -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
+ background: -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
+ background: -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
+ border: 1px solid #aaa;
+ font-family: sans-serif;
+ font-size: 1em;
+ margin: 0px;
+ padding: 4px 5px;
+ outline: none;
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ -o-border-radius: 3px;
+ -ms-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ border-radius: 3px;
+}
+div.chzn-container textarea:focus {
+ border-color: #058cf5;
+ -moz-box-shadow: 0px 0px 3px #aaa;
+ -webkit-box-shadow: 0px 0px 3px #aaa;
+ box-shadow: 0px 0px 3px #aaa;
+}
+
+
+div.chzn-container div.chzn-drop {
+ background: #FFF;
+ border: 1px solid #aaa;
+ border-width: 0 1px 1px;
+ left: 0;
+ position: absolute;
+ top: 29px;
+ -webkit-box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.15);
+ -moz-box-shadow: 0px 4px 5px rgba(0, 0, 0, 0.15);
+ box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.15);
+ z-index: 20;
+}
+div.chzn-container-single div.chzn-drop {
+ -moz-border-radius: 0 0 4px 4px;
+ -webkit-border-radius: 0 0 4px 4px;
+ -o-border-radius: 0 0 4px 4px;
+ -ms-border-radius: 0 0 4px 4px;
+ -khtml-border-radius: 0 0 4px 4px;
+ border-radius: 0 0 4px 4px;
+}
+
+
+/* SINGLE */
+div.chzn-container a.chzn-single {
+ background: #FFF;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #eeeeee), color-stop(0.5, white));
+ background-image: -moz-linear-gradient(center bottom, #eeeeee 0%, white 50%);
+ background-image: -o-linear-gradient(bottom, #eeeeee 0%, white 50%);
+ border: 1px solid #aaa;
+ display: block;
+ overflow: hidden;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -o-border-radius: 4px;
+ -ms-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+ height: 25px;
+ color: #444;
+ line-height: 26px;
+ padding: 0px 0px 0px 8px;
+ position: relative;
+ text-decoration: none;
+ z-index: 19;
+ white-space: nowrap;
+}
+div.chzn-container a.chzn-single span {
+ display: block;
+ margin-right: 26px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
+div.chzn-container a.chzn-single div {
+ -moz-border-radius-topright: 4px;
+ -webkit-border-top-right-radius: 4px;
+ -o-border-top-right-radius: 4px;
+ -ms-border-top-right-radius: 4px;
+ -khtml-border-top-right-radius: 4px;
+ border-top-right-radius: 4px;
+ -moz-border-radius-bottomright: 4px;
+ -webkit-border-bottom-right-radius: 4px;
+ -o-border-bottom-right-radius: 4px;
+ -ms-border-bottom-right-radius: 4px;
+ -khtml-border-bottom-right-radius: 4px;
+ border-bottom-right-radius: 4px;
+ background: #ccc;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #ccc), color-stop(0.6, #eee));
+ background-image: -moz-linear-gradient(center bottom, #ccc 0%, #eee 60%);
+ background-image: -o-linear-gradient(bottom, #ccc 0%, #eee 60%);
+ border-left: 1px solid #aaa;
+ display: block;
+ height: 100%;
+ position: absolute;
+ right: 0;
+ top: 0;
+ width: 18px;
+}
+div.chzn-container a.chzn-single div b {
+ background: url('chosen-sprite.png') no-repeat 0 1px;
+ display: block;
+ width: 100%;
+ height: 100%;
+}
+div.chzn-container div.chzn-search {
+ padding: 3px 4px;
+ margin: 0px;
+ white-space: nowrap;
+}
+div.chzn-container div.chzn-search input {
+ background: url('chosen-sprite.png') no-repeat 97% -35px, #ffffff;
+ background: url('chosen-sprite.png') no-repeat 97% -35px, -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
+ background: url('chosen-sprite.png') no-repeat 97% -35px, -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
+ background: url('chosen-sprite.png') no-repeat 97% -35px, -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
+ -moz-border-radius: 0px;
+ -webkit-border-radius: 0px;
+ -o-border-radius: 0px;
+ -ms-border-radius: 0px;
+ -khtml-border-radius: 0px;
+ border-radius: 0px;
+ margin: 1px 0;
+ outline: 0;
+}
+
+
+/* Multi */
+div.chzn-container ul.chzn-choices {
+ background: #fff;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.85, white), color-stop(0.99, #eeeeee));
+ background-image: -moz-linear-gradient(center bottom, white 85%, #eeeeee 99%);
+ background-image: -o-linear-gradient(bottom, white 85%, #eeeeee 99%);
+ margin: 0;
+ cursor: text;
+ border: 1px solid #aaa;
+ overflow: hidden;
+ height: auto !important;
+ height: 1%;
+ padding: 0;
+ position: relative;
+}
+div.chzn-container ul.chzn-choices:focus {
+ border-color: #058cf5;
+ -moz-box-shadow: 0px 0px 5px #999;
+ -webkit-box-shadow: 0px 0px 5px #999;
+ box-shadow: 0px 0px 5px #999;
+}
+div.chzn-container ul.chzn-choices li {
+ float: left;
+ list-style-type: none;
+ margin: 0px;
+}
+div.chzn-container ul.chzn-choices li.search-field {
+ margin: 0px;
+ white-space: nowrap;
+ padding: 0px;
+}
+div.chzn-container ul.chzn-choices li.search-field input {
+ color: #666;
+ background: transparent !important;
+ border: 0px !important;
+ padding: 5px;
+ margin: 1px 0;
+ outline: 0;
+ -webkit-box-shadow: none;
+ -moz-box-shadow: none;
+ box-shadow: none;
+}
+div.chzn-container ul.chzn-choices li.search-field input.default {
+ color: #999;
+}
+div.chzn-container ul.chzn-choices li.search-choice {
+ -moz-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ background: #e4e4e4;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, #e4e4e4), color-stop(0.7, #eeeeee));
+ background-image: -moz-linear-gradient(center bottom, #e4e4e4 0%, #eeeeee 70%);
+ background-image: -o-linear-gradient(bottom, #e4e4e4 0%, #eeeeee 70%);
+ color: #333;
+ border: 1px solid #b4b4b4;
+ line-height: 13px;
+ padding: 3px 19px 3px 6px;
+ position: relative;
+ margin: 3px 0px 3px 5px;
+}
+div.chzn-container ul.chzn-choices li.search-choice span {
+ cursor: default;
+}
+div.chzn-container ul.chzn-choices li.search-choice.search-choice-focus {
+ background: #d4d4d4;
+}
+div.chzn-container ul.chzn-choices li.search-choice a.search-choice-close {
+ position: absolute;
+ right: 5px;
+ top: 6px;
+ display: block;
+ width: 8px;
+ height: 9px;
+ font-size: 1px;
+ background: url(chosen-sprite.png) right top no-repeat;
+}
+div.chzn-container ul.chzn-choices li.search-choice a.search-choice-close:hover {
+ background-position: right -9px;
+}
+div.chzn-container ul.chzn-choices li.search-choice.search-choice-focus a.search-choice-close {
+ background-position: right -9px;
+}
+
+
+/* Results */
+div.chzn-container ul.chzn-results {
+ margin: 0 4px 4px 0;
+ max-height: 190px;
+ padding: 0 0 0 4px;
+ position: relative;
+ overflow-x: hidden;
+ overflow-y: auto;
+ z-index: 20;
+}
+div.chzn-container-multi ul.chzn-results {
+ margin: -1px 0 0;
+ padding: 0;
+}
+div.chzn-container-multi ul.chzn-results li {
+ border-left: 0px !important;
+ border-right: 0px !important;
+}
+div.chzn-container ul.chzn-results li {
+ line-height: 80%;
+ padding: 7px 7px 8px;
+ z-index: 22;
+ margin: 0;
+ list-style-type: none;
+}
+div.chzn-container ul.chzn-results li.active-result {
+ cursor: pointer;
+}
+div.chzn-container ul.chzn-results li em {
+ font-style: normal;
+ background: #FEFFDC;
+}
+div.chzn-container ul.chzn-results li.highlighted {
+ background: #3875d7;
+ color: #fff;
+}
+div.chzn-container ul.chzn-results li.highlighted em {
+ background: transparent;
+}
+div.chzn-container ul.chzn-results li.no-results {
+ background: #F4F4F4;
+}
+div.chzn-container ul.chzn-results li.group-result {
+ cursor: default;
+ color: #999;
+ font-weight: bold;
+}
+div.chzn-container ul.chzn-results li.group-option {
+ padding-left: 20px;
+}
+
+div.chzn-container-multi div.chzn-drop li.result-selected {
+ display: none;
+}
+
+
+
+/* Active */
+div.chzn-container-active a.chzn-single {
+ -webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
+ -moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
+ box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
+ border: 1px solid #5897fb;
+}
+div.chzn-container-active a.chzn-single-with-drop {
+ border: 1px solid #aaa;
+ border-width: 1px 1px 1px;
+ -moz-box-shadow: 0px 1px 0px #FFF inset;
+ -webkit-box-shadow: 0px 1px 0px #FFF inset;
+ box-shadow: 0px 1px 0px #FFF inset;
+ background: #EEE;
+ background-image: -webkit-gradient(linear, left bottom, left top, color-stop(0, white), color-stop(0.5, #eeeeee));
+ background-image: -moz-linear-gradient(center bottom, white 0%, #eeeeee 50%);
+ background-image: -o-linear-gradient(bottom, white 0%, #eeeeee 50%);
+ -webkit-border-bottom-left-radius: 0px;
+ -webkit-border-bottom-right-radius: 0px;
+ -moz-border-radius-bottomleft: 0px;
+ -moz-border-radius-bottomright: 0px;
+ border-bottom-left-radius: 0px;
+ border-bottom-right-radius: 0px;
+}
+div.chzn-container-active a.chzn-single-with-drop div {
+ background: transparent;
+ border-left: none;
+}
+div.chzn-container-active a.chzn-single-with-drop div b {
+ background-position: -18px 1px;
+}
+div.chzn-container-active ul.chzn-choices {
+ z-index: 21;
+ -webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
+ -moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
+ box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.3);
+ border: 1px solid #5897fb;
+}
+div.chzn-container-active ul.chzn-choices input {
+ color: #111 !important;
+}
diff --git a/src/usr/local/www/javascript/chosen/chosen.jquery.js b/src/usr/local/www/javascript/chosen/chosen.jquery.js
new file mode 100644
index 0000000..21e822a
--- /dev/null
+++ b/src/usr/local/www/javascript/chosen/chosen.jquery.js
@@ -0,0 +1,755 @@
+(function() {
+ /*
+ Chosen, a Select Box Enhancer for jQuery and Protoype
+ by Patrick Filler for Harvest, http://getharvest.com
+
+ Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
+
+ Copyright (c) 2011 by Harvest
+ */ var $, Chosen, SelectParser, get_side_border_padding, root;
+ var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+ root = typeof exports !== "undefined" && exports !== null ? exports : this;
+ $ = jQuery;
+ $.fn.extend({
+ chosen: function(data, options) {
+ return $(this).each(function(input_field) {
+ if (!($(this)).hasClass("chzn-done")) {
+ return new Chosen(this, data, options);
+ }
+ });
+ }
+ });
+ Chosen = (function() {
+ function Chosen(elmn) {
+ this.set_default_values();
+ this.form_field = elmn;
+ this.form_field_jq = $(this.form_field);
+ this.is_multiple = this.form_field.multiple;
+ this.default_text_default = this.form_field.multiple ? "Select Some Options" : "Select an Option";
+ this.set_up_html();
+ this.register_observers();
+ this.form_field_jq.addClass("chzn-done");
+ }
+ Chosen.prototype.set_default_values = function() {
+ this.click_test_action = __bind(function(evt) {
+ return this.test_active_click(evt);
+ }, this);
+ this.active_field = false;
+ this.mouse_on_container = false;
+ this.results_showing = false;
+ this.result_highlighted = null;
+ this.result_single_selected = null;
+ return this.choices = 0;
+ };
+ Chosen.prototype.set_up_html = function() {
+ var container_div, dd_top, dd_width, sf_width;
+ this.container_id = this.form_field.id + "_chzn";
+ this.f_width = this.form_field_jq.width();
+ this.default_text = this.form_field_jq.attr('title') ? this.form_field_jq.attr('title') : this.default_text_default;
+ container_div = $("<div />", {
+ id: this.container_id,
+ "class": 'chzn-container',
+ style: 'width: ' + this.f_width + 'px;'
+ });
+ if (this.is_multiple) {
+ container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + this.default_text + '" class="default" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
+ } else {
+ container_div.html('<a href="javascript:void(0)" class="chzn-single"><span>' + this.default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" /></div><ul class="chzn-results"></ul></div>');
+ }
+ this.form_field_jq.hide().after(container_div);
+ this.container = $('#' + this.container_id);
+ this.container.addClass("chzn-container-" + (this.is_multiple ? "multi" : "single"));
+ this.dropdown = this.container.find('div.chzn-drop').first();
+ dd_top = this.container.height();
+ dd_width = this.f_width - get_side_border_padding(this.dropdown);
+ this.dropdown.css({
+ "width": dd_width + "px",
+ "top": dd_top + "px"
+ });
+ this.search_field = this.container.find('input').first();
+ this.search_results = this.container.find('ul.chzn-results').first();
+ this.search_field_scale();
+ this.search_no_results = this.container.find('li.no-results').first();
+ if (this.is_multiple) {
+ this.search_choices = this.container.find('ul.chzn-choices').first();
+ this.search_container = this.container.find('li.search-field').first();
+ } else {
+ this.search_container = this.container.find('div.chzn-search').first();
+ this.selected_item = this.container.find('.chzn-single').first();
+ sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
+ this.search_field.css({
+ "width": sf_width + "px"
+ });
+ }
+ this.results_build();
+ return this.set_tab_index();
+ };
+ Chosen.prototype.register_observers = function() {
+ this.container.click(__bind(function(evt) {
+ return this.container_click(evt);
+ }, this));
+ this.container.mouseenter(__bind(function(evt) {
+ return this.mouse_enter(evt);
+ }, this));
+ this.container.mouseleave(__bind(function(evt) {
+ return this.mouse_leave(evt);
+ }, this));
+ this.search_results.click(__bind(function(evt) {
+ return this.search_results_click(evt);
+ }, this));
+ this.search_results.mouseover(__bind(function(evt) {
+ return this.search_results_mouseover(evt);
+ }, this));
+ this.search_results.mouseout(__bind(function(evt) {
+ return this.search_results_mouseout(evt);
+ }, this));
+ this.form_field_jq.bind("liszt:updated", __bind(function(evt) {
+ return this.results_update_field(evt);
+ }, this));
+ this.search_field.blur(__bind(function(evt) {
+ return this.input_blur(evt);
+ }, this));
+ this.search_field.keyup(__bind(function(evt) {
+ return this.keyup_checker(evt);
+ }, this));
+ this.search_field.keydown(__bind(function(evt) {
+ return this.keydown_checker(evt);
+ }, this));
+ if (this.is_multiple) {
+ this.search_choices.click(__bind(function(evt) {
+ return this.choices_click(evt);
+ }, this));
+ return this.search_field.focus(__bind(function(evt) {
+ return this.input_focus(evt);
+ }, this));
+ } else {
+ return this.selected_item.focus(__bind(function(evt) {
+ return this.activate_field(evt);
+ }, this));
+ }
+ };
+ Chosen.prototype.container_click = function(evt) {
+ if (evt && evt.type === "click") {
+ evt.stopPropagation();
+ }
+ if (!this.pending_destroy_click) {
+ if (!this.active_field) {
+ if (this.is_multiple) {
+ this.search_field.val("");
+ }
+ $(document).click(this.click_test_action);
+ this.results_show();
+ } else if (!this.is_multiple && evt && ($(evt.target) === this.selected_item || $(evt.target).parents("a.chzn-single").length)) {
+ evt.preventDefault();
+ this.results_toggle();
+ }
+ return this.activate_field();
+ } else {
+ return this.pending_destroy_click = false;
+ }
+ };
+ Chosen.prototype.mouse_enter = function() {
+ return this.mouse_on_container = true;
+ };
+ Chosen.prototype.mouse_leave = function() {
+ return this.mouse_on_container = false;
+ };
+ Chosen.prototype.input_focus = function(evt) {
+ if (!this.active_field) {
+ return setTimeout((__bind(function() {
+ return this.container_click();
+ }, this)), 50);
+ }
+ };
+ Chosen.prototype.input_blur = function(evt) {
+ if (!this.mouse_on_container) {
+ this.active_field = false;
+ return setTimeout((__bind(function() {
+ return this.blur_test();
+ }, this)), 100);
+ }
+ };
+ Chosen.prototype.blur_test = function(evt) {
+ if (!this.active_field && this.container.hasClass("chzn-container-active")) {
+ return this.close_field();
+ }
+ };
+ Chosen.prototype.close_field = function() {
+ $(document).unbind("click", this.click_test_action);
+ if (!this.is_multiple) {
+ this.selected_item.attr("tabindex", this.search_field.attr("tabindex"));
+ this.search_field.attr("tabindex", -1);
+ }
+ this.active_field = false;
+ this.results_hide();
+ this.container.removeClass("chzn-container-active");
+ this.winnow_results_clear();
+ this.clear_backstroke();
+ this.show_search_field_default();
+ return this.search_field_scale();
+ };
+ Chosen.prototype.activate_field = function() {
+ if (!this.is_multiple && !this.active_field) {
+ this.search_field.attr("tabindex", this.selected_item.attr("tabindex"));
+ this.selected_item.attr("tabindex", -1);
+ }
+ this.container.addClass("chzn-container-active");
+ this.active_field = true;
+ this.search_field.val(this.search_field.val());
+ return this.search_field.focus();
+ };
+ Chosen.prototype.test_active_click = function(evt) {
+ if ($(evt.target).parents('#' + this.container.id).length) {
+ return this.active_field = true;
+ } else {
+ return this.close_field();
+ }
+ };
+ Chosen.prototype.results_build = function() {
+ var content, data, startTime, _i, _len, _ref;
+ startTime = new Date();
+ this.parsing = true;
+ this.results_data = SelectParser.select_to_array(this.form_field);
+ if (this.is_multiple && this.choices > 0) {
+ this.search_choices.find("li.search-choice").remove();
+ this.choices = 0;
+ } else if (!this.is_multiple) {
+ this.selected_item.find("span").text(this.default_text);
+ }
+ content = '';
+ _ref = this.results_data;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ data = _ref[_i];
+ if (data.group) {
+ content += this.result_add_group(data);
+ } else if (!data.empty) {
+ content += this.result_add_option(data);
+ if (data.selected && this.is_multiple) {
+ this.choice_build(data);
+ } else if (data.selected && !this.is_multiple) {
+ this.selected_item.find("span").text(data.text);
+ }
+ }
+ }
+ this.show_search_field_default();
+ this.search_field_scale();
+ this.search_results.html(content);
+ return this.parsing = false;
+ };
+ Chosen.prototype.result_add_group = function(group) {
+ if (!group.disabled) {
+ group.dom_id = this.form_field.id + "chzn_g_" + group.array_index;
+ return '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>';
+ } else {
+ return "";
+ }
+ };
+ Chosen.prototype.result_add_option = function(option) {
+ var classes;
+ if (!option.disabled) {
+ option.dom_id = this.form_field.id + "chzn_o_" + option.array_index;
+ classes = option.selected && this.is_multiple ? [] : ["active-result"];
+ if (option.selected) {
+ classes.push("result-selected");
+ }
+ if (option.group_array_index != null) {
+ classes.push("group-option");
+ }
+ return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + $("<div />").text(option.text).html() + '</li>';
+ } else {
+ return "";
+ }
+ };
+ Chosen.prototype.results_update_field = function() {
+ this.result_clear_highlight();
+ this.result_single_selected = null;
+ return this.results_build();
+ };
+ Chosen.prototype.result_do_highlight = function(el) {
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
+ if (el.length) {
+ this.result_clear_highlight();
+ this.result_highlight = el;
+ this.result_highlight.addClass("highlighted");
+ maxHeight = parseInt(this.search_results.css("maxHeight"), 10);
+ visible_top = this.search_results.scrollTop();
+ visible_bottom = maxHeight + visible_top;
+ high_top = this.result_highlight.position().top + this.search_results.scrollTop();
+ high_bottom = high_top + this.result_highlight.outerHeight();
+ if (high_bottom >= visible_bottom) {
+ return this.search_results.scrollTop((high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0);
+ } else if (high_top < visible_top) {
+ return this.search_results.scrollTop(high_top);
+ }
+ }
+ };
+ Chosen.prototype.result_clear_highlight = function() {
+ if (this.result_highlight) {
+ this.result_highlight.removeClass("highlighted");
+ }
+ return this.result_highlight = null;
+ };
+ Chosen.prototype.results_toggle = function() {
+ if (this.results_showing) {
+ return this.results_hide();
+ } else {
+ return this.results_show();
+ }
+ };
+ Chosen.prototype.results_show = function() {
+ var dd_top;
+ if (!this.is_multiple) {
+ this.selected_item.addClass("chzn-single-with-drop");
+ if (this.result_single_selected) {
+ this.result_do_highlight(this.result_single_selected);
+ }
+ }
+ dd_top = this.is_multiple ? this.container.height() : this.container.height() - 1;
+ this.dropdown.css({
+ "top": dd_top + "px",
+ "left": 0
+ });
+ this.results_showing = true;
+ this.search_field.focus();
+ this.search_field.val(this.search_field.val());
+ return this.winnow_results();
+ };
+ Chosen.prototype.results_hide = function() {
+ if (!this.is_multiple) {
+ this.selected_item.removeClass("chzn-single-with-drop");
+ }
+ this.result_clear_highlight();
+ this.dropdown.css({
+ "left": "-9000px"
+ });
+ return this.results_showing = false;
+ };
+ Chosen.prototype.set_tab_index = function(el) {
+ var ti;
+ if (this.form_field_jq.attr("tabindex")) {
+ ti = this.form_field_jq.attr("tabindex");
+ this.form_field_jq.attr("tabindex", -1);
+ if (this.is_multiple) {
+ return this.search_field.attr("tabindex", ti);
+ } else {
+ this.selected_item.attr("tabindex", ti);
+ return this.search_field.attr("tabindex", -1);
+ }
+ }
+ };
+ Chosen.prototype.show_search_field_default = function() {
+ if (this.is_multiple && this.choices < 1 && !this.active_field) {
+ this.search_field.val(this.default_text);
+ return this.search_field.addClass("default");
+ } else {
+ this.search_field.val("");
+ return this.search_field.removeClass("default");
+ }
+ };
+ Chosen.prototype.search_results_click = function(evt) {
+ var target;
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
+ if (target.length) {
+ this.result_highlight = target;
+ return this.result_select();
+ }
+ };
+ Chosen.prototype.search_results_mouseover = function(evt) {
+ var target;
+ target = $(evt.target).hasClass("active-result") ? $(evt.target) : $(evt.target).parents(".active-result").first();
+ if (target) {
+ return this.result_do_highlight(target);
+ }
+ };
+ Chosen.prototype.search_results_mouseout = function(evt) {
+ if ($(evt.target).hasClass("active-result" || $(evt.target).parents('.active-result').first())) {
+ return this.result_clear_highlight();
+ }
+ };
+ Chosen.prototype.choices_click = function(evt) {
+ evt.preventDefault();
+ if (this.active_field && !($(evt.target).hasClass("search-choice" || $(evt.target).parents('.search-choice').first)) && !this.results_showing) {
+ return this.results_show();
+ }
+ };
+ Chosen.prototype.choice_build = function(item) {
+ var choice_id, link;
+ choice_id = this.form_field.id + "_chzn_c_" + item.array_index;
+ this.choices += 1;
+ this.search_container.before('<li class="search-choice" id="' + choice_id + '"><span>' + item.text + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>');
+ link = $('#' + choice_id).find("a").first();
+ return link.click(__bind(function(evt) {
+ return this.choice_destroy_link_click(evt);
+ }, this));
+ };
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
+ evt.preventDefault();
+ this.pending_destroy_click = true;
+ return this.choice_destroy($(evt.target));
+ };
+ Chosen.prototype.choice_destroy = function(link) {
+ this.choices -= 1;
+ this.show_search_field_default();
+ if (this.is_multiple && this.choices > 0 && this.search_field.val().length < 1) {
+ this.results_hide();
+ }
+ this.result_deselect(link.attr("rel"));
+ return link.parents('li').first().remove();
+ };
+ Chosen.prototype.result_select = function() {
+ var high, high_id, item, position;
+ if (this.result_highlight) {
+ high = this.result_highlight;
+ high_id = high.attr("id");
+ this.result_clear_highlight();
+ high.addClass("result-selected");
+ if (this.is_multiple) {
+ this.result_deactivate(high);
+ } else {
+ this.result_single_selected = high;
+ }
+ position = high_id.substr(high_id.lastIndexOf("_") + 1);
+ item = this.results_data[position];
+ item.selected = true;
+ this.form_field.options[item.options_index].selected = true;
+ if (this.is_multiple) {
+ this.choice_build(item);
+ } else {
+ this.selected_item.find("span").first().text(item.text);
+ }
+ this.results_hide();
+ this.search_field.val("");
+ this.form_field_jq.trigger("change");
+ return this.search_field_scale();
+ }
+ };
+ Chosen.prototype.result_activate = function(el) {
+ return el.addClass("active-result").show();
+ };
+ Chosen.prototype.result_deactivate = function(el) {
+ return el.removeClass("active-result").hide();
+ };
+ Chosen.prototype.result_deselect = function(pos) {
+ var result, result_data;
+ result_data = this.results_data[pos];
+ result_data.selected = false;
+ this.form_field.options[result_data.options_index].selected = false;
+ result = $("#" + this.form_field.id + "chzn_o_" + pos);
+ result.removeClass("result-selected").addClass("active-result").show();
+ this.result_clear_highlight();
+ this.winnow_results();
+ this.form_field_jq.trigger("change");
+ return this.search_field_scale();
+ };
+ Chosen.prototype.results_search = function(evt) {
+ if (this.results_showing) {
+ return this.winnow_results();
+ } else {
+ return this.results_show();
+ }
+ };
+ Chosen.prototype.winnow_results = function() {
+ var found, option, part, parts, regex, result_id, results, searchText, startTime, startpos, text, zregex, _i, _j, _len, _len2, _ref;
+ startTime = new Date();
+ this.no_results_clear();
+ results = 0;
+ searchText = this.search_field.val() === this.default_text ? "" : $.trim(this.search_field.val());
+ regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
+ zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
+ _ref = this.results_data;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ option = _ref[_i];
+ if (!option.disabled && !option.empty) {
+ if (option.group) {
+ $('#' + option.dom_id).hide();
+ } else if (!(this.is_multiple && option.selected)) {
+ found = false;
+ result_id = option.dom_id;
+ if (regex.test(option.text)) {
+ found = true;
+ results += 1;
+ } else if (option.text.indexOf(" ") >= 0 || option.text.indexOf("[") === 0) {
+ parts = option.text.replace(/\[|\]/g, "").split(" ");
+ if (parts.length) {
+ for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
+ part = parts[_j];
+ if (regex.test(part)) {
+ found = true;
+ results += 1;
+ }
+ }
+ }
+ }
+ if (found) {
+ if (searchText.length) {
+ startpos = option.text.search(zregex);
+ text = option.text.substr(0, startpos + searchText.length) + '</em>' + option.text.substr(startpos + searchText.length);
+ text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
+ } else {
+ text = option.text;
+ }
+ if ($("#" + result_id).html !== text) {
+ $("#" + result_id).html(text);
+ }
+ this.result_activate($("#" + result_id));
+ if (option.group_array_index != null) {
+ $("#" + this.results_data[option.group_array_index].dom_id).show();
+ }
+ } else {
+ if (this.result_highlight && result_id === this.result_highlight.attr('id')) {
+ this.result_clear_highlight();
+ }
+ this.result_deactivate($("#" + result_id));
+ }
+ }
+ }
+ }
+ if (results < 1 && searchText.length) {
+ return this.no_results(searchText);
+ } else {
+ return this.winnow_results_set_highlight();
+ }
+ };
+ Chosen.prototype.winnow_results_clear = function() {
+ var li, lis, _i, _len, _results;
+ this.search_field.val("");
+ lis = this.search_results.find("li");
+ _results = [];
+ for (_i = 0, _len = lis.length; _i < _len; _i++) {
+ li = lis[_i];
+ li = $(li);
+ _results.push(li.hasClass("group-result") ? li.show() : !this.is_multiple || !li.hasClass("result-selected") ? this.result_activate(li) : void 0);
+ }
+ return _results;
+ };
+ Chosen.prototype.winnow_results_set_highlight = function() {
+ var do_high;
+ if (!this.result_highlight) {
+ do_high = this.search_results.find(".active-result").first();
+ if (do_high) {
+ return this.result_do_highlight(do_high);
+ }
+ }
+ };
+ Chosen.prototype.no_results = function(terms) {
+ var no_results_html;
+ no_results_html = $('<li class="no-results">No results match "<span></span>"</li>');
+ no_results_html.find("span").first().text(terms);
+ return this.search_results.append(no_results_html);
+ };
+ Chosen.prototype.no_results_clear = function() {
+ return this.search_results.find(".no-results").remove();
+ };
+ Chosen.prototype.keydown_arrow = function() {
+ var first_active, next_sib;
+ if (!this.result_highlight) {
+ first_active = this.search_results.find("li.active-result").first();
+ if (first_active) {
+ this.result_do_highlight($(first_active));
+ }
+ } else if (this.results_showing) {
+ next_sib = this.result_highlight.nextAll("li.active-result").first();
+ if (next_sib) {
+ this.result_do_highlight(next_sib);
+ }
+ }
+ if (!this.results_showing) {
+ return this.results_show();
+ }
+ };
+ Chosen.prototype.keyup_arrow = function() {
+ var prev_sibs;
+ if (!this.results_showing && !this.is_multiple) {
+ return this.results_show();
+ } else if (this.result_highlight) {
+ prev_sibs = this.result_highlight.prevAll("li.active-result");
+ if (prev_sibs.length) {
+ return this.result_do_highlight(prev_sibs.first());
+ } else {
+ if (this.choices > 0) {
+ this.results_hide();
+ }
+ return this.result_clear_highlight();
+ }
+ }
+ };
+ Chosen.prototype.keydown_backstroke = function() {
+ if (this.pending_backstroke) {
+ this.choice_destroy(this.pending_backstroke.find("a").first());
+ return this.clear_backstroke();
+ } else {
+ this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
+ return this.pending_backstroke.addClass("search-choice-focus");
+ }
+ };
+ Chosen.prototype.clear_backstroke = function() {
+ if (this.pending_backstroke) {
+ this.pending_backstroke.removeClass("search-choice-focus");
+ }
+ return this.pending_backstroke = null;
+ };
+ Chosen.prototype.keyup_checker = function(evt) {
+ var stroke, _ref;
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
+ this.search_field_scale();
+ switch (stroke) {
+ case 8:
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
+ return this.keydown_backstroke();
+ } else if (!this.pending_backstroke) {
+ this.result_clear_highlight();
+ return this.results_search();
+ }
+ break;
+ case 13:
+ evt.preventDefault();
+ if (this.results_showing) {
+ return this.result_select();
+ }
+ break;
+ case 27:
+ if (this.results_showing) {
+ return this.results_hide();
+ }
+ break;
+ case 9:
+ case 38:
+ case 40:
+ case 16:
+ break;
+ default:
+ return this.results_search();
+ }
+ };
+ Chosen.prototype.keydown_checker = function(evt) {
+ var stroke, _ref;
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
+ this.search_field_scale();
+ if (stroke !== 8 && this.pending_backstroke) {
+ this.clear_backstroke();
+ }
+ switch (stroke) {
+ case 8:
+ this.backstroke_length = this.search_field.val().length;
+ break;
+ case 9:
+ this.mouse_on_container = false;
+ break;
+ case 13:
+ evt.preventDefault();
+ break;
+ case 38:
+ evt.preventDefault();
+ this.keyup_arrow();
+ break;
+ case 40:
+ this.keydown_arrow();
+ break;
+ }
+ };
+ Chosen.prototype.search_field_scale = function() {
+ var dd_top, div, h, style, style_block, styles, w, _i, _len;
+ if (this.is_multiple) {
+ h = 0;
+ w = 0;
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
+ style = styles[_i];
+ style_block += style + ":" + this.search_field.css(style) + ";";
+ }
+ div = $('<div />', {
+ 'style': style_block
+ });
+ div.text(this.search_field.val());
+ $('body').append(div);
+ w = div.width() + 25;
+ div.remove();
+ if (w > this.f_width - 10) {
+ w = this.f_width - 10;
+ }
+ this.search_field.css({
+ 'width': w + 'px'
+ });
+ dd_top = this.container.height();
+ return this.dropdown.css({
+ "top": dd_top + "px"
+ });
+ }
+ };
+ return Chosen;
+ })();
+ get_side_border_padding = function(elmt) {
+ var side_border_padding;
+ return side_border_padding = elmt.outerWidth() - elmt.width();
+ };
+ root.get_side_border_padding = get_side_border_padding;
+ SelectParser = (function() {
+ function SelectParser() {
+ this.options_index = 0;
+ this.parsed = [];
+ }
+ SelectParser.prototype.add_node = function(child) {
+ if (child.nodeName === "OPTGROUP") {
+ return this.add_group(child);
+ } else {
+ return this.add_option(child);
+ }
+ };
+ SelectParser.prototype.add_group = function(group) {
+ var group_position, option, _i, _len, _ref, _results;
+ group_position = this.parsed.length;
+ this.parsed.push({
+ array_index: group_position,
+ group: true,
+ label: group.label,
+ children: 0,
+ disabled: group.disabled
+ });
+ _ref = group.childNodes;
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ option = _ref[_i];
+ _results.push(this.add_option(option, group_position, group.disabled));
+ }
+ return _results;
+ };
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
+ if (option.nodeName === "OPTION") {
+ if (option.text !== "") {
+ if (group_position != null) {
+ this.parsed[group_position].children += 1;
+ }
+ this.parsed.push({
+ array_index: this.parsed.length,
+ options_index: this.options_index,
+ value: option.value,
+ text: option.text,
+ selected: option.selected,
+ disabled: group_disabled === true ? group_disabled : option.disabled,
+ group_array_index: group_position
+ });
+ } else {
+ this.parsed.push({
+ array_index: this.parsed.length,
+ options_index: this.options_index,
+ empty: true
+ });
+ }
+ return this.options_index += 1;
+ }
+ };
+ return SelectParser;
+ })();
+ SelectParser.select_to_array = function(select) {
+ var child, parser, _i, _len, _ref;
+ parser = new SelectParser();
+ _ref = select.childNodes;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ child = _ref[_i];
+ parser.add_node(child);
+ }
+ return parser.parsed;
+ };
+ root.SelectParser = SelectParser;
+}).call(this);
diff --git a/src/usr/local/www/javascript/chosen/chosen.jquery.min.js b/src/usr/local/www/javascript/chosen/chosen.jquery.min.js
new file mode 100644
index 0000000..ae69f22
--- /dev/null
+++ b/src/usr/local/www/javascript/chosen/chosen.jquery.min.js
@@ -0,0 +1,9 @@
+/*
+Chosen, a Select Box Enhancer for jQuery and Protoype
+by Patrick Filler for Harvest, http://getharvest.com
+
+Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
+
+Copyright (c) 2011 by Harvest
+*/
+(function(){var $,Chosen,SelectParser,get_side_border_padding,root;var __bind=function(fn,me){return function(){return fn.apply(me,arguments);};};root=typeof exports!=="undefined"&&exports!==null?exports:this;$=jQuery;$.fn.extend({chosen:function(data,options){return $(this).each(function(input_field){if(!($(this)).hasClass("chzn-done")){return new Chosen(this,data,options);}});}});Chosen=(function(){function Chosen(elmn){this.set_default_values();this.form_field=elmn;this.form_field_jq=$(this.form_field);this.is_multiple=this.form_field.multiple;this.default_text_default=this.form_field.multiple?"Select Some Options":"Select an Option";this.set_up_html();this.register_observers();this.form_field_jq.addClass("chzn-done");}Chosen.prototype.set_default_values=function(){this.click_test_action=__bind(function(evt){return this.test_active_click(evt);},this);this.active_field=false;this.mouse_on_container=false;this.results_showing=false;this.result_highlighted=null;this.result_single_selected=null;return this.choices=0;};Chosen.prototype.set_up_html=function(){var container_div,dd_top,dd_width,sf_width;this.container_id=this.form_field.id+"_chzn";this.f_width=this.form_field_jq.width();this.default_text=this.form_field_jq.attr("title")?this.form_field_jq.attr("title"):this.default_text_default;container_div=$("<div />",{id:this.container_id,"class":"chzn-container",style:"width: "+this.f_width+"px;"});if(this.is_multiple){container_div.html('<ul class="chzn-choices"><li class="search-field"><input type="text" value="'+this.default_text+'" class="default" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');}else{container_div.html('<a href="javascript:void(0)" class="chzn-single"><span>'+this.default_text+'</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" /></div><ul class="chzn-results"></ul></div>');}this.form_field_jq.hide().after(container_div);this.container=$("#"+this.container_id);this.container.addClass("chzn-container-"+(this.is_multiple?"multi":"single"));this.dropdown=this.container.find("div.chzn-drop").first();dd_top=this.container.height();dd_width=this.f_width-get_side_border_padding(this.dropdown);this.dropdown.css({width:dd_width+"px",top:dd_top+"px"});this.search_field=this.container.find("input").first();this.search_results=this.container.find("ul.chzn-results").first();this.search_field_scale();this.search_no_results=this.container.find("li.no-results").first();if(this.is_multiple){this.search_choices=this.container.find("ul.chzn-choices").first();this.search_container=this.container.find("li.search-field").first();}else{this.search_container=this.container.find("div.chzn-search").first();this.selected_item=this.container.find(".chzn-single").first();sf_width=dd_width-get_side_border_padding(this.search_container)-get_side_border_padding(this.search_field);this.search_field.css({width:sf_width+"px"});}this.results_build();return this.set_tab_index();};Chosen.prototype.register_observers=function(){this.container.click(__bind(function(evt){return this.container_click(evt);},this));this.container.mouseenter(__bind(function(evt){return this.mouse_enter(evt);},this));this.container.mouseleave(__bind(function(evt){return this.mouse_leave(evt);},this));this.search_results.click(__bind(function(evt){return this.search_results_click(evt);},this));this.search_results.mouseover(__bind(function(evt){return this.search_results_mouseover(evt);},this));this.search_results.mouseout(__bind(function(evt){return this.search_results_mouseout(evt);},this));this.form_field_jq.bind("liszt:updated",__bind(function(evt){return this.results_update_field(evt);},this));this.search_field.blur(__bind(function(evt){return this.input_blur(evt);},this));this.search_field.keyup(__bind(function(evt){return this.keyup_checker(evt);},this));this.search_field.keydown(__bind(function(evt){return this.keydown_checker(evt);},this));if(this.is_multiple){this.search_choices.click(__bind(function(evt){return this.choices_click(evt);},this));return this.search_field.focus(__bind(function(evt){return this.input_focus(evt);},this));}else{return this.selected_item.focus(__bind(function(evt){return this.activate_field(evt);},this));}};Chosen.prototype.container_click=function(evt){if(evt&&evt.type==="click"){evt.stopPropagation();}if(!this.pending_destroy_click){if(!this.active_field){if(this.is_multiple){this.search_field.val("");}$(document).click(this.click_test_action);this.results_show();}else{if(!this.is_multiple&&evt&&($(evt.target)===this.selected_item||$(evt.target).parents("a.chzn-single").length)){evt.preventDefault();this.results_toggle();}}return this.activate_field();}else{return this.pending_destroy_click=false;}};Chosen.prototype.mouse_enter=function(){return this.mouse_on_container=true;};Chosen.prototype.mouse_leave=function(){return this.mouse_on_container=false;};Chosen.prototype.input_focus=function(evt){if(!this.active_field){return setTimeout((__bind(function(){return this.container_click();},this)),50);}};Chosen.prototype.input_blur=function(evt){if(!this.mouse_on_container){this.active_field=false;return setTimeout((__bind(function(){return this.blur_test();},this)),100);}};Chosen.prototype.blur_test=function(evt){if(!this.active_field&&this.container.hasClass("chzn-container-active")){return this.close_field();}};Chosen.prototype.close_field=function(){$(document).unbind("click",this.click_test_action);if(!this.is_multiple){this.selected_item.attr("tabindex",this.search_field.attr("tabindex"));this.search_field.attr("tabindex",-1);}this.active_field=false;this.results_hide();this.container.removeClass("chzn-container-active");this.winnow_results_clear();this.clear_backstroke();this.show_search_field_default();return this.search_field_scale();};Chosen.prototype.activate_field=function(){if(!this.is_multiple&&!this.active_field){this.search_field.attr("tabindex",this.selected_item.attr("tabindex"));this.selected_item.attr("tabindex",-1);}this.container.addClass("chzn-container-active");this.active_field=true;this.search_field.val(this.search_field.val());return this.search_field.focus();};Chosen.prototype.test_active_click=function(evt){if($(evt.target).parents("#"+this.container.id).length){return this.active_field=true;}else{return this.close_field();}};Chosen.prototype.results_build=function(){var content,data,startTime,_i,_len,_ref;startTime=new Date();this.parsing=true;this.results_data=SelectParser.select_to_array(this.form_field);if(this.is_multiple&&this.choices>0){this.search_choices.find("li.search-choice").remove();this.choices=0;}else{if(!this.is_multiple){this.selected_item.find("span").text(this.default_text);}}content="";_ref=this.results_data;for(_i=0,_len=_ref.length;_i<_len;_i++){data=_ref[_i];if(data.group){content+=this.result_add_group(data);}else{if(!data.empty){content+=this.result_add_option(data);if(data.selected&&this.is_multiple){this.choice_build(data);}else{if(data.selected&&!this.is_multiple){this.selected_item.find("span").text(data.text);}}}}}this.show_search_field_default();this.search_field_scale();this.search_results.html(content);return this.parsing=false;};Chosen.prototype.result_add_group=function(group){if(!group.disabled){group.dom_id=this.form_field.id+"chzn_g_"+group.array_index;return'<li id="'+group.dom_id+'" class="group-result">'+$("<div />").text(group.label).html()+"</li>";}else{return"";}};Chosen.prototype.result_add_option=function(option){var classes;if(!option.disabled){option.dom_id=this.form_field.id+"chzn_o_"+option.array_index;classes=option.selected&&this.is_multiple?[]:["active-result"];if(option.selected){classes.push("result-selected");}if(option.group_array_index!=null){classes.push("group-option");}return'<li id="'+option.dom_id+'" class="'+classes.join(" ")+'">'+$("<div />").text(option.text).html()+"</li>";}else{return"";}};Chosen.prototype.results_update_field=function(){this.result_clear_highlight();this.result_single_selected=null;return this.results_build();};Chosen.prototype.result_do_highlight=function(el){var high_bottom,high_top,maxHeight,visible_bottom,visible_top;if(el.length){this.result_clear_highlight();this.result_highlight=el;this.result_highlight.addClass("highlighted");maxHeight=parseInt(this.search_results.css("maxHeight"),10);visible_top=this.search_results.scrollTop();visible_bottom=maxHeight+visible_top;high_top=this.result_highlight.position().top+this.search_results.scrollTop();high_bottom=high_top+this.result_highlight.outerHeight();if(high_bottom>=visible_bottom){return this.search_results.scrollTop((high_bottom-maxHeight)>0?high_bottom-maxHeight:0);}else{if(high_top<visible_top){return this.search_results.scrollTop(high_top);}}}};Chosen.prototype.result_clear_highlight=function(){if(this.result_highlight){this.result_highlight.removeClass("highlighted");}return this.result_highlight=null;};Chosen.prototype.results_toggle=function(){if(this.results_showing){return this.results_hide();}else{return this.results_show();}};Chosen.prototype.results_show=function(){var dd_top;if(!this.is_multiple){this.selected_item.addClass("chzn-single-with-drop");if(this.result_single_selected){this.result_do_highlight(this.result_single_selected);}}dd_top=this.is_multiple?this.container.height():this.container.height()-1;this.dropdown.css({top:dd_top+"px",left:0});this.results_showing=true;this.search_field.focus();this.search_field.val(this.search_field.val());return this.winnow_results();};Chosen.prototype.results_hide=function(){if(!this.is_multiple){this.selected_item.removeClass("chzn-single-with-drop");}this.result_clear_highlight();this.dropdown.css({left:"-9000px"});return this.results_showing=false;};Chosen.prototype.set_tab_index=function(el){var ti;if(this.form_field_jq.attr("tabindex")){ti=this.form_field_jq.attr("tabindex");this.form_field_jq.attr("tabindex",-1);if(this.is_multiple){return this.search_field.attr("tabindex",ti);}else{this.selected_item.attr("tabindex",ti);return this.search_field.attr("tabindex",-1);}}};Chosen.prototype.show_search_field_default=function(){if(this.is_multiple&&this.choices<1&&!this.active_field){this.search_field.val(this.default_text);return this.search_field.addClass("default");}else{this.search_field.val("");return this.search_field.removeClass("default");}};Chosen.prototype.search_results_click=function(evt){var target;target=$(evt.target).hasClass("active-result")?$(evt.target):$(evt.target).parents(".active-result").first();if(target.length){this.result_highlight=target;return this.result_select();}};Chosen.prototype.search_results_mouseover=function(evt){var target;target=$(evt.target).hasClass("active-result")?$(evt.target):$(evt.target).parents(".active-result").first();if(target){return this.result_do_highlight(target);}};Chosen.prototype.search_results_mouseout=function(evt){if($(evt.target).hasClass("active-result"||$(evt.target).parents(".active-result").first())){return this.result_clear_highlight();}};Chosen.prototype.choices_click=function(evt){evt.preventDefault();if(this.active_field&&!($(evt.target).hasClass("search-choice"||$(evt.target).parents(".search-choice").first))&&!this.results_showing){return this.results_show();}};Chosen.prototype.choice_build=function(item){var choice_id,link;choice_id=this.form_field.id+"_chzn_c_"+item.array_index;this.choices+=1;this.search_container.before('<li class="search-choice" id="'+choice_id+'"><span>'+item.text+'</span><a href="javascript:void(0)" class="search-choice-close" rel="'+item.array_index+'"></a></li>');link=$("#"+choice_id).find("a").first();return link.click(__bind(function(evt){return this.choice_destroy_link_click(evt);},this));};Chosen.prototype.choice_destroy_link_click=function(evt){evt.preventDefault();this.pending_destroy_click=true;return this.choice_destroy($(evt.target));};Chosen.prototype.choice_destroy=function(link){this.choices-=1;this.show_search_field_default();if(this.is_multiple&&this.choices>0&&this.search_field.val().length<1){this.results_hide();}this.result_deselect(link.attr("rel"));return link.parents("li").first().remove();};Chosen.prototype.result_select=function(){var high,high_id,item,position;if(this.result_highlight){high=this.result_highlight;high_id=high.attr("id");this.result_clear_highlight();high.addClass("result-selected");if(this.is_multiple){this.result_deactivate(high);}else{this.result_single_selected=high;}position=high_id.substr(high_id.lastIndexOf("_")+1);item=this.results_data[position];item.selected=true;this.form_field.options[item.options_index].selected=true;if(this.is_multiple){this.choice_build(item);}else{this.selected_item.find("span").first().text(item.text);}this.results_hide();this.search_field.val("");this.form_field_jq.trigger("change");return this.search_field_scale();}};Chosen.prototype.result_activate=function(el){return el.addClass("active-result").show();};Chosen.prototype.result_deactivate=function(el){return el.removeClass("active-result").hide();};Chosen.prototype.result_deselect=function(pos){var result,result_data;result_data=this.results_data[pos];result_data.selected=false;this.form_field.options[result_data.options_index].selected=false;result=$("#"+this.form_field.id+"chzn_o_"+pos);result.removeClass("result-selected").addClass("active-result").show();this.result_clear_highlight();this.winnow_results();this.form_field_jq.trigger("change");return this.search_field_scale();};Chosen.prototype.results_search=function(evt){if(this.results_showing){return this.winnow_results();}else{return this.results_show();}};Chosen.prototype.winnow_results=function(){var found,option,part,parts,regex,result_id,results,searchText,startTime,startpos,text,zregex,_i,_j,_len,_len2,_ref;startTime=new Date();this.no_results_clear();results=0;searchText=this.search_field.val()===this.default_text?"":$.trim(this.search_field.val());regex=new RegExp("^"+searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");zregex=new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");_ref=this.results_data;for(_i=0,_len=_ref.length;_i<_len;_i++){option=_ref[_i];if(!option.disabled&&!option.empty){if(option.group){$("#"+option.dom_id).hide();}else{if(!(this.is_multiple&&option.selected)){found=false;result_id=option.dom_id;if(regex.test(option.text)){found=true;results+=1;}else{if(option.text.indexOf(" ")>=0||option.text.indexOf("[")===0){parts=option.text.replace(/\[|\]/g,"").split(" ");if(parts.length){for(_j=0,_len2=parts.length;_j<_len2;_j++){part=parts[_j];if(regex.test(part)){found=true;results+=1;}}}}}if(found){if(searchText.length){startpos=option.text.search(zregex);text=option.text.substr(0,startpos+searchText.length)+"</em>"+option.text.substr(startpos+searchText.length);text=text.substr(0,startpos)+"<em>"+text.substr(startpos);}else{text=option.text;}if($("#"+result_id).html!==text){$("#"+result_id).html(text);}this.result_activate($("#"+result_id));if(option.group_array_index!=null){$("#"+this.results_data[option.group_array_index].dom_id).show();}}else{if(this.result_highlight&&result_id===this.result_highlight.attr("id")){this.result_clear_highlight();}this.result_deactivate($("#"+result_id));}}}}}if(results<1&&searchText.length){return this.no_results(searchText);}else{return this.winnow_results_set_highlight();}};Chosen.prototype.winnow_results_clear=function(){var li,lis,_i,_len,_results;this.search_field.val("");lis=this.search_results.find("li");_results=[];for(_i=0,_len=lis.length;_i<_len;_i++){li=lis[_i];li=$(li);_results.push(li.hasClass("group-result")?li.show():!this.is_multiple||!li.hasClass("result-selected")?this.result_activate(li):void 0);}return _results;};Chosen.prototype.winnow_results_set_highlight=function(){var do_high;if(!this.result_highlight){do_high=this.search_results.find(".active-result").first();if(do_high){return this.result_do_highlight(do_high);}}};Chosen.prototype.no_results=function(terms){var no_results_html;no_results_html=$('<li class="no-results">No results match "<span></span>"</li>');no_results_html.find("span").first().text(terms);return this.search_results.append(no_results_html);};Chosen.prototype.no_results_clear=function(){return this.search_results.find(".no-results").remove();};Chosen.prototype.keydown_arrow=function(){var first_active,next_sib;if(!this.result_highlight){first_active=this.search_results.find("li.active-result").first();if(first_active){this.result_do_highlight($(first_active));}}else{if(this.results_showing){next_sib=this.result_highlight.nextAll("li.active-result").first();if(next_sib){this.result_do_highlight(next_sib);}}}if(!this.results_showing){return this.results_show();}};Chosen.prototype.keyup_arrow=function(){var prev_sibs;if(!this.results_showing&&!this.is_multiple){return this.results_show();}else{if(this.result_highlight){prev_sibs=this.result_highlight.prevAll("li.active-result");if(prev_sibs.length){return this.result_do_highlight(prev_sibs.first());}else{if(this.choices>0){this.results_hide();}return this.result_clear_highlight();}}}};Chosen.prototype.keydown_backstroke=function(){if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.find("a").first());return this.clear_backstroke();}else{this.pending_backstroke=this.search_container.siblings("li.search-choice").last();return this.pending_backstroke.addClass("search-choice-focus");}};Chosen.prototype.clear_backstroke=function(){if(this.pending_backstroke){this.pending_backstroke.removeClass("search-choice-focus");}return this.pending_backstroke=null;};Chosen.prototype.keyup_checker=function(evt){var stroke,_ref;stroke=(_ref=evt.which)!=null?_ref:evt.keyCode;this.search_field_scale();switch(stroke){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0){return this.keydown_backstroke();}else{if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search();}}break;case 13:evt.preventDefault();if(this.results_showing){return this.result_select();}break;case 27:if(this.results_showing){return this.results_hide();}break;case 9:case 38:case 40:case 16:break;default:return this.results_search();}};Chosen.prototype.keydown_checker=function(evt){var stroke,_ref;stroke=(_ref=evt.which)!=null?_ref:evt.keyCode;this.search_field_scale();if(stroke!==8&&this.pending_backstroke){this.clear_backstroke();}switch(stroke){case 8:this.backstroke_length=this.search_field.val().length;break;case 9:this.mouse_on_container=false;break;case 13:evt.preventDefault();break;case 38:evt.preventDefault();this.keyup_arrow();break;case 40:this.keydown_arrow();break;}};Chosen.prototype.search_field_scale=function(){var dd_top,div,h,style,style_block,styles,w,_i,_len;if(this.is_multiple){h=0;w=0;style_block="position:absolute; left: -1000px; top: -1000px; display:none;";styles=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(_i=0,_len=styles.length;_i<_len;_i++){style=styles[_i];style_block+=style+":"+this.search_field.css(style)+";";}div=$("<div />",{style:style_block});div.text(this.search_field.val());$("body").append(div);w=div.width()+25;div.remove();if(w>this.f_width-10){w=this.f_width-10;}this.search_field.css({width:w+"px"});dd_top=this.container.height();return this.dropdown.css({top:dd_top+"px"});}};return Chosen;})();get_side_border_padding=function(elmt){var side_border_padding;return side_border_padding=elmt.outerWidth()-elmt.width();};root.get_side_border_padding=get_side_border_padding;SelectParser=(function(){function SelectParser(){this.options_index=0;this.parsed=[];}SelectParser.prototype.add_node=function(child){if(child.nodeName==="OPTGROUP"){return this.add_group(child);}else{return this.add_option(child);}};SelectParser.prototype.add_group=function(group){var group_position,option,_i,_len,_ref,_results;group_position=this.parsed.length;this.parsed.push({array_index:group_position,group:true,label:group.label,children:0,disabled:group.disabled});_ref=group.childNodes;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){option=_ref[_i];_results.push(this.add_option(option,group_position,group.disabled));}return _results;};SelectParser.prototype.add_option=function(option,group_position,group_disabled){if(option.nodeName==="OPTION"){if(option.text!==""){if(group_position!=null){this.parsed[group_position].children+=1;}this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:option.value,text:option.text,selected:option.selected,disabled:group_disabled===true?group_disabled:option.disabled,group_array_index:group_position});}else{this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:true});}return this.options_index+=1;}};return SelectParser;})();SelectParser.select_to_array=function(select){var child,parser,_i,_len,_ref;parser=new SelectParser();_ref=select.childNodes;for(_i=0,_len=_ref.length;_i<_len;_i++){child=_ref[_i];parser.add_node(child);}return parser.parsed;};root.SelectParser=SelectParser;}).call(this); \ No newline at end of file
diff --git a/src/usr/local/www/javascript/chosen/chosen.proto.js b/src/usr/local/www/javascript/chosen/chosen.proto.js
new file mode 100644
index 0000000..e3c0fbd
--- /dev/null
+++ b/src/usr/local/www/javascript/chosen/chosen.proto.js
@@ -0,0 +1,765 @@
+(function() {
+ /*
+ Chosen, a Select Box Enhancer for jQuery and Protoype
+ by Patrick Filler for Harvest, http://getharvest.com
+
+ Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
+
+ Copyright (c) 2011 by Harvest
+ */ var Chosen, SelectParser, get_side_border_padding, root;
+ var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
+ root = typeof exports !== "undefined" && exports !== null ? exports : this;
+ Chosen = (function() {
+ function Chosen(elmn) {
+ this.set_default_values();
+ this.form_field = elmn;
+ this.is_multiple = this.form_field.multiple;
+ this.default_text_default = this.form_field.multiple ? "Select Some Options" : "Select an Option";
+ this.set_up_html();
+ this.register_observers();
+ }
+ Chosen.prototype.set_default_values = function() {
+ this.click_test_action = __bind(function(evt) {
+ return this.test_active_click(evt);
+ }, this);
+ this.active_field = false;
+ this.mouse_on_container = false;
+ this.results_showing = false;
+ this.result_highlighted = null;
+ this.result_single_selected = null;
+ this.choices = 0;
+ this.single_temp = new Template('<a href="javascript:void(0)" class="chzn-single"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" /></div><ul class="chzn-results"></ul></div>');
+ this.multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');
+ this.choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>');
+ return this.no_results_temp = new Template('<li class="no-results">No results match "<span>#{terms}</span>"</li>');
+ };
+ Chosen.prototype.set_up_html = function() {
+ var base_template, container_props, dd_top, dd_width, sf_width;
+ this.container_id = this.form_field.id + "_chzn";
+ this.f_width = this.form_field.getStyle("width") ? parseInt(this.form_field.getStyle("width"), 10) : this.form_field.getWidth();
+ container_props = {
+ 'id': this.container_id,
+ 'class': 'chzn-container',
+ 'style': 'width: ' + this.f_width + 'px'
+ };
+ this.default_text = this.form_field.readAttribute('title') ? this.form_field.readAttribute('title') : this.default_text_default;
+ base_template = this.is_multiple ? new Element('div', container_props).update(this.multi_temp.evaluate({
+ "default": this.default_text
+ })) : new Element('div', container_props).update(this.single_temp.evaluate({
+ "default": this.default_text
+ }));
+ this.form_field.hide().insert({
+ after: base_template
+ });
+ this.container = $(this.container_id);
+ this.container.addClassName("chzn-container-" + (this.is_multiple ? "multi" : "single"));
+ this.dropdown = this.container.down('div.chzn-drop');
+ dd_top = this.container.getHeight();
+ dd_width = this.f_width - get_side_border_padding(this.dropdown);
+ this.dropdown.setStyle({
+ "width": dd_width + "px",
+ "top": dd_top + "px"
+ });
+ this.search_field = this.container.down('input');
+ this.search_results = this.container.down('ul.chzn-results');
+ this.search_field_scale();
+ this.search_no_results = this.container.down('li.no-results');
+ if (this.is_multiple) {
+ this.search_choices = this.container.down('ul.chzn-choices');
+ this.search_container = this.container.down('li.search-field');
+ } else {
+ this.search_container = this.container.down('div.chzn-search');
+ this.selected_item = this.container.down('.chzn-single');
+ sf_width = dd_width - get_side_border_padding(this.search_container) - get_side_border_padding(this.search_field);
+ this.search_field.setStyle({
+ "width": sf_width + "px"
+ });
+ }
+ this.results_build();
+ return this.set_tab_index();
+ };
+ Chosen.prototype.register_observers = function() {
+ this.container.observe("click", __bind(function(evt) {
+ return this.container_click(evt);
+ }, this));
+ this.container.observe("mouseenter", __bind(function(evt) {
+ return this.mouse_enter(evt);
+ }, this));
+ this.container.observe("mouseleave", __bind(function(evt) {
+ return this.mouse_leave(evt);
+ }, this));
+ this.search_results.observe("click", __bind(function(evt) {
+ return this.search_results_click(evt);
+ }, this));
+ this.search_results.observe("mouseover", __bind(function(evt) {
+ return this.search_results_mouseover(evt);
+ }, this));
+ this.search_results.observe("mouseout", __bind(function(evt) {
+ return this.search_results_mouseout(evt);
+ }, this));
+ this.form_field.observe("liszt:updated", __bind(function(evt) {
+ return this.results_update_field(evt);
+ }, this));
+ this.search_field.observe("blur", __bind(function(evt) {
+ return this.input_blur(evt);
+ }, this));
+ this.search_field.observe("keyup", __bind(function(evt) {
+ return this.keyup_checker(evt);
+ }, this));
+ this.search_field.observe("keydown", __bind(function(evt) {
+ return this.keydown_checker(evt);
+ }, this));
+ if (this.is_multiple) {
+ this.search_choices.observe("click", __bind(function(evt) {
+ return this.choices_click(evt);
+ }, this));
+ return this.search_field.observe("focus", __bind(function(evt) {
+ return this.input_focus(evt);
+ }, this));
+ } else {
+ return this.selected_item.observe("focus", __bind(function(evt) {
+ return this.activate_field(evt);
+ }, this));
+ }
+ };
+ Chosen.prototype.container_click = function(evt) {
+ if (evt && evt.type === "click") {
+ evt.stop();
+ }
+ if (!this.pending_destroy_click) {
+ if (!this.active_field) {
+ if (this.is_multiple) {
+ this.search_field.clear();
+ }
+ document.observe("click", this.click_test_action);
+ this.results_show();
+ } else if (!this.is_multiple && evt && (evt.target === this.selected_item || evt.target.up("a.chzn-single"))) {
+ this.results_toggle();
+ }
+ return this.activate_field();
+ } else {
+ return this.pending_destroy_click = false;
+ }
+ };
+ Chosen.prototype.mouse_enter = function() {
+ return this.mouse_on_container = true;
+ };
+ Chosen.prototype.mouse_leave = function() {
+ return this.mouse_on_container = false;
+ };
+ Chosen.prototype.input_focus = function(evt) {
+ if (!this.active_field) {
+ return setTimeout(this.container_click.bind(this), 50);
+ }
+ };
+ Chosen.prototype.input_blur = function(evt) {
+ if (!this.mouse_on_container) {
+ this.active_field = false;
+ return setTimeout(this.blur_test.bind(this), 100);
+ }
+ };
+ Chosen.prototype.blur_test = function(evt) {
+ if (!this.active_field && this.container.hasClassName("chzn-container-active")) {
+ return this.close_field();
+ }
+ };
+ Chosen.prototype.close_field = function() {
+ document.stopObserving("click", this.click_test_action);
+ if (!this.is_multiple) {
+ this.selected_item.tabIndex = this.search_field.tabIndex;
+ this.search_field.tabIndex = -1;
+ }
+ this.active_field = false;
+ this.results_hide();
+ this.container.removeClassName("chzn-container-active");
+ this.winnow_results_clear();
+ this.clear_backstroke();
+ this.show_search_field_default();
+ return this.search_field_scale();
+ };
+ Chosen.prototype.activate_field = function() {
+ if (!this.is_multiple && !this.active_field) {
+ this.search_field.tabIndex = this.selected_item.tabIndex;
+ this.selected_item.tabIndex = -1;
+ }
+ this.container.addClassName("chzn-container-active");
+ this.active_field = true;
+ this.search_field.value = this.search_field.value;
+ return this.search_field.focus();
+ };
+ Chosen.prototype.test_active_click = function(evt) {
+ if (evt.target.up('#' + this.container.id)) {
+ return this.active_field = true;
+ } else {
+ return this.close_field();
+ }
+ };
+ Chosen.prototype.results_build = function() {
+ var content, data, startTime, _i, _len, _ref;
+ startTime = new Date();
+ this.parsing = true;
+ this.results_data = SelectParser.select_to_array(this.form_field);
+ if (this.is_multiple && this.choices > 0) {
+ this.search_choices.select("li.search-choice").invoke("remove");
+ this.choices = 0;
+ } else if (!this.is_multiple) {
+ this.selected_item.down("span").update(this.default_text);
+ }
+ content = '';
+ _ref = this.results_data;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ data = _ref[_i];
+ if (data.group) {
+ content += this.result_add_group(data);
+ } else if (!data.empty) {
+ content += this.result_add_option(data);
+ if (data.selected && this.is_multiple) {
+ this.choice_build(data);
+ } else if (data.selected && !this.is_multiple) {
+ this.selected_item.down("span").update(data.text);
+ }
+ }
+ }
+ this.show_search_field_default();
+ this.search_field_scale();
+ this.search_results.update(content);
+ return this.parsing = false;
+ };
+ Chosen.prototype.result_add_group = function(group) {
+ if (!group.disabled) {
+ group.dom_id = this.form_field.id + "chzn_g_" + group.array_index;
+ return '<li id="' + group.dom_id + '" class="group-result">' + group.label.escapeHTML() + '</li>';
+ } else {
+ return "";
+ }
+ };
+ Chosen.prototype.result_add_option = function(option) {
+ var classes;
+ if (!option.disabled) {
+ option.dom_id = this.form_field.id + "chzn_o_" + option.array_index;
+ classes = option.selected && this.is_multiple ? [] : ["active-result"];
+ if (option.selected) {
+ classes.push("result-selected");
+ }
+ if (option.group_array_index != null) {
+ classes.push("group-option");
+ }
+ return '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.text.escapeHTML() + '</li>';
+ } else {
+ return "";
+ }
+ };
+ Chosen.prototype.results_update_field = function() {
+ this.result_clear_highlight();
+ this.result_single_selected = null;
+ return this.results_build();
+ };
+ Chosen.prototype.result_do_highlight = function(el) {
+ var high_bottom, high_top, maxHeight, visible_bottom, visible_top;
+ this.result_clear_highlight();
+ this.result_highlight = el;
+ this.result_highlight.addClassName("highlighted");
+ maxHeight = parseInt(this.search_results.getStyle('maxHeight'), 10);
+ visible_top = this.search_results.scrollTop;
+ visible_bottom = maxHeight + visible_top;
+ high_top = this.result_highlight.positionedOffset().top;
+ high_bottom = high_top + this.result_highlight.getHeight();
+ if (high_bottom >= visible_bottom) {
+ return this.search_results.scrollTop = (high_bottom - maxHeight) > 0 ? high_bottom - maxHeight : 0;
+ } else if (high_top < visible_top) {
+ return this.search_results.scrollTop = high_top;
+ }
+ };
+ Chosen.prototype.result_clear_highlight = function() {
+ if (this.result_highlight) {
+ this.result_highlight.removeClassName('highlighted');
+ }
+ return this.result_highlight = null;
+ };
+ Chosen.prototype.results_toggle = function() {
+ if (this.results_showing) {
+ return this.results_hide();
+ } else {
+ return this.results_show();
+ }
+ };
+ Chosen.prototype.results_show = function() {
+ var dd_top;
+ if (!this.is_multiple) {
+ this.selected_item.addClassName('chzn-single-with-drop');
+ if (this.result_single_selected) {
+ this.result_do_highlight(this.result_single_selected);
+ }
+ }
+ dd_top = this.is_multiple ? this.container.getHeight() : this.container.getHeight() - 1;
+ this.dropdown.setStyle({
+ "top": dd_top + "px",
+ "left": 0
+ });
+ this.results_showing = true;
+ this.search_field.focus();
+ this.search_field.value = this.search_field.value;
+ return this.winnow_results();
+ };
+ Chosen.prototype.results_hide = function() {
+ if (!this.is_multiple) {
+ this.selected_item.removeClassName('chzn-single-with-drop');
+ }
+ this.result_clear_highlight();
+ this.dropdown.setStyle({
+ "left": "-9000px"
+ });
+ return this.results_showing = false;
+ };
+ Chosen.prototype.set_tab_index = function(el) {
+ var ti;
+ if (this.form_field.tabIndex) {
+ ti = this.form_field.tabIndex;
+ this.form_field.tabIndex = -1;
+ if (this.is_multiple) {
+ return this.search_field.tabIndex = ti;
+ } else {
+ this.selected_item.tabIndex = ti;
+ return this.search_field.tabIndex = -1;
+ }
+ }
+ };
+ Chosen.prototype.show_search_field_default = function() {
+ if (this.is_multiple && this.choices < 1 && !this.active_field) {
+ this.search_field.value = this.default_text;
+ return this.search_field.addClassName("default");
+ } else {
+ this.search_field.value = "";
+ return this.search_field.removeClassName("default");
+ }
+ };
+ Chosen.prototype.search_results_click = function(evt) {
+ var target;
+ target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
+ if (target) {
+ this.result_highlight = target;
+ return this.result_select();
+ }
+ };
+ Chosen.prototype.search_results_mouseover = function(evt) {
+ var target;
+ target = evt.target.hasClassName("active-result") ? evt.target : evt.target.up(".active-result");
+ if (target) {
+ return this.result_do_highlight(target);
+ }
+ };
+ Chosen.prototype.search_results_mouseout = function(evt) {
+ if (evt.target.hasClassName('active-result') || evt.target.up('.active-result')) {
+ return this.result_clear_highlight();
+ }
+ };
+ Chosen.prototype.choices_click = function(evt) {
+ evt.preventDefault();
+ if (this.active_field && !(evt.target.hasClassName('search-choice') || evt.target.up('.search-choice')) && !this.results_showing) {
+ return this.results_show();
+ }
+ };
+ Chosen.prototype.choice_build = function(item) {
+ var choice_id, link;
+ choice_id = this.form_field.id + "_chzn_c_" + item.array_index;
+ this.choices += 1;
+ this.search_container.insert({
+ before: this.choice_temp.evaluate({
+ "id": choice_id,
+ "choice": item.text,
+ "position": item.array_index
+ })
+ });
+ link = $(choice_id).down('a');
+ return link.observe("click", __bind(function(evt) {
+ return this.choice_destroy_link_click(evt);
+ }, this));
+ };
+ Chosen.prototype.choice_destroy_link_click = function(evt) {
+ evt.preventDefault();
+ this.pending_destroy_click = true;
+ return this.choice_destroy(evt.target);
+ };
+ Chosen.prototype.choice_destroy = function(link) {
+ this.choices -= 1;
+ this.show_search_field_default();
+ if (this.is_multiple && this.choices > 0 && this.search_field.value.length < 1) {
+ this.results_hide();
+ }
+ this.result_deselect(link.readAttribute("rel"));
+ return link.up('li').remove();
+ };
+ Chosen.prototype.result_select = function() {
+ var high, item, position;
+ if (this.result_highlight) {
+ high = this.result_highlight;
+ this.result_clear_highlight();
+ high.addClassName("result-selected");
+ if (this.is_multiple) {
+ this.result_deactivate(high);
+ } else {
+ this.result_single_selected = high;
+ }
+ position = high.id.substr(high.id.lastIndexOf("_") + 1);
+ item = this.results_data[position];
+ item.selected = true;
+ this.form_field.options[item.options_index].selected = true;
+ if (this.is_multiple) {
+ this.choice_build(item);
+ } else {
+ this.selected_item.down("span").update(item.text);
+ }
+ this.results_hide();
+ this.search_field.value = "";
+ if (typeof Event.simulate === 'function') {
+ this.form_field.simulate("change");
+ }
+ return this.search_field_scale();
+ }
+ };
+ Chosen.prototype.result_activate = function(el) {
+ return el.addClassName("active-result").show();
+ };
+ Chosen.prototype.result_deactivate = function(el) {
+ return el.removeClassName("active-result").hide();
+ };
+ Chosen.prototype.result_deselect = function(pos) {
+ var result, result_data;
+ result_data = this.results_data[pos];
+ result_data.selected = false;
+ this.form_field.options[result_data.options_index].selected = false;
+ result = $(this.form_field.id + "chzn_o_" + pos);
+ result.removeClassName("result-selected").addClassName("active-result").show();
+ this.result_clear_highlight();
+ this.winnow_results();
+ if (typeof Event.simulate === 'function') {
+ this.form_field.simulate("change");
+ }
+ return this.search_field_scale();
+ };
+ Chosen.prototype.results_search = function(evt) {
+ if (this.results_showing) {
+ return this.winnow_results();
+ } else {
+ return this.results_show();
+ }
+ };
+ Chosen.prototype.winnow_results = function() {
+ var found, option, part, parts, regex, result_id, results, searchText, startTime, startpos, text, zregex, _i, _j, _len, _len2, _ref;
+ startTime = new Date();
+ this.no_results_clear();
+ results = 0;
+ searchText = this.search_field.value === this.default_text ? "" : this.search_field.value.strip();
+ regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
+ zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i');
+ _ref = this.results_data;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ option = _ref[_i];
+ if (!option.disabled && !option.empty) {
+ if (option.group) {
+ $(option.dom_id).hide();
+ } else if (!(this.is_multiple && option.selected)) {
+ found = false;
+ result_id = option.dom_id;
+ if (regex.test(option.text)) {
+ found = true;
+ results += 1;
+ } else if (option.text.indexOf(" ") >= 0 || option.text.indexOf("[") === 0) {
+ parts = option.text.replace(/\[|\]/g, "").split(" ");
+ if (parts.length) {
+ for (_j = 0, _len2 = parts.length; _j < _len2; _j++) {
+ part = parts[_j];
+ if (regex.test(part)) {
+ found = true;
+ results += 1;
+ }
+ }
+ }
+ }
+ if (found) {
+ if (searchText.length) {
+ startpos = option.text.search(zregex);
+ text = option.text.substr(0, startpos + searchText.length) + '</em>' + option.text.substr(startpos + searchText.length);
+ text = text.substr(0, startpos) + '<em>' + text.substr(startpos);
+ } else {
+ text = option.text;
+ }
+ if ($(result_id).innerHTML !== text) {
+ $(result_id).update(text);
+ }
+ this.result_activate($(result_id));
+ if (option.group_array_index != null) {
+ $(this.results_data[option.group_array_index].dom_id).show();
+ }
+ } else {
+ if ($(result_id) === this.result_highlight) {
+ this.result_clear_highlight();
+ }
+ this.result_deactivate($(result_id));
+ }
+ }
+ }
+ }
+ if (results < 1 && searchText.length) {
+ return this.no_results(searchText);
+ } else {
+ return this.winnow_results_set_highlight();
+ }
+ };
+ Chosen.prototype.winnow_results_clear = function() {
+ var li, lis, _i, _len, _results;
+ this.search_field.clear();
+ lis = this.search_results.select("li");
+ _results = [];
+ for (_i = 0, _len = lis.length; _i < _len; _i++) {
+ li = lis[_i];
+ _results.push(li.hasClassName("group-result") ? li.show() : !this.is_multiple || !li.hasClassName("result-selected") ? this.result_activate(li) : void 0);
+ }
+ return _results;
+ };
+ Chosen.prototype.winnow_results_set_highlight = function() {
+ var do_high;
+ if (!this.result_highlight) {
+ do_high = this.search_results.down(".active-result");
+ if (do_high) {
+ return this.result_do_highlight(do_high);
+ }
+ }
+ };
+ Chosen.prototype.no_results = function(terms) {
+ return this.search_results.insert(this.no_results_temp.evaluate({
+ "terms": terms.escapeHTML()
+ }));
+ };
+ Chosen.prototype.no_results_clear = function() {
+ var nr, _results;
+ nr = null;
+ _results = [];
+ while (nr = this.search_results.down(".no-results")) {
+ _results.push(nr.remove());
+ }
+ return _results;
+ };
+ Chosen.prototype.keydown_arrow = function() {
+ var actives, nexts, sibs;
+ actives = this.search_results.select("li.active-result");
+ if (actives.length) {
+ if (!this.result_highlight) {
+ this.result_do_highlight(actives.first());
+ } else if (this.results_showing) {
+ sibs = this.result_highlight.nextSiblings();
+ nexts = sibs.intersect(actives);
+ if (nexts.length) {
+ this.result_do_highlight(nexts.first());
+ }
+ }
+ if (!this.results_showing) {
+ return this.results_show();
+ }
+ }
+ };
+ Chosen.prototype.keyup_arrow = function() {
+ var actives, prevs, sibs;
+ if (!this.results_showing && !this.is_multiple) {
+ return this.results_show();
+ } else if (this.result_highlight) {
+ sibs = this.result_highlight.previousSiblings();
+ actives = this.search_results.select("li.active-result");
+ prevs = sibs.intersect(actives);
+ if (prevs.length) {
+ return this.result_do_highlight(prevs.first());
+ } else {
+ if (this.choices > 0) {
+ this.results_hide();
+ }
+ return this.result_clear_highlight();
+ }
+ }
+ };
+ Chosen.prototype.keydown_backstroke = function() {
+ if (this.pending_backstroke) {
+ this.choice_destroy(this.pending_backstroke.down("a"));
+ return this.clear_backstroke();
+ } else {
+ this.pending_backstroke = this.search_container.siblings("li.search-choice").last();
+ return this.pending_backstroke.addClassName("search-choice-focus");
+ }
+ };
+ Chosen.prototype.clear_backstroke = function() {
+ if (this.pending_backstroke) {
+ this.pending_backstroke.removeClassName("search-choice-focus");
+ }
+ return this.pending_backstroke = null;
+ };
+ Chosen.prototype.keyup_checker = function(evt) {
+ var stroke, _ref;
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
+ this.search_field_scale();
+ switch (stroke) {
+ case 8:
+ if (this.is_multiple && this.backstroke_length < 1 && this.choices > 0) {
+ return this.keydown_backstroke();
+ } else if (!this.pending_backstroke) {
+ this.result_clear_highlight();
+ return this.results_search();
+ }
+ break;
+ case 13:
+ evt.preventDefault();
+ if (this.results_showing) {
+ return this.result_select();
+ }
+ break;
+ case 27:
+ if (this.results_showing) {
+ return this.results_hide();
+ }
+ break;
+ case 9:
+ case 38:
+ case 40:
+ case 16:
+ break;
+ default:
+ return this.results_search();
+ }
+ };
+ Chosen.prototype.keydown_checker = function(evt) {
+ var stroke, _ref;
+ stroke = (_ref = evt.which) != null ? _ref : evt.keyCode;
+ this.search_field_scale();
+ if (stroke !== 8 && this.pending_backstroke) {
+ this.clear_backstroke();
+ }
+ switch (stroke) {
+ case 8:
+ return this.backstroke_length = this.search_field.value.length;
+ case 9:
+ return this.mouse_on_container = false;
+ case 13:
+ return evt.preventDefault();
+ case 38:
+ evt.preventDefault();
+ return this.keyup_arrow();
+ case 40:
+ return this.keydown_arrow();
+ }
+ };
+ Chosen.prototype.search_field_scale = function() {
+ var dd_top, div, h, style, style_block, styles, w, _i, _len;
+ if (this.is_multiple) {
+ h = 0;
+ w = 0;
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;";
+ styles = ['font-size', 'font-style', 'font-weight', 'font-family', 'line-height', 'text-transform', 'letter-spacing'];
+ for (_i = 0, _len = styles.length; _i < _len; _i++) {
+ style = styles[_i];
+ style_block += style + ":" + this.search_field.getStyle(style) + ";";
+ }
+ div = new Element('div', {
+ 'style': style_block
+ }).update(this.search_field.value);
+ document.body.appendChild(div);
+ w = Element.measure(div, 'width') + 25;
+ div.remove();
+ if (w > this.f_width - 10) {
+ w = this.f_width - 10;
+ }
+ this.search_field.setStyle({
+ 'width': w + 'px'
+ });
+ dd_top = this.container.getHeight();
+ return this.dropdown.setStyle({
+ "top": dd_top + "px"
+ });
+ }
+ };
+ return Chosen;
+ })();
+ root.Chosen = Chosen;
+ document.observe('dom:loaded', function(evt) {
+ var select, selects, _i, _len, _results;
+ selects = $$(".chzn-select");
+ _results = [];
+ for (_i = 0, _len = selects.length; _i < _len; _i++) {
+ select = selects[_i];
+ _results.push(new Chosen(select));
+ }
+ return _results;
+ });
+ get_side_border_padding = function(elmt) {
+ var layout, side_border_padding;
+ layout = new Element.Layout(elmt);
+ return side_border_padding = layout.get("border-left") + layout.get("border-right") + layout.get("padding-left") + layout.get("padding-right");
+ };
+ root.get_side_border_padding = get_side_border_padding;
+ root = typeof exports !== "undefined" && exports !== null ? exports : this;
+ SelectParser = (function() {
+ function SelectParser() {
+ this.options_index = 0;
+ this.parsed = [];
+ }
+ SelectParser.prototype.add_node = function(child) {
+ if (child.nodeName === "OPTGROUP") {
+ return this.add_group(child);
+ } else {
+ return this.add_option(child);
+ }
+ };
+ SelectParser.prototype.add_group = function(group) {
+ var group_position, option, _i, _len, _ref, _results;
+ group_position = this.parsed.length;
+ this.parsed.push({
+ array_index: group_position,
+ group: true,
+ label: group.label,
+ children: 0,
+ disabled: group.disabled
+ });
+ _ref = group.childNodes;
+ _results = [];
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ option = _ref[_i];
+ _results.push(this.add_option(option, group_position, group.disabled));
+ }
+ return _results;
+ };
+ SelectParser.prototype.add_option = function(option, group_position, group_disabled) {
+ if (option.nodeName === "OPTION") {
+ if (option.text !== "") {
+ if (group_position != null) {
+ this.parsed[group_position].children += 1;
+ }
+ this.parsed.push({
+ array_index: this.parsed.length,
+ options_index: this.options_index,
+ value: option.value,
+ text: option.text,
+ selected: option.selected,
+ disabled: group_disabled === true ? group_disabled : option.disabled,
+ group_array_index: group_position
+ });
+ } else {
+ this.parsed.push({
+ array_index: this.parsed.length,
+ options_index: this.options_index,
+ empty: true
+ });
+ }
+ return this.options_index += 1;
+ }
+ };
+ return SelectParser;
+ })();
+ SelectParser.select_to_array = function(select) {
+ var child, parser, _i, _len, _ref;
+ parser = new SelectParser();
+ _ref = select.childNodes;
+ for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+ child = _ref[_i];
+ parser.add_node(child);
+ }
+ return parser.parsed;
+ };
+ root.SelectParser = SelectParser;
+}).call(this);
diff --git a/src/usr/local/www/javascript/chosen/chosen.proto.min.js b/src/usr/local/www/javascript/chosen/chosen.proto.min.js
new file mode 100644
index 0000000..79109c5
--- /dev/null
+++ b/src/usr/local/www/javascript/chosen/chosen.proto.min.js
@@ -0,0 +1,9 @@
+/*
+Chosen, a Select Box Enhancer for jQuery and Protoype
+by Patrick Filler for Harvest, http://getharvest.com
+
+Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
+
+Copyright (c) 2011 by Harvest
+*/
+(function(){var Chosen,SelectParser,get_side_border_padding,root;var __bind=function(fn,me){return function(){return fn.apply(me,arguments);};};root=typeof exports!=="undefined"&&exports!==null?exports:this;Chosen=(function(){function Chosen(elmn){this.set_default_values();this.form_field=elmn;this.is_multiple=this.form_field.multiple;this.default_text_default=this.form_field.multiple?"Select Some Options":"Select an Option";this.set_up_html();this.register_observers();}Chosen.prototype.set_default_values=function(){this.click_test_action=__bind(function(evt){return this.test_active_click(evt);},this);this.active_field=false;this.mouse_on_container=false;this.results_showing=false;this.result_highlighted=null;this.result_single_selected=null;this.choices=0;this.single_temp=new Template('<a href="javascript:void(0)" class="chzn-single"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" /></div><ul class="chzn-results"></ul></div>');this.multi_temp=new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>');this.choice_temp=new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>');return this.no_results_temp=new Template('<li class="no-results">No results match "<span>#{terms}</span>"</li>');};Chosen.prototype.set_up_html=function(){var base_template,container_props,dd_top,dd_width,sf_width;this.container_id=this.form_field.id+"_chzn";this.f_width=this.form_field.getStyle("width")?parseInt(this.form_field.getStyle("width"),10):this.form_field.getWidth();container_props={id:this.container_id,"class":"chzn-container",style:"width: "+this.f_width+"px"};this.default_text=this.form_field.readAttribute("title")?this.form_field.readAttribute("title"):this.default_text_default;base_template=this.is_multiple?new Element("div",container_props).update(this.multi_temp.evaluate({"default":this.default_text})):new Element("div",container_props).update(this.single_temp.evaluate({"default":this.default_text}));this.form_field.hide().insert({after:base_template});this.container=$(this.container_id);this.container.addClassName("chzn-container-"+(this.is_multiple?"multi":"single"));this.dropdown=this.container.down("div.chzn-drop");dd_top=this.container.getHeight();dd_width=this.f_width-get_side_border_padding(this.dropdown);this.dropdown.setStyle({width:dd_width+"px",top:dd_top+"px"});this.search_field=this.container.down("input");this.search_results=this.container.down("ul.chzn-results");this.search_field_scale();this.search_no_results=this.container.down("li.no-results");if(this.is_multiple){this.search_choices=this.container.down("ul.chzn-choices");this.search_container=this.container.down("li.search-field");}else{this.search_container=this.container.down("div.chzn-search");this.selected_item=this.container.down(".chzn-single");sf_width=dd_width-get_side_border_padding(this.search_container)-get_side_border_padding(this.search_field);this.search_field.setStyle({width:sf_width+"px"});}this.results_build();return this.set_tab_index();};Chosen.prototype.register_observers=function(){this.container.observe("click",__bind(function(evt){return this.container_click(evt);},this));this.container.observe("mouseenter",__bind(function(evt){return this.mouse_enter(evt);},this));this.container.observe("mouseleave",__bind(function(evt){return this.mouse_leave(evt);},this));this.search_results.observe("click",__bind(function(evt){return this.search_results_click(evt);},this));this.search_results.observe("mouseover",__bind(function(evt){return this.search_results_mouseover(evt);},this));this.search_results.observe("mouseout",__bind(function(evt){return this.search_results_mouseout(evt);},this));this.form_field.observe("liszt:updated",__bind(function(evt){return this.results_update_field(evt);},this));this.search_field.observe("blur",__bind(function(evt){return this.input_blur(evt);},this));this.search_field.observe("keyup",__bind(function(evt){return this.keyup_checker(evt);},this));this.search_field.observe("keydown",__bind(function(evt){return this.keydown_checker(evt);},this));if(this.is_multiple){this.search_choices.observe("click",__bind(function(evt){return this.choices_click(evt);},this));return this.search_field.observe("focus",__bind(function(evt){return this.input_focus(evt);},this));}else{return this.selected_item.observe("focus",__bind(function(evt){return this.activate_field(evt);},this));}};Chosen.prototype.container_click=function(evt){if(evt&&evt.type==="click"){evt.stop();}if(!this.pending_destroy_click){if(!this.active_field){if(this.is_multiple){this.search_field.clear();}document.observe("click",this.click_test_action);this.results_show();}else{if(!this.is_multiple&&evt&&(evt.target===this.selected_item||evt.target.up("a.chzn-single"))){this.results_toggle();}}return this.activate_field();}else{return this.pending_destroy_click=false;}};Chosen.prototype.mouse_enter=function(){return this.mouse_on_container=true;};Chosen.prototype.mouse_leave=function(){return this.mouse_on_container=false;};Chosen.prototype.input_focus=function(evt){if(!this.active_field){return setTimeout(this.container_click.bind(this),50);}};Chosen.prototype.input_blur=function(evt){if(!this.mouse_on_container){this.active_field=false;return setTimeout(this.blur_test.bind(this),100);}};Chosen.prototype.blur_test=function(evt){if(!this.active_field&&this.container.hasClassName("chzn-container-active")){return this.close_field();}};Chosen.prototype.close_field=function(){document.stopObserving("click",this.click_test_action);if(!this.is_multiple){this.selected_item.tabIndex=this.search_field.tabIndex;this.search_field.tabIndex=-1;}this.active_field=false;this.results_hide();this.container.removeClassName("chzn-container-active");this.winnow_results_clear();this.clear_backstroke();this.show_search_field_default();return this.search_field_scale();};Chosen.prototype.activate_field=function(){if(!this.is_multiple&&!this.active_field){this.search_field.tabIndex=this.selected_item.tabIndex;this.selected_item.tabIndex=-1;}this.container.addClassName("chzn-container-active");this.active_field=true;this.search_field.value=this.search_field.value;return this.search_field.focus();};Chosen.prototype.test_active_click=function(evt){if(evt.target.up("#"+this.container.id)){return this.active_field=true;}else{return this.close_field();}};Chosen.prototype.results_build=function(){var content,data,startTime,_i,_len,_ref;startTime=new Date();this.parsing=true;this.results_data=SelectParser.select_to_array(this.form_field);if(this.is_multiple&&this.choices>0){this.search_choices.select("li.search-choice").invoke("remove");this.choices=0;}else{if(!this.is_multiple){this.selected_item.down("span").update(this.default_text);}}content="";_ref=this.results_data;for(_i=0,_len=_ref.length;_i<_len;_i++){data=_ref[_i];if(data.group){content+=this.result_add_group(data);}else{if(!data.empty){content+=this.result_add_option(data);if(data.selected&&this.is_multiple){this.choice_build(data);}else{if(data.selected&&!this.is_multiple){this.selected_item.down("span").update(data.text);}}}}}this.show_search_field_default();this.search_field_scale();this.search_results.update(content);return this.parsing=false;};Chosen.prototype.result_add_group=function(group){if(!group.disabled){group.dom_id=this.form_field.id+"chzn_g_"+group.array_index;return'<li id="'+group.dom_id+'" class="group-result">'+group.label.escapeHTML()+"</li>";}else{return"";}};Chosen.prototype.result_add_option=function(option){var classes;if(!option.disabled){option.dom_id=this.form_field.id+"chzn_o_"+option.array_index;classes=option.selected&&this.is_multiple?[]:["active-result"];if(option.selected){classes.push("result-selected");}if(option.group_array_index!=null){classes.push("group-option");}return'<li id="'+option.dom_id+'" class="'+classes.join(" ")+'">'+option.text.escapeHTML()+"</li>";}else{return"";}};Chosen.prototype.results_update_field=function(){this.result_clear_highlight();this.result_single_selected=null;return this.results_build();};Chosen.prototype.result_do_highlight=function(el){var high_bottom,high_top,maxHeight,visible_bottom,visible_top;this.result_clear_highlight();this.result_highlight=el;this.result_highlight.addClassName("highlighted");maxHeight=parseInt(this.search_results.getStyle("maxHeight"),10);visible_top=this.search_results.scrollTop;visible_bottom=maxHeight+visible_top;high_top=this.result_highlight.positionedOffset().top;high_bottom=high_top+this.result_highlight.getHeight();if(high_bottom>=visible_bottom){return this.search_results.scrollTop=(high_bottom-maxHeight)>0?high_bottom-maxHeight:0;}else{if(high_top<visible_top){return this.search_results.scrollTop=high_top;}}};Chosen.prototype.result_clear_highlight=function(){if(this.result_highlight){this.result_highlight.removeClassName("highlighted");}return this.result_highlight=null;};Chosen.prototype.results_toggle=function(){if(this.results_showing){return this.results_hide();}else{return this.results_show();}};Chosen.prototype.results_show=function(){var dd_top;if(!this.is_multiple){this.selected_item.addClassName("chzn-single-with-drop");if(this.result_single_selected){this.result_do_highlight(this.result_single_selected);}}dd_top=this.is_multiple?this.container.getHeight():this.container.getHeight()-1;this.dropdown.setStyle({top:dd_top+"px",left:0});this.results_showing=true;this.search_field.focus();this.search_field.value=this.search_field.value;return this.winnow_results();};Chosen.prototype.results_hide=function(){if(!this.is_multiple){this.selected_item.removeClassName("chzn-single-with-drop");}this.result_clear_highlight();this.dropdown.setStyle({left:"-9000px"});return this.results_showing=false;};Chosen.prototype.set_tab_index=function(el){var ti;if(this.form_field.tabIndex){ti=this.form_field.tabIndex;this.form_field.tabIndex=-1;if(this.is_multiple){return this.search_field.tabIndex=ti;}else{this.selected_item.tabIndex=ti;return this.search_field.tabIndex=-1;}}};Chosen.prototype.show_search_field_default=function(){if(this.is_multiple&&this.choices<1&&!this.active_field){this.search_field.value=this.default_text;return this.search_field.addClassName("default");}else{this.search_field.value="";return this.search_field.removeClassName("default");}};Chosen.prototype.search_results_click=function(evt){var target;target=evt.target.hasClassName("active-result")?evt.target:evt.target.up(".active-result");if(target){this.result_highlight=target;return this.result_select();}};Chosen.prototype.search_results_mouseover=function(evt){var target;target=evt.target.hasClassName("active-result")?evt.target:evt.target.up(".active-result");if(target){return this.result_do_highlight(target);}};Chosen.prototype.search_results_mouseout=function(evt){if(evt.target.hasClassName("active-result")||evt.target.up(".active-result")){return this.result_clear_highlight();}};Chosen.prototype.choices_click=function(evt){evt.preventDefault();if(this.active_field&&!(evt.target.hasClassName("search-choice")||evt.target.up(".search-choice"))&&!this.results_showing){return this.results_show();}};Chosen.prototype.choice_build=function(item){var choice_id,link;choice_id=this.form_field.id+"_chzn_c_"+item.array_index;this.choices+=1;this.search_container.insert({before:this.choice_temp.evaluate({id:choice_id,choice:item.text,position:item.array_index})});link=$(choice_id).down("a");return link.observe("click",__bind(function(evt){return this.choice_destroy_link_click(evt);},this));};Chosen.prototype.choice_destroy_link_click=function(evt){evt.preventDefault();this.pending_destroy_click=true;return this.choice_destroy(evt.target);};Chosen.prototype.choice_destroy=function(link){this.choices-=1;this.show_search_field_default();if(this.is_multiple&&this.choices>0&&this.search_field.value.length<1){this.results_hide();}this.result_deselect(link.readAttribute("rel"));return link.up("li").remove();};Chosen.prototype.result_select=function(){var high,item,position;if(this.result_highlight){high=this.result_highlight;this.result_clear_highlight();high.addClassName("result-selected");if(this.is_multiple){this.result_deactivate(high);}else{this.result_single_selected=high;}position=high.id.substr(high.id.lastIndexOf("_")+1);item=this.results_data[position];item.selected=true;this.form_field.options[item.options_index].selected=true;if(this.is_multiple){this.choice_build(item);}else{this.selected_item.down("span").update(item.text);}this.results_hide();this.search_field.value="";if(typeof Event.simulate==="function"){this.form_field.simulate("change");}return this.search_field_scale();}};Chosen.prototype.result_activate=function(el){return el.addClassName("active-result").show();};Chosen.prototype.result_deactivate=function(el){return el.removeClassName("active-result").hide();};Chosen.prototype.result_deselect=function(pos){var result,result_data;result_data=this.results_data[pos];result_data.selected=false;this.form_field.options[result_data.options_index].selected=false;result=$(this.form_field.id+"chzn_o_"+pos);result.removeClassName("result-selected").addClassName("active-result").show();this.result_clear_highlight();this.winnow_results();if(typeof Event.simulate==="function"){this.form_field.simulate("change");}return this.search_field_scale();};Chosen.prototype.results_search=function(evt){if(this.results_showing){return this.winnow_results();}else{return this.results_show();}};Chosen.prototype.winnow_results=function(){var found,option,part,parts,regex,result_id,results,searchText,startTime,startpos,text,zregex,_i,_j,_len,_len2,_ref;startTime=new Date();this.no_results_clear();results=0;searchText=this.search_field.value===this.default_text?"":this.search_field.value.strip();regex=new RegExp("^"+searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");zregex=new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"i");_ref=this.results_data;for(_i=0,_len=_ref.length;_i<_len;_i++){option=_ref[_i];if(!option.disabled&&!option.empty){if(option.group){$(option.dom_id).hide();}else{if(!(this.is_multiple&&option.selected)){found=false;result_id=option.dom_id;if(regex.test(option.text)){found=true;results+=1;}else{if(option.text.indexOf(" ")>=0||option.text.indexOf("[")===0){parts=option.text.replace(/\[|\]/g,"").split(" ");if(parts.length){for(_j=0,_len2=parts.length;_j<_len2;_j++){part=parts[_j];if(regex.test(part)){found=true;results+=1;}}}}}if(found){if(searchText.length){startpos=option.text.search(zregex);text=option.text.substr(0,startpos+searchText.length)+"</em>"+option.text.substr(startpos+searchText.length);text=text.substr(0,startpos)+"<em>"+text.substr(startpos);}else{text=option.text;}if($(result_id).innerHTML!==text){$(result_id).update(text);}this.result_activate($(result_id));if(option.group_array_index!=null){$(this.results_data[option.group_array_index].dom_id).show();}}else{if($(result_id)===this.result_highlight){this.result_clear_highlight();}this.result_deactivate($(result_id));}}}}}if(results<1&&searchText.length){return this.no_results(searchText);}else{return this.winnow_results_set_highlight();}};Chosen.prototype.winnow_results_clear=function(){var li,lis,_i,_len,_results;this.search_field.clear();lis=this.search_results.select("li");_results=[];for(_i=0,_len=lis.length;_i<_len;_i++){li=lis[_i];_results.push(li.hasClassName("group-result")?li.show():!this.is_multiple||!li.hasClassName("result-selected")?this.result_activate(li):void 0);}return _results;};Chosen.prototype.winnow_results_set_highlight=function(){var do_high;if(!this.result_highlight){do_high=this.search_results.down(".active-result");if(do_high){return this.result_do_highlight(do_high);}}};Chosen.prototype.no_results=function(terms){return this.search_results.insert(this.no_results_temp.evaluate({terms:terms.escapeHTML()}));};Chosen.prototype.no_results_clear=function(){var nr,_results;nr=null;_results=[];while(nr=this.search_results.down(".no-results")){_results.push(nr.remove());}return _results;};Chosen.prototype.keydown_arrow=function(){var actives,nexts,sibs;actives=this.search_results.select("li.active-result");if(actives.length){if(!this.result_highlight){this.result_do_highlight(actives.first());}else{if(this.results_showing){sibs=this.result_highlight.nextSiblings();nexts=sibs.intersect(actives);if(nexts.length){this.result_do_highlight(nexts.first());}}}if(!this.results_showing){return this.results_show();}}};Chosen.prototype.keyup_arrow=function(){var actives,prevs,sibs;if(!this.results_showing&&!this.is_multiple){return this.results_show();}else{if(this.result_highlight){sibs=this.result_highlight.previousSiblings();actives=this.search_results.select("li.active-result");prevs=sibs.intersect(actives);if(prevs.length){return this.result_do_highlight(prevs.first());}else{if(this.choices>0){this.results_hide();}return this.result_clear_highlight();}}}};Chosen.prototype.keydown_backstroke=function(){if(this.pending_backstroke){this.choice_destroy(this.pending_backstroke.down("a"));return this.clear_backstroke();}else{this.pending_backstroke=this.search_container.siblings("li.search-choice").last();return this.pending_backstroke.addClassName("search-choice-focus");}};Chosen.prototype.clear_backstroke=function(){if(this.pending_backstroke){this.pending_backstroke.removeClassName("search-choice-focus");}return this.pending_backstroke=null;};Chosen.prototype.keyup_checker=function(evt){var stroke,_ref;stroke=(_ref=evt.which)!=null?_ref:evt.keyCode;this.search_field_scale();switch(stroke){case 8:if(this.is_multiple&&this.backstroke_length<1&&this.choices>0){return this.keydown_backstroke();}else{if(!this.pending_backstroke){this.result_clear_highlight();return this.results_search();}}break;case 13:evt.preventDefault();if(this.results_showing){return this.result_select();}break;case 27:if(this.results_showing){return this.results_hide();}break;case 9:case 38:case 40:case 16:break;default:return this.results_search();}};Chosen.prototype.keydown_checker=function(evt){var stroke,_ref;stroke=(_ref=evt.which)!=null?_ref:evt.keyCode;this.search_field_scale();if(stroke!==8&&this.pending_backstroke){this.clear_backstroke();}switch(stroke){case 8:return this.backstroke_length=this.search_field.value.length;case 9:return this.mouse_on_container=false;case 13:return evt.preventDefault();case 38:evt.preventDefault();return this.keyup_arrow();case 40:return this.keydown_arrow();}};Chosen.prototype.search_field_scale=function(){var dd_top,div,h,style,style_block,styles,w,_i,_len;if(this.is_multiple){h=0;w=0;style_block="position:absolute; left: -1000px; top: -1000px; display:none;";styles=["font-size","font-style","font-weight","font-family","line-height","text-transform","letter-spacing"];for(_i=0,_len=styles.length;_i<_len;_i++){style=styles[_i];style_block+=style+":"+this.search_field.getStyle(style)+";";}div=new Element("div",{style:style_block}).update(this.search_field.value);document.body.appendChild(div);w=Element.measure(div,"width")+25;div.remove();if(w>this.f_width-10){w=this.f_width-10;}this.search_field.setStyle({width:w+"px"});dd_top=this.container.getHeight();return this.dropdown.setStyle({top:dd_top+"px"});}};return Chosen;})();root.Chosen=Chosen;document.observe("dom:loaded",function(evt){var select,selects,_i,_len,_results;selects=$$(".chzn-select");_results=[];for(_i=0,_len=selects.length;_i<_len;_i++){select=selects[_i];_results.push(new Chosen(select));}return _results;});get_side_border_padding=function(elmt){var layout,side_border_padding;layout=new Element.Layout(elmt);return side_border_padding=layout.get("border-left")+layout.get("border-right")+layout.get("padding-left")+layout.get("padding-right");};root.get_side_border_padding=get_side_border_padding;root=typeof exports!=="undefined"&&exports!==null?exports:this;SelectParser=(function(){function SelectParser(){this.options_index=0;this.parsed=[];}SelectParser.prototype.add_node=function(child){if(child.nodeName==="OPTGROUP"){return this.add_group(child);}else{return this.add_option(child);}};SelectParser.prototype.add_group=function(group){var group_position,option,_i,_len,_ref,_results;group_position=this.parsed.length;this.parsed.push({array_index:group_position,group:true,label:group.label,children:0,disabled:group.disabled});_ref=group.childNodes;_results=[];for(_i=0,_len=_ref.length;_i<_len;_i++){option=_ref[_i];_results.push(this.add_option(option,group_position,group.disabled));}return _results;};SelectParser.prototype.add_option=function(option,group_position,group_disabled){if(option.nodeName==="OPTION"){if(option.text!==""){if(group_position!=null){this.parsed[group_position].children+=1;}this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,value:option.value,text:option.text,selected:option.selected,disabled:group_disabled===true?group_disabled:option.disabled,group_array_index:group_position});}else{this.parsed.push({array_index:this.parsed.length,options_index:this.options_index,empty:true});}return this.options_index+=1;}};return SelectParser;})();SelectParser.select_to_array=function(select){var child,parser,_i,_len,_ref;parser=new SelectParser();_ref=select.childNodes;for(_i=0,_len=_ref.length;_i<_len;_i++){child=_ref[_i];parser.add_node(child);}return parser.parsed;};root.SelectParser=SelectParser;}).call(this); \ No newline at end of file
diff --git a/src/usr/local/www/javascript/chosen/coffee/chosen.jquery.coffee b/src/usr/local/www/javascript/chosen/coffee/chosen.jquery.coffee
new file mode 100644
index 0000000..0d6596a
--- /dev/null
+++ b/src/usr/local/www/javascript/chosen/coffee/chosen.jquery.coffee
@@ -0,0 +1,633 @@
+###
+Chosen, a Select Box Enhancer for jQuery and Protoype
+by Patrick Filler for Harvest, http://getharvest.com
+
+Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
+
+Copyright (c) 2011 by Harvest
+###
+
+root = exports ? this
+$ = jQuery
+
+$.fn.extend({
+ chosen: (data, options) ->
+ $(this).each((input_field) ->
+ new Chosen(this, data, options) unless ($ this).hasClass "chzn-done"
+ )
+})
+
+class Chosen
+
+ constructor: (elmn) ->
+ this.set_default_values()
+
+ @form_field = elmn
+ @form_field_jq = $ @form_field
+ @is_multiple = @form_field.multiple
+
+ @default_text_default = if @form_field.multiple then "Select Some Options" else "Select an Option"
+
+ this.set_up_html()
+ this.register_observers()
+ @form_field_jq.addClass "chzn-done"
+
+ set_default_values: ->
+
+ @click_test_action = (evt) => this.test_active_click(evt)
+ @active_field = false
+ @mouse_on_container = false
+ @results_showing = false
+ @result_highlighted = null
+ @result_single_selected = null
+ @choices = 0
+
+ set_up_html: ->
+ @container_id = @form_field.id + "_chzn"
+
+ @f_width = @form_field_jq.width()
+
+ @default_text = if @form_field_jq.attr 'title' then @form_field_jq.attr 'title' else @default_text_default
+
+ container_div = ($ "<div />", {
+ id: @container_id
+ class: 'chzn-container'
+ style: 'width: ' + (@f_width) + 'px;' #use parens around @f_width so coffeescript doesn't think + ' px' is a function parameter
+ })
+
+ if @is_multiple
+ container_div.html '<ul class="chzn-choices"><li class="search-field"><input type="text" value="' + @default_text + '" class="default" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>'
+ else
+ container_div.html '<a href="javascript:void(0)" class="chzn-single"><span>' + @default_text + '</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" /></div><ul class="chzn-results"></ul></div>'
+
+ @form_field_jq.hide().after container_div
+ @container = ($ '#' + @container_id)
+ @container.addClass( "chzn-container-" + (if @is_multiple then "multi" else "single") )
+ @dropdown = @container.find('div.chzn-drop').first()
+
+ dd_top = @container.height()
+ dd_width = (@f_width - get_side_border_padding(@dropdown))
+
+ @dropdown.css({"width": dd_width + "px", "top": dd_top + "px"})
+
+ @search_field = @container.find('input').first()
+ @search_results = @container.find('ul.chzn-results').first()
+ this.search_field_scale()
+
+ @search_no_results = @container.find('li.no-results').first()
+
+ if @is_multiple
+ @search_choices = @container.find('ul.chzn-choices').first()
+ @search_container = @container.find('li.search-field').first()
+ else
+ @search_container = @container.find('div.chzn-search').first()
+ @selected_item = @container.find('.chzn-single').first()
+ sf_width = dd_width - get_side_border_padding(@search_container) - get_side_border_padding(@search_field)
+ @search_field.css( {"width" : sf_width + "px"} )
+
+ this.results_build()
+ this.set_tab_index()
+
+
+ register_observers: ->
+ @container.click (evt) => this.container_click(evt)
+ @container.mouseenter (evt) => this.mouse_enter(evt)
+ @container.mouseleave (evt) => this.mouse_leave(evt)
+
+ @search_results.click (evt) => this.search_results_click(evt)
+ @search_results.mouseover (evt) => this.search_results_mouseover(evt)
+ @search_results.mouseout (evt) => this.search_results_mouseout(evt)
+
+ @form_field_jq.bind "liszt:updated", (evt) => this.results_update_field(evt)
+
+ @search_field.blur (evt) => this.input_blur(evt)
+ @search_field.keyup (evt) => this.keyup_checker(evt)
+ @search_field.keydown (evt) => this.keydown_checker(evt)
+
+ if @is_multiple
+ @search_choices.click (evt) => this.choices_click(evt)
+ @search_field.focus (evt) => this.input_focus(evt)
+ else
+ @selected_item.focus (evt) => this.activate_field(evt)
+
+ container_click: (evt) ->
+ if evt and evt.type is "click"
+ evt.stopPropagation()
+ if not @pending_destroy_click
+ if not @active_field
+ @search_field.val "" if @is_multiple
+ $(document).click @click_test_action
+ this.results_show()
+ else if not @is_multiple and evt and ($(evt.target) is @selected_item || $(evt.target).parents("a.chzn-single").length)
+ evt.preventDefault()
+ this.results_toggle()
+
+ this.activate_field()
+ else
+ @pending_destroy_click = false
+
+ mouse_enter: -> @mouse_on_container = true
+ mouse_leave: -> @mouse_on_container = false
+
+ input_focus: (evt) ->
+ setTimeout (=> this.container_click()), 50 unless @active_field
+
+ input_blur: (evt) ->
+ if not @mouse_on_container
+ @active_field = false
+ setTimeout (=> this.blur_test()), 100
+
+ blur_test: (evt) ->
+ this.close_field() if not @active_field and @container.hasClass "chzn-container-active"
+
+ close_field: ->
+ $(document).unbind "click", @click_test_action
+
+ if not @is_multiple
+ @selected_item.attr "tabindex", @search_field.attr("tabindex")
+ @search_field.attr "tabindex", -1
+
+ @active_field = false
+ this.results_hide()
+
+ @container.removeClass "chzn-container-active"
+ this.winnow_results_clear()
+ this.clear_backstroke()
+
+ this.show_search_field_default()
+ this.search_field_scale()
+
+ activate_field: ->
+ if not @is_multiple and not @active_field
+ @search_field.attr "tabindex", (@selected_item.attr "tabindex")
+ @selected_item.attr "tabindex", -1
+
+ @container.addClass "chzn-container-active"
+ @active_field = true
+
+ @search_field.val(@search_field.val())
+ @search_field.focus()
+
+
+ test_active_click: (evt) ->
+ if $(evt.target).parents('#' + @container.id).length
+ @active_field = true
+ else
+ this.close_field()
+
+ results_build: ->
+ startTime = new Date()
+ @parsing = true
+ @results_data = SelectParser.select_to_array @form_field
+
+ if @is_multiple and @choices > 0
+ @search_choices.find("li.search-choice").remove()
+ @choices = 0
+ else if not @is_multiple
+ @selected_item.find("span").text @default_text
+
+ content = ''
+ for data in @results_data
+ if data.group
+ content += this.result_add_group data
+ else if !data.empty
+ content += this.result_add_option data
+ if data.selected and @is_multiple
+ this.choice_build data
+ else if data.selected and not @is_multiple
+ @selected_item.find("span").text data.text
+
+ this.show_search_field_default()
+ this.search_field_scale()
+
+ @search_results.html content
+ @parsing = false
+
+
+ result_add_group: (group) ->
+ if not group.disabled
+ group.dom_id = @form_field.id + "chzn_g_" + group.array_index
+ '<li id="' + group.dom_id + '" class="group-result">' + $("<div />").text(group.label).html() + '</li>'
+ else
+ ""
+
+ result_add_option: (option) ->
+ if not option.disabled
+ option.dom_id = @form_field.id + "chzn_o_" + option.array_index
+
+ classes = if option.selected and @is_multiple then [] else ["active-result"]
+ classes.push "result-selected" if option.selected
+ classes.push "group-option" if option.group_array_index?
+
+ '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + $("<div />").text(option.text).html() + '</li>'
+ else
+ ""
+
+ results_update_field: ->
+ this.result_clear_highlight()
+ @result_single_selected = null
+ this.results_build()
+
+ result_do_highlight: (el) ->
+ if el.length
+ this.result_clear_highlight()
+
+ @result_highlight = el
+ @result_highlight.addClass "highlighted"
+
+ maxHeight = parseInt @search_results.css("maxHeight"), 10
+ visible_top = @search_results.scrollTop()
+ visible_bottom = maxHeight + visible_top
+
+ high_top = @result_highlight.position().top + @search_results.scrollTop()
+ high_bottom = high_top + @result_highlight.outerHeight()
+
+ if high_bottom >= visible_bottom
+ @search_results.scrollTop if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
+ else if high_top < visible_top
+ @search_results.scrollTop high_top
+
+ result_clear_highlight: ->
+ @result_highlight.removeClass "highlighted" if @result_highlight
+ @result_highlight = null
+
+ results_toggle: ->
+ if @results_showing
+ this.results_hide()
+ else
+ this.results_show()
+
+ results_show: ->
+ if not @is_multiple
+ @selected_item.addClass "chzn-single-with-drop"
+ if @result_single_selected
+ this.result_do_highlight( @result_single_selected )
+
+ dd_top = if @is_multiple then @container.height() else (@container.height() - 1)
+ @dropdown.css {"top": dd_top + "px", "left":0}
+ @results_showing = true
+
+ @search_field.focus()
+ @search_field.val @search_field.val()
+
+ this.winnow_results()
+
+ results_hide: ->
+ @selected_item.removeClass "chzn-single-with-drop" unless @is_multiple
+ this.result_clear_highlight()
+ @dropdown.css {"left":"-9000px"}
+ @results_showing = false
+
+
+ set_tab_index: (el) ->
+ if @form_field_jq.attr "tabindex"
+ ti = @form_field_jq.attr "tabindex"
+ @form_field_jq.attr "tabindex", -1
+
+ if @is_multiple
+ @search_field.attr "tabindex", ti
+ else
+ @selected_item.attr "tabindex", ti
+ @search_field.attr "tabindex", -1
+
+ show_search_field_default: ->
+ if @is_multiple and @choices < 1 and not @active_field
+ @search_field.val(@default_text)
+ @search_field.addClass "default"
+ else
+ @search_field.val("")
+ @search_field.removeClass "default"
+
+ search_results_click: (evt) ->
+ target = if $(evt.target).hasClass "active-result" then $(evt.target) else $(evt.target).parents(".active-result").first()
+ if target.length
+ @result_highlight = target
+ this.result_select()
+
+ search_results_mouseover: (evt) ->
+ target = if $(evt.target).hasClass "active-result" then $(evt.target) else $(evt.target).parents(".active-result").first()
+ this.result_do_highlight( target ) if target
+
+ search_results_mouseout: (evt) ->
+ this.result_clear_highlight() if $(evt.target).hasClass "active-result" or $(evt.target).parents('.active-result').first()
+
+
+ choices_click: (evt) ->
+ evt.preventDefault()
+ if( @active_field and not($(evt.target).hasClass "search-choice" or $(evt.target).parents('.search-choice').first) and not @results_showing )
+ this.results_show()
+
+ choice_build: (item) ->
+ choice_id = @form_field.id + "_chzn_c_" + item.array_index
+ @choices += 1
+ @search_container.before '<li class="search-choice" id="' + choice_id + '"><span>' + item.text + '</span><a href="javascript:void(0)" class="search-choice-close" rel="' + item.array_index + '"></a></li>'
+ link = $('#' + choice_id).find("a").first()
+ link.click (evt) => this.choice_destroy_link_click(evt)
+
+ choice_destroy_link_click: (evt) ->
+ evt.preventDefault()
+ @pending_destroy_click = true
+ this.choice_destroy $(evt.target)
+
+ choice_destroy: (link) ->
+ @choices -= 1
+ this.show_search_field_default()
+
+ this.results_hide() if @is_multiple and @choices > 0 and @search_field.val().length < 1
+
+ this.result_deselect (link.attr "rel")
+ link.parents('li').first().remove()
+
+ result_select: ->
+ if @result_highlight
+ high = @result_highlight
+ high_id = high.attr "id"
+
+ this.result_clear_highlight()
+
+ high.addClass "result-selected"
+
+ if @is_multiple
+ this.result_deactivate high
+ else
+ @result_single_selected = high
+
+ position = high_id.substr(high_id.lastIndexOf("_") + 1 )
+ item = @results_data[position]
+ item.selected = true
+
+ @form_field.options[item.options_index].selected = true
+
+ if @is_multiple
+ this.choice_build item
+ else
+ @selected_item.find("span").first().text item.text
+
+ this.results_hide()
+ @search_field.val ""
+
+ @form_field_jq.trigger "change"
+ this.search_field_scale()
+
+ result_activate: (el) ->
+ el.addClass("active-result").show()
+
+ result_deactivate: (el) ->
+ el.removeClass("active-result").hide()
+
+ result_deselect: (pos) ->
+ result_data = @results_data[pos]
+ result_data.selected = false
+
+ @form_field.options[result_data.options_index].selected = false
+ result = $("#" + @form_field.id + "chzn_o_" + pos)
+ result.removeClass("result-selected").addClass("active-result").show()
+
+ this.result_clear_highlight()
+ this.winnow_results()
+
+ @form_field_jq.trigger "change"
+ this.search_field_scale()
+
+ results_search: (evt) ->
+ if @results_showing
+ this.winnow_results()
+ else
+ this.results_show()
+
+ winnow_results: ->
+ startTime = new Date()
+ this.no_results_clear()
+
+ results = 0
+
+ searchText = if @search_field.val() is @default_text then "" else $.trim @search_field.val()
+ regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
+ zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
+
+ for option in @results_data
+ if not option.disabled and not option.empty
+ if option.group
+ $('#' + option.dom_id).hide()
+ else if not (@is_multiple and option.selected)
+ found = false
+ result_id = option.dom_id
+
+ if regex.test option.text
+ found = true
+ results += 1
+ else if option.text.indexOf(" ") >= 0 or option.text.indexOf("[") == 0
+ #TODO: replace this substitution of /\[\]/ with a list of characters to skip.
+ parts = option.text.replace(/\[|\]/g, "").split(" ")
+ if parts.length
+ for part in parts
+ if regex.test part
+ found = true
+ results += 1
+
+ if found
+ if searchText.length
+ startpos = option.text.search zregex
+ text = option.text.substr(0, startpos + searchText.length) + '</em>' + option.text.substr(startpos + searchText.length)
+ text = text.substr(0, startpos) + '<em>' + text.substr(startpos)
+ else
+ text = option.text
+
+ $("#" + result_id).html text if $("#" + result_id).html != text
+
+ this.result_activate $("#" + result_id)
+
+ $("#" + @results_data[option.group_array_index].dom_id).show() if option.group_array_index?
+ else
+ this.result_clear_highlight() if @result_highlight and result_id is @result_highlight.attr 'id'
+ this.result_deactivate $("#" + result_id)
+
+ if results < 1 and searchText.length
+ this.no_results searchText
+ else
+ this.winnow_results_set_highlight()
+
+ winnow_results_clear: ->
+ @search_field.val ""
+ lis = @search_results.find("li")
+
+ for li in lis
+ li = $(li)
+ if li.hasClass "group-result"
+ li.show()
+ else if not @is_multiple or not li.hasClass "result-selected"
+ this.result_activate li
+
+ winnow_results_set_highlight: ->
+ if not @result_highlight
+ do_high = @search_results.find(".active-result").first()
+ if(do_high)
+ this.result_do_highlight do_high
+
+ no_results: (terms) ->
+ no_results_html = $('<li class="no-results">No results match "<span></span>"</li>')
+ no_results_html.find("span").first().text(terms)
+
+ @search_results.append no_results_html
+
+ no_results_clear: ->
+ @search_results.find(".no-results").remove()
+
+ keydown_arrow: ->
+ if not @result_highlight
+ first_active = @search_results.find("li.active-result").first()
+ this.result_do_highlight $(first_active) if first_active
+ else if @results_showing
+ next_sib = @result_highlight.nextAll("li.active-result").first()
+ this.result_do_highlight next_sib if next_sib
+ this.results_show() if not @results_showing
+
+ keyup_arrow: ->
+ if not @results_showing and not @is_multiple
+ this.results_show()
+ else if @result_highlight
+ prev_sibs = @result_highlight.prevAll("li.active-result")
+
+ if prev_sibs.length
+ this.result_do_highlight prev_sibs.first()
+ else
+ this.results_hide() if @choices > 0
+ this.result_clear_highlight()
+
+ keydown_backstroke: ->
+ if @pending_backstroke
+ this.choice_destroy @pending_backstroke.find("a").first()
+ this.clear_backstroke()
+ else
+ @pending_backstroke = @search_container.siblings("li.search-choice").last()
+ @pending_backstroke.addClass "search-choice-focus"
+
+ clear_backstroke: ->
+ @pending_backstroke.removeClass "search-choice-focus" if @pending_backstroke
+ @pending_backstroke = null
+
+ keyup_checker: (evt) ->
+ stroke = evt.which ? evt.keyCode
+ this.search_field_scale()
+
+ switch stroke
+ when 8
+ if @is_multiple and @backstroke_length < 1 and @choices > 0
+ this.keydown_backstroke()
+ else if not @pending_backstroke
+ this.result_clear_highlight()
+ this.results_search()
+ when 13
+ evt.preventDefault()
+ this.result_select() if this.results_showing
+ when 27
+ this.results_hide() if @results_showing
+ when 9, 38, 40, 16
+ # don't do anything on these keys
+ else this.results_search()
+
+
+ keydown_checker: (evt) ->
+ stroke = evt.which ? evt.keyCode
+ this.search_field_scale()
+
+ this.clear_backstroke() if stroke != 8 and this.pending_backstroke
+
+ switch stroke
+ when 8
+ @backstroke_length = this.search_field.val().length
+ break
+ when 9
+ @mouse_on_container = false
+ break
+ when 13
+ evt.preventDefault()
+ break
+ when 38
+ evt.preventDefault()
+ this.keyup_arrow()
+ break
+ when 40
+ this.keydown_arrow()
+ break
+
+
+ search_field_scale: ->
+ if @is_multiple
+ h = 0
+ w = 0
+
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"
+ styles = ['font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing']
+
+ for style in styles
+ style_block += style + ":" + @search_field.css(style) + ";"
+
+ div = $('<div />', { 'style' : style_block })
+ div.text @search_field.val()
+ $('body').append div
+
+ w = div.width() + 25
+ div.remove()
+
+ if( w > @f_width-10 )
+ w = @f_width - 10
+
+ @search_field.css({'width': w + 'px'})
+
+ dd_top = @container.height()
+ @dropdown.css({"top": dd_top + "px"})
+
+get_side_border_padding = (elmt) ->
+ side_border_padding = elmt.outerWidth() - elmt.width()
+
+root.get_side_border_padding = get_side_border_padding
+
+class SelectParser
+
+ constructor: ->
+ @options_index = 0
+ @parsed = []
+
+ add_node: (child) ->
+ if child.nodeName is "OPTGROUP"
+ this.add_group child
+ else
+ this.add_option child
+
+ add_group: (group) ->
+ group_position = @parsed.length
+ @parsed.push
+ array_index: group_position
+ group: true
+ label: group.label
+ children: 0
+ disabled: group.disabled
+ this.add_option( option, group_position, group.disabled ) for option in group.childNodes
+
+ add_option: (option, group_position, group_disabled) ->
+ if option.nodeName is "OPTION"
+ if option.text != ""
+ if group_position?
+ @parsed[group_position].children += 1
+ @parsed.push
+ array_index: @parsed.length
+ options_index: @options_index
+ value: option.value
+ text: option.text
+ selected: option.selected
+ disabled: if group_disabled is true then group_disabled else option.disabled
+ group_array_index: group_position
+ else
+ @parsed.push
+ array_index: @parsed.length
+ options_index: @options_index
+ empty: true
+ @options_index += 1
+
+SelectParser.select_to_array = (select) ->
+ parser = new SelectParser()
+ parser.add_node( child ) for child in select.childNodes
+ parser.parsed
+
+root.SelectParser = SelectParser
diff --git a/src/usr/local/www/javascript/chosen/coffee/chosen.proto.coffee b/src/usr/local/www/javascript/chosen/coffee/chosen.proto.coffee
new file mode 100644
index 0000000..87a22b6
--- /dev/null
+++ b/src/usr/local/www/javascript/chosen/coffee/chosen.proto.coffee
@@ -0,0 +1,629 @@
+###
+Chosen, a Select Box Enhancer for jQuery and Protoype
+by Patrick Filler for Harvest, http://getharvest.com
+
+Available for use under the MIT License, http://en.wikipedia.org/wiki/MIT_License
+
+Copyright (c) 2011 by Harvest
+###
+
+root = exports ? this
+
+class Chosen
+
+ constructor: (elmn) ->
+ this.set_default_values()
+
+ @form_field = elmn
+ @is_multiple = @form_field.multiple
+
+ @default_text_default = if @form_field.multiple then "Select Some Options" else "Select an Option"
+
+ this.set_up_html()
+ this.register_observers()
+
+
+ set_default_values: ->
+
+ @click_test_action = (evt) => this.test_active_click(evt)
+ @active_field = false
+ @mouse_on_container = false
+ @results_showing = false
+ @result_highlighted = null
+ @result_single_selected = null
+ @choices = 0
+
+ # HTML Templates
+ @single_temp = new Template('<a href="javascript:void(0)" class="chzn-single"><span>#{default}</span><div><b></b></div></a><div class="chzn-drop" style="left:-9000px;"><div class="chzn-search"><input type="text" /></div><ul class="chzn-results"></ul></div>')
+ @multi_temp = new Template('<ul class="chzn-choices"><li class="search-field"><input type="text" value="#{default}" class="default" style="width:25px;" /></li></ul><div class="chzn-drop" style="left:-9000px;"><ul class="chzn-results"></ul></div>')
+ @choice_temp = new Template('<li class="search-choice" id="#{id}"><span>#{choice}</span><a href="javascript:void(0)" class="search-choice-close" rel="#{position}"></a></li>')
+ @no_results_temp = new Template('<li class="no-results">No results match "<span>#{terms}</span>"</li>')
+
+
+ set_up_html: ->
+ @container_id = @form_field.id + "_chzn"
+
+ @f_width = if @form_field.getStyle("width") then parseInt @form_field.getStyle("width"), 10 else @form_field.getWidth()
+
+ container_props =
+ 'id': @container_id
+ 'class': 'chzn-container'
+ 'style': 'width: ' + (@f_width) + 'px' #use parens around @f_width so coffeescript doesn't think + ' px' is a function parameter
+
+ @default_text = if @form_field.readAttribute 'title' then @form_field.readAttribute 'title' else @default_text_default
+
+ base_template = if @is_multiple then new Element('div', container_props).update( @multi_temp.evaluate({ "default": @default_text}) ) else new Element('div', container_props).update( @single_temp.evaluate({ "default":@default_text }) )
+
+ @form_field.hide().insert({ after: base_template })
+ @container = $(@container_id)
+ @container.addClassName( "chzn-container-" + (if @is_multiple then "multi" else "single") )
+ @dropdown = @container.down('div.chzn-drop')
+
+ dd_top = @container.getHeight()
+ dd_width = (@f_width - get_side_border_padding(@dropdown))
+
+ @dropdown.setStyle({"width": dd_width + "px", "top": dd_top + "px"})
+
+ @search_field = @container.down('input')
+ @search_results = @container.down('ul.chzn-results')
+ this.search_field_scale()
+
+ @search_no_results = @container.down('li.no-results')
+
+ if @is_multiple
+ @search_choices = @container.down('ul.chzn-choices')
+ @search_container = @container.down('li.search-field')
+ else
+ @search_container = @container.down('div.chzn-search')
+ @selected_item = @container.down('.chzn-single')
+ sf_width = dd_width - get_side_border_padding(@search_container) - get_side_border_padding(@search_field)
+ @search_field.setStyle( {"width" : sf_width + "px"} )
+
+ this.results_build()
+ this.set_tab_index()
+
+
+ register_observers: ->
+ @container.observe "click", (evt) => this.container_click(evt)
+ @container.observe "mouseenter", (evt) => this.mouse_enter(evt)
+ @container.observe "mouseleave", (evt) => this.mouse_leave(evt)
+
+ @search_results.observe "click", (evt) => this.search_results_click(evt)
+ @search_results.observe "mouseover", (evt) => this.search_results_mouseover(evt)
+ @search_results.observe "mouseout", (evt) => this.search_results_mouseout(evt)
+
+ @form_field.observe "liszt:updated", (evt) => this.results_update_field(evt)
+
+ @search_field.observe "blur", (evt) => this.input_blur(evt)
+ @search_field.observe "keyup", (evt) => this.keyup_checker(evt)
+ @search_field.observe "keydown", (evt) => this.keydown_checker(evt)
+
+ if @is_multiple
+ @search_choices.observe "click", (evt) => this.choices_click(evt)
+ @search_field.observe "focus", (evt) => this.input_focus(evt)
+ else
+ @selected_item.observe "focus", (evt) => this.activate_field(evt)
+
+
+ container_click: (evt) ->
+ if evt and evt.type is "click"
+ evt.stop()
+ if not @pending_destroy_click
+ if not @active_field
+ @search_field.clear() if @is_multiple
+ document.observe "click", @click_test_action
+ this.results_show()
+ else if not @is_multiple and evt and (evt.target is @selected_item || evt.target.up("a.chzn-single"))
+ this.results_toggle()
+
+ this.activate_field()
+ else
+ @pending_destroy_click = false
+
+ mouse_enter: -> @mouse_on_container = true
+ mouse_leave: -> @mouse_on_container = false
+
+ input_focus: (evt) ->
+ setTimeout this.container_click.bind(this), 50 unless @active_field
+
+ input_blur: (evt) ->
+ if not @mouse_on_container
+ @active_field = false
+ setTimeout this.blur_test.bind(this), 100
+
+ blur_test: (evt) ->
+ this.close_field() if not @active_field and @container.hasClassName("chzn-container-active")
+
+ close_field: ->
+ document.stopObserving "click", @click_test_action
+
+ if not @is_multiple
+ @selected_item.tabIndex = @search_field.tabIndex
+ @search_field.tabIndex = -1
+
+ @active_field = false
+ this.results_hide()
+
+ @container.removeClassName "chzn-container-active"
+ this.winnow_results_clear()
+ this.clear_backstroke()
+
+ this.show_search_field_default()
+ this.search_field_scale()
+
+ activate_field: ->
+ if not @is_multiple and not @active_field
+ @search_field.tabIndex = @selected_item.tabIndex
+ @selected_item.tabIndex = -1
+
+ @container.addClassName "chzn-container-active"
+ @active_field = true
+
+ @search_field.value = @search_field.value
+ @search_field.focus()
+
+
+ test_active_click: (evt) ->
+ if evt.target.up('#' + @container.id)
+ @active_field = true
+ else
+ this.close_field()
+
+ results_build: ->
+ startTime = new Date()
+ @parsing = true
+ @results_data = SelectParser.select_to_array @form_field
+
+ if @is_multiple and @choices > 0
+ @search_choices.select("li.search-choice").invoke("remove")
+ @choices = 0
+ else if not @is_multiple
+ @selected_item.down("span").update(@default_text)
+
+ content = ''
+ for data in @results_data
+ if data.group
+ content += this.result_add_group data
+ else if !data.empty
+ content += this.result_add_option data
+ if data.selected and @is_multiple
+ this.choice_build data
+ else if data.selected and not @is_multiple
+ @selected_item.down("span").update( data.text )
+
+ this.show_search_field_default()
+ this.search_field_scale()
+
+ @search_results.update content
+ @parsing = false
+
+
+ result_add_group: (group) ->
+ if not group.disabled
+ group.dom_id = @form_field.id + "chzn_g_" + group.array_index
+ '<li id="' + group.dom_id + '" class="group-result">' + group.label.escapeHTML() + '</li>'
+ else
+ ""
+
+ result_add_option: (option) ->
+ if not option.disabled
+ option.dom_id = @form_field.id + "chzn_o_" + option.array_index
+
+ classes = if option.selected and @is_multiple then [] else ["active-result"]
+ classes.push "result-selected" if option.selected
+ classes.push "group-option" if option.group_array_index?
+
+ '<li id="' + option.dom_id + '" class="' + classes.join(' ') + '">' + option.text.escapeHTML() + '</li>'
+ else
+ ""
+
+ results_update_field: ->
+ this.result_clear_highlight()
+ @result_single_selected = null
+ this.results_build()
+
+ result_do_highlight: (el) ->
+ this.result_clear_highlight()
+
+ @result_highlight = el
+ @result_highlight.addClassName "highlighted"
+
+ maxHeight = parseInt @search_results.getStyle('maxHeight'), 10
+ visible_top = @search_results.scrollTop
+ visible_bottom = maxHeight + visible_top
+
+ high_top = @result_highlight.positionedOffset().top
+ high_bottom = high_top + @result_highlight.getHeight()
+
+ if high_bottom >= visible_bottom
+ @search_results.scrollTop = if (high_bottom - maxHeight) > 0 then (high_bottom - maxHeight) else 0
+ else if high_top < visible_top
+ @search_results.scrollTop = high_top
+
+ result_clear_highlight: ->
+ @result_highlight.removeClassName('highlighted') if @result_highlight
+ @result_highlight = null
+
+ results_toggle: ->
+ if @results_showing
+ this.results_hide()
+ else
+ this.results_show()
+
+ results_show: ->
+ if not @is_multiple
+ @selected_item.addClassName('chzn-single-with-drop')
+ if @result_single_selected
+ this.result_do_highlight( @result_single_selected )
+
+ dd_top = if @is_multiple then @container.getHeight() else (@container.getHeight() - 1)
+ @dropdown.setStyle {"top": dd_top + "px", "left":0}
+ @results_showing = true
+
+ @search_field.focus()
+ @search_field.value = @search_field.value
+
+ this.winnow_results()
+
+ results_hide: ->
+ @selected_item.removeClassName('chzn-single-with-drop') unless @is_multiple
+ this.result_clear_highlight()
+ @dropdown.setStyle({"left":"-9000px"})
+ @results_showing = false
+
+
+ set_tab_index: (el) ->
+ if @form_field.tabIndex
+ ti = @form_field.tabIndex
+ @form_field.tabIndex = -1
+
+ if @is_multiple
+ @search_field.tabIndex = ti
+ else
+ @selected_item.tabIndex = ti
+ @search_field.tabIndex = -1
+
+ show_search_field_default: ->
+ if @is_multiple and @choices < 1 and not @active_field
+ @search_field.value = @default_text
+ @search_field.addClassName "default"
+ else
+ @search_field.value = ""
+ @search_field.removeClassName "default"
+
+ search_results_click: (evt) ->
+ target = if evt.target.hasClassName("active-result") then evt.target else evt.target.up(".active-result")
+ if target
+ @result_highlight = target
+ this.result_select()
+
+ search_results_mouseover: (evt) ->
+ target = if evt.target.hasClassName("active-result") then evt.target else evt.target.up(".active-result")
+ this.result_do_highlight( target ) if target
+
+ search_results_mouseout: (evt) ->
+ this.result_clear_highlight() if evt.target.hasClassName('active-result') or evt.target.up('.active-result')
+
+
+ choices_click: (evt) ->
+ evt.preventDefault()
+ if( @active_field and not(evt.target.hasClassName('search-choice') or evt.target.up('.search-choice')) and not @results_showing )
+ this.results_show()
+
+ choice_build: (item) ->
+ choice_id = @form_field.id + "_chzn_c_" + item.array_index
+ @choices += 1
+ @search_container.insert { before: @choice_temp.evaluate({"id":choice_id, "choice":item.text, "position":item.array_index}) }
+ link = $(choice_id).down('a')
+ link.observe "click", (evt) => this.choice_destroy_link_click(evt)
+
+ choice_destroy_link_click: (evt) ->
+ evt.preventDefault()
+ @pending_destroy_click = true
+ this.choice_destroy evt.target
+
+ choice_destroy: (link) ->
+ @choices -= 1
+ this.show_search_field_default()
+
+ this.results_hide() if @is_multiple and @choices > 0 and @search_field.value.length < 1
+
+ this.result_deselect link.readAttribute("rel")
+ link.up('li').remove()
+
+ result_select: ->
+ if @result_highlight
+ high = @result_highlight
+ this.result_clear_highlight()
+
+ high.addClassName("result-selected")
+
+ if @is_multiple
+ this.result_deactivate high
+ else
+ @result_single_selected = high
+
+ position = high.id.substr(high.id.lastIndexOf("_") + 1 )
+ item = @results_data[position]
+ item.selected = true
+
+ @form_field.options[item.options_index].selected = true
+
+ if @is_multiple
+ this.choice_build item
+ else
+ @selected_item.down("span").update(item.text)
+
+ this.results_hide()
+ @search_field.value = ""
+
+ @form_field.simulate("change") if typeof Event.simulate is 'function'
+ this.search_field_scale()
+
+ result_activate: (el) ->
+ el.addClassName("active-result").show()
+
+ result_deactivate: (el) ->
+ el.removeClassName("active-result").hide()
+
+ result_deselect: (pos) ->
+ result_data = @results_data[pos]
+ result_data.selected = false
+
+ @form_field.options[result_data.options_index].selected = false
+ result = $(@form_field.id + "chzn_o_" + pos)
+ result.removeClassName("result-selected").addClassName("active-result").show()
+
+ this.result_clear_highlight()
+ this.winnow_results()
+
+ @form_field.simulate("change") if typeof Event.simulate is 'function'
+ this.search_field_scale()
+
+ results_search: (evt) ->
+ if @results_showing
+ this.winnow_results()
+ else
+ this.results_show()
+
+ winnow_results: ->
+ startTime = new Date()
+ this.no_results_clear()
+
+ results = 0
+
+ searchText = if @search_field.value is @default_text then "" else @search_field.value.strip()
+ regex = new RegExp('^' + searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
+ zregex = new RegExp(searchText.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), 'i')
+
+ for option in @results_data
+ if not option.disabled and not option.empty
+ if option.group
+ $(option.dom_id).hide()
+ else if not (@is_multiple and option.selected)
+ found = false
+ result_id = option.dom_id
+
+ if regex.test option.text
+ found = true
+ results += 1
+ else if option.text.indexOf(" ") >= 0 or option.text.indexOf("[") == 0
+ #TODO: replace this substitution of /\[\]/ with a list of characters to skip.
+ parts = option.text.replace(/\[|\]/g, "").split(" ")
+ if parts.length
+ for part in parts
+ if regex.test part
+ found = true
+ results += 1
+
+ if found
+ if searchText.length
+ startpos = option.text.search zregex
+ text = option.text.substr(0, startpos + searchText.length) + '</em>' + option.text.substr(startpos + searchText.length)
+ text = text.substr(0, startpos) + '<em>' + text.substr(startpos)
+ else
+ text = option.text
+
+ $(result_id).update text if $(result_id).innerHTML != text
+
+ this.result_activate $(result_id)
+
+ $(@results_data[option.group_array_index].dom_id).show() if option.group_array_index?
+ else
+ this.result_clear_highlight() if $(result_id) is @result_highlight
+ this.result_deactivate $(result_id)
+
+ if results < 1 and searchText.length
+ this.no_results(searchText)
+ else
+ this.winnow_results_set_highlight()
+
+ winnow_results_clear: ->
+ @search_field.clear()
+ lis = @search_results.select("li")
+
+ for li in lis
+ if li.hasClassName("group-result")
+ li.show()
+ else if not @is_multiple or not li.hasClassName("result-selected")
+ this.result_activate li
+
+ winnow_results_set_highlight: ->
+ if not @result_highlight
+ do_high = @search_results.down(".active-result")
+ if(do_high)
+ this.result_do_highlight do_high
+
+ no_results: (terms) ->
+ @search_results.insert @no_results_temp.evaluate({"terms":terms.escapeHTML()})
+
+ no_results_clear: ->
+ nr = null
+ nr.remove() while nr = @search_results.down(".no-results")
+
+
+ keydown_arrow: ->
+ actives = @search_results.select("li.active-result")
+ if actives.length
+ if not @result_highlight
+ this.result_do_highlight actives.first()
+ else if @results_showing
+ sibs = @result_highlight.nextSiblings()
+ nexts = sibs.intersect(actives)
+ this.result_do_highlight nexts.first() if nexts.length
+ this.results_show() if not @results_showing
+
+ keyup_arrow: ->
+ if not @results_showing and not @is_multiple
+ this.results_show()
+ else if @result_highlight
+ sibs = @result_highlight.previousSiblings()
+ actives = @search_results.select("li.active-result")
+ prevs = sibs.intersect(actives)
+
+ if prevs.length
+ this.result_do_highlight prevs.first()
+ else
+ this.results_hide() if @choices > 0
+ this.result_clear_highlight()
+
+ keydown_backstroke: ->
+ if @pending_backstroke
+ this.choice_destroy @pending_backstroke.down("a")
+ this.clear_backstroke()
+ else
+ @pending_backstroke = @search_container.siblings("li.search-choice").last()
+ @pending_backstroke.addClassName("search-choice-focus")
+
+ clear_backstroke: ->
+ @pending_backstroke.removeClassName("search-choice-focus") if @pending_backstroke
+ @pending_backstroke = null
+
+ keyup_checker: (evt) ->
+ stroke = evt.which ? evt.keyCode
+ this.search_field_scale()
+
+ switch stroke
+ when 8
+ if @is_multiple and @backstroke_length < 1 and @choices > 0
+ this.keydown_backstroke()
+ else if not @pending_backstroke
+ this.result_clear_highlight()
+ this.results_search()
+ when 13
+ evt.preventDefault()
+ this.result_select() if this.results_showing
+ when 27
+ this.results_hide() if @results_showing
+ when 9, 38, 40, 16
+ # don't do anything on these keys
+ else this.results_search()
+
+
+ keydown_checker: (evt) ->
+ stroke = evt.which ? evt.keyCode
+ this.search_field_scale()
+
+ this.clear_backstroke() if stroke != 8 and this.pending_backstroke
+
+ switch stroke
+ when 8
+ @backstroke_length = this.search_field.value.length
+ when 9
+ @mouse_on_container = false
+ when 13
+ evt.preventDefault()
+ when 38
+ evt.preventDefault()
+ this.keyup_arrow()
+ when 40
+ this.keydown_arrow()
+
+
+ search_field_scale: ->
+ if @is_multiple
+ h = 0
+ w = 0
+
+ style_block = "position:absolute; left: -1000px; top: -1000px; display:none;"
+ styles = ['font-size','font-style', 'font-weight', 'font-family','line-height', 'text-transform', 'letter-spacing']
+
+ for style in styles
+ style_block += style + ":" + @search_field.getStyle(style) + ";"
+
+ div = new Element('div', { 'style' : style_block }).update(@search_field.value)
+ document.body.appendChild(div)
+
+ w = Element.measure(div, 'width') + 25
+ div.remove()
+
+ if( w > @f_width-10 )
+ w = @f_width - 10
+
+ @search_field.setStyle({'width': w + 'px'})
+
+ dd_top = @container.getHeight()
+ @dropdown.setStyle({"top": dd_top + "px"})
+
+root.Chosen = Chosen
+
+document.observe 'dom:loaded', (evt) ->
+ selects = $$(".chzn-select")
+ new Chosen select for select in selects
+
+get_side_border_padding = (elmt) ->
+ layout = new Element.Layout(elmt)
+ side_border_padding = layout.get("border-left") + layout.get("border-right") + layout.get("padding-left") + layout.get("padding-right")
+
+root.get_side_border_padding = get_side_border_padding
+
+root = exports ? this
+
+class SelectParser
+
+ constructor: ->
+ @options_index = 0
+ @parsed = []
+
+ add_node: (child) ->
+ if child.nodeName is "OPTGROUP"
+ this.add_group child
+ else
+ this.add_option child
+
+ add_group: (group) ->
+ group_position = @parsed.length
+ @parsed.push
+ array_index: group_position
+ group: true
+ label: group.label
+ children: 0
+ disabled: group.disabled
+ this.add_option( option, group_position, group.disabled ) for option in group.childNodes
+
+ add_option: (option, group_position, group_disabled) ->
+ if option.nodeName is "OPTION"
+ if option.text != ""
+ if group_position?
+ @parsed[group_position].children += 1
+ @parsed.push
+ array_index: @parsed.length
+ options_index: @options_index
+ value: option.value
+ text: option.text
+ selected: option.selected
+ disabled: if group_disabled is true then group_disabled else option.disabled
+ group_array_index: group_position
+ else
+ @parsed.push
+ array_index: @parsed.length
+ options_index: @options_index
+ empty: true
+ @options_index += 1
+
+SelectParser.select_to_array = (select) ->
+ parser = new SelectParser()
+ parser.add_node( child ) for child in select.childNodes
+ parser.parsed
+
+root.SelectParser = SelectParser
diff --git a/src/usr/local/www/javascript/datepicker/css/datepicker.css b/src/usr/local/www/javascript/datepicker/css/datepicker.css
new file mode 100644
index 0000000..0773fa6
--- /dev/null
+++ b/src/usr/local/www/javascript/datepicker/css/datepicker.css
@@ -0,0 +1,178 @@
+/* This is a very basic stylesheet for the date-picker. Feel free to create your own. */
+
+/* The wrapper div */
+.datePicker
+ {
+ position:absolute;
+ min-width:21em;
+ width:21em;
+ z-index:9999;
+ text-align:center;
+ font:900 0.8em/0.8em Verdana, Sans-Serif;
+ background:transparent;
+ }
+/*
+ Quirksmode necessity
+ --------------------
+
+ If your HTML document renders in quirksmode (i.e. has no doctype declaration)
+ then uncomment the following CSS rule or the datePicker will be HUGE...
+
+.datePicker th,
+.datePicker td
+ {
+ font-size:11px;
+ }
+*/
+/* The iframe hack to cover selectlists in Internet Explorer <= v6 */
+.iehack
+ {
+ position:absolute;
+ background:#fff;
+ z-index:9998;
+ padding:0;
+ border:0;
+ display:none;
+ }
+/* The button created beside each input */
+.date-picker-control
+ {
+ border:0 none;
+ padding:0;
+ margin-left:4px;
+ background:transparent url(../media/cal.gif) no-repeat 0 0;
+ width:16px;
+ height:16px;
+ margin-top:0;
+ vertical-align:top;
+ cursor:pointer;
+ }
+/* The next & previous buttons */
+.datePicker th button
+ {
+ display:inline;
+ padding:0;
+ margin:0;
+ color:#000;
+ height:1em;
+ width:0.8em;
+ line-height:0.8em;
+ border-width:0;
+ font-family: georgia, times new roman, palatino, times, bookman, serif;
+ background:transparent;
+ font-weight:bold;
+ cursor:pointer;
+ }
+.datePicker th button:active,
+.datePicker th button:focus,
+.date-picker-control:active,
+.date-picker-control:focus
+ {
+ outline:none;
+ }
+.datePicker th button.prev-but
+ {
+ text-align:left;
+ }
+.datePicker th button.next-but
+ {
+ text-align:right;
+ }
+/* The mon, tue, wed etc day buttons */
+.datePicker th button.fd-day-header
+ {
+ text-align:center;
+ margin:0 auto;
+ font:900 1em Verdana, Sans-Serif;
+ height:auto;
+ width:auto;
+ text-decoration:none;
+ line-height:1.4em;
+ }
+/* The table */
+.datePicker table
+ {
+ position:relative;
+ margin:0;
+ padding:0;
+ border:1px solid #ccc;
+ background:#fff url(../media/gradient-e5e5e5-ffffff.gif) repeat-x 0 -20px;
+ text-align:center;
+ width:100%;
+ }
+.datePicker table tfoot td
+ {
+ background:#fff url(../media/gradient-e5e5e5-ffffff.gif) repeat-x 0 -40px;
+ }
+/* Common TD & TH styling */
+.datePicker table td
+ {
+ border: 1px solid #ccc;
+ padding:0.6em 0.5em 0.5em 0.5em;
+ /* Opera requires a line-height bigger than 1em in order to redraw properly */
+ line-height:1.2em;
+ cursor:default;
+ background:#fff url(../media/gradient-e5e5e5-ffffff.gif) repeat-x 0 -50px;
+ }
+.datePicker table th
+ {
+ border:0 none;
+ padding:0;
+ line-height:1em;
+ font-weight:bold;
+ color:#222;
+ text-align:center;
+ }
+/* The "mon tue wed etc" day header button styles */
+.datePicker table th.date-picker-day-header
+ {
+ text-transform:lowercase;
+ cursor:help;
+ }
+/* The "todays date" style */
+.datePicker table td.date-picker-today
+ {
+ background:#fff url(../media/bullet2.gif) no-repeat 0 0;
+ color:rgb(100,100,100) !important;
+ }
+/* The "selected date" style */
+.datePicker table td.date-picker-selected-date
+ {
+ color:#333 !important;
+ border-color:#333 !important;
+ }
+/* the "highlight days" style */
+td.date-picker-highlight
+ {
+ color:#a86666;
+ }
+/* The date "out of range" style */
+.datePicker table td.out-of-range
+ {
+ color:#ccc !important;
+ font-style:oblique;
+ background:transparent !important;
+ cursor:default !important;
+ }
+/* The "disabled days" style */
+.datePicker table td.day-disabled
+ {
+ color:#aaa !important;
+ background:transparent !important;
+ cursor:default !important;
+ }
+/* The "active cursor" style */
+.datePicker table td#date-picker-hover
+ {
+ background:#fff url(../media/bg_header.jpg) no-repeat 0 0;
+ cursor:pointer;
+ border-color:rgb(100,130,170);
+ color:rgb(100,130,170);
+ }
+/* Remove the images for Internet Explorer <= v6 using the "* html" hack */
+* html .datePicker table td.date-picker-selected,
+* html .datePicker table td.date-picker-hover,
+* html .datePicker table td
+ {
+ background-image:none;
+ }
diff --git a/src/usr/local/www/javascript/datepicker/js/blank.html b/src/usr/local/www/javascript/datepicker/js/blank.html
new file mode 100644
index 0000000..53a7f24
--- /dev/null
+++ b/src/usr/local/www/javascript/datepicker/js/blank.html
@@ -0,0 +1,6 @@
+<html>
+<head>
+</head>
+<body>
+</body>
+</html>
diff --git a/src/usr/local/www/javascript/datepicker/js/datepicker.js b/src/usr/local/www/javascript/datepicker/js/datepicker.js
new file mode 100644
index 0000000..3d6dbd3
--- /dev/null
+++ b/src/usr/local/www/javascript/datepicker/js/datepicker.js
@@ -0,0 +1,1111 @@
+/*
+ DatePicker v2.5 by frequency-decoder.com (2006/12/01)
+
+ Released under a creative commons Attribution-ShareAlike 2.5 license (http://creativecommons.org/licenses/by-sa/2.5/)
+
+ Please credit frequency-decoder in any derivative work - thanks.
+
+ You are free:
+
+ * to copy, distribute, display, and perform the work
+ * to make derivative works
+ * to make commercial use of the work
+
+ Under the following conditions:
+
+ by Attribution.
+ --------------
+ You must attribute the work in the manner specified by the author or licensor.
+
+ sa
+ --
+ Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one.
+
+ * For any reuse or distribution, you must make clear to others the license terms of this work.
+ * Any of these conditions can be waived if you get permission from the copyright holder.
+*/
+var datePickerController;
+
+(function() {
+
+datePicker.isSupported = typeof document.createElement != "undefined" &&
+ typeof document.documentElement != "undefined" &&
+ typeof document.documentElement.offsetWidth == "number";
+
+// Detect the users language
+datePicker.languageinfo = navigator.language ? navigator.language : navigator.userLanguage;
+datePicker.languageinfo = datePicker.languageinfo ? datePicker.languageinfo.toLowerCase().replace(/-[a-z]+$/, "") : 'en';
+
+if(datePicker.languageinfo != 'en') {
+ // Load the appropriate language file
+ var scriptFiles = document.getElementsByTagName('head')[0].getElementsByTagName('script');
+ var loc = "";
+
+ for(var i = 0, scriptFile; scriptFile = scriptFiles[i]; i++) {
+ if(scriptFile.src && scriptFile.src.match(/datepicker/)) {
+ loc = scriptFile.src.replace("datepicker", "lang/" + datePicker.languageinfo);
+ break;
+ };
+ };
+
+ if(loc != "") {
+ var script = document.createElement('script');
+ script.type = "text/javascript";
+ script.src = loc;
+ // Hopefully this allows a UTF-8 js file to be imported into a non-UTF HTML document
+ script.setAttribute("charset", "utf-8");
+ document.getElementsByTagName('head')[0].appendChild(script);
+ };
+};
+
+// Defaults for the language should the locale file not load
+datePicker.months = [
+ "January",
+ "February",
+ "March",
+ "April",
+ "May",
+ "June",
+ "July",
+ "August",
+ "September",
+ "October",
+ "November",
+ "December"];
+datePicker.fullDay = [
+ "Monday",
+ "Tuesday",
+ "Wednesday",
+ "Thursday",
+ "Friday",
+ "Saturday",
+ "Sunday"];
+datePicker.titles = [
+ "Previous month",
+ "Next month",
+ "Previous year",
+ "Next year"];
+datePicker.daysPerMonth = [31,28,31,30,31,30,31,31,30,31,30,31];
+
+datePicker.getDaysPerMonth = function (nMonth, nYear) {
+ nMonth = (nMonth + 12) % 12;
+ var res = datePicker.daysPerMonth[nMonth];
+ if(((0 == (nYear%4)) && ((0 != (nYear%100)) || (0 == (nYear%400)))) && nMonth == 1) {
+ res = 29;
+ };
+ return res;
+};
+
+function datePicker(options) {
+
+ this.defaults = {};
+
+ for(opt in options) {
+ this[opt] = this.defaults[opt] = options[opt];
+ };
+
+ this.date = new Date();
+ this.yearinc = 1;
+ this.timer = null;
+ this.pause = 1000;
+ this.timerSet = false;
+ this.opacity = 0;
+ this.opacityTo = 0;
+ this.fadeTimer = null;
+ this.interval = new Date();
+ this.firstDayOfWeek = this.defaults.firstDayOfWeek = 0;
+ this.dateSet = null;
+ this.visible = false;
+ this.div;
+ this.table;
+
+ var o = this;
+
+ o.reset = function() {
+ for(def in o.defaults) {
+ o[def] = o.defaults[def];
+ };
+ };
+ o.setOpacity = function(op) {
+ o.div.style.opacity = + op/100;
+ o.div.style.filter = 'alpha(opacity=' + op + ')';
+ o.opacity = op;
+ };
+ o.fade = function() {
+
+ window.clearTimeout(o.fadeTimer);
+ var diff = Math.round(o.opacity + ((o.opacityTo - o.opacity) / 4));
+
+ o.setOpacity(diff);
+
+ if(Math.abs(o.opacityTo - diff) > 3) {
+ o.fadeTimer = window.setTimeout(function () { o.fade(); }, 50);
+ } else {
+ o.setOpacity(o.opacityTo);
+ if(o.opacityTo == 0) o.div.style.display = "none";
+ };
+ };
+ o.killEvent = function(e) {
+ if (e == null) e = document.parentWindow.event;
+
+ if (e.stopPropagation) {
+ e.stopPropagation();
+ e.preventDefault();
+ }
+ /*@cc_on@*/
+ /*@if(@_win32)
+ e.cancelBubble = true;
+ e.returnValue = false;
+ /*@end@*/
+ return false;
+ };
+ o.startTimer = function () {
+ if (o.timerSet) o.stopTimer();
+ o.timer = window.setTimeout(function () { o.onTimer(); }, o.timerInc);
+ o.timerSet = true;
+ };
+ o.stopTimer = function () {
+ if (o.timer != null) window.clearTimeout(o.timer);
+ o.timerSet = false;
+ };
+ o.events = {
+ onkeydown: function (e) {
+
+ if(!o.visible) return false;
+
+ if (e == null) e = document.parentWindow.event;
+ var kc = e.keyCode ? e.keyCode : e.charCode;
+
+ if ( kc == 13 ) {
+ // close with update
+ o.returnFormattedDate();
+ o.hide();
+ return o.killEvent(e);
+ } else if ( kc == 27 ) {
+ // close
+ o.hide();
+ return o.killEvent(e);
+ } else if ( kc == 32 || kc == 0 ) {
+ // close
+ o.date = new Date( );
+ o.updateTable();
+ return o.killEvent(e);
+ };
+
+ // Internet Explorer fires the keydown event faster than the JavaScript engine can
+ // update the interface. The following attempts to fix this.
+
+ /*@cc_on@*/
+ /*@if(@_win32)
+ if(new Date().getTime() - o.interval.getTime() < 100) return o.killEvent(e);
+ o.interval = new Date();
+ /*@end@*/
+
+ if ((kc > 49 && kc < 56) || (kc > 97 && kc < 104)) {
+ if (kc > 96) kc -= (96-48);
+ kc -= 49;
+ o.firstDayOfWeek = (o.firstDayOfWeek + kc) % 7;
+ o.updateTable();
+ return o.killEvent(e);
+ };
+
+ if ( kc < 37 || kc > 40 ) return true;
+
+ var d = new Date( o.date ).valueOf();
+
+ if ( kc == 37 ) {
+ // ctrl + left = previous month
+ if( e.ctrlKey ) {
+ d = new Date( o.date );
+ d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth() - 1,d.getFullYear())) ); // no need to catch dec -> jan for the year
+ d.setMonth( d.getMonth() - 1 );
+ } else {
+ d -= 24 * 60 * 60 * 1000;
+ };
+ } else if ( kc == 39 ) {
+ // ctrl + right = next month
+ if( e.ctrlKey ) {
+ d = new Date( o.date );
+ d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth() + 1,d.getFullYear())) ); // no need to catch dec -> jan for the year
+ d.setMonth( d.getMonth() + 1 );
+ } else {
+ d += 24 * 60 * 60 * 1000;
+ };
+ } else if ( kc == 38 ) {
+ // ctrl + up = next year
+ if( e.ctrlKey ) {
+ d = new Date( o.date );
+ d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth(),d.getFullYear() + 1)) ); // no need to catch dec -> jan for the year
+ d.setFullYear( d.getFullYear() + 1 );
+ } else {
+ d -= 7 * 24 * 60 * 60 * 1000;
+ };
+ } else if ( kc == 40 ) {
+ // ctrl + down = prev year
+ if( e.ctrlKey ) {
+ d = new Date( o.date );
+ d.setDate( Math.min(d.getDate(), datePicker.getDaysPerMonth(d.getMonth(),d.getFullYear() - 1)) ); // no need to catch dec -> jan for the year
+ d.setFullYear( d.getFullYear() - 1 );
+ } else {
+ d += 7 * 24 * 60 * 60 * 1000;
+ };
+ };
+
+ var tmpDate = new Date( d );
+ if(!o.outOfRange(tmpDate)) {
+ o.date = tmpDate;
+ };
+
+ o.updateTable();
+
+ return o.killEvent(e);
+ },
+ onmousedown: function(e) {
+ if ( e == null ) e = document.parentWindow.event;
+ var el = e.target != null ? e.target : e.srcElement;
+
+ var found = false;
+
+ while(el.parentNode) {
+ if(el.id && (el.id == "fd-"+o.id || el.id == "fd-but-"+o.id)) {
+ found = true;
+ break;
+ }
+ try {
+ el = el.parentNode;
+ } catch(err) {
+ break;
+ }
+ }
+ if(found) return true;
+ datePickerController.hideAll();
+ },
+ onmouseover: function(e) {
+ if(document.getElementById("date-picker-hover")) {
+ document.getElementById("date-picker-hover").id = "";
+ };
+
+ this.id = "date-picker-hover";
+
+ o.date.setDate(this.firstChild.nodeValue);
+ },
+ onclick: function (e) {
+ if(o.opacity != o.opacityTo) return false;
+ if ( e == null ) e = document.parentWindow.event;
+ var el = e.target != null ? e.target : e.srcElement;
+ while ( el.nodeType != 1 ) el = el.parentNode;
+
+ var d = new Date( o.date );
+ var n = Number( el.firstChild.data );
+
+ if(isNaN(n)) { return true; };
+
+ d.setDate( n );
+ o.date = d;
+
+ o.returnFormattedDate();
+ o.hide();
+ return o.killEvent(e);
+ },
+ incDec:function(e) {
+ if(o.timerSet) {
+ o.stopTimer();
+ };
+
+ datePickerController.addEvent(document, "mouseup", o.events.clearTimer);
+
+ o.timerInc = 1000;
+ o.dayInc = arguments[1];
+ o.yearInc = arguments[2];
+ o.monthInc = arguments[3];
+ o.onTimer();
+ return o.killEvent(e);
+ },
+ clearTimer:function() {
+ o.stopped = true;
+ o.timerInc = 1000;
+ o.yearInc = 0;
+ o.monthInc = 0;
+ o.dayInc = 0;
+ try {
+ datePickerController.removeEvent(document, "mouseup", o.events.clearTimer);
+ } catch(e) { };
+ o.stopTimer();
+ }
+ };
+ o.onTimer = function() {
+ var d = new Date( o.date );
+
+ d.setDate( Math.min(d.getDate()+o.dayInc, datePicker.getDaysPerMonth(d.getMonth()+o.monthInc,d.getFullYear()+o.yearInc)) ); // no need to catch dec -> jan for the year
+ d.setMonth( d.getMonth() + o.monthInc );
+ d.setFullYear( d.getFullYear() + o.yearInc );
+
+ o.date = d;
+
+ if(o.timerInc > 50) {
+ o.timerInc = 50 + Math.round(((o.timerInc - 50) / 1.8));
+ };
+ o.startTimer();
+ o.updateTable();
+ };
+ o.getElem = function() {
+ return document.getElementById(o.id.replace(/^fd-/, '')) || false;
+ };
+ o.setRangeLow = function(range) {
+ if(String(range).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/) == -1) range = '';
+ o.low = o.defaults.low = range;
+ };
+ o.setRangeHigh = function(range) {
+ if(String(range).search(/^(\d\d?\d\d)(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01])$/) == -1) range = '';
+ o.high = o.defaults.high = range;
+ };
+ o.setDisabledDays = function(dayArray) {
+ o.disableDays = o.defaults.disableDays = dayArray;
+ };
+ o.setFirstDayOfWeek = function(e) {
+ if ( e == null ) e = document.parentWindow.event;
+ var elem = e.target != null ? e.target : e.srcElement;
+
+ if(elem.tagName.toLowerCase() != "th") {
+ while(elem.tagName.toLowerCase() != "th") elem = elem.parentNode;
+ }
+
+ var cnt = 0;
+
+ while(elem.previousSibling) {
+ elem = elem.previousSibling;
+ if(elem.tagName.toLowerCase() == "th") cnt++;
+ }
+
+ o.firstDayOfWeek = (o.firstDayOfWeek + cnt) % 7;
+ o.updateTable();
+
+ return o.killEvent(e);
+ };
+ o.trueBody = function() {
+ return;
+ };
+ o.resize = function() {
+ if(!o.created || !o.getElem()) return;
+
+ o.div.style.visibility = "hidden";
+ o.div.style.display = "block";
+
+ var osh = o.div.offsetHeight;
+ var osw = o.div.offsetWidth;
+
+ o.div.style.visibility = "visible";
+ o.div.style.display = "none";
+
+ var elem = document.getElementById('fd-but-' + o.id);
+ var pos = datePickerController.findPosition(elem);
+ var trueBody = (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
+
+ if ( parseInt(trueBody.clientWidth+trueBody.scrollLeft) < parseInt(osw+pos[0])) {
+ o.div.style.left = Math.abs(parseInt((trueBody.clientWidth+trueBody.scrollLeft) - osw)) + "px";
+ } else {
+ o.div.style.left = pos[0] + "px";
+ };
+
+ if ( parseInt(trueBody.clientHeight+trueBody.scrollTop) < parseInt(osh+pos[1]+elem.offsetHeight+2)) {
+ o.div.style.top = Math.abs(parseInt(pos[1] - (osh + 2))) + "px";
+ } else {
+ o.div.style.top = Math.abs(parseInt(pos[1] + elem.offsetHeight + 2)) + "px";
+ };
+ };
+ o.equaliseDates = function() {
+ var clearDayFound = false;
+ var tmpDate;
+ for(var i = o.low; i <= o.high; i++) {
+ tmpDate = String(i);
+ if(!o.disableDays[new Date(tmpDate.substr(4,2) + '/' + tmpDate.substr(6,2) + '/' + tmpDate.substr(0,4)).getDay() - 1]) {
+ clearDayFound = true;
+ break;
+ };
+ };
+ if(!clearDayFound) o.disableDays = o.defaults.disableDays = [0,0,0,0,0,0,0];
+ };
+ o.outOfRange = function(tmpDate) {
+ if(!o.low && !o.high) return false;
+
+ var level = false;
+ if(!tmpDate) {
+ level = true;
+ tmpDate = o.date;
+ };
+
+ var d = (tmpDate.getDate() < 10) ? "0" + tmpDate.getDate() : tmpDate.getDate();
+ var m = ((tmpDate.getMonth() + 1) < 10) ? "0" + (tmpDate.getMonth() + 1) : tmpDate.getMonth() + 1;
+ var y = tmpDate.getFullYear();
+ var dt = (y+' '+m+' '+d).replace(/ /g,'');
+
+ if(o.low) {
+ if(parseInt(dt) < parseInt(o.low)) {
+ if(!level) return true;
+ o.date = new Date( o.low.substr(4,2) + '/' + o.low.substr(6,2) + '/' + o.low.substr(0,4) );
+ return false;
+ };
+ };
+ if(o.high) {
+ if(parseInt(dt) > parseInt(o.high)) {
+ if(!level) return true;
+ o.date = new Date( o.high.substr(4,2) + '/' + o.high.substr(6,2) + '/' + o.high.substr(0,4) );
+ };
+ };
+ return false;
+ };
+ o.create = function() {
+
+ /*@cc_on@*/
+ /*@if(@_jscript_version <= 5.6)
+ if(!document.getElementById("iePopUpHack")) {
+ var loc = "./blank.html";
+ var scriptFiles = document.getElementsByTagName('head')[0].getElementsByTagName('script');
+ for(var i = 0, scriptFile; scriptFile = scriptFiles[i]; i++) {
+ if(scriptFile.src && scriptFile.src.match(/datepicker.js$/)) {
+ loc = scriptFile.src.replace("datepicker.js", "blank.html");
+ break;
+ };
+ };
+
+ o.iePopUp = document.createElement('iframe');
+ o.iePopUp.src = loc;
+ o.iePopUp.setAttribute('className','iehack');
+ o.iePopUp.scrolling="no";
+ o.iePopUp.frameBorder="0";
+ o.iePopUp.name = o.iePopUp.id = "iePopUpHack";
+ document.body.appendChild(o.iePopUp);
+ } else {
+ o.iePopUp = document.getElementById("iePopUpHack");
+ };
+ /*@end@*/
+
+ if(typeof(fdLocale) == "object" && o.locale) {
+ datePicker.titles = fdLocale.titles;
+ datePicker.months = fdLocale.months;
+ datePicker.fullDay = fdLocale.fullDay;
+ // Optional parameters
+ if(fdLocale.dayAbbr) datePicker.dayAbbr = fdLocale.dayAbbr;
+ if(fdLocale.firstDayOfWeek) o.firstDayOfWeek = o.defaults.firstDayOfWeek = fdLocale.firstDayOfWeek;
+ };
+
+ o.div = document.createElement('div');
+ o.div.style.zIndex = 9999;
+ o.div.id = "fd-"+o.id;
+ var tableBody = document.createElement('tbody');
+ var tableHead = document.createElement('thead');
+ var nbsp = String.fromCharCode( 160 );
+
+ o.table = document.createElement('table');
+ o.div.className = "datePicker";
+
+ var tr = document.createElement('tr');
+ var th = document.createElement('th');
+
+ // previous year
+ var tmpelem = document.createElement('button');
+ tmpelem.setAttribute("type", "button");
+ tmpelem.className = "prev-but";
+ tmpelem.appendChild(document.createTextNode('\u00AB'));
+ tmpelem.title = datePicker.titles[2];
+ tmpelem.onmousedown = function(e) { this.blur(); o.events.incDec(e,0,-1,0); };
+ tmpelem.onmouseup = o.events.clearTimer;
+ th.appendChild( tmpelem );
+
+ // previous month
+ var tmpelem = document.createElement('button');
+ tmpelem.setAttribute("type", "button");
+ tmpelem.className = "prev-but";
+ tmpelem.appendChild(document.createTextNode("\u2039"));
+ tmpelem.title = datePicker.titles[0];
+ tmpelem.onmousedown = function(e) { this.blur(); o.events.incDec(e,0,0,-1); };
+ tmpelem.onmouseup = o.events.clearTimer;
+ th.appendChild( tmpelem );
+ tr.appendChild( th );
+
+ // title bar
+ o.titleBar = document.createElement('th');
+
+ /*@cc_on
+ /*@if (@_win32)
+ o.titleBar.setAttribute('colSpan','5');
+ @else @*/
+ o.titleBar.setAttribute('colspan','5');
+ /*@end
+ @*/
+
+ o.titleBar.setAttribute('text-align','center');
+ tr.appendChild( o.titleBar );
+
+ th = document.createElement('th');
+
+ // next month
+ var tmpelem = document.createElement('button');
+ tmpelem.setAttribute("type", "button");
+ tmpelem.className = "next-but";
+ tmpelem.appendChild(document.createTextNode('\u203A'));
+ tmpelem.title = datePicker.titles[1];
+ tmpelem.onmousedown = function(e) { this.blur(); o.events.incDec(e,0,0,1); };
+ tmpelem.onmouseup = o.events.clearTimer;
+
+ th.appendChild( tmpelem );
+
+ // next year
+ var tmpelem = document.createElement('button');
+ tmpelem.setAttribute("type", "button");
+ tmpelem.className = "next-but";
+ tmpelem.appendChild(document.createTextNode('\u00BB'));
+ tmpelem.title = datePicker.titles[3];
+ tmpelem.onmousedown = function(e) { this.blur(); o.events.incDec(e,0,1,0); };
+ tmpelem.onmouseup = o.events.clearTimer;
+ th.appendChild( tmpelem );
+
+ tr.appendChild( th );
+
+ tableHead.appendChild(tr);
+
+ var row, col;
+
+ for(var rows = 0; rows < 7; rows++) {
+ row = document.createElement('tr');
+ for(var cols = 0; cols < 7; cols++) {
+ col = (rows == 0) ? document.createElement('th') : document.createElement('td');
+ if(rows != 0) {
+ col.appendChild(document.createTextNode(nbsp));
+ } else {
+ col.className = "date-picker-day-header";
+ col.scope = "col";
+ };
+
+ row.appendChild(col);
+ }
+ if(rows != 0) tableBody.appendChild(row);
+ else tableHead.appendChild(row);
+ };
+ o.table.appendChild( tableHead );
+ o.table.appendChild( tableBody );
+
+ o.div.appendChild( o.table );
+ o.created = true;
+
+ document.getElementsByTagName('body')[0].appendChild( o.div );
+ };
+ o.setDateFromInput = function() {
+ o.dateSet = null;
+
+ var elem = o.getElem();
+ if(!elem) return;
+
+ var date = elem.value;
+
+ var d,m,y,dt,dates;
+
+ d = o.format.replace(/-/g,'').indexOf('d');
+ m = o.format.replace(/-/g,'').indexOf('m');
+ y = o.format.replace(/-/g,'').indexOf('y');
+
+ if(o.splitDate) {
+ dates = [];
+
+ dates[m] = document.getElementById(o.id+'-mm').value;
+ if(dates[m] < 1 || dates[m] > 12) dates[m] = "";
+
+ dates[d] = document.getElementById(o.id+'-dd').value;
+ if(dates[d] < 1 || dates[d] > datePicker.daysPerMonth[dates[m]-1]) dates[d] = "";
+
+ dates[y] = date;
+ } else {
+ if(date.match(/^[0-9]{4}$/)) {
+ if(date > 1600 && date < 2030) {
+ o.date.setFullYear(date);
+ return;
+ };
+ };
+
+ dates = date.split(o.divider);
+
+ if(dates.length != 3) {
+ o.date = new Date();
+ return;
+ };
+ };
+
+ var check = new Date( dates[y] + "/" + dates[m] + "/" + dates[d] );
+ if(check == 'Invalid Date' /*@cc_on@*/ /*@if(@_win32) || check == 'NaN' /*@end@*/) {
+ o.date = new Date();
+ return;
+ };
+
+ o.date.setMonth(dates[m]-1);
+ o.date.setFullYear(dates[y]);
+ o.date.setDate(dates[d]);
+
+ o.dateSet = new Date(o.date);
+ };
+ o.returnFormattedDate = function() {
+ var elem = o.getElem();
+ if(!elem) return;
+
+ var d = (o.date.getDate() < 10) ? "0" + o.date.getDate() : o.date.getDate();
+ var m = ((o.date.getMonth() + 1) < 10) ? "0" + (o.date.getMonth() + 1) : o.date.getMonth() + 1;
+ var yyyy = o.date.getFullYear();
+
+ var weekDay = ( o.date.getDay() + 6 ) % 7;
+
+ if(!(o.disableDays[weekDay])) {
+ if(o.splitDate) {
+ document.getElementById(o.id+"-dd").value = d;
+ document.getElementById(o.id+"-mm").value = m;
+ elem.value = yyyy;
+
+ document.getElementById(o.id+"-dd").focus();
+ if(document.getElementById(o.id+"-dd").onchange) document.getElementById(o.id+"-dd").onchange();
+ if(document.getElementById(o.id+"-mm").onchange) document.getElementById(o.id+"-mm").onchange();
+ } else {
+ elem.value = o.format.replace('y',yyyy).replace('m',m).replace('d',d).replace(/-/g,o.divider);
+ elem.focus();
+ };
+ if(elem.onchange) elem.onchange();
+ };
+ };
+ // Credit where credit's due:
+
+ // Most of the logic for this method from the webfx date-picker
+ // http://webfx.eae.net/
+
+ o.updateTable = function() {
+
+ if(document.getElementById("date-picker-hover")) {
+ document.getElementById("date-picker-hover").id = "";
+ };
+
+ var i;
+ var str = "";
+ var rows = 6;
+ var cols = 7;
+ var currentWeek = 0;
+ var nbsp = String.fromCharCode( 160 );
+
+ var cells = new Array( rows );
+
+ for ( i = 0; i < rows; i++ ) {
+ cells[i] = new Array( cols );
+ };
+
+ o.outOfRange();
+
+ // Set the tmpDate to this month
+ var tmpDate = new Date( o.date.getFullYear(), o.date.getMonth(), 1 );
+ var today = new Date();
+
+ // titleBar
+ var titleText = datePicker.months[o.date.getMonth()] + nbsp + o.date.getFullYear();
+ while(o.titleBar.firstChild) o.titleBar.removeChild(o.titleBar.firstChild);
+ o.titleBar.appendChild(document.createTextNode(titleText));
+
+ for ( i = 1; i < 32; i++ ) {
+
+ tmpDate.setDate( i );
+ var weekDay = ( tmpDate.getDay() + 6 ) % 7;
+ var colIndex = ( (weekDay - o.firstDayOfWeek) + 7 ) % 7;
+ var cell = { text:"", className:"", id:"" };
+
+ if ( tmpDate.getMonth() == o.date.getMonth() ) {
+
+ cells[currentWeek][colIndex] = { text:"", className:"", id:"" };
+
+ var isToday = tmpDate.getDate() == today.getDate() &&
+ tmpDate.getMonth() == today.getMonth() &&
+ tmpDate.getFullYear() == today.getFullYear();
+
+ if ( o.dateSet != null && o.dateSet.getDate() == tmpDate.getDate() && o.dateSet.getMonth() == tmpDate.getMonth() && o.dateSet.getFullYear() == tmpDate.getFullYear()) {
+ cells[currentWeek][colIndex].className = "date-picker-selected-date";
+ };
+ if ( o.date.getDate() == tmpDate.getDate() && o.date.getFullYear() == tmpDate.getFullYear()) {
+ cells[currentWeek][colIndex].id = "date-picker-hover";
+ };
+
+ if(o.highlightDays[weekDay]) {
+ cells[currentWeek][colIndex].className += " date-picker-highlight";
+ };
+ if ( isToday ) {
+ cells[currentWeek][colIndex].className = "date-picker-today";
+ };
+ if(o.outOfRange(tmpDate)) {
+ cells[currentWeek][colIndex].className = "out-of-range";
+ } else if(o.disableDays[weekDay]) {
+ cells[currentWeek][colIndex].className = "day-disabled";
+ };
+ cells[currentWeek][colIndex].text = tmpDate.getDate();
+ if ( colIndex == 6 ) currentWeek++;
+ };
+ };
+
+ // Table headers
+ var lnk, d;
+ var ths = o.table.getElementsByTagName('thead')[0].getElementsByTagName('tr')[1].getElementsByTagName('th');
+ for ( var y = 0; y < 7; y++ ) {
+ d = (o.firstDayOfWeek + y) % 7;
+
+ while(ths[y].firstChild) ths[y].removeChild(ths[y].firstChild);
+
+ ths[y].title = datePicker.fullDay[d];
+
+ // Don't create a button for the first day header
+ if(y > 0) {
+ but = document.createElement("BUTTON");
+ but.className = "fd-day-header";
+ but.onclick = but.onkeypress = ths[y].onclick = o.setFirstDayOfWeek;
+ but.appendChild(document.createTextNode(datePicker.dayAbbr ? datePicker.dayAbbr[d] : datePicker.fullDay[d].charAt(0)));
+ ths[y].appendChild(but);
+ but.title = datePicker.fullDay[d];
+ } else {
+ ths[y].appendChild(document.createTextNode(datePicker.dayAbbr ? datePicker.dayAbbr[d] : datePicker.fullDay[d].charAt(0)));
+ ths[y].onclick = null;
+ };
+ };
+
+
+ var trs = o.table.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
+
+ var tmpCell;
+
+ for ( var y = 0; y < rows; y++ ) {
+ var tds = trs[y].getElementsByTagName('td');
+ for (var x = 0; x < cols; x++) {
+ tmpCell = tds[x];
+
+ while(tmpCell.firstChild) tmpCell.removeChild(tmpCell.firstChild);
+
+ if ( typeof cells[y][x] != "undefined" ) {
+ tmpCell.className = cells[y][x].className;
+ tmpCell.id = cells[y][x].id;
+
+ tmpCell.appendChild(document.createTextNode(cells[y][x].text));
+
+ if(cells[y][x].className != "out-of-range") {
+ tmpCell.onmouseover = o.events.onmouseover;
+ tmpCell.onclick = cells[y][x].className == "day-disabled" ? o.killEvent : o.events.onclick;
+ tmpCell.title = datePicker.months[o.date.getMonth()] + nbsp + cells[y][x].text + "," + nbsp + o.date.getFullYear();
+ } else {
+ tmpCell.onmouseover = null;
+ tmpCell.onclick = o.killEvent;
+ tmpCell.title = "";
+ };
+ } else {
+ tmpCell.className = "";
+ tmpCell.id = "";
+ tmpCell.onmouseover = null;
+ tmpCell.onclick = function(e) { return o.killEvent(e); };
+ tmpCell.appendChild(document.createTextNode(nbsp));
+ tmpCell.title = "";
+ };
+ };
+ };
+ };
+ o.init = function() {
+ if(o.low && o.high && (o.high - o.low < 7)) {
+ o.equaliseDates();
+ };
+ o.resize();
+ o.setDateFromInput();
+ o.fade();
+ o.ieHack(true);
+ };
+ o.ieHack = function(cleanup) {
+ // IE hack
+ if(o.iePopUp) {
+ o.iePopUp.style.display = "block";
+ o.iePopUp.style.top = (o.div.offsetTop + 2) + "px";
+ o.iePopUp.style.left = o.div.offsetLeft + "px";
+ o.iePopUp.style.width = o.div.clientWidth + "px";
+ o.iePopUp.style.height = (o.div.clientHeight - 2) + "px";
+ if(cleanup) o.iePopUp.style.display = "none";
+ }
+ };
+ o.show = function() {
+ var elem = o.getElem();
+ if(!elem || o.visible || elem.disabled) return;
+
+ o.reset();
+ o.setDateFromInput();
+ o.updateTable();
+ o.resize();
+ o.ieHack(false);
+
+ datePickerController.addEvent(document, "mousedown", o.events.onmousedown);
+ datePickerController.addEvent(document, "keypress", o.events.onkeydown);
+
+ // Internet Explorer requires the keydown event in order to catch arrow keys
+
+ /*@cc_on@*/
+ /*@if(@_win32)
+ datePickerController.removeEvent(document, "keypress", o.events.onkeydown);
+ datePickerController.addEvent(document, "keydown", o.events.onkeydown);
+ /*@end@*/
+
+ o.opacityTo = 90;
+ o.div.style.display = "block";
+ o.ieHack(false);
+ o.fade();
+ o.visible = true;
+
+ };
+ o.hide = function() {
+ try {
+ datePickerController.removeEvent(document, "mousedown", o.events.onmousedown);
+ datePickerController.removeEvent(document, "keypress", o.events.onkeydown);
+ datePickerController.removeEvent(document, "keydown", o.events.onkeydown);
+ } catch(e) {
+
+ };
+ if(o.iePopUp) {
+ o.iePopUp.style.display = "none";
+ };
+ o.opacityTo = 0;
+ o.fade();
+ o.visible = false;
+ };
+ o.create();
+ o.init();
+};
+
+datePickerController = {
+ datePickers: {},
+ addEvent: function(obj, type, fn, tmp) {
+ tmp || (tmp = true);
+ if( obj.attachEvent ) {
+ obj["e"+type+fn] = fn;
+ obj[type+fn] = function(){obj["e"+type+fn]( window.event );};
+ obj.attachEvent( "on"+type, obj[type+fn] );
+ } else {
+ obj.addEventListener( type, fn, true );
+ };
+ },
+ removeEvent: function(obj, type, fn, tmp) {
+ tmp || (tmp = true);
+ if( obj.detachEvent ) {
+ obj.detachEvent( "on"+type, obj[type+fn] );
+ obj[type+fn] = null;
+ } else {
+ obj.removeEventListener( type, fn, true );
+ };
+ },
+ findPosition: function(obj) {
+ var curleft = 0;
+ var curtop = 0;
+ var orig = obj;
+
+ if(obj.offsetParent) {
+ while(obj.offsetParent) {
+ curleft += obj.offsetLeft;
+ curtop += obj.offsetTop;
+ obj = obj.offsetParent;
+ };
+ } else if (obj.x) {
+ curleft += obj.x;
+ curtop += obj.y;
+ };
+ return [ curleft, curtop ];
+ },
+ hideAll: function(exception) {
+ for(dp in datePickerController.datePickers) {
+ if(exception && exception == datePickerController.datePickers[dp].id) continue;
+ datePickerController.datePickers[dp].hide();
+ };
+ },
+ cleanUp: function() {
+ var dp;
+ for(dp in datePickerController.datePickers) {
+ if(!document.getElementById(datePickerController.datePickers[dp].id)) {
+ dpElem = document.getElementById("fd-"+datePickerController.datePickers[dp].id);
+ if(dpElem) {
+ dpElem.parentNode.removeChild(dpElem);
+ };
+ datePickerController.datePickers[dp] = null;
+ delete datePickerController.datePickers[dp];
+ };
+ };
+ },
+ dateFormat: function(dateIn, favourMDY) {
+ var dateTest = [
+ { regExp:/^(0[1-9]|[12][0-9]|3[01])([- \/.])(0[1-9]|1[012])([- \/.])(\d\d?\d\d)$/, d:1, m:3, y:5 }, // dmy
+ { regExp:/^(0[1-9]|1[012])([- \/.])(0[1-9]|[12][0-9]|3[01])([- \/.])(\d\d?\d\d)$/, d:3, m:1, y:5 }, // mdy
+ { regExp:/^(\d\d?\d\d)([- \/.])(0[1-9]|1[012])([- \/.])(0[1-9]|[12][0-9]|3[01])$/, d:5, m:3, y:1 } // ymd
+ ];
+
+ var start;
+ var cnt = 0;
+
+ while(cnt < 3) {
+ start = (cnt + (favourMDY ? 4 : 3)) % 3;
+
+ if(dateIn.match(dateTest[start].regExp)) {
+ res = dateIn.match(dateTest[start].regExp);
+ y = res[dateTest[start].y];
+ m = res[dateTest[start].m];
+ d = res[dateTest[start].d];
+ if(m.length == 1) m = "0" + m;
+ if(d.length == 1) d = "0" + d;
+ if(y.length != 4) y = (parseInt(y) < 50) ? '20' + y : '19' + y;
+
+ return y+m+d;
+ };
+
+ cnt++;
+ };
+
+ return 0;
+ },
+ create: function() {
+ if(!datePicker.isSupported) return;
+
+ datePickerController.cleanUp();
+
+ var inputs = document.getElementsByTagName('input');
+
+ var regExp1 = /disable-days-([1-7]){1,6}/g; // the days to disable
+ var regExp3 = /highlight-days-([1-7]){1,7}/g; // the days to highlight in red
+ var regExp4 = /range-low-([0-9\-]){10}/g; // the lowest selectable date
+ var regExp5 = /range-high-([0-9\-]){10}/g; // the highest selectable date
+ var regExp6 = /format-([dmy\-]{5})/g; // the input/output date format
+ var regExp7 = /divider-(dot|slash|space|dash)/g; // the character used to divide the date
+ var regExp8 = /no-locale/g; // do not attempt to detect the browser language
+
+ for(var i=0, inp; inp = inputs[i]; i++) {
+ if(inp.className && (inp.className.search(regExp6) != -1 || inp.className.search(/split-date/) != -1) && inp.type == "text" && inp.name) {
+
+ if(!inp.id) {
+ // Internet explorer requires you to give each input a unique ID attribute.
+ if(document.getElementById(inp.name)) continue;
+ inp.id = inp.name;
+ };
+
+ var options = {
+ id:inp.id,
+ low:"",
+ high:"",
+ divider:"/",
+ format:"d-m-y",
+ highlightDays:[0,0,0,0,0,1,1],
+ disableDays:[0,0,0,0,0,0,0],
+ locale:inp.className.search(regExp8) == -1,
+ splitDate:0
+ };
+
+ // Split the date into three parts ?
+ if(inp.className.search(/split-date/) != -1) {
+ if(document.getElementById(inp.id+'-dd') && document.getElementById(inp.id+'-mm') && document.getElementById(inp.id+'-dd').tagName.toLowerCase() == "input" && document.getElementById(inp.id+'-mm').tagName.toLowerCase() == "input") {
+ options.splitDate = 1;
+ };
+ };
+
+ // Date format(variations of d-m-y)
+ if(inp.className.search(regExp6) != -1) {
+ options.format = inp.className.match(regExp6)[0].replace('format-','');
+ };
+
+ // What divider to use, a "/", "-", "." or " "
+ if(inp.className.search(regExp7) != -1) {
+ var divider = inp.className.match(regExp7)[0].replace('divider-','');
+ switch(divider.toLowerCase()) {
+ case "dot":
+ options.divider = ".";
+ break;
+ case "space":
+ options.divider = " ";
+ break;
+ case "dash":
+ options.divider = "-";
+ break;
+ default:
+ options.divider = "/";
+ };
+ };
+
+ // The days to highlight
+ if(inp.className.search(regExp3) != -1) {
+ var tmp = inp.className.match(regExp3)[0].replace(/highlight-days-/, '');
+ options.highlightDays = [0,0,0,0,0,0,0];
+ for(var j = 0; j < tmp.length; j++) {
+ options.highlightDays[tmp.charAt(j) - 1] = 1;
+ };
+ };
+
+ // The days to disable
+ if(inp.className.search(regExp1) != -1) {
+ var tmp = inp.className.match(regExp1)[0].replace(/disable-days-/, '');
+ options.disableDays = [0,0,0,0,0,0,0];
+ for(var j = 0; j < tmp.length; j++) {
+ options.disableDays[tmp.charAt(j) - 1] = 1;
+ };
+ };
+
+ // The lower limit
+ if(inp.className.search(regExp4) != -1) {
+ options.low = datePickerController.dateFormat(inp.className.match(regExp4)[0].replace(/range-low-/, ''), options.format.charAt(0) == "m");
+ if(options.low == 0) {
+ options.low = '';
+ };
+ };
+
+ // The higher limit
+ if(inp.className.search(regExp5) != -1) {
+ options.high = datePickerController.dateFormat(inp.className.match(regExp5)[0].replace(/range-high-/, ''), options.format.charAt(0) == "m");
+ if(options.high == 0) {
+ options.high = '';
+ };
+ };
+
+ // Datepicker is already created so reset it's defaults
+ if(document.getElementById('fd-'+inp.id)) {
+ for(var opt in options) {
+ datePickerController.datePickers[inp.id].defaults[opt] = options[opt];
+ };
+ };
+
+ // Create the button (if needs be)
+ if(!document.getElementById("fd-but-" + inp.id)) {
+ var but = document.createElement('button');
+ but.setAttribute("type", "button");
+ but.className = "date-picker-control";
+
+ but.id = "fd-but-" + inp.id;
+ but.appendChild(document.createTextNode(String.fromCharCode( 160 )));
+
+ if(inp.nextSibling) {
+ inp.parentNode.insertBefore(but, inp.nextSibling);
+ } else {
+ inp.parentNode.appendChild(but);
+ };
+
+ } else {
+ var but = document.getElementById("fd-but-" + inp.id);
+ };
+
+ // Add button events
+ but.onclick = but.onpress = function() {
+ var inpId = this.id.replace('fd-but-','');
+
+ datePickerController.hideAll(inpId);
+ if(inpId in datePickerController.datePickers && !datePickerController.datePickers[inpId].visible) {
+ datePickerController.datePickers[inpId].show();
+ };
+ return false;
+ };
+
+ // Create the datePicker (if needs be)
+ if(!document.getElementById('fd-'+inp.id)) {
+ datePickerController.datePickers[inp.id] = new datePicker(options);
+ };
+ };
+ };
+ }
+
+};
+
+
+})();
+
+datePickerController.addEvent(window, 'load', datePickerController.create);
+
diff --git a/src/usr/local/www/javascript/datepicker/media/bg_header.jpg b/src/usr/local/www/javascript/datepicker/media/bg_header.jpg
new file mode 100755
index 0000000..10dbd74
--- /dev/null
+++ b/src/usr/local/www/javascript/datepicker/media/bg_header.jpg
Binary files differ
diff --git a/src/usr/local/www/javascript/datepicker/media/bullet1.gif b/src/usr/local/www/javascript/datepicker/media/bullet1.gif
new file mode 100755
index 0000000..ae352c2
--- /dev/null
+++ b/src/usr/local/www/javascript/datepicker/media/bullet1.gif
Binary files differ
diff --git a/src/usr/local/www/javascript/datepicker/media/bullet2.gif b/src/usr/local/www/javascript/datepicker/media/bullet2.gif
new file mode 100755
index 0000000..04b293d
--- /dev/null
+++ b/src/usr/local/www/javascript/datepicker/media/bullet2.gif
Binary files differ
diff --git a/src/usr/local/www/javascript/datepicker/media/cal.gif b/src/usr/local/www/javascript/datepicker/media/cal.gif
new file mode 100755
index 0000000..8526cf5
--- /dev/null
+++ b/src/usr/local/www/javascript/datepicker/media/cal.gif
Binary files differ
diff --git a/src/usr/local/www/javascript/datepicker/media/gradient-e5e5e5-ffffff.gif b/src/usr/local/www/javascript/datepicker/media/gradient-e5e5e5-ffffff.gif
new file mode 100755
index 0000000..72a0d3e
--- /dev/null
+++ b/src/usr/local/www/javascript/datepicker/media/gradient-e5e5e5-ffffff.gif
Binary files differ
diff --git a/src/usr/local/www/javascript/domTT/LICENSE b/src/usr/local/www/javascript/domTT/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/src/usr/local/www/javascript/domTT/LICENSE
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/src/usr/local/www/javascript/domTT/behaviour.js b/src/usr/local/www/javascript/domTT/behaviour.js
new file mode 100644
index 0000000..21b28d7
--- /dev/null
+++ b/src/usr/local/www/javascript/domTT/behaviour.js
@@ -0,0 +1,254 @@
+/*
+ Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work
+ of Simon Willison (see comments by Simon below).
+
+ Description:
+
+ Uses css selectors to apply javascript behaviours to enable
+ unobtrusive javascript in html documents.
+
+ Usage:
+
+ var myrules = {
+ 'b.someclass' : function(element){
+ element.onclick = function(){
+ alert(this.innerHTML);
+ }
+ },
+ '#someid u' : function(element){
+ element.onmouseover = function(){
+ this.innerHTML = "BLAH!";
+ }
+ }
+ };
+
+ Behaviour.register(myrules);
+
+ // Call Behaviour.apply() to re-apply the rules (if you
+ // update the dom, etc).
+
+ License:
+
+ This file is entirely BSD licensed.
+
+ More information:
+
+ http://ripcord.co.nz/behaviour/
+
+*/
+
+var Behaviour = {
+ list : new Array,
+
+ register : function(sheet){
+ Behaviour.list.push(sheet);
+ },
+
+ start : function(){
+ Behaviour.addLoadEvent(function(){
+ Behaviour.apply();
+ });
+ },
+
+ apply : function(){
+ for (h=0;sheet=Behaviour.list[h];h++){
+ for (selector in sheet){
+ list = document.getElementsBySelector(selector);
+
+ if (!list){
+ continue;
+ }
+
+ for (i=0;element=list[i];i++){
+ sheet[selector](element);
+ }
+ }
+ }
+ },
+
+ addLoadEvent : function(func){
+ var oldonload = window.onload;
+
+ if (typeof window.onload != 'function') {
+ window.onload = func;
+ } else {
+ window.onload = function() {
+ oldonload();
+ func();
+ };
+ }
+ }
+};
+
+Behaviour.start();
+
+/*
+ The following code is Copyright (C) Simon Willison 2004.
+
+ document.getElementsBySelector(selector)
+ - returns an array of element objects from the current document
+ matching the CSS selector. Selectors can contain element names,
+ class names and ids and can be nested. For example:
+
+ elements = document.getElementsBySelect('div#main p a.external')
+
+ Will return an array of all 'a' elements with 'external' in their
+ class attribute that are contained inside 'p' elements that are
+ contained inside the 'div' element which has id="main"
+
+ New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
+ See http://www.w3.org/TR/css3-selectors/#attribute-selectors
+
+ Version 0.4 - Simon Willison, March 25th 2003
+ -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
+ -- Opera 7 fails
+*/
+
+function getAllChildren(e) {
+ // Returns all children of element. Workaround required for IE5/Windows. Ugh.
+ return e.all ? e.all : e.getElementsByTagName('*');
+}
+
+document.getElementsBySelector = function(selector) {
+ // Attempt to fail gracefully in lesser browsers
+ if (!document.getElementsByTagName) {
+ return new Array();
+ }
+ // Split selector in to tokens
+ var tokens = selector.split(' ');
+ var currentContext = new Array(document);
+ for (var i = 0; i < tokens.length; i++) {
+ token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');
+ if (token.indexOf('#') > -1) {
+ // Token is an ID selector
+ var bits = token.split('#');
+ var tagName = bits[0];
+ var id = bits[1];
+ var element = document.getElementById(id);
+ if (tagName && element.nodeName.toLowerCase() != tagName) {
+ // tag with that ID not found, return false
+ return new Array();
+ }
+ // Set currentContext to contain just this element
+ currentContext = new Array(element);
+ continue; // Skip to next token
+ }
+ if (token.indexOf('.') > -1) {
+ // Token contains a class selector
+ var bits = token.split('.');
+ var tagName = bits[0];
+ var className = bits[1];
+ if (!tagName) {
+ tagName = '*';
+ }
+ // Get elements matching tag, filter them for class selector
+ var found = new Array;
+ var foundCount = 0;
+ for (var h = 0; h < currentContext.length; h++) {
+ var elements;
+ if (tagName == '*') {
+ elements = getAllChildren(currentContext[h]);
+ } else {
+ elements = currentContext[h].getElementsByTagName(tagName);
+ }
+ for (var j = 0; j < elements.length; j++) {
+ found[foundCount++] = elements[j];
+ }
+ }
+ currentContext = new Array;
+ var currentContextIndex = 0;
+ for (var k = 0; k < found.length; k++) {
+ if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
+ currentContext[currentContextIndex++] = found[k];
+ }
+ }
+ continue; // Skip to next token
+ }
+ // Code to deal with attribute selectors
+ if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
+ var tagName = RegExp.$1;
+ var attrName = RegExp.$2;
+ var attrOperator = RegExp.$3;
+ var attrValue = RegExp.$4;
+ if (!tagName) {
+ tagName = '*';
+ }
+ // Grab all of the tagName elements within current context
+ var found = new Array;
+ var foundCount = 0;
+ for (var h = 0; h < currentContext.length; h++) {
+ var elements;
+ if (tagName == '*') {
+ elements = getAllChildren(currentContext[h]);
+ } else {
+ elements = currentContext[h].getElementsByTagName(tagName);
+ }
+ for (var j = 0; j < elements.length; j++) {
+ found[foundCount++] = elements[j];
+ }
+ }
+ currentContext = new Array;
+ var currentContextIndex = 0;
+ var checkFunction; // This function will be used to filter the elements
+ switch (attrOperator) {
+ case '=': // Equality
+ checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
+ break;
+ case '~': // Match one of space separated words
+ checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
+ break;
+ case '|': // Match start with value followed by optional hyphen
+ checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
+ break;
+ case '^': // Match starts with value
+ checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
+ break;
+ case '$': // Match ends with value - fails with "Warning" in Opera 7
+ checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
+ break;
+ case '*': // Match ends with value
+ checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
+ break;
+ default :
+ // Just test for existence of attribute
+ checkFunction = function(e) { return e.getAttribute(attrName); };
+ }
+ currentContext = new Array;
+ var currentContextIndex = 0;
+ for (var k = 0; k < found.length; k++) {
+ if (checkFunction(found[k])) {
+ currentContext[currentContextIndex++] = found[k];
+ }
+ }
+ // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
+ continue; // Skip to next token
+ }
+
+ if (!currentContext[0]){
+ return;
+ }
+
+ // If we get here, token is JUST an element (not a class or ID selector)
+ tagName = token;
+ var found = new Array;
+ var foundCount = 0;
+ for (var h = 0; h < currentContext.length; h++) {
+ var elements = currentContext[h].getElementsByTagName(tagName);
+ for (var j = 0; j < elements.length; j++) {
+ found[foundCount++] = elements[j];
+ }
+ }
+ currentContext = found;
+ }
+ return currentContext;
+}
+
+/* That revolting regular expression explained
+/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
+ \---/ \---/\-------------/ \-------/
+ | | | |
+ | | | The value
+ | | ~,|,^,$,* or =
+ | Attribute
+ Tag
+*/
diff --git a/src/usr/local/www/javascript/domTT/domLib.js b/src/usr/local/www/javascript/domTT/domLib.js
new file mode 100644
index 0000000..9a51a34
--- /dev/null
+++ b/src/usr/local/www/javascript/domTT/domLib.js
@@ -0,0 +1,706 @@
+/** $Id: domLib.js 2321 2006-06-12 06:45:41Z dallen $ */
+// {{{ license
+
+/*
+ * Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// }}}
+// {{{ intro
+
+/**
+ * Title: DOM Library Core
+ * Version: 0.70
+ *
+ * Summary:
+ * A set of commonly used functions that make it easier to create javascript
+ * applications that rely on the DOM.
+ *
+ * Updated: 2005/05/17
+ *
+ * Maintainer: Dan Allen <dan.allen@mojavelinux.com>
+ * Maintainer: Jason Rust <jrust@rustyparts.com>
+ *
+ * License: Apache 2.0
+ */
+
+// }}}
+// {{{ global constants (DO NOT EDIT)
+
+// -- Browser Detection --
+var domLib_userAgent = navigator.userAgent.toLowerCase();
+var domLib_isMac = navigator.appVersion.indexOf('Mac') != -1;
+var domLib_isWin = domLib_userAgent.indexOf('windows') != -1;
+// NOTE: could use window.opera for detecting Opera
+var domLib_isOpera = domLib_userAgent.indexOf('opera') != -1;
+var domLib_isOpera7up = domLib_userAgent.match(/opera.(7|8)/i);
+var domLib_isSafari = domLib_userAgent.indexOf('safari') != -1;
+var domLib_isKonq = domLib_userAgent.indexOf('konqueror') != -1;
+// Both konqueror and safari use the khtml rendering engine
+var domLib_isKHTML = (domLib_isKonq || domLib_isSafari || domLib_userAgent.indexOf('khtml') != -1);
+var domLib_isIE = (!domLib_isKHTML && !domLib_isOpera && (domLib_userAgent.indexOf('msie 5') != -1 || domLib_userAgent.indexOf('msie 6') != -1 || domLib_userAgent.indexOf('msie 7') != -1 || domLib_userAgent.indexOf('msie 8') != -1));
+var domLib_isIE5up = domLib_isIE;
+var domLib_isIE50 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.0') != -1);
+var domLib_isIE55 = (domLib_isIE && domLib_userAgent.indexOf('msie 5.5') != -1);
+var domLib_isIE5 = (domLib_isIE50 || domLib_isIE55);
+// safari and konq may use string "khtml, like gecko", so check for destinctive /
+var domLib_isGecko = domLib_userAgent.indexOf('gecko/') != -1;
+var domLib_isMacIE = (domLib_isIE && domLib_isMac);
+var domLib_isIE55up = domLib_isIE5up && !domLib_isIE50 && !domLib_isMacIE;
+var domLib_isIE6up = domLib_isIE55up && !domLib_isIE55;
+
+// -- Browser Abilities --
+var domLib_standardsMode = (document.compatMode && document.compatMode == 'CSS1Compat');
+var domLib_useLibrary = (domLib_isOpera7up || domLib_isKHTML || domLib_isIE5up || domLib_isGecko || domLib_isMacIE || document.defaultView);
+// fixed in Konq3.2
+var domLib_hasBrokenTimeout = (domLib_isMacIE || (domLib_isKonq && domLib_userAgent.match(/konqueror\/3.([2-9])/) == null));
+var domLib_canFade = (domLib_isGecko || domLib_isIE || domLib_isSafari || domLib_isOpera);
+var domLib_canDrawOverSelect = (domLib_isMac || domLib_isOpera || domLib_isGecko);
+var domLib_canDrawOverFlash = (domLib_isMac || domLib_isWin);
+
+// -- Event Variables --
+var domLib_eventTarget = domLib_isIE ? 'srcElement' : 'currentTarget';
+var domLib_eventButton = domLib_isIE ? 'button' : 'which';
+var domLib_eventTo = domLib_isIE ? 'toElement' : 'relatedTarget';
+var domLib_stylePointer = domLib_isIE ? 'hand' : 'pointer';
+// NOTE: a bug exists in Opera that prevents maxWidth from being set to 'none', so we make it huge
+var domLib_styleNoMaxWidth = domLib_isOpera ? '10000px' : 'none';
+var domLib_hidePosition = '-1000px';
+var domLib_scrollbarWidth = 14;
+var domLib_autoId = 1;
+var domLib_zIndex = 1010;
+
+// -- Detection --
+var domLib_collisionElements;
+var domLib_collisionsCached = false;
+
+var domLib_timeoutStateId = 0;
+var domLib_timeoutStates = new domTT_Hash();
+
+// }}}
+// {{{ DOM enhancements
+
+if (!document.ELEMENT_NODE)
+{
+ document.ELEMENT_NODE = 1;
+ document.ATTRIBUTE_NODE = 2;
+ document.TEXT_NODE = 3;
+ document.DOCUMENT_NODE = 9;
+ document.DOCUMENT_FRAGMENT_NODE = 11;
+}
+
+function domLib_clone(obj)
+{
+ var copy = {};
+ for (var i in obj)
+ {
+ var value = obj[i];
+ try
+ {
+ if (value != null && typeof(value) == 'object' && value != window && !value.nodeType)
+ {
+ copy[i] = domLib_clone(value);
+ }
+ else
+ {
+ copy[i] = value;
+ }
+ }
+ catch(e)
+ {
+ copy[i] = value;
+ }
+ }
+
+ return copy;
+}
+
+// }}}
+// {{{ class domTT_Hash()
+
+function domTT_Hash()
+{
+ this.length = 0;
+ this.numericLength = 0;
+ this.elementData = [];
+ for (var i = 0; i < arguments.length; i += 2)
+ {
+ if (typeof(arguments[i + 1]) != 'undefined')
+ {
+ this.elementData[arguments[i]] = arguments[i + 1];
+ this.length++;
+ if (arguments[i] == parseInt(arguments[i]))
+ {
+ this.numericLength++;
+ }
+ }
+ }
+}
+
+// using prototype as opposed to inner functions saves on memory
+domTT_Hash.prototype.get = function(in_key)
+{
+ if (typeof(this.elementData[in_key]) != 'undefined') {
+ return this.elementData[in_key];
+ }
+
+ return null;
+};
+
+domTT_Hash.prototype.set = function(in_key, in_value)
+{
+ if (typeof(in_value) != 'undefined')
+ {
+ if (typeof(this.elementData[in_key]) == 'undefined')
+ {
+ this.length++;
+ if (in_key == parseInt(in_key))
+ {
+ this.numericLength++;
+ }
+ }
+
+ return this.elementData[in_key] = in_value;
+ }
+
+ return false;
+};
+
+domTT_Hash.prototype.remove = function(in_key)
+{
+ var tmp_value;
+ if (typeof(this.elementData[in_key]) != 'undefined')
+ {
+ this.length--;
+ if (in_key == parseInt(in_key))
+ {
+ this.numericLength--;
+ }
+
+ tmp_value = this.elementData[in_key];
+ delete this.elementData[in_key];
+ }
+
+ return tmp_value;
+};
+
+domTT_Hash.prototype.size = function()
+{
+ return this.length;
+};
+
+domTT_Hash.prototype.has = function(in_key)
+{
+ return typeof(this.elementData[in_key]) != 'undefined';
+};
+
+domTT_Hash.prototype.find = function(in_obj)
+{
+ for (var tmp_key in this.elementData)
+ {
+ if (this.elementData[tmp_key] == in_obj)
+ {
+ return tmp_key;
+ }
+ }
+
+ return null;
+};
+
+domTT_Hash.prototype.merge = function(in_hash)
+{
+ for (var tmp_key in in_hash.elementData)
+ {
+ if (typeof(this.elementData[tmp_key]) == 'undefined')
+ {
+ this.length++;
+ if (tmp_key == parseInt(tmp_key))
+ {
+ this.numericLength++;
+ }
+ }
+
+ this.elementData[tmp_key] = in_hash.elementData[tmp_key];
+ }
+};
+
+domTT_Hash.prototype.compare = function(in_hash)
+{
+ if (this.length != in_hash.length)
+ {
+ return false;
+ }
+
+ for (var tmp_key in this.elementData)
+ {
+ if (this.elementData[tmp_key] != in_hash.elementData[tmp_key])
+ {
+ return false;
+ }
+ }
+
+ return true;
+};
+
+// }}}
+// {{{ domLib_isDescendantOf()
+
+function domLib_isDescendantOf(in_object, in_ancestor, in_bannedTags)
+{
+ if (in_object == null)
+ {
+ return false;
+ }
+
+ if (in_object == in_ancestor)
+ {
+ return true;
+ }
+
+ if (typeof(in_bannedTags) != 'undefined' &&
+ (',' + in_bannedTags.join(',') + ',').indexOf(',' + in_object.tagName + ',') != -1)
+ {
+ return false;
+ }
+
+ while (in_object != document.documentElement)
+ {
+ try
+ {
+ if ((tmp_object = in_object.offsetParent) && tmp_object == in_ancestor)
+ {
+ return true;
+ }
+ else if ((tmp_object = in_object.parentNode) == in_ancestor)
+ {
+ return true;
+ }
+ else
+ {
+ in_object = tmp_object;
+ }
+ }
+ // in case we get some wierd error, assume we left the building
+ catch(e)
+ {
+ return false;
+ }
+ }
+
+ return false;
+}
+
+// }}}
+// {{{ domLib_detectCollisions()
+
+/**
+ * For any given target element, determine if elements on the page
+ * are colliding with it that do not obey the rules of z-index.
+ */
+function domLib_detectCollisions(in_object, in_recover, in_useCache)
+{
+ // the reason for the cache is that if the root menu is built before
+ // the page is done loading, then it might not find all the elements.
+ // so really the only time you don't use cache is when building the
+ // menu as part of the page load
+ if (!domLib_collisionsCached)
+ {
+ var tags = [];
+
+ if (!domLib_canDrawOverFlash)
+ {
+ tags[tags.length] = 'object';
+ }
+
+ if (!domLib_canDrawOverSelect)
+ {
+ tags[tags.length] = 'select';
+ }
+
+ domLib_collisionElements = domLib_getElementsByTagNames(tags, true);
+ domLib_collisionsCached = in_useCache;
+ }
+
+ // if we don't have a tip, then unhide selects
+ if (in_recover)
+ {
+ for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
+ {
+ var thisElement = domLib_collisionElements[cnt];
+
+ if (!thisElement.hideList)
+ {
+ thisElement.hideList = new domTT_Hash();
+ }
+
+ thisElement.hideList.remove(in_object.id);
+ if (!thisElement.hideList.length)
+ {
+ domLib_collisionElements[cnt].style.visibility = 'visible';
+ if (domLib_isKonq)
+ {
+ domLib_collisionElements[cnt].style.display = '';
+ }
+ }
+ }
+
+ return;
+ }
+ else if (domLib_collisionElements.length == 0)
+ {
+ return;
+ }
+
+ // okay, we have a tip, so hunt and destroy
+ var objectOffsets = domLib_getOffsets(in_object);
+
+ for (var cnt = 0; cnt < domLib_collisionElements.length; cnt++)
+ {
+ var thisElement = domLib_collisionElements[cnt];
+
+ // if collision element is in active element, move on
+ // WARNING: is this too costly?
+ if (domLib_isDescendantOf(thisElement, in_object))
+ {
+ continue;
+ }
+
+ // konqueror only has trouble with multirow selects
+ if (domLib_isKonq &&
+ thisElement.tagName == 'SELECT' &&
+ (thisElement.size <= 1 && !thisElement.multiple))
+ {
+ continue;
+ }
+
+ if (!thisElement.hideList)
+ {
+ thisElement.hideList = new domTT_Hash();
+ }
+
+ var selectOffsets = domLib_getOffsets(thisElement);
+ var center2centerDistance = Math.sqrt(Math.pow(selectOffsets.get('leftCenter') - objectOffsets.get('leftCenter'), 2) + Math.pow(selectOffsets.get('topCenter') - objectOffsets.get('topCenter'), 2));
+ var radiusSum = selectOffsets.get('radius') + objectOffsets.get('radius');
+ // the encompassing circles are overlapping, get in for a closer look
+ if (center2centerDistance < radiusSum)
+ {
+ // tip is left of select
+ if ((objectOffsets.get('leftCenter') <= selectOffsets.get('leftCenter') && objectOffsets.get('right') < selectOffsets.get('left')) ||
+ // tip is right of select
+ (objectOffsets.get('leftCenter') > selectOffsets.get('leftCenter') && objectOffsets.get('left') > selectOffsets.get('right')) ||
+ // tip is above select
+ (objectOffsets.get('topCenter') <= selectOffsets.get('topCenter') && objectOffsets.get('bottom') < selectOffsets.get('top')) ||
+ // tip is below select
+ (objectOffsets.get('topCenter') > selectOffsets.get('topCenter') && objectOffsets.get('top') > selectOffsets.get('bottom')))
+ {
+ thisElement.hideList.remove(in_object.id);
+ if (!thisElement.hideList.length)
+ {
+ thisElement.style.visibility = 'visible';
+ if (domLib_isKonq)
+ {
+ thisElement.style.display = '';
+ }
+ }
+ }
+ else
+ {
+ thisElement.hideList.set(in_object.id, true);
+ thisElement.style.visibility = 'hidden';
+ if (domLib_isKonq)
+ {
+ thisElement.style.display = 'none';
+ }
+ }
+ }
+ }
+}
+
+// }}}
+// {{{ domLib_getOffsets()
+
+function domLib_getOffsets(in_object, in_preserveScroll)
+{
+ if (typeof(in_preserveScroll) == 'undefined') {
+ in_preserveScroll = false;
+ }
+
+ var originalObject = in_object;
+ var originalWidth = in_object.offsetWidth;
+ var originalHeight = in_object.offsetHeight;
+ var offsetLeft = 0;
+ var offsetTop = 0;
+
+ while (in_object)
+ {
+ offsetLeft += in_object.offsetLeft;
+ offsetTop += in_object.offsetTop;
+ in_object = in_object.offsetParent;
+ // consider scroll offset of parent elements
+ if (in_object && !in_preserveScroll)
+ {
+ offsetLeft -= in_object.scrollLeft;
+ offsetTop -= in_object.scrollTop;
+ }
+ }
+
+ // MacIE misreports the offsets (even with margin: 0 in body{}), still not perfect
+ if (domLib_isMacIE) {
+ offsetLeft += 10;
+ offsetTop += 10;
+ }
+
+ return new domTT_Hash(
+ 'left', offsetLeft,
+ 'top', offsetTop,
+ 'right', offsetLeft + originalWidth,
+ 'bottom', offsetTop + originalHeight,
+ 'leftCenter', offsetLeft + originalWidth/2,
+ 'topCenter', offsetTop + originalHeight/2,
+ 'radius', Math.max(originalWidth, originalHeight)
+ );
+}
+
+// }}}
+// {{{ domLib_setTimeout()
+
+function domLib_setTimeout(in_function, in_timeout, in_args)
+{
+ if (typeof(in_args) == 'undefined')
+ {
+ in_args = [];
+ }
+
+ if (in_timeout == -1)
+ {
+ // timeout event is disabled
+ return 0;
+ }
+ else if (in_timeout == 0)
+ {
+ in_function(in_args);
+ return 0;
+ }
+
+ // must make a copy of the arguments so that we release the reference
+ var args = domLib_clone(in_args);
+
+ if (!domLib_hasBrokenTimeout)
+ {
+ return setTimeout(function() { in_function(args); }, in_timeout);
+ }
+ else
+ {
+ var id = domLib_timeoutStateId++;
+ var data = new domTT_Hash();
+ data.set('function', in_function);
+ data.set('args', args);
+ domLib_timeoutStates.set(id, data);
+
+ data.set('timeoutId', setTimeout('domLib_timeoutStates.get(' + id + ').get(\'function\')(domLib_timeoutStates.get(' + id + ').get(\'args\')); domLib_timeoutStates.remove(' + id + ');', in_timeout));
+ return id;
+ }
+}
+
+// }}}
+// {{{ domLib_clearTimeout()
+
+function domLib_clearTimeout(in_id)
+{
+ if (!domLib_hasBrokenTimeout)
+ {
+ if (in_id > 0) {
+ clearTimeout(in_id);
+ }
+ }
+ else
+ {
+ if (domLib_timeoutStates.has(in_id))
+ {
+ clearTimeout(domLib_timeoutStates.get(in_id).get('timeoutId'));
+ domLib_timeoutStates.remove(in_id);
+ }
+ }
+}
+
+// }}}
+// {{{ domLib_getEventPosition()
+
+function domLib_getEventPosition(in_eventObj)
+{
+ var eventPosition = new domTT_Hash('x', 0, 'y', 0, 'scrollX', 0, 'scrollY', 0);
+
+ // IE varies depending on standard compliance mode
+ if (domLib_isIE)
+ {
+ var doc = (domLib_standardsMode ? document.documentElement : document.body);
+ // NOTE: events may fire before the body has been loaded
+ if (doc)
+ {
+ eventPosition.set('x', in_eventObj.clientX + doc.scrollLeft);
+ eventPosition.set('y', in_eventObj.clientY + doc.scrollTop);
+ eventPosition.set('scrollX', doc.scrollLeft);
+ eventPosition.set('scrollY', doc.scrollTop);
+ }
+ }
+ else
+ {
+ eventPosition.set('x', in_eventObj.pageX);
+ eventPosition.set('y', in_eventObj.pageY);
+ eventPosition.set('scrollX', in_eventObj.pageX - in_eventObj.clientX);
+ eventPosition.set('scrollY', in_eventObj.pageY - in_eventObj.clientY);
+ }
+
+ return eventPosition;
+}
+
+// }}}
+// {{{ domLib_cancelBubble()
+
+function domLib_cancelBubble(in_event)
+{
+ var eventObj = in_event ? in_event : window.event;
+ eventObj.cancelBubble = true;
+}
+
+// }}}
+// {{{ domLib_getIFrameReference()
+
+function domLib_getIFrameReference(in_frame)
+{
+ if (domLib_isGecko || domLib_isIE)
+ {
+ return in_frame.frameElement;
+ }
+ else
+ {
+ // we could either do it this way or require an id on the frame
+ // equivalent to the name
+ var name = in_frame.name;
+ if (!name || !in_frame.parent)
+ {
+ return null;
+ }
+
+ var candidates = in_frame.parent.document.getElementsByTagName('iframe');
+ for (var i = 0; i < candidates.length; i++)
+ {
+ if (candidates[i].name == name)
+ {
+ return candidates[i];
+ }
+ }
+
+ return null;
+ }
+}
+
+// }}}
+// {{{ domLib_getElementsByClass()
+
+function domLib_getElementsByClass(in_class)
+{
+ var elements = domLib_isIE5 ? document.all : document.getElementsByTagName('*');
+ var matches = [];
+ var cnt = 0;
+ for (var i = 0; i < elements.length; i++)
+ {
+ if ((" " + elements[i].className + " ").indexOf(" " + in_class + " ") != -1)
+ {
+ matches[cnt++] = elements[i];
+ }
+ }
+
+ return matches;
+}
+
+// }}}
+// {{{ domLib_getElementsByTagNames()
+
+function domLib_getElementsByTagNames(in_list, in_excludeHidden)
+{
+ var elements = [];
+ for (var i = 0; i < in_list.length; i++)
+ {
+ var matches = document.getElementsByTagName(in_list[i]);
+ for (var j = 0; j < matches.length; j++)
+ {
+ // skip objects that have nested embeds, or else we get "flashing"
+ if (matches[j].tagName == 'OBJECT' && domLib_isGecko)
+ {
+ var kids = matches[j].childNodes;
+ var skip = false;
+ for (var k = 0; k < kids.length; k++)
+ {
+ if (kids[k].tagName == 'EMBED')
+ {
+ skip = true;
+ break;
+ }
+ }
+ if (skip) continue;
+ }
+
+ if (in_excludeHidden && domLib_getComputedStyle(matches[j], 'visibility') == 'hidden')
+ {
+ continue;
+ }
+
+ elements[elements.length] = matches[j];
+ }
+ }
+
+ return elements;
+}
+
+// }}}
+// {{{ domLib_getComputedStyle()
+
+function domLib_getComputedStyle(in_obj, in_property)
+{
+ if (domLib_isIE)
+ {
+ var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
+ return eval('in_obj.currentStyle.' + humpBackProp);
+ }
+ // getComputedStyle() is broken in konqueror, so let's go for the style object
+ else if (domLib_isKonq)
+ {
+ //var humpBackProp = in_property.replace(/-(.)/, function (a, b) { return b.toUpperCase(); });
+ return eval('in_obj.style.' + in_property);
+ }
+ else
+ {
+ return document.defaultView.getComputedStyle(in_obj, null).getPropertyValue(in_property);
+ }
+}
+
+// }}}
+// {{{ makeTrue()
+
+function makeTrue()
+{
+ return true;
+}
+
+// }}}
+// {{{ makeFalse()
+
+function makeFalse()
+{
+ return false;
+}
+
+// }}}
diff --git a/src/usr/local/www/javascript/domTT/domTT.js b/src/usr/local/www/javascript/domTT/domTT.js
new file mode 100644
index 0000000..fc9bf6a
--- /dev/null
+++ b/src/usr/local/www/javascript/domTT/domTT.js
@@ -0,0 +1,1132 @@
+/** $Id: domTT.js 2324 2006-06-12 07:06:39Z dallen $ */
+// {{{ license
+
+/*
+ * Copyright 2002-2005 Dan Allen, Mojavelinux.com (dan.allen@mojavelinux.com)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// }}}
+// {{{ intro
+
+/**
+ * Title: DOM Tooltip Library
+ * Version: 0.7.3
+ *
+ * Summary:
+ * Allows developers to add custom tooltips to the webpages. Tooltips are
+ * generated using the domTT_activate() function and customized by setting
+ * a handful of options.
+ *
+ * Maintainer: Dan Allen <dan.allen@mojavelinux.com>
+ * Contributors:
+ * Josh Gross <josh@jportalhome.com>
+ * Jason Rust <jason@rustyparts.com>
+ *
+ * License: Apache 2.0
+ * However, if you use this library, you earn the position of official bug
+ * reporter :) Please post questions or problem reports to the newsgroup:
+ *
+ * http://groups-beta.google.com/group/dom-tooltip
+ *
+ * If you are doing this for commercial work, perhaps you could send me a few
+ * Starbucks Coffee gift dollars or PayPal bucks to encourage future
+ * developement (NOT REQUIRED). E-mail me for my snail mail address.
+
+ *
+ * Homepage: http://www.mojavelinux.com/projects/domtooltip/
+ *
+ * Newsgroup: http://groups-beta.google.com/group/dom-tooltip
+ *
+ * Freshmeat Project: http://freshmeat.net/projects/domtt/?topic_id=92
+ *
+ * Updated: 2005/07/16
+ *
+ * Supported Browsers:
+ * Mozilla (Gecko), IE 5.5+, IE on Mac, Safari, Konqueror, Opera 7
+ *
+ * Usage:
+ * Please see the HOWTO documentation.
+**/
+
+// }}}
+// {{{ settings (editable)
+
+// IE mouse events seem to be off by 2 pixels
+var domTT_offsetX = (domLib_isIE ? -2 : 0);
+var domTT_offsetY = (domLib_isIE ? 4 : 2);
+var domTT_direction = 'southeast';
+var domTT_mouseHeight = domLib_isIE ? 13 : 19;
+var domTT_closeLink = 'X';
+var domTT_closeAction = 'hide';
+var domTT_activateDelay = 500;
+var domTT_maxWidth = false;
+var domTT_styleClass = 'domTT';
+var domTT_fade = 'neither';
+var domTT_lifetime = 0;
+var domTT_grid = 0;
+var domTT_trailDelay = 200;
+var domTT_useGlobalMousePosition = true;
+var domTT_postponeActivation = false;
+var domTT_tooltipIdPrefix = '[domTT]';
+var domTT_screenEdgeDetection = true;
+var domTT_screenEdgePadding = 4;
+var domTT_oneOnly = false;
+var domTT_cloneNodes = false;
+var domTT_detectCollisions = true;
+var domTT_bannedTags = ['OPTION'];
+var domTT_draggable = false;
+if (typeof(domTT_dragEnabled) == 'undefined')
+{
+ domTT_dragEnabled = false;
+}
+
+// }}}
+// {{{ globals (DO NOT EDIT)
+
+var domTT_predefined = new domTT_Hash();
+// tooltips are keyed on both the tip id and the owner id,
+// since events can originate on either object
+var domTT_tooltips = new domTT_Hash();
+var domTT_lastOpened = 0;
+var domTT_documentLoaded = false;
+var domTT_mousePosition = null;
+
+// }}}
+// {{{ document.onmousemove
+
+if (domLib_useLibrary && domTT_useGlobalMousePosition)
+{
+ document.onmousemove = function(in_event)
+ {
+ if (typeof(in_event) == 'undefined') { in_event = window.event; }
+
+ domTT_mousePosition = domLib_getEventPosition(in_event);
+ if (domTT_dragEnabled && domTT_dragMouseDown)
+ {
+ domTT_dragUpdate(in_event);
+ }
+ };
+}
+
+// }}}
+// {{{ domTT_activate()
+
+function domTT_activate(in_this, in_event)
+{
+ if (!domLib_useLibrary || (domTT_postponeActivation && !domTT_documentLoaded)) { return false; }
+
+ // make sure in_event is set (for IE, some cases we have to use window.event)
+ if (typeof(in_event) == 'undefined') { in_event = window.event; }
+
+ // don't allow tooltips on banned tags (such as OPTION)
+ if (in_event != null) {
+ var target = in_event.srcElement ? in_event.srcElement : in_event.target;
+ if (target != null && (',' + domTT_bannedTags.join(',') + ',').indexOf(',' + target.tagName + ',') != -1)
+ {
+ return false;
+ }
+ }
+
+ var owner = document.body;
+ // we have an active event so get the owner
+ if (in_event != null && in_event.type.match(/key|mouse|click|contextmenu/i))
+ {
+ // make sure we have nothing higher than the body element
+ if (in_this.nodeType && in_this.nodeType != document.DOCUMENT_NODE)
+ {
+ owner = in_this;
+ }
+ }
+ // non active event (make sure we were passed a string id)
+ else
+ {
+ if (typeof(in_this) != 'object' && !(owner = domTT_tooltips.get(in_this)))
+ {
+ // NOTE: two steps to avoid "flashing" in gecko
+ var embryo = document.createElement('div');
+ owner = document.body.appendChild(embryo);
+ owner.style.display = 'none';
+ owner.id = in_this;
+ }
+ }
+
+ // make sure the owner has a unique id
+ if (!owner.id)
+ {
+ owner.id = '__autoId' + domLib_autoId++;
+ }
+
+ // see if we should only be opening one tip at a time
+ // NOTE: this is not "perfect" yet since it really steps on any other
+ // tip working on fade out or delayed close, but it get's the job done
+ if (domTT_oneOnly && domTT_lastOpened)
+ {
+ domTT_deactivate(domTT_lastOpened);
+ }
+
+ domTT_lastOpened = owner.id;
+
+ var tooltip = domTT_tooltips.get(owner.id);
+ if (tooltip)
+ {
+ if (tooltip.get('eventType') != in_event.type)
+ {
+ if (tooltip.get('type') == 'greasy')
+ {
+ tooltip.set('closeAction', 'destroy');
+ domTT_deactivate(owner.id);
+ }
+ else if (tooltip.get('status') != 'inactive')
+ {
+ return owner.id;
+ }
+ }
+ else
+ {
+ if (tooltip.get('status') == 'inactive')
+ {
+ tooltip.set('status', 'pending');
+ tooltip.set('activateTimeout', domLib_setTimeout(domTT_runShow, tooltip.get('delay'), [owner.id, in_event]));
+
+ return owner.id;
+ }
+ // either pending or active, let it be
+ else
+ {
+ return owner.id;
+ }
+ }
+ }
+
+ // setup the default options hash
+ var options = new domTT_Hash(
+ 'caption', '',
+ 'content', '',
+ 'clearMouse', true,
+ 'closeAction', domTT_closeAction,
+ 'closeLink', domTT_closeLink,
+ 'delay', domTT_activateDelay,
+ 'direction', domTT_direction,
+ 'draggable', domTT_draggable,
+ 'fade', domTT_fade,
+ 'fadeMax', 100,
+ 'grid', domTT_grid,
+ 'id', domTT_tooltipIdPrefix + owner.id,
+ 'inframe', false,
+ 'lifetime', domTT_lifetime,
+ 'offsetX', domTT_offsetX,
+ 'offsetY', domTT_offsetY,
+ 'parent', document.body,
+ 'position', 'absolute',
+ 'styleClass', domTT_styleClass,
+ 'type', 'greasy',
+ 'trail', false,
+ 'lazy', false
+ );
+
+ // load in the options from the function call
+ for (var i = 2; i < arguments.length; i += 2)
+ {
+ // load in predefined
+ if (arguments[i] == 'predefined')
+ {
+ var predefinedOptions = domTT_predefined.get(arguments[i + 1]);
+ for (var j in predefinedOptions.elementData)
+ {
+ options.set(j, predefinedOptions.get(j));
+ }
+ }
+ // set option
+ else
+ {
+ options.set(arguments[i], arguments[i + 1]);
+ }
+ }
+
+ options.set('eventType', in_event != null ? in_event.type : null);
+
+ // immediately set the status text if provided
+ if (options.has('statusText'))
+ {
+ try { window.status = options.get('statusText'); } catch(e) {}
+ }
+
+ // if we didn't give content...assume we just wanted to change the status and return
+ if (!options.has('content') || options.get('content') == '' || options.get('content') == null)
+ {
+ if (typeof(owner.onmouseout) != 'function')
+ {
+ owner.onmouseout = function(in_event) { domTT_mouseout(this, in_event); };
+ }
+
+ return owner.id;
+ }
+
+ options.set('owner', owner);
+
+ domTT_create(options);
+
+ // determine the show delay
+ options.set('delay', (in_event != null && in_event.type.match(/click|mousedown|contextmenu/i)) ? 0 : parseInt(options.get('delay')));
+ domTT_tooltips.set(owner.id, options);
+ domTT_tooltips.set(options.get('id'), options);
+ options.set('status', 'pending');
+ options.set('activateTimeout', domLib_setTimeout(domTT_runShow, options.get('delay'), [owner.id, in_event]));
+
+ return owner.id;
+}
+
+// }}}
+// {{{ domTT_create()
+
+function domTT_create(in_options)
+{
+ var tipOwner = in_options.get('owner');
+ var parentObj = in_options.get('parent');
+ var parentDoc = parentObj.ownerDocument || parentObj.document;
+
+ // create the tooltip and hide it
+ // NOTE: two steps to avoid "flashing" in gecko
+ var embryo = parentDoc.createElement('div');
+ var tipObj = parentObj.appendChild(embryo);
+ tipObj.style.position = 'absolute';
+ tipObj.style.left = '0px';
+ tipObj.style.top = '0px';
+ tipObj.style.visibility = 'hidden';
+ tipObj.id = in_options.get('id');
+ tipObj.className = in_options.get('styleClass');
+
+ var contentBlock;
+ var tableLayout = false;
+
+ if (in_options.get('caption') || (in_options.get('type') == 'sticky' && in_options.get('caption') !== false))
+ {
+ tableLayout = true;
+ // layout the tip with a hidden formatting table
+ var tipLayoutTable = tipObj.appendChild(parentDoc.createElement('table'));
+ tipLayoutTable.style.borderCollapse = 'collapse';
+ if (domLib_isKHTML)
+ {
+ tipLayoutTable.cellSpacing = 0;
+ }
+
+ var tipLayoutTbody = tipLayoutTable.appendChild(parentDoc.createElement('tbody'));
+
+ var numCaptionCells = 0;
+ var captionRow = tipLayoutTbody.appendChild(parentDoc.createElement('tr'));
+ var captionCell = captionRow.appendChild(parentDoc.createElement('td'));
+ captionCell.style.padding = '0px';
+ var caption = captionCell.appendChild(parentDoc.createElement('div'));
+ caption.className = 'caption';
+ if (domLib_isIE50)
+ {
+ caption.style.height = '100%';
+ }
+
+ if (in_options.get('caption').nodeType)
+ {
+ caption.appendChild(domTT_cloneNodes ? in_options.get('caption').cloneNode(1) : in_options.get('caption'));
+ }
+ else
+ {
+ caption.innerHTML = in_options.get('caption');
+ }
+
+ if (in_options.get('type') == 'sticky')
+ {
+ var numCaptionCells = 2;
+ var closeLinkCell = captionRow.appendChild(parentDoc.createElement('td'));
+ closeLinkCell.style.padding = '0px';
+ var closeLink = closeLinkCell.appendChild(parentDoc.createElement('div'));
+ closeLink.className = 'caption';
+ if (domLib_isIE50)
+ {
+ closeLink.style.height = '100%';
+ }
+
+ closeLink.style.textAlign = 'right';
+ closeLink.style.cursor = domLib_stylePointer;
+ // merge the styles of the two cells
+ closeLink.style.borderLeftWidth = caption.style.borderRightWidth = '0px';
+ closeLink.style.paddingLeft = caption.style.paddingRight = '0px';
+ closeLink.style.marginLeft = caption.style.marginRight = '0px';
+ if (in_options.get('closeLink').nodeType)
+ {
+ closeLink.appendChild(in_options.get('closeLink').cloneNode(1));
+ }
+ else
+ {
+ closeLink.innerHTML = in_options.get('closeLink');
+ }
+
+ closeLink.onclick = function()
+ {
+ domTT_deactivate(tipOwner.id);
+ };
+ closeLink.onmousedown = function(in_event)
+ {
+ if (typeof(in_event) == 'undefined') { in_event = window.event; }
+ in_event.cancelBubble = true;
+ };
+ // MacIE has to have a newline at the end and must be made with createTextNode()
+ if (domLib_isMacIE)
+ {
+ closeLinkCell.appendChild(parentDoc.createTextNode("\n"));
+ }
+ }
+
+ // MacIE has to have a newline at the end and must be made with createTextNode()
+ if (domLib_isMacIE)
+ {
+ captionCell.appendChild(parentDoc.createTextNode("\n"));
+ }
+
+ var contentRow = tipLayoutTbody.appendChild(parentDoc.createElement('tr'));
+ var contentCell = contentRow.appendChild(parentDoc.createElement('td'));
+ contentCell.style.padding = '0px';
+ if (numCaptionCells)
+ {
+ if (domLib_isIE || domLib_isOpera)
+ {
+ contentCell.colSpan = numCaptionCells;
+ }
+ else
+ {
+ contentCell.setAttribute('colspan', numCaptionCells);
+ }
+ }
+
+ contentBlock = contentCell.appendChild(parentDoc.createElement('div'));
+ if (domLib_isIE50)
+ {
+ contentBlock.style.height = '100%';
+ }
+ }
+ else
+ {
+ contentBlock = tipObj.appendChild(parentDoc.createElement('div'));
+ }
+
+ contentBlock.className = 'contents';
+
+ var content = in_options.get('content');
+ // allow content has a function to return the actual content
+ if (typeof(content) == 'function') {
+ content = content(in_options.get('id'));
+ }
+
+ if (content != null && content.nodeType)
+ {
+ contentBlock.appendChild(domTT_cloneNodes ? content.cloneNode(1) : content);
+ }
+ else
+ {
+ contentBlock.innerHTML = content;
+ }
+
+ // adjust the width if specified
+ if (in_options.has('width'))
+ {
+ tipObj.style.width = parseInt(in_options.get('width')) + 'px';
+ }
+
+ // check if we are overridding the maxWidth
+ // if the browser supports maxWidth, the global setting will be ignored (assume stylesheet)
+ var maxWidth = domTT_maxWidth;
+ if (in_options.has('maxWidth'))
+ {
+ if ((maxWidth = in_options.get('maxWidth')) === false)
+ {
+ tipObj.style.maxWidth = domLib_styleNoMaxWidth;
+ }
+ else
+ {
+ maxWidth = parseInt(in_options.get('maxWidth'));
+ tipObj.style.maxWidth = maxWidth + 'px';
+ }
+ }
+
+ // HACK: fix lack of maxWidth in CSS for KHTML and IE
+ if (maxWidth !== false && (domLib_isIE || domLib_isKHTML) && tipObj.offsetWidth > maxWidth)
+ {
+ tipObj.style.width = maxWidth + 'px';
+ }
+
+ in_options.set('offsetWidth', tipObj.offsetWidth);
+ in_options.set('offsetHeight', tipObj.offsetHeight);
+
+ // konqueror miscalcuates the width of the containing div when using the layout table based on the
+ // border size of the containing div
+ if (domLib_isKonq && tableLayout && !tipObj.style.width)
+ {
+ var left = document.defaultView.getComputedStyle(tipObj, '').getPropertyValue('border-left-width');
+ var right = document.defaultView.getComputedStyle(tipObj, '').getPropertyValue('border-right-width');
+
+ left = left.substring(left.indexOf(':') + 2, left.indexOf(';'));
+ right = right.substring(right.indexOf(':') + 2, right.indexOf(';'));
+ var correction = 2 * ((left ? parseInt(left) : 0) + (right ? parseInt(right) : 0));
+ tipObj.style.width = (tipObj.offsetWidth - correction) + 'px';
+ }
+
+ // if a width is not set on an absolutely positioned object, both IE and Opera
+ // will attempt to wrap when it spills outside of body...we cannot have that
+ if (domLib_isIE || domLib_isOpera)
+ {
+ if (!tipObj.style.width)
+ {
+ // HACK: the correction here is for a border
+ tipObj.style.width = (tipObj.offsetWidth - 2) + 'px';
+ }
+
+ // HACK: the correction here is for a border
+ tipObj.style.height = (tipObj.offsetHeight - 2) + 'px';
+ }
+
+ // store placement offsets from event position
+ var offsetX, offsetY;
+
+ // tooltip floats
+ if (in_options.get('position') == 'absolute' && !(in_options.has('x') && in_options.has('y')))
+ {
+ // determine the offset relative to the pointer
+ switch (in_options.get('direction'))
+ {
+ case 'northeast':
+ offsetX = in_options.get('offsetX');
+ offsetY = 0 - tipObj.offsetHeight - in_options.get('offsetY');
+ break;
+ case 'northwest':
+ offsetX = 0 - tipObj.offsetWidth - in_options.get('offsetX');
+ offsetY = 0 - tipObj.offsetHeight - in_options.get('offsetY');
+ break;
+ case 'north':
+ offsetX = 0 - parseInt(tipObj.offsetWidth/2);
+ offsetY = 0 - tipObj.offsetHeight - in_options.get('offsetY');
+ break;
+ case 'southwest':
+ offsetX = 0 - tipObj.offsetWidth - in_options.get('offsetX');
+ offsetY = in_options.get('offsetY');
+ break;
+ case 'southeast':
+ offsetX = in_options.get('offsetX');
+ offsetY = in_options.get('offsetY');
+ break;
+ case 'south':
+ offsetX = 0 - parseInt(tipObj.offsetWidth/2);
+ offsetY = in_options.get('offsetY');
+ break;
+ }
+
+ // if we are in an iframe, get the offsets of the iframe in the parent document
+ if (in_options.get('inframe'))
+ {
+ var iframeObj = domLib_getIFrameReference(window);
+ if (iframeObj)
+ {
+ var frameOffsets = domLib_getOffsets(iframeObj);
+ offsetX += frameOffsets.get('left');
+ offsetY += frameOffsets.get('top');
+ }
+ }
+ }
+ // tooltip is fixed
+ else
+ {
+ offsetX = 0;
+ offsetY = 0;
+ in_options.set('trail', false);
+ }
+
+ // set the direction-specific offsetX/Y
+ in_options.set('offsetX', offsetX);
+ in_options.set('offsetY', offsetY);
+ if (in_options.get('clearMouse') && in_options.get('direction').indexOf('south') != -1)
+ {
+ in_options.set('mouseOffset', domTT_mouseHeight);
+ }
+ else
+ {
+ in_options.set('mouseOffset', 0);
+ }
+
+ if (domLib_canFade && typeof(Fadomatic) == 'function')
+ {
+ if (in_options.get('fade') != 'neither')
+ {
+ var fadeHandler = new Fadomatic(tipObj, 10, 0, 0, in_options.get('fadeMax'));
+ in_options.set('fadeHandler', fadeHandler);
+ }
+ }
+ else
+ {
+ in_options.set('fade', 'neither');
+ }
+
+ // setup mouse events
+ if (in_options.get('trail') && typeof(tipOwner.onmousemove) != 'function')
+ {
+ tipOwner.onmousemove = function(in_event) { domTT_mousemove(this, in_event); };
+ }
+
+ if (typeof(tipOwner.onmouseout) != 'function')
+ {
+ tipOwner.onmouseout = function(in_event) { domTT_mouseout(this, in_event); };
+ }
+
+ if (in_options.get('type') == 'sticky')
+ {
+ if (in_options.get('position') == 'absolute' && domTT_dragEnabled && in_options.get('draggable'))
+ {
+ if (domLib_isIE)
+ {
+ captionRow.onselectstart = function() { return false; };
+ }
+
+ // setup drag
+ captionRow.onmousedown = function(in_event) { domTT_dragStart(tipObj, in_event); };
+ captionRow.onmousemove = function(in_event) { domTT_dragUpdate(in_event); };
+ captionRow.onmouseup = function() { domTT_dragStop(); };
+ }
+ }
+ else if (in_options.get('type') == 'velcro')
+ {
+ /* can use once we have deactivateDelay
+ tipObj.onmouseover = function(in_event)
+ {
+ if (typeof(in_event) == 'undefined') { in_event = window.event; }
+ var tooltip = domTT_tooltips.get(tipObj.id);
+ if (in_options.get('lifetime')) {
+ domLib_clearTimeout(in_options.get('lifetimeTimeout');
+ }
+ };
+ */
+ tipObj.onmouseout = function(in_event)
+ {
+ if (typeof(in_event) == 'undefined') { in_event = window.event; }
+ if (!domLib_isDescendantOf(in_event[domLib_eventTo], tipObj, domTT_bannedTags)) {
+ domTT_deactivate(tipOwner.id);
+ }
+ };
+ // NOTE: this might interfere with links in the tip
+ tipObj.onclick = function(in_event)
+ {
+ domTT_deactivate(tipOwner.id);
+ };
+ }
+
+ if (in_options.get('position') == 'relative')
+ {
+ tipObj.style.position = 'relative';
+ }
+
+ in_options.set('node', tipObj);
+ in_options.set('status', 'inactive');
+}
+
+// }}}
+// {{{ domTT_show()
+
+// in_id is either tip id or the owner id
+function domTT_show(in_id, in_event)
+{
+
+ // should always find one since this call would be cancelled if tip was killed
+ var tooltip = domTT_tooltips.get(in_id);
+ var status = tooltip.get('status');
+ var tipObj = tooltip.get('node');
+
+ if (tooltip.get('position') == 'absolute')
+ {
+ var mouseX, mouseY;
+
+ if (tooltip.has('x') && tooltip.has('y'))
+ {
+ mouseX = tooltip.get('x');
+ mouseY = tooltip.get('y');
+ }
+ else if (!domTT_useGlobalMousePosition || domTT_mousePosition == null || status == 'active' || tooltip.get('delay') == 0)
+ {
+ var eventPosition = domLib_getEventPosition(in_event);
+ var eventX = eventPosition.get('x');
+ var eventY = eventPosition.get('y');
+ if (tooltip.get('inframe'))
+ {
+ eventX -= eventPosition.get('scrollX');
+ eventY -= eventPosition.get('scrollY');
+ }
+
+ // only move tip along requested trail axis when updating position
+ if (status == 'active' && tooltip.get('trail') !== true)
+ {
+ var trail = tooltip.get('trail');
+ if (trail == 'x')
+ {
+ mouseX = eventX;
+ mouseY = tooltip.get('mouseY');
+ }
+ else if (trail == 'y')
+ {
+ mouseX = tooltip.get('mouseX');
+ mouseY = eventY;
+ }
+ }
+ else
+ {
+ mouseX = eventX;
+ mouseY = eventY;
+ }
+ }
+ else
+ {
+ mouseX = domTT_mousePosition.get('x');
+ mouseY = domTT_mousePosition.get('y');
+ if (tooltip.get('inframe'))
+ {
+ mouseX -= domTT_mousePosition.get('scrollX');
+ mouseY -= domTT_mousePosition.get('scrollY');
+ }
+ }
+
+ // we are using a grid for updates
+ if (tooltip.get('grid'))
+ {
+ // if this is not a mousemove event or it is a mousemove event on an active tip and
+ // the movement is bigger than the grid
+ if (in_event.type != 'mousemove' || (status == 'active' && (Math.abs(tooltip.get('lastX') - mouseX) > tooltip.get('grid') || Math.abs(tooltip.get('lastY') - mouseY) > tooltip.get('grid'))))
+ {
+ tooltip.set('lastX', mouseX);
+ tooltip.set('lastY', mouseY);
+ }
+ // did not satisfy the grid movement requirement
+ else
+ {
+ return false;
+ }
+ }
+
+ // mouseX and mouseY store the last acknowleged mouse position,
+ // good for trailing on one axis
+ tooltip.set('mouseX', mouseX);
+ tooltip.set('mouseY', mouseY);
+
+ var coordinates;
+ if (domTT_screenEdgeDetection)
+ {
+ coordinates = domTT_correctEdgeBleed(
+ tooltip.get('offsetWidth'),
+ tooltip.get('offsetHeight'),
+ mouseX,
+ mouseY,
+ tooltip.get('offsetX'),
+ tooltip.get('offsetY'),
+ tooltip.get('mouseOffset'),
+ tooltip.get('inframe') ? window.parent : window
+ );
+ }
+ else
+ {
+ coordinates = {
+ 'x' : mouseX + tooltip.get('offsetX'),
+ 'y' : mouseY + tooltip.get('offsetY') + tooltip.get('mouseOffset')
+ };
+ }
+
+ // update the position
+ tipObj.style.left = coordinates.x + 'px';
+ tipObj.style.top = coordinates.y + 'px';
+
+ // increase the tip zIndex so it goes over previously shown tips
+ tipObj.style.zIndex = domLib_zIndex++;
+ }
+
+ // if tip is not active, active it now and check for a fade in
+ if (status == 'pending')
+ {
+ // unhide the tooltip
+ tooltip.set('status', 'active');
+ tipObj.style.display = '';
+ tipObj.style.visibility = 'visible';
+
+ var fade = tooltip.get('fade');
+ if (fade != 'neither')
+ {
+ var fadeHandler = tooltip.get('fadeHandler');
+ if (fade == 'out' || fade == 'both')
+ {
+ fadeHandler.haltFade();
+ if (fade == 'out')
+ {
+ fadeHandler.halt();
+ }
+ }
+
+ if (fade == 'in' || fade == 'both')
+ {
+ fadeHandler.fadeIn();
+ }
+ }
+
+ if (tooltip.get('type') == 'greasy' && tooltip.get('lifetime') != 0)
+ {
+ tooltip.set('lifetimeTimeout', domLib_setTimeout(domTT_runDeactivate, tooltip.get('lifetime'), [tipObj.id]));
+ }
+ }
+
+ if (tooltip.get('position') == 'absolute' && domTT_detectCollisions)
+ {
+ // utilize original collision element cache
+ domLib_detectCollisions(tipObj, false, true);
+ }
+}
+
+// }}}
+// {{{ domTT_close()
+
+// in_handle can either be an child object of the tip, the tip id or the owner id
+function domTT_close(in_handle)
+{
+ var id;
+ if (typeof(in_handle) == 'object' && in_handle.nodeType)
+ {
+ var obj = in_handle;
+ while (!obj.id || !domTT_tooltips.get(obj.id))
+ {
+ obj = obj.parentNode;
+
+ if (obj.nodeType != document.ELEMENT_NODE) { return; }
+ }
+
+ id = obj.id;
+ }
+ else
+ {
+ id = in_handle;
+ }
+
+ domTT_deactivate(id);
+}
+
+// }}}
+// {{{ domTT_closeAll()
+
+// run through the tooltips and close them all
+function domTT_closeAll()
+{
+ // NOTE: this will iterate 2x # of tooltips
+ for (var id in domTT_tooltips.elementData) {
+ domTT_close(id);
+ }
+}
+
+// }}}
+// {{{ domTT_deactivate()
+
+// in_id is either the tip id or the owner id
+function domTT_deactivate(in_id)
+{
+ var tooltip = domTT_tooltips.get(in_id);
+ if (tooltip)
+ {
+ var status = tooltip.get('status');
+ if (status == 'pending')
+ {
+ // cancel the creation of this tip if it is still pending
+ domLib_clearTimeout(tooltip.get('activateTimeout'));
+ tooltip.set('status', 'inactive');
+ }
+ else if (status == 'active')
+ {
+ if (tooltip.get('lifetime'))
+ {
+ domLib_clearTimeout(tooltip.get('lifetimeTimeout'));
+ }
+
+ var tipObj = tooltip.get('node');
+ if (tooltip.get('closeAction') == 'hide')
+ {
+ var fade = tooltip.get('fade');
+ if (fade != 'neither')
+ {
+ var fadeHandler = tooltip.get('fadeHandler');
+ if (fade == 'out' || fade == 'both')
+ {
+ fadeHandler.fadeOut();
+ }
+ else
+ {
+ fadeHandler.hide();
+ }
+ }
+ else
+ {
+ tipObj.style.display = 'none';
+ }
+ }
+ else
+ {
+ tooltip.get('parent').removeChild(tipObj);
+ domTT_tooltips.remove(tooltip.get('owner').id);
+ domTT_tooltips.remove(tooltip.get('id'));
+ }
+
+ tooltip.set('status', 'inactive');
+ if (domTT_detectCollisions) {
+ // unhide all of the selects that are owned by this object
+ // utilize original collision element cache
+ domLib_detectCollisions(tipObj, true, true);
+ }
+ }
+ }
+}
+
+// }}}
+// {{{ domTT_mouseout()
+
+function domTT_mouseout(in_owner, in_event)
+{
+ if (!domLib_useLibrary) { return false; }
+
+ if (typeof(in_event) == 'undefined') { in_event = window.event; }
+
+ var toChild = domLib_isDescendantOf(in_event[domLib_eventTo], in_owner, domTT_bannedTags);
+ var tooltip = domTT_tooltips.get(in_owner.id);
+ if (tooltip && (tooltip.get('type') == 'greasy' || tooltip.get('status') != 'active'))
+ {
+ // deactivate tip if exists and we moved away from the owner
+ if (!toChild)
+ {
+ domTT_deactivate(in_owner.id);
+ try { window.status = window.defaultStatus; } catch(e) {}
+ }
+ }
+ else if (!toChild)
+ {
+ try { window.status = window.defaultStatus; } catch(e) {}
+ }
+}
+
+// }}}
+// {{{ domTT_mousemove()
+
+function domTT_mousemove(in_owner, in_event)
+{
+ if (!domLib_useLibrary) { return false; }
+
+ if (typeof(in_event) == 'undefined') { in_event = window.event; }
+
+ var tooltip = domTT_tooltips.get(in_owner.id);
+ if (tooltip && tooltip.get('trail') && tooltip.get('status') == 'active')
+ {
+ // see if we are trailing lazy
+ if (tooltip.get('lazy'))
+ {
+ domLib_setTimeout(domTT_runShow, domTT_trailDelay, [in_owner.id, in_event]);
+ }
+ else
+ {
+ domTT_show(in_owner.id, in_event);
+ }
+ }
+}
+
+// }}}
+// {{{ domTT_addPredefined()
+
+function domTT_addPredefined(in_id)
+{
+ var options = new domTT_Hash();
+ for (var i = 1; i < arguments.length; i += 2)
+ {
+ options.set(arguments[i], arguments[i + 1]);
+ }
+
+ domTT_predefined.set(in_id, options);
+}
+
+// }}}
+// {{{ domTT_correctEdgeBleed()
+
+function domTT_correctEdgeBleed(in_width, in_height, in_x, in_y, in_offsetX, in_offsetY, in_mouseOffset, in_window)
+{
+ var win, doc;
+ var bleedRight, bleedBottom;
+ var pageHeight, pageWidth, pageYOffset, pageXOffset;
+
+ var x = in_x + in_offsetX;
+ var y = in_y + in_offsetY + in_mouseOffset;
+
+ win = (typeof(in_window) == 'undefined' ? window : in_window);
+
+ // Gecko and IE swaps values of clientHeight, clientWidth properties when
+ // in standards compliance mode from documentElement to document.body
+ doc = ((domLib_standardsMode && (domLib_isIE || domLib_isGecko)) ? win.document.documentElement : win.document.body);
+
+ // for IE in compliance mode
+ if (domLib_isIE)
+ {
+ pageHeight = doc.clientHeight;
+ pageWidth = doc.clientWidth;
+ pageYOffset = doc.scrollTop;
+ pageXOffset = doc.scrollLeft;
+ }
+ else
+ {
+ pageHeight = doc.clientHeight;
+ pageWidth = doc.clientWidth;
+
+ if (domLib_isKHTML)
+ {
+ pageHeight = win.innerHeight;
+ }
+
+ pageYOffset = win.pageYOffset;
+ pageXOffset = win.pageXOffset;
+ }
+
+ // we are bleeding off the right, move tip over to stay on page
+ // logic: take x position, add width and subtract from effective page width
+ if ((bleedRight = (x - pageXOffset) + in_width - (pageWidth - domTT_screenEdgePadding)) > 0)
+ {
+ x -= bleedRight;
+ }
+
+ // we are bleeding to the left, move tip over to stay on page
+ // if tip doesn't fit, we will go back to bleeding off the right
+ // logic: take x position and check if less than edge padding
+ if ((x - pageXOffset) < domTT_screenEdgePadding)
+ {
+ x = domTT_screenEdgePadding + pageXOffset;
+ }
+
+ // if we are bleeding off the bottom, flip to north
+ // logic: take y position, add height and subtract from effective page height
+ if ((bleedBottom = (y - pageYOffset) + in_height - (pageHeight - domTT_screenEdgePadding)) > 0)
+ {
+ y = in_y - in_height - in_offsetY;
+ }
+
+ // if we are bleeding off the top, flip to south
+ // if tip doesn't fit, we will go back to bleeding off the bottom
+ // logic: take y position and check if less than edge padding
+ if ((y - pageYOffset) < domTT_screenEdgePadding)
+ {
+ y = in_y + domTT_mouseHeight + in_offsetY;
+ }
+
+ return {'x' : x, 'y' : y};
+}
+
+// }}}
+// {{{ domTT_isActive()
+
+// in_id is either the tip id or the owner id
+function domTT_isActive(in_id)
+{
+ var tooltip = domTT_tooltips.get(in_id);
+ if (!tooltip || tooltip.get('status') != 'active')
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+}
+
+// }}}
+// {{{ domTT_runXXX()
+
+// All of these domMenu_runXXX() methods are used by the event handling sections to
+// avoid the circular memory leaks caused by inner functions
+function domTT_runDeactivate(args) { domTT_deactivate(args[0]); }
+function domTT_runShow(args) { domTT_show(args[0], args[1]); }
+
+// }}}
+// {{{ domTT_replaceTitles()
+
+function domTT_replaceTitles(in_decorator)
+{
+ var elements = domLib_getElementsByClass('tooltip');
+ for (var i = 0; i < elements.length; i++)
+ {
+ if (elements[i].title)
+ {
+ var content;
+ if (typeof(in_decorator) == 'function')
+ {
+ content = in_decorator(elements[i]);
+ }
+ else
+ {
+ content = elements[i].title;
+ }
+
+ content = content.replace(new RegExp('\'', 'g'), '\\\'');
+ elements[i].onmouseover = new Function('in_event', "domTT_activate(this, in_event, 'content', '" + content + "')");
+ elements[i].title = '';
+ }
+ }
+}
+
+// }}}
+// {{{ domTT_update()
+
+// Allow authors to update the contents of existing tips using the DOM
+// Unfortunately, the tip must already exist, or else no work is done.
+// TODO: make getting at content or caption cleaner
+function domTT_update(handle, content, type)
+{
+ // type defaults to 'content', can also be 'caption'
+ if (typeof(type) == 'undefined')
+ {
+ type = 'content';
+ }
+
+ var tip = domTT_tooltips.get(handle);
+ if (!tip)
+ {
+ return;
+ }
+
+ var tipObj = tip.get('node');
+ var updateNode;
+ if (type == 'content')
+ {
+ // <div class="contents">...
+ updateNode = tipObj.firstChild;
+ if (updateNode.className != 'contents')
+ {
+ // <table><tbody><tr>...</tr><tr><td><div class="contents">...
+ updateNode = updateNode.firstChild.firstChild.nextSibling.firstChild.firstChild;
+ }
+ }
+ else
+ {
+ updateNode = tipObj.firstChild;
+ if (updateNode.className == 'contents')
+ {
+ // missing caption
+ return;
+ }
+
+ // <table><tbody><tr><td><div class="caption">...
+ updateNode = updateNode.firstChild.firstChild.firstChild.firstChild;
+ }
+
+ // TODO: allow for a DOM node as content
+ updateNode.innerHTML = content;
+}
+
+// }}}
diff --git a/src/usr/local/www/javascript/domTT/fadomatic.js b/src/usr/local/www/javascript/domTT/fadomatic.js
new file mode 100644
index 0000000..2c67d0b
--- /dev/null
+++ b/src/usr/local/www/javascript/domTT/fadomatic.js
@@ -0,0 +1,180 @@
+/** $Id$ */
+// Title: Fadomatic
+// Version: 1.2
+// Homepage: http://chimpen.com/fadomatic
+// Author: Philip McCarthy <fadomatic@chimpen.com>
+
+// Fade interval in milliseconds
+// Make this larger if you experience performance issues
+Fadomatic.INTERVAL_MILLIS = 50;
+
+// Creates a fader
+// element - The element to fade
+// speed - The speed to fade at, from 0.0 to 100.0
+// initialOpacity (optional, default 100) - element's starting opacity, 0 to 100
+// minOpacity (optional, default 0) - element's minimum opacity, 0 to 100
+// maxOpacity (optional, default 0) - element's minimum opacity, 0 to 100
+function Fadomatic (element, rate, initialOpacity, minOpacity, maxOpacity) {
+ this._element = element;
+ this._intervalId = null;
+ this._rate = rate;
+ this._isFadeOut = true;
+
+ // Set initial opacity and bounds
+ // NB use 99 instead of 100 to avoid flicker at start of fade
+ this._minOpacity = 0;
+ this._maxOpacity = 99;
+ this._opacity = 99;
+
+ if (typeof minOpacity != 'undefined') {
+ if (minOpacity < 0) {
+ this._minOpacity = 0;
+ } else if (minOpacity > 99) {
+ this._minOpacity = 99;
+ } else {
+ this._minOpacity = minOpacity;
+ }
+ }
+
+ if (typeof maxOpacity != 'undefined') {
+ if (maxOpacity < 0) {
+ this._maxOpacity = 0;
+ } else if (maxOpacity > 99) {
+ this._maxOpacity = 99;
+ } else {
+ this._maxOpacity = maxOpacity;
+ }
+
+ if (this._maxOpacity < this._minOpacity) {
+ this._maxOpacity = this._minOpacity;
+ }
+ }
+
+ if (typeof initialOpacity != 'undefined') {
+ if (initialOpacity > this._maxOpacity) {
+ this._opacity = this._maxOpacity;
+ } else if (initialOpacity < this._minOpacity) {
+ this._opacity = this._minOpacity;
+ } else {
+ this._opacity = initialOpacity;
+ }
+ }
+
+ // See if we're using W3C opacity, MSIE filter, or just
+ // toggling visiblity
+ if(typeof element.style.opacity != 'undefined') {
+
+ this._updateOpacity = this._updateOpacityW3c;
+
+ } else if(typeof element.style.filter != 'undefined') {
+
+ // If there's not an alpha filter on the element already,
+ // add one
+ if (element.style.filter.indexOf("alpha") == -1) {
+
+ // Attempt to preserve existing filters
+ var existingFilters="";
+ if (element.style.filter) {
+ existingFilters = element.style.filter+" ";
+ }
+ element.style.filter = existingFilters+"alpha(opacity="+this._opacity+")";
+ }
+
+ this._updateOpacity = this._updateOpacityMSIE;
+
+ } else {
+
+ this._updateOpacity = this._updateVisibility;
+ }
+
+ this._updateOpacity();
+}
+
+// Initiates a fade out
+Fadomatic.prototype.fadeOut = function () {
+ this._isFadeOut = true;
+ this._beginFade();
+};
+
+// Initiates a fade in
+Fadomatic.prototype.fadeIn = function () {
+ this._isFadeOut = false;
+ this._beginFade();
+};
+
+// Makes the element completely opaque, stops any fade in progress
+Fadomatic.prototype.show = function () {
+ this.haltFade();
+ this._opacity = this._maxOpacity;
+ this._updateOpacity();
+};
+
+// Makes the element completely transparent, stops any fade in progress
+Fadomatic.prototype.hide = function () {
+ this.haltFade();
+ this._opacity = 0;
+ this._updateOpacity();
+};
+
+// Halts any fade in progress
+Fadomatic.prototype.haltFade = function () {
+
+ clearInterval(this._intervalId);
+};
+
+// Resumes a fade where it was halted
+Fadomatic.prototype.resumeFade = function () {
+
+ this._beginFade();
+};
+
+// Pseudo-private members
+
+Fadomatic.prototype._beginFade = function () {
+
+ this.haltFade();
+ var objref = this;
+ this._intervalId = setInterval(function() { objref._tickFade(); },Fadomatic.INTERVAL_MILLIS);
+};
+
+Fadomatic.prototype._tickFade = function () {
+
+ if (this._isFadeOut) {
+ this._opacity -= this._rate;
+ if (this._opacity < this._minOpacity) {
+ this._opacity = this._minOpacity;
+ this.haltFade();
+ }
+ } else {
+ this._opacity += this._rate;
+ if (this._opacity > this._maxOpacity ) {
+ this._opacity = this._maxOpacity;
+ this.haltFade();
+ }
+ }
+
+ this._updateOpacity();
+};
+
+Fadomatic.prototype._updateVisibility = function () {
+
+ if (this._opacity > 0) {
+ this._element.style.visibility = 'visible';
+ } else {
+ this._element.style.visibility = 'hidden';
+ }
+};
+
+Fadomatic.prototype._updateOpacityW3c = function () {
+
+ this._element.style.opacity = this._opacity/100;
+ this._updateVisibility();
+};
+
+Fadomatic.prototype._updateOpacityMSIE = function () {
+
+ this._element.filters.alpha.opacity = this._opacity;
+ this._updateVisibility();
+};
+
+Fadomatic.prototype._updateOpacity = null;
diff --git a/src/usr/local/www/javascript/filter_log.js b/src/usr/local/www/javascript/filter_log.js
new file mode 100644
index 0000000..66a7309
--- /dev/null
+++ b/src/usr/local/www/javascript/filter_log.js
@@ -0,0 +1,168 @@
+if (typeof getURL == 'undefined') {
+ getURL = function(url, callback) {
+ if (!url)
+ throw 'No URL for getURL';
+ try {
+ if (typeof callback.operationComplete == 'function')
+ callback = callback.operationComplete;
+ } catch (e) {}
+ if (typeof callback != 'function')
+ throw 'No callback function for getURL';
+ var http_request = null;
+ if (typeof XMLHttpRequest != 'undefined') {
+ http_request = new XMLHttpRequest();
+ }
+ else if (typeof ActiveXObject != 'undefined') {
+ try {
+ http_request = new ActiveXObject('Msxml2.XMLHTTP');
+ } catch (e) {
+ try {
+ http_request = new ActiveXObject('Microsoft.XMLHTTP');
+ } catch (e) {}
+ }
+ }
+ if (!http_request)
+ throw 'Both getURL and XMLHttpRequest are undefined';
+ http_request.onreadystatechange = function() {
+ if (http_request.readyState == 4) {
+ callback( { success : true,
+ content : http_request.responseText,
+ contentType : http_request.getResponseHeader("Content-Type") } );
+ }
+ };
+ http_request.open('GET', url, true);
+ http_request.send(null);
+ };
+}
+
+function outputrule(req) {
+ alert(req.content);
+}
+function fetch_new_rules() {
+ if(isPaused)
+ return;
+ if(isBusy)
+ return;
+ isBusy = true;
+ getURL('diag_logs_filter_dynamic.php?lastsawtime=' + lastsawtime, fetch_new_rules_callback);
+}
+function fetch_new_rules_callback(callback_data) {
+ if(isPaused)
+ return;
+
+ var data_split;
+ var new_data_to_add = Array();
+ var data = callback_data.content;
+
+ data_split = data.split("\n");
+
+ for(var x=0; x<data_split.length-1; x++) {
+ /* loop through rows */
+ row_split = data_split[x].split("||");
+ lastsawtime = row_split[9];
+
+ var tmp = format_log_line(row_split);
+ if ( !(tmp) ) continue;
+
+ new_data_to_add[new_data_to_add.length] = tmp;
+ }
+ update_table_rows(new_data_to_add);
+ isBusy = false;
+}
+
+function in_arrayi(needle, haystack) {
+ var i = haystack.length;
+ while (i--) {
+ if (haystack[i].toLowerCase() === needle.toLowerCase()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+function update_table_rows(data) {
+ if(isPaused)
+ return;
+
+ var isIE = navigator.appName.indexOf('Microsoft') != -1;
+ var isSafari = navigator.userAgent.indexOf('Safari') != -1;
+ var isOpera = navigator.userAgent.indexOf('Opera') != -1;
+ var showanim = 1;
+ if (isIE) {
+ showanim = 0;
+ }
+
+ var startat = data.length - nentries;
+ if (startat < 0) {
+ startat = 0;
+ }
+ data = data.slice(startat, data.length);
+
+ var rows = jQuery('#filter-log-entries>tr');
+
+ // Number of rows to move by
+ var move = rows.length + data.length - nentries;
+ if (move < 0)
+ move = 0;
+
+ if (isReverse == false) {
+ for (var i = move; i < rows.length; i++) {
+ jQuery(rows[i - move]).html(jQuery(rows[i]).html());
+ }
+
+ var tbody = jQuery('#filter-log-entries');
+ for (var i = 0; i < data.length; i++) {
+ var rowIndex = rows.length - move + i;
+ if (rowIndex < rows.length) {
+ jQuery(rows[rowIndex]).html(data[i]);
+ } else {
+ jQuery(tbody).append('<tr>' + data[i] + '</tr>');
+ }
+ }
+ } else {
+ for (var i = rows.length - 1; i >= move; i--) {
+ jQuery(rows[i]).html(jQuery(rows[i - move]).html());
+ }
+
+ var tbody = jQuery('#filter-log-entries');
+ for (var i = 0; i < data.length; i++) {
+ var rowIndex = move - 1 - i;
+ if (rowIndex >= 0) {
+ jQuery(rows[rowIndex]).html(data[i]);
+ } else {
+ jQuery(tbody).prepend('<tr>' + data[i] + '</tr>');
+ }
+ }
+ }
+
+ // Much easier to go through each of the rows once they've all be added.
+ rows = jQuery('#filter-log-entries>tr');
+ for (var i = 0; i < rows.length; i++) {
+ rows[i].className = i % 2 == 0 ? 'listMRodd' : 'listMReven';
+ }
+}
+
+function toggle_pause() {
+ if(isPaused) {
+ isPaused = false;
+ fetch_new_rules();
+ } else {
+ isPaused = true;
+ }
+}
+/* start local AJAX engine */
+if (typeof updateDelay != 'undefined') {
+ timer = setInterval('fetch_new_rules()', updateDelay);
+}
+
+function toggleListDescriptions(){
+ var ss = document.styleSheets;
+ for (var i=0; i<ss.length; i++) {
+ var rules = ss[i].cssRules || ss[i].rules;
+ for (var j=0; j<rules.length; j++) {
+ if (rules[j].selectorText === ".listMRDescriptionL" || rules[j].selectorText === ".listMRDescriptionR") {
+ rules[j].style.display = rules[j].style.display === "none" ? "table-cell" : "none";
+ }
+ }
+ }
+}
diff --git a/src/usr/local/www/javascript/firebug-lite.js b/src/usr/local/www/javascript/firebug-lite.js
new file mode 100644
index 0000000..135b9e6
--- /dev/null
+++ b/src/usr/local/www/javascript/firebug-lite.js
@@ -0,0 +1,1000 @@
+/**
+ * firebug lite <http://www.getfirebug.com/lite.html>
+ * v1.0
+ * 04.11.2008, 8:25 PM ~
+ * v1.0a
+ * 03.27.2008, 5:44 AM ~ 04.01.2008, 21:32 PM
+ * Azer Koçulu <http://azer.kodfabrik.com>
+ */
+
+var firebug = {
+ env:{ "cache":{}, "ctmp":[], "dIndex":"console", "init":false, "ml":false, "objCn":[] },
+ init:function(){
+ firebug.el = {}; // elements
+ firebug.el.content = {};
+ with(firebug){
+
+ document.documentElement.childNodes[0].appendChild(
+ new pi.element("link").attribute.set("rel","stylesheet").attribute.set("href","http://firebuglite.appspot.com/firebug-lite.css").environment.getElement()
+ );
+
+ /*
+ * main interface
+ */
+ el.main = new pi.element("DIV").attribute.set("id","Firebug").environment.addStyle({ "width":pi.util.GetWindowSize().width+"px" }).insert(document.body);
+ el.header = new pi.element("DIV").attribute.addClass("Header").insert(el.main);
+ el.left = {};
+ el.left.container = new pi.element("DIV").attribute.addClass("Left").insert(el.main);
+ el.right = {};
+ el.right.container = new pi.element("DIV").attribute.addClass("Right").insert(el.main);
+ el.main.child.add(new pi.element("DIV").environment.addStyle({ "clear":"both" }));
+
+ /*
+ * buttons
+ */
+ el.button = {};
+ el.button.container = new pi.element("DIV").attribute.addClass("ButtonContainer").insert(el.header);
+ el.button.logo = new pi.element("A").attribute.set("title","Firebug Lite").attribute.set("target","_blank").attribute.set("href","http://getfirebug.com/lite.html").update("&nbsp;").attribute.addClass("Button Logo").insert(el.button.container);
+ el.button.inspect = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.inspector.toggle).update("Inspect").insert(el.button.container);
+ el.button.maximize = new pi.element("A").attribute.addClass("Button Maximize").event.addListener("click",win.maximize).insert(el.button.container);
+ el.button.minimize = new pi.element("A").attribute.addClass("Button Minimize").event.addListener("click",win.minimize).insert(el.button.container);
+ el.button.close = new pi.element("A").attribute.addClass("Button Close").event.addListener("click",win.close).insert(el.button.container);
+
+ if(pi.env.ie||pi.env.webkit){
+ el.button.container.environment.addStyle({ "paddingTop":"12px" });
+ }
+
+ /*
+ * navigation
+ */
+ el.nav = {};
+ el.nav.container = new pi.element("DIV").attribute.addClass("Nav").insert(el.left.container);
+ el.nav.console = new pi.element("A").attribute.addClass("Tab Selected").event.addListener("click",d.navigate.curry(window,"console")).update("Console").insert(el.nav.container);
+ el.nav.html = new pi.element("A").attribute.addClass("Tab").update("HTML").event.addListener("click",d.navigate.curry(window,"html")).insert(el.nav.container);
+ el.nav.css = new pi.element("A").attribute.addClass("Tab").update("CSS").event.addListener("click",d.navigate.curry(window,"css")).insert(el.nav.container);
+ el.nav.scripts = new pi.element("A").attribute.addClass("Tab").update("Script").event.addListener("click",d.navigate.curry(window,"scripts")).insert(el.nav.container);
+ el.nav.dom = new pi.element("A").attribute.addClass("Tab").update("DOM").event.addListener("click",d.navigate.curry(window,"dom")).insert(el.nav.container);
+ el.nav.xhr = new pi.element("A").attribute.addClass("Tab").update("XHR").event.addListener("click",d.navigate.curry(window,"xhr")).insert(el.nav.container);
+
+ /*
+ * inspector
+ */
+
+ el.borderInspector = new pi.element("DIV").attribute.set("id","FirebugBorderInspector").event.addListener("click",listen.inspector).insert(document.body);
+ el.bgInspector = new pi.element("DIV").attribute.set("id","FirebugBGInspector").insert(document.body);
+
+ /*
+ * console
+ */
+ el.left.console = {};
+ el.left.console.container = new pi.element("DIV").attribute.addClass("Console").insert(el.left.container);
+ el.left.console.mlButton = new pi.element("A").attribute.addClass("MLButton").event.addListener("click",d.console.toggleML).insert(el.left.console.container);
+ el.left.console.monitor = new pi.element("DIV").insert(
+ new pi.element("DIV").attribute.addClass("Monitor").insert(el.left.console.container)
+ );
+ el.left.console.container.child.add(
+ new pi.element("DIV").attribute.addClass("InputArrow").update(">>>")
+ );
+ el.left.console.input = new pi.element("INPUT").attribute.set("type","text").attribute.addClass("Input").event.addListener("keydown",listen.consoleTextbox).insert(
+ new pi.element("DIV").attribute.addClass("InputContainer").insert(el.left.console.container)
+ );
+
+ el.right.console = {};
+ el.right.console.container = new pi.element("DIV").attribute.addClass("Console Container").insert(el.right.container);
+ el.right.console.mlButton = new pi.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.console.container);
+ el.right.console.input = new pi.element("TEXTAREA").attribute.addClass("Input").insert(el.right.console.container);
+ el.right.console.run = new pi.element("A").attribute.addClass("Button").event.addListener("click",listen.runMultiline).update("Run").insert(el.right.console.container);
+
+ el.right.console.clear = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.clean.curry(window,el.right.console.input)).update("Clear").insert(el.right.console.container);
+
+ el.button.console = {};
+ el.button.console.container = new pi.element("DIV").attribute.addClass("ButtonSet").insert(el.button.container);
+ el.button.console.clear = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.clean.curry(window,el.left.console.monitor)).update("Clear").insert(el.button.console.container);
+
+ /*
+ * html
+ */
+
+ el.left.html = {};
+ el.left.html.container = new pi.element("DIV").attribute.addClass("HTML").insert(el.left.container);
+
+ el.right.html = {};
+ el.right.html.container = new pi.element("DIV").attribute.addClass("HTML Container").insert(el.right.container);
+
+ el.right.html.nav = {};
+ el.right.html.nav.container = new pi.element("DIV").attribute.addClass("Nav").insert(el.right.html.container);
+ el.right.html.nav.computedStyle = new pi.element("A").attribute.addClass("Tab Selected").event.addListener("click",d.html.navigate.curry(firebug,"computedStyle")).update("Computed Style").insert(el.right.html.nav.container);
+ if(!pi.env.ie6)
+ el.right.html.nav.dom = new pi.element("A").attribute.addClass("Tab").event.addListener("click",d.html.navigate.curry(firebug,"dom")).update("DOM").insert(el.right.html.nav.container);
+
+ el.right.html.content = new pi.element("DIV").attribute.addClass("Content").insert(el.right.html.container);
+
+ el.button.html = {};
+ el.button.html.container = new pi.element("DIV").attribute.addClass("ButtonSet HTML").insert(el.button.container);
+
+ /*
+ * css
+ */
+
+ el.left.css = {};
+ el.left.css.container = new pi.element("DIV").attribute.addClass("CSS").insert(el.left.container);
+
+ el.right.css = {};
+ el.right.css.container = new pi.element("DIV").attribute.addClass("CSS Container").insert(el.right.container);
+
+ el.right.css.nav = {};
+ el.right.css.nav.container = new pi.element("DIV").attribute.addClass("Nav").insert(el.right.css.container);
+ el.right.css.nav.runCSS = new pi.element("A").attribute.addClass("Tab Selected").update("Run CSS").insert(el.right.css.nav.container);
+
+ el.right.css.mlButton = new pi.element("A").attribute.addClass("MLButton CloseML").event.addListener("click",d.console.toggleML).insert(el.right.css.container);
+ el.right.css.input = new pi.element("TEXTAREA").attribute.addClass("Input").insert(el.right.css.container);
+ el.right.css.run = new pi.element("A").attribute.addClass("Button").event.addListener("click",listen.runCSS).update("Run").insert(el.right.css.container);
+ el.right.css.clear = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.clean.curry(window,el.right.css.input)).update("Clear").insert(el.right.css.container);
+
+ el.button.css = {};
+ el.button.css.container = new pi.element("DIV").attribute.addClass("ButtonSet CSS").insert(el.button.container);
+ el.button.css.selectbox = new pi.element("SELECT").event.addListener("change",listen.cssSelectbox).insert(el.button.css.container);
+
+ /*
+ * scripts
+ */
+
+ el.left.scripts = {};
+ el.left.scripts.container = new pi.element("DIV").attribute.addClass("Scripts").insert(el.left.container);
+
+ el.right.scripts = {};
+ el.right.scripts.container = new pi.element("DIV").attribute.addClass("Scripts Container").insert(el.right.container);
+
+ el.button.scripts = {};
+ el.button.scripts.container = new pi.element("DIV").attribute.addClass("ButtonSet Scripts").insert(el.button.container);
+ el.button.scripts.selectbox = new pi.element("SELECT").event.addListener("change",listen.scriptsSelectbox).insert(el.button.scripts.container);
+ el.button.scripts.lineNumbers = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.scripts.toggleLineNumbers).update("Show Line Numbers").insert(el.button.scripts.container);
+
+ /*
+ * dom
+ */
+
+ el.left.dom = {};
+ el.left.dom.container = new pi.element("DIV").attribute.addClass("DOM").insert(el.left.container);
+
+ el.right.dom = {};
+ el.right.dom.container = new pi.element("DIV").attribute.addClass("DOM Container").insert(el.right.container);
+
+ el.button.dom = {};
+ el.button.dom.container = new pi.element("DIV").attribute.addClass("ButtonSet DOM").insert(el.button.container);
+ el.button.dom.label = new pi.element("LABEL").update("Object Path:").insert(el.button.dom.container);
+ el.button.dom.textbox = new pi.element("INPUT").event.addListener("keydown",listen.domTextbox).update("window").insert(el.button.dom.container);
+
+ /*
+ * str
+ */
+
+ el.left.str = {};
+ el.left.str.container = new pi.element("DIV").attribute.addClass("STR").insert(el.left.container);
+
+ el.right.str = {};
+ el.right.str.container = new pi.element("DIV").attribute.addClass("STR").insert(el.left.container);
+
+ el.button.str = {};
+ el.button.str.container = new pi.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container);
+ el.button.str.watch = new pi.element("A").attribute.addClass("Button").event.addListener("click",d.navigate.curry(window,"xhr")).update("Back").insert(el.button.str.container);
+
+ /*
+ * xhr
+ */
+
+ el.left.xhr = {};
+ el.left.xhr.container = new pi.element("DIV").attribute.addClass("XHR").insert(el.left.container);
+
+ el.right.xhr = {};
+ el.right.xhr.container = new pi.element("DIV").attribute.addClass("XHR").insert(el.left.container);
+
+
+ el.button.xhr = {};
+ el.button.xhr.container = new pi.element("DIV").attribute.addClass("ButtonSet XHR").insert(el.button.container);
+ el.button.xhr.label = new pi.element("LABEL").update("XHR Path:").insert(el.button.xhr.container);
+ el.button.xhr.textbox = new pi.element("INPUT").event.addListener("keydown",listen.xhrTextbox).insert(el.button.xhr.container);
+ el.button.xhr.watch = new pi.element("A").attribute.addClass("Button").event.addListener("click",listen.addXhrObject).update("Watch").insert(el.button.xhr.container);
+
+ // fix ie6 a:hover bug
+ if(pi.env.ie6)
+ {
+ var buttons = [
+ el.button.inspect,
+ el.button.close,
+ el.button.inspect,
+ el.button.console.clear,
+ el.right.console.run,
+ el.right.console.clear,
+ el.right.css.run,
+ el.right.css.clear
+ ];
+ for(var i=0; i<buttons.length; i++)
+ buttons[i].attribute.set("href","#");
+ }
+ //
+
+ env.init = true;
+
+ for(var i=0; i<env.ctmp.length; i++)
+ {
+ d.console.log.apply(window,env.ctmp[i]);
+ }
+ }
+ },
+ win:{
+ close:function(){
+ with(firebug){
+ el.main.update("");
+ el.main.remove();
+ }
+ },
+ minimize:function(){
+ with(firebug){
+ el.main.environment.addStyle({ "height":"35px" });
+ el.button.maximize.environment.addStyle({ "display":"block" });
+ el.button.minimize.environment.addStyle({ "display":"none" });
+ d.refreshSize();
+ }
+ },
+ maximize:function(){
+ with(firebug){
+ el.main.environment.addStyle({ "height":"295px" });
+ el.button.minimize.environment.addStyle({ "display":"block" });
+ el.button.maximize.environment.addStyle({ "display":"none" });
+ d.refreshSize();
+ }
+ }
+ },
+ watchXHR:function(){
+ with(firebug){
+ d.xhr.addObject.apply(window,arguments);
+ if(env.dIndex!="xhr"){
+ d.navigate("xhr");
+ }
+ }
+ },
+ d: {
+ clean:function(_element){
+ with(firebug){
+ _element.update("");
+ }
+ },
+ console:{
+ dir:function(_value){
+ with(firebug){
+ d.console.addLine().attribute.addClass("Arrow").update(">>> console.dir("+_value+")");
+ d.dom.open(_value,d.console.addLine());
+ }
+ },
+ addLine:function(){
+ with (firebug) {
+ return new pi.element("DIV").attribute.addClass("Row").insert(el.left.console.monitor);
+ }
+ },
+ openObject:function(_index){
+ with (firebug) {
+ d.dom.open(env.objCn[_index], el.left.dom.container, pi.env.ie);
+ d.navigate("dom");
+ }
+ },
+ historyIndex:0,
+ history:[],
+ log:function(_values){
+ with (firebug) {
+ if(env.init==false){
+ env.ctmp.push(arguments);
+ return;
+ }
+
+ var value = "";
+ for(var i=0; i<arguments.length; i++){
+ value += (i>0?" ":"")+d.highlight(arguments[i],false,false,true);
+ }
+
+ d.console.addLine().update(value);
+ d.console.scroll();
+
+ }
+ },
+ print: function(_cmd,_text){
+ with (firebug){
+ d.console.addLine().attribute.addClass("Arrow").update(">>> "+_cmd);
+ d.console.addLine().update(d.highlight(_text,false,false,true));
+ d.console.scroll();
+ d.console.historyIndex = d.console.history.push(_cmd);
+ }
+ },
+ run:function(cmd){
+ with(firebug){
+ if(cmd.length==0)return;
+ el.left.console.input.environment.getElement().value = "";
+ try {
+ var result = eval.call(window,cmd);
+ d.console.print(cmd,result);
+ } catch(e){
+ d.console.addLine().attribute.addClass("Arrow").update(">>> "+cmd);
+ if(!pi.env.ff){
+ d.console.scroll();
+ return d.console.addLine().attribute.addClass("Error").update("<strong>Error: </strong>"+(e.description||e),true);
+ }
+ if(e.fileName==null){
+ d.console.addLine().attribute.addClass("Error").update("<strong>Error: </strong>"+e.message,true);
+ }
+ var fileName = e.fileName.split("\/").getLastItem();
+ d.console.addLine().attribute.addClass("Error").update("<strong>Error: </strong>"+e.message+" (<em>"+fileName+"</em>,"+e.lineNumber+")",true);
+ d.console.scroll();
+ }
+ d.console.scroll();
+ }
+ },
+ scroll:function(){
+ with(firebug){
+ el.left.console.monitor.environment.getElement().parentNode.scrollTop = Math.abs(el.left.console.monitor.environment.getSize().offsetHeight-200);
+ }
+ },
+ toggleML:function(){
+ with(firebug){
+ var open = !env.ml;
+ env.ml = !env.ml;
+ d.navigateRightColumn("console",open);
+ el[open?"left":"right"].console.mlButton.environment.addStyle({ display:"none" });
+ el[!open?"left":"right"].console.mlButton.environment.addStyle({ display:"block" });
+ el.left.console.monitor.environment.addStyle({ "height":(open?233:210)+"px" });
+ el.left.console.mlButton.attribute[(open?"add":"remove")+"Class"]("CloseML");
+ }
+ }
+ },
+ css:{
+ index:-1,
+ open:function(_index){
+ with (firebug) {
+ var item = document.styleSheets[_index];
+ var uri = item.href;
+ if(uri.indexOf("http:\/\/")>-1&&getDomain(uri)!=document.domain){
+ el.left.css.container.update("<em>Access to restricted URI denied</em>");
+ return;
+ }
+ var rules = item[pi.env.ie ? "rules" : "cssRules"];
+ var str = "";
+ for (var i=0; i<rules.length; i++) {
+ var item = rules[i];
+ var selector = item.selectorText;
+ var cssText = pi.env.ie?item.style.cssText:item.cssText.match(/\{(.*)\}/)[1];
+ str+=d.css.printRule(selector, cssText.split(";"), el.left.css.container);
+ }
+ el.left.css.container.update(str);
+ }
+ },
+ printRule:function(_selector,_css,_layer){
+ with(firebug){
+ var str = "<div class='Selector'>"+_selector+" {</div>";
+ for(var i=0; i<_css.length; i++){
+ var item = _css[i];
+ str += "<div class='CSSText'>"+item.replace(/(.+\:)(.+)/,"<span class='CSSProperty'>$1</span><span class='CSSValue'>$2;</span>")+"</div>";
+ }
+ str+="<div class='Selector'>}</div>";
+ return str;
+ }
+ },
+ refresh:function(){
+ with(firebug){
+ el.button.css.selectbox.update("");
+ var collection = document.styleSheets;
+ for(var i=0; i<collection.length; i++){
+ var uri = collection[i].href;
+ d.css.index=d.css.index<0?i:d.css.index;
+ el.button.css.selectbox.child.add(
+ new pi.element("OPTION").attribute.set("value",i).update(uri)
+ );
+ };
+ d.css.open(d.css.index);
+ }
+ }
+ },
+ dom: {
+ open: function(_object,_layer){
+ with (firebug) {
+ _layer.clean();
+ var container = new pi.element("DIV").attribute.addClass("DOMContent").insert(_layer);
+ d.dom.print(_object, container);
+ }
+ },
+ print:function(_object,_parent, _inTree){
+ with (firebug) {
+ var obj = _object || window, parentElement = _parent;
+ parentElement.update("");
+
+ if(parentElement.opened&&parentElement!=el.left.dom.container){
+ parentElement.environment.getParent().pi.child.get()[0].pi.child.get()[0].pi.attribute.removeClass("Opened");
+ parentElement.opened = false;
+ parentElement.environment.addStyle({ "display":"none" });
+ return;
+ }
+ if(_inTree)
+ parentElement.environment.getParent().pi.child.get()[0].pi.child.get()[0].pi.attribute.addClass("Opened");
+ parentElement.opened = true;
+
+ for (var key in obj) {
+ try {
+
+ var value = obj[key], property = key, container = new pi.element("DIV").attribute.addClass("DOMRow").insert(parentElement),
+ left = new pi.element("DIV").attribute.addClass("DOMRowLeft").insert(container), right = new pi.element("DIV").attribute.addClass("DOMRowRight").insert(container);
+
+ container.child.add(
+ new pi.element("DIV").environment.addStyle({ "clear":"both" })
+ );
+
+ var link = new pi.element("A").attribute.addClass(
+ typeof value=="object"&&Boolean(value)?"Property Object":"Property"
+ ).update(property).insert(left);
+
+ right.update(
+ d.highlight(value,false,true)
+ );
+
+ var subContainer = new pi.element("DIV").attribute.addClass("DOMRowSubContainer").insert(container);
+
+ if(typeof value!="object"||Boolean(value)==false)
+ continue;
+
+ link.event.addListener("click",d.dom.print.curry(window,value, subContainer, true));
+ }catch(e){
+ }
+ }
+ parentElement.environment.addStyle({ "display":"block" });
+ }
+ }
+ },
+ highlight:function(_value,_inObject,_inArray,_link){
+ with(firebug){
+ var isArray = false, isElement = false;
+ try {
+ isArray = pi.util.IsArray(_value);
+ isElement = _value!=undefined&&Boolean(_value.nodeName)&&Boolean(_value.nodeType);
+ }catch(e){};
+
+ // number, string, boolean, null, function
+ if(_value==null||["boolean","function","number","string"].indexOf(typeof _value)>-1){
+ // NULL
+ if(_value==null){
+ return "<span class='Null'>null</span>";
+ }
+
+ // BOOLEAN & NUMBER
+ if (["boolean", "number"].indexOf(typeof _value) > -1) {
+ return "<span class='DarkBlue'>" + _value + "</span>";
+ }
+
+ // FUNCTION
+ if(typeof _value=="function"){
+ return "<span class='"+(_inObject?"Italic Gray":"Green")+"'>function()</span>";
+ }
+
+ // STRING
+ return "<span class='Red'>\""+( !_inObject&&!_inArray?_value : _value.substring(0,35) ).replace(/\n/g,"\\n").replace(/\s/g,"&nbsp;").replace(/>/g,"&#62;").replace(/</g,"&#60;")+"\"</span>";
+ }
+ // element
+ else if(isElement){
+ if(_value.nodeType==3)return d.highlight(_value.nodeValue);
+
+ if(_inArray||_inObject){
+ var result = "<span class='Blue'>"+_value.nodeName.toLowerCase();
+ if(_value.getAttribute&&_value.getAttribute("id"))result += "<span class='DarkBlue'>#"+_value.getAttribute("id")+"</span>";
+ var elClass = _value.getAttribute?_value.getAttribute(pi.env.ie?"className":"class"):"";
+ if(elClass)result += "<span class='Red'>."+elClass.split(" ")[0]+"</span>";
+ return result+"</span>";
+ }
+
+ var result = "<span class='Blue'>&#60;"+_value.nodeName.toLowerCase()+"";
+ if(_value.attributes)
+ for(var i=0; i<_value.attributes.length; i++){
+ var item = _value.attributes[i];
+ if(pi.env.ie&&Boolean(item.nodeValue)==false)continue;
+ result += " <span class='DarkBlue'>"+item.nodeName+"=\"<span class='Red'>"+item.nodeValue+"</span>\"</span>";
+ }
+ result += "&#62;</span>";
+ return result;
+ }
+ // array & object
+ else if(isArray||["object","array"].indexOf(typeof _value)>-1){
+ var result = "";
+ if(isArray||_value instanceof Array){
+ if(_inObject)return "<span class='Gray Italic'>["+_value.length+"]</span>";
+ result += "<span class='Strong'>[ ";
+
+ for(var i=0; i<_value.length; i++){
+ if((_inObject||_inArray)&&pi.env.ie&&i>3)break;
+ result += (i > 0 ? ", " : "") + d.highlight(_value[i], false, true, true);
+ }
+ result += " ]</span>";
+ return result;
+ }
+ if(_inObject)return "<span class='Gray Italic'>Object</span>";
+ result += "<span class='Strong Green"+ ( !_link?"'":" ObjectLink' onmouseover='this.className=this.className.replace(\"ObjectLink\",\"ObjectLinkHover\")' onmouseout='this.className=this.className.replace(\"ObjectLinkHover\",\"ObjectLink\")' onclick='firebug.d.console.openObject(" +( env.objCn.push( _value ) -1 )+")'" ) + ">Object";
+ var i=0;
+ for(var key in _value){
+ var value = _value[key];
+ if((_inObject||_inArray)&&pi.env.ie&&i>3)
+ break;
+ result += " "+key+"="+d.highlight(value,true);
+ i++;
+ };
+ result += "</span>";
+ return result;
+ } else {
+ if(_inObject)
+ return "<span class='Gray Italic'>"+_value+"</span>";
+ return _value;
+ }
+
+ }
+ },
+ html:{
+ nIndex:"computedStyle",
+ current:null,
+ highlight:function(_element,_clear,_event){
+ with(firebug){
+ if(_clear){
+ el.bgInspector.environment.addStyle({ "display":"none" });
+ return;
+ }
+ d.inspector.inspect(_element,true);
+ }
+ },
+ inspect:function(_element){
+ var el = _element, map = [], parent = _element;
+ while(parent){
+ map.push(parent);
+ if(parent==document.body)break;
+ parent = parent.parentNode;
+ }
+ map = map.reverse();
+ with(firebug){
+ d.inspector.toggle();
+ var parentLayer = el.left.html.container.child.get()[1].childNodes[1].pi;
+ for(var t=0; map[t];){
+ if(t==map.length-1){
+
+ var link = parentLayer.environment.getElement().previousSibling.pi;
+ link.attribute.addClass("Selected");
+
+ if(d.html.current)d.html.current[1].attribute.removeClass("Selected");
+
+ d.html.current = [_element,link];
+
+ return t;
+ }
+ parentLayer = d.html.openHtmlTree(map[t],parentLayer,map[t+1]);
+ t++;
+ }
+ }
+ },
+ navigate:function(_index,_element){
+ with(firebug){
+ el.right.html.nav[d.html.nIndex].attribute.removeClass("Selected");
+ el.right.html.nav[_index].attribute.addClass("Selected");
+ d.html.nIndex = _index;
+ d.html.openProperties();
+
+ }
+ },
+ openHtmlTree:function(_element,_parent,_returnParentElementByElement,_event){
+ with(firebug){
+ var element = _element || document.documentElement,
+ parent = _parent || el.left.html.container,
+ returnParentEl = _returnParentElementByElement || null,
+ returnParentVal = null;
+
+ if(parent!=el.left.html.container){
+ var nodeLink = parent.environment.getParent().pi.child.get()[0].pi;
+ if(d.html.current)d.html.current[1].attribute.removeClass("Selected");
+ nodeLink.attribute.addClass("Selected");
+
+ d.html.current = [_element,nodeLink];
+ d.html.openProperties();
+ }
+
+ if(element.childNodes&&(element.childNodes.length==0||(element.childNodes.length==1&&element.childNodes[0].nodeType==3)))return;
+ parent.clean();
+
+ if(parent.opened&&Boolean(_returnParentElementByElement)==false){
+ parent.opened = false;
+ parent.environment.getParent().pi.child.get()[0].pi.attribute.removeClass("Open");
+ return;
+ }
+ if (parent != el.left.html.container) {
+ parent.environment.getParent().pi.child.get()[0].pi.attribute.addClass("Open");
+ parent.opened = true;
+
+ }
+
+ for(var i=0; i<element.childNodes.length; i++){
+ var item = element.childNodes[i];
+
+ if(item.nodeType==3)continue;
+ var container = new pi.element().attribute.addClass("Block").insert(parent);
+ var link = new pi.element("A").attribute.addClass("Link").update(d.highlight(item)).insert(container);
+ var subContainer = new pi.element("DIV").attribute.addClass("SubContainer").insert(container);
+ link.event.addListener("click",d.html.openHtmlTree.curry(window,item,subContainer,false));
+ link.event.addListener("mouseover",d.html.highlight.curry(window,item, false));
+ link.event.addListener("mouseout",d.html.highlight.curry(window,item,true));
+
+ returnParentVal = returnParentEl==item?subContainer:returnParentVal;
+
+ if(d.html.current==null&&item==document.body){
+ link.attribute.addClass("Selected");
+ d.html.current = [item,link];
+ d.html.openHtmlTree(item,subContainer);
+ }
+
+ if(item.childNodes&&item.childNodes.length==1&&item.childNodes[0].nodeType==3){
+ link.child.get()[0].appendChild(document.createTextNode(item.childNodes[0].nodeValue.substring(0,100)));
+ link.child.get()[0].appendChild(document.createTextNode("</"));
+ link.child.get()[0].appendChild(new pi.element("span").attribute.addClass("Blue").update(item.nodeName.toLowerCase()).environment.getElement());
+ link.child.get()[0].appendChild(document.createTextNode(">"));
+ continue;
+ }
+ else if(item.childNodes&&item.childNodes.length==0)continue;
+ link.attribute.addClass("ParentLink");
+
+ }
+ return returnParentVal;
+ }
+ },
+ openProperties:function(){
+ with(firebug){
+
+ var index = d.html.nIndex;
+ var node = d.html.current[0];
+ d.clean(el.right.html.content);
+ var str = "";
+ switch(index){
+ case "computedStyle":
+ var property = ["opacity","filter","azimuth","background","backgroundAttachment","backgroundColor","backgroundImage","backgroundPosition","backgroundRepeat","border","borderCollapse","borderColor","borderSpacing","borderStyle","borderTop","borderRight","borderBottom","borderLeft","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","borderWidth","bottom","captionSide","clear","clip","color","content","counterIncrement","counterReset","cue","cueAfter","cueBefore","cursor","direction","display","elevation","emptyCells","cssFloat","font","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","height","left","letterSpacing","lineHeight","listStyle","listStyleImage","listStylePosition","listStyleType","margin","marginTop","marginRight","marginBottom","marginLeft","markerOffset","marks","maxHeight","maxWidth","minHeight","minWidth","orphans","outline","outlineColor","outlineStyle","outlineWidth","overflow","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","page","pageBreakAfter","pageBreakBefore","pageBreakInside","pause","pauseAfter","pauseBefore","pitch","pitchRange","playDuring","position","quotes","richness","right","size","speak","speakHeader","speakNumeral","speakPunctuation","speechRate","stress","tableLayout","textAlign","textDecoration","textIndent","textShadow","textTransform","top","unicodeBidi","verticalAlign","visibility","voiceFamily","volume","whiteSpace","widows","width","wordSpacing","zIndex"].sort();
+ var view = document.defaultView?document.defaultView.getComputedStyle(node,null):node.currentStyle;
+ for(var i=0; i<property.length; i++){
+ var item = property[i];
+ if(!view[item])continue;
+ str+="<div class='CSSItem'><div class='CSSProperty'>"+item+"</div><div class='CSSValue'>"+d.highlight(view[item])+"</div></div>";
+ }
+ el.right.html.content.update(str);
+ break;
+ case "dom":
+ d.dom.open(node,el.right.html.content,pi.env.ie);
+ break;
+ }
+ }
+ }
+ },
+ inspector:{
+ enabled:false,
+ el:null,
+ inspect:function(_element,_bgInspector){
+ var el = _element, top = el.offsetTop, left = el.offsetLeft, parent = _element.offsetParent;
+ while(Boolean(parent)&&parent!=document.firstChild){
+ top += parent.offsetTop;
+ left += parent.offsetLeft;
+ parent = parent.offsetParent;
+ if(parent==document.body)break;
+ };
+
+ with(firebug){
+ el[_bgInspector?"bgInspector":"borderInspector"].environment.addStyle({
+ "width":_element.offsetWidth+"px", "height":_element.offsetHeight+"px",
+ "top":top-(_bgInspector?0:2)+"px", "left":left-(_bgInspector?0:2)+"px",
+ "display":"block"
+ });
+
+ if(!_bgInspector){
+ d.inspector.el = _element;
+ }
+ };
+ },
+ toggle:function(){
+ with (firebug) {
+ d.inspector.enabled = !d.inspector.enabled;
+ el.button.inspect.attribute[(d.inspector.enabled ? "add" : "remove") + "Class"]("Enabled");
+ if(d.inspector.enabled==false){
+ el.borderInspector.environment.addStyle({ "display":"none" });
+ d.inspector.el = null;
+ } else if(pi.env.dIndex!="html") {
+ d.navigate("html");
+ }
+ }
+ }
+ },
+ scripts:{
+ index:-1,
+ lineNumbers:false,
+ open:function(_index){
+ with(firebug){
+ d.scripts.index = _index;
+ el.left.scripts.container.update("");
+ var script = document.getElementsByTagName("script")[_index],uri = script.src||document.location.href,source;
+
+ if(uri.indexOf("http:\/\/")>-1&&getDomain(uri)!=document.domain){
+ el.left.scripts.container.update("<em>Access to restricted URI denied</em>");
+ return;
+ }
+
+ if(uri!=document.location.href){
+ source = env.cache[uri]||pi.xhr.get(uri).responseText;
+ env.cache[uri] = source;
+ } else
+ source = script.innerHTML;
+ source = source.replace(/\n|\t|<|>/g,function(_ch){
+ return ({"<":"&#60;",">":"&#62;","\t":"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;","\n":"<br />"})[_ch];
+ });
+
+ if (!d.scripts.lineNumbers)
+ el.left.scripts.container.child.add(
+ new pi.element("DIV").attribute.addClass("CodeContainer").update(source)
+ );
+ else {
+ source = source.split("<br />");
+ for (var i = 0; i < source.length; i++) {
+ el.left.scripts.container.child.add(new pi.element("DIV").child.add(new pi.element("DIV").attribute.addClass("LineNumber").update(i + 1), new pi.element("DIV").attribute.addClass("Code").update("&nbsp;" + source[i]), new pi.element("DIV").environment.addStyle({
+ "clear": "both"
+ })));
+ };
+ };
+ }
+ },
+ toggleLineNumbers:function(){
+ with(firebug){
+ d.scripts.lineNumbers = !d.scripts.lineNumbers;
+ el.button.scripts.lineNumbers.attribute[(d.scripts.lineNumbers ? "add" : "remove") + "Class"]("Enabled");
+ d.scripts.open( d.scripts.index );
+
+ }
+ },
+ refresh:function(){
+ with(firebug){
+ el.button.scripts.selectbox.clean();
+ var collection = document.getElementsByTagName("script");
+ for(var i=0; i<collection.length; i++){
+ var item = collection[i];
+ d.scripts.index=d.scripts.index<0?i:d.scripts.index;
+ el.button.scripts.selectbox.child.add(
+ new pi.element("OPTION").attribute.set("value",i).update(item.src||item.baseURI||"..")
+ );
+ }
+ d.scripts.open( d.scripts.index );
+ }
+ }
+ },
+ str: {
+ open:function(_str){
+ with(firebug){
+ d.navigate("str");
+ el.left.str.container.update(_str.replace(/\n/g,"<br />"))
+ }
+ }
+ },
+ xhr:{
+ objects:[],
+ addObject:function(){
+ with(firebug){
+ for(var i=0; i<arguments.length; i++){
+ try {
+ var item = arguments[i];
+ var val = eval(item);
+ d.xhr.objects.push([
+ item, val
+ ]);
+ } catch(e){
+ continue;
+ }
+ }
+ }
+ },
+ open:function(){
+ with(firebug){
+ el.left.xhr.container.update("");
+ el.left.xhr.name = new pi.element("DIV").attribute.addClass("BlockContent").insert(new pi.element("DIV").attribute.addClass("Block").environment.addStyle({ "width":"20%" }).insert(el.left.xhr.container));
+ el.left.xhr.nameTitle = new pi.element("STRONG").update("Object Name:").insert(el.left.xhr.name);
+ el.left.xhr.nameContent = new pi.element("DIV").insert(el.left.xhr.name);
+ el.left.xhr.status = new pi.element("DIV").attribute.addClass("BlockContent").insert(new pi.element("DIV").attribute.addClass("Block").environment.addStyle({ "width":"10%" }).insert(el.left.xhr.container));
+ el.left.xhr.statusTitle = new pi.element("STRONG").update("Status:").insert(el.left.xhr.status);
+ el.left.xhr.statusContent = new pi.element("DIV").insert(el.left.xhr.status);
+ el.left.xhr.readystate = new pi.element("DIV").attribute.addClass("BlockContent").insert(new pi.element("DIV").environment.addStyle({ "width":"15%" }).attribute.addClass("Block").insert(el.left.xhr.container));
+ el.left.xhr.readystateTitle =el.left.xhr.nameTitle = new pi.element("STRONG").update("Ready State:").insert(el.left.xhr.readystate);
+ el.left.xhr.readystateContent = new pi.element("DIV").insert(el.left.xhr.readystate);
+ el.left.xhr.response = new pi.element("DIV").attribute.addClass("BlockContent").insert(new pi.element("DIV").environment.addStyle({ "width":(pi.env.ie?"50":"55")+"%" }).attribute.addClass("Block").insert(el.left.xhr.container));
+ el.left.xhr.responseTitle = new pi.element("STRONG").update("Response:").insert(el.left.xhr.response);
+ el.left.xhr.responseContent = new pi.element("DIV").insert(el.left.xhr.response);
+ setTimeout(d.xhr.refresh,500);
+ }
+ },
+ refresh:function(){
+ with(firebug){
+ el.left.xhr.nameContent.update("");
+ el.left.xhr.statusContent.update("");
+ el.left.xhr.readystateContent.update("");
+ el.left.xhr.responseContent.update("");
+ for(var i=0; i<d.xhr.objects.length; i++){
+ var item = d.xhr.objects[i];
+ var response = item[1].responseText;
+ if(Boolean(item[1])==false)continue;
+ el.left.xhr.nameContent.child.add(new pi.element("span").update(item[0]));
+ try { 
+ el.left.xhr.statusContent.child.add(new pi.element("span").update(item[1].status));
+ } catch(e){ el.left.xhr.statusContent.child.add(new pi.element("span").update("&nbsp;")); }
+ el.left.xhr.readystateContent.child.add(new pi.element("span").update(item[1].readyState));
+
+ el.left.xhr.responseContent.child.add(new pi.element("span").child.add(
+ new pi.element("A").event.addListener("click",d.str.open.curry(window,response)).update("&nbsp;"+response.substring(0,50))
+ ));
+ };
+ if(env.dIndex=="xhr")
+ setTimeout(d.xhr.refresh,500);
+ }
+ }
+ },
+ navigateRightColumn:function(_index,_open){
+ with(firebug){
+ el.left.container.environment.addStyle({ "width":_open?"70%":"100%" });
+ el.right.container.environment.addStyle({ "display":_open?"block":"none" });
+ }
+ },
+ navigate:function(_index){
+ with(firebug){
+
+ var open = _index, close = env.dIndex;
+ env.dIndex = open;
+
+ el.button[close].container.environment.addStyle({ "display":"none" });
+ el.left[close].container.environment.addStyle({ "display":"none" });
+ el.right[close].container.environment.addStyle({ "display":"none" });
+
+ el.button[open].container.environment.addStyle({ "display":"inline" });
+ el.left[open].container.environment.addStyle({ "display":"block" });
+ el.right[open].container.environment.addStyle({ "display":"block" });
+
+ if(el.nav[close])
+ el.nav[close].attribute.removeClass("Selected");
+ if(el.nav[open])
+ el.nav[open].attribute.addClass("Selected");
+
+ switch(open){
+ case "console":
+ d.navigateRightColumn(_index);
+ break;
+ case "html":
+ d.navigateRightColumn(_index,true);
+ d.html.openHtmlTree();
+ break;
+ case "css":
+ d.navigateRightColumn(_index,true);
+ d.css.refresh();
+ break;
+ case "scripts":
+ d.navigateRightColumn(_index);
+ d.scripts.refresh();
+ break;
+ case "dom":
+ d.navigateRightColumn(_index);
+ if(el.left.dom.container.environment.getElement().innerHTML=="")
+ d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container);
+ break;
+ case "xhr":
+ d.navigateRightColumn(_index);
+ d.xhr.open();
+ break;
+ }
+
+ }
+ },
+ refreshSize:function(){
+ with(firebug){
+ el.main.environment.addStyle({ "width":pi.util.GetWindowSize().width+"px"});
+ if(pi.env.ie6)
+ el.main.environment.addStyle({ "top":pi.util.GetWindowSize().height-el.main.environment.getSize().offsetHeight+"px" });
+ }
+ }
+ },
+ getDomain:function(_url){
+ return _url.match(/http:\/\/(www.)?([\.\w]+)/)[2];
+ },
+ listen: {
+ addXhrObject:function(){
+ with(firebug){
+ d.xhr.addObject.apply(window, el.button.xhr.textbox.environment.getElement().value.split(","));
+ }
+ },
+ consoleTextbox:function(_event){
+ with(firebug){
+ if(_event.keyCode==13&&(env.multilinemode==false||_event.shiftKey==false)){
+ d.console.historyIndex = d.console.history.length;
+ d.console.run(el.left.console.input.environment.getElement().value);
+ return false;
+ }
+ if([13,38,40].indexOf(_event.keyCode)==-1)
+ return;
+ d.console.historyIndex+=_event.keyCode!=40?0:d.console.historyIndex==d.console.history.length?0:1;
+ d.console.historyIndex-=_event.keyCode!=38?0:d.console.historyIndex==0?0:1;
+ el.left.console.input.update(
+ d.console.history.length > d.console.historyIndex ?
+ d.console.history[d.console.historyIndex] :
+ ""
+ );
+ }
+ },
+ cssSelectbox:function(){
+ with(firebug){
+ d.css.open(el.button.css.selectbox.environment.getElement().selectedIndex);
+ }
+ },
+ domTextbox:function(_event){
+ with(firebug){
+ if(_event.keyCode==13){
+ d.dom.open(eval(el.button.dom.textbox.environment.getElement().value),el.left.dom.container);
+ }
+ }
+ },
+ inspector:function(){
+ with(firebug){
+ d.html.inspect(d.inspector.el);
+ }
+ },
+ keyboard:function(_event){
+ with(firebug){
+ if(_event.keyCode==27&&d.inspector.enabled)
+ d.inspector.toggle();
+ }
+ },
+ mouse:function(_event){
+ with(firebug){
+ var target = _event[pi.env.ie?"srcElement":"target"];
+ if(
+ d.inspector.enabled&&
+ target!=document.body&&
+ target!=document.firstChild&&
+ target!=document.childNodes[1]&&
+ target!=el.borderInspector.environment.getElement()&&
+ target!=el.main.environment.getElement()&&
+ target.offsetParent!=el.main.environment.getElement()
+ )
+ d.inspector.inspect(target);
+ }
+ },
+ runMultiline:function(){
+ with(firebug){
+ d.console.run.call(window,el.right.console.input.environment.getElement().value);
+ }
+ },
+ runCSS:function(){
+ with(firebug){
+ var source = el.right.css.input.environment.getElement().value.replace(/\n|\t/g,"").split("}");
+ for(var i=0; i<source.length; i++){
+ var item = source[i]+"}", rule = !pi.env.ie?item:item.split(/{|}/), collection = document.getElementsByTagName("style"),
+ style = collection.length>0?collection[0]:document.body.appendChild( document.createElement("style") );
+ if(!item.match(/.+\{.+\}/))continue;
+ if(pi.env.ie)
+ style.styleSheet.addRule(rule[0],rule[1]);
+ else
+ style.sheet.insertRule( rule, style.sheet.cssRules.length );
+ }
+ }
+ },
+ scriptsSelectbox:function(){
+ with(firebug){
+ d.scripts.open(parseInt(el.button.scripts.selectbox.environment.getElement().value));
+ }
+ },
+ xhrTextbox:function(_event){
+ with(firebug){
+ if(_event.keyCode==13){
+ d.xhr.addObject.apply(window, el.button.xhr.textbox.environment.getElement().value.split(","));
+ }
+ }
+ }
+ }
+};
+
+window.console = firebug.d.console;
+pi.util.AddEvent(window,"resize",firebug.d.refreshSize);
+pi.util.AddEvent(document,"mousemove",firebug.listen.mouse);
+pi.util.AddEvent(document,"keydown",firebug.listen.keyboard);
+pi.util.DOMContentLoaded.push(firebug.init); \ No newline at end of file
diff --git a/src/usr/local/www/javascript/firewall_nat_edit/autosuggest.js b/src/usr/local/www/javascript/firewall_nat_edit/autosuggest.js
new file mode 100644
index 0000000..d9b5ac0
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_nat_edit/autosuggest.js
@@ -0,0 +1,337 @@
+
+/**
+ * An autosuggest textbox control.
+ * @class
+ * @scope public
+ */
+function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
+ oProvider /*:SuggestionProvider*/) {
+
+ /**
+ * The currently selected suggestions.
+ * @scope private
+ */
+ this.cur /*:int*/ = -1;
+
+ /**
+ * The dropdown list layer.
+ * @scope private
+ */
+ this.layer = null;
+
+ /**
+ * Suggestion provider for the autosuggest feature.
+ * @scope private.
+ */
+ this.provider /*:SuggestionProvider*/ = oProvider;
+
+ /**
+ * The textbox to capture.
+ * @scope private
+ */
+ this.textbox /*:HTMLInputElement*/ = oTextbox;
+
+ //initialize the control
+ this.init();
+
+}
+
+/**
+ * Autosuggests one or more suggestions for what the user has typed.
+ * If no suggestions are passed in, then no autosuggest occurs.
+ * @scope private
+ * @param aSuggestions An array of suggestion strings.
+ * @param bTypeAhead If the control should provide a type ahead suggestion.
+ */
+AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/,
+ bTypeAhead /*:boolean*/) {
+
+ //make sure there's at least one suggestion
+ if (aSuggestions.length > 0) {
+ if (bTypeAhead) {
+ this.typeAhead(aSuggestions[0]);
+ }
+
+ this.showSuggestions(aSuggestions);
+ } else {
+ this.hideSuggestions();
+ }
+};
+
+/**
+ * Creates the dropdown layer to display multiple suggestions.
+ * @scope private
+ */
+AutoSuggestControl.prototype.createDropDown = function () {
+
+ var oThis = this;
+
+ //create the layer and assign styles
+ this.layer = document.createElement("div");
+ this.layer.className = "suggestions";
+ this.layer.style.visibility = "hidden";
+ this.layer.style.width = this.textbox.offsetWidth;
+
+ //when the user clicks on the a suggestion, get the text (innerHTML)
+ //and place it into a textbox
+ this.layer.onmousedown =
+ this.layer.onmouseup =
+ this.layer.onmouseover = function (oEvent) {
+ oEvent = oEvent || window.event;
+ oTarget = oEvent.target || oEvent.srcElement;
+
+ if (oEvent.type == "mousedown") {
+ oThis.textbox.value = oTarget.firstChild.nodeValue;
+ oThis.hideSuggestions();
+ } else if (oEvent.type == "mouseover") {
+ oThis.highlightSuggestion(oTarget);
+ } else {
+ oThis.textbox.focus();
+ }
+ };
+
+
+ document.body.appendChild(this.layer);
+};
+
+/**
+ * Gets the left coordinate of the textbox.
+ * @scope private
+ * @return The left coordinate of the textbox in pixels.
+ */
+AutoSuggestControl.prototype.getLeft = function () /*:int*/ {
+
+ var oNode = this.textbox;
+ var iLeft = 0;
+
+ while(oNode.tagName != "BODY") {
+ iLeft += oNode.offsetLeft;
+ oNode = oNode.offsetParent;
+ }
+
+ return iLeft;
+};
+
+/**
+ * Gets the top coordinate of the textbox.
+ * @scope private
+ * @return The top coordinate of the textbox in pixels.
+ */
+AutoSuggestControl.prototype.getTop = function () /*:int*/ {
+
+ var oNode = this.textbox;
+ var iTop = 0;
+
+ while(oNode.tagName != "BODY") {
+ iTop += oNode.offsetTop;
+ oNode = oNode.offsetParent;
+ }
+
+ return iTop;
+};
+
+/**
+ * Handles three keydown events.
+ * @scope private
+ * @param oEvent The event object for the keydown event.
+ */
+AutoSuggestControl.prototype.handleKeyDown = function (oEvent /*:Event*/) {
+
+ switch(oEvent.keyCode) {
+ case 38: //up arrow
+ this.previousSuggestion();
+ break;
+ case 40: //down arrow
+ this.nextSuggestion();
+ break;
+ case 13: //enter
+ this.hideSuggestions();
+ break;
+ }
+
+};
+
+/**
+ * Handles keyup events.
+ * @scope private
+ * @param oEvent The event object for the keyup event.
+ */
+AutoSuggestControl.prototype.handleKeyUp = function (oEvent /*:Event*/) {
+
+ var iKeyCode = oEvent.keyCode;
+
+ //for backspace (8) and delete (46), shows suggestions without typeahead
+ if (iKeyCode == 8 || iKeyCode == 46) {
+ this.provider.requestSuggestions(this, false);
+
+ //make sure not to interfere with non-character keys
+ } else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode < 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {
+ //ignore
+ } else {
+ //request suggestions from the suggestion provider with typeahead
+ this.provider.requestSuggestions(this, true);
+ }
+};
+
+/**
+ * Hides the suggestion dropdown.
+ * @scope private
+ */
+AutoSuggestControl.prototype.hideSuggestions = function () {
+ this.layer.style.visibility = "hidden";
+};
+
+/**
+ * Highlights the given node in the suggestions dropdown.
+ * @scope private
+ * @param oSuggestionNode The node representing a suggestion in the dropdown.
+ */
+AutoSuggestControl.prototype.highlightSuggestion = function (oSuggestionNode) {
+
+ for (var i=0; i < this.layer.childNodes.length; i++) {
+ var oNode = this.layer.childNodes[i];
+ if (oNode == oSuggestionNode) {
+ oNode.className = "current";
+ } else if (oNode.className == "current") {
+ oNode.className = "";
+ }
+ }
+};
+
+/**
+ * Initializes the textbox with event handlers for
+ * auto suggest functionality.
+ * @scope private
+ */
+AutoSuggestControl.prototype.init = function () {
+
+ //save a reference to this object
+ var oThis = this;
+
+ //assign the onkeyup event handler
+ this.textbox.onkeyup = function (oEvent) {
+
+ //check for the proper location of the event object
+ if (!oEvent) {
+ oEvent = window.event;
+ }
+
+ //call the handleKeyUp() method with the event object
+ oThis.handleKeyUp(oEvent);
+ };
+
+ //assign onkeydown event handler
+ this.textbox.onkeydown = function (oEvent) {
+
+ //check for the proper location of the event object
+ if (!oEvent) {
+ oEvent = window.event;
+ }
+
+ //call the handleKeyDown() method with the event object
+ oThis.handleKeyDown(oEvent);
+ };
+
+ //assign onblur event handler (hides suggestions)
+ this.textbox.onblur = function () {
+ oThis.hideSuggestions();
+ };
+
+ //create the suggestions dropdown
+ this.createDropDown();
+};
+
+/**
+ * Highlights the next suggestion in the dropdown and
+ * places the suggestion into the textbox.
+ * @scope private
+ */
+AutoSuggestControl.prototype.nextSuggestion = function () {
+ var cSuggestionNodes = this.layer.childNodes;
+
+ if (cSuggestionNodes.length > 0 && this.cur < cSuggestionNodes.length-1) {
+ var oNode = cSuggestionNodes[++this.cur];
+ this.highlightSuggestion(oNode);
+ this.textbox.value = oNode.firstChild.nodeValue;
+ }
+};
+
+/**
+ * Highlights the previous suggestion in the dropdown and
+ * places the suggestion into the textbox.
+ * @scope private
+ */
+AutoSuggestControl.prototype.previousSuggestion = function () {
+ var cSuggestionNodes = this.layer.childNodes;
+
+ if (cSuggestionNodes.length > 0 && this.cur > 0) {
+ var oNode = cSuggestionNodes[--this.cur];
+ this.highlightSuggestion(oNode);
+ this.textbox.value = oNode.firstChild.nodeValue;
+ }
+};
+
+/**
+ * Selects a range of text in the textbox.
+ * @scope public
+ * @param iStart The start index (base 0) of the selection.
+ * @param iLength The number of characters to select.
+ */
+AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*:int*/) {
+
+ //use text ranges for Internet Explorer
+ if (this.textbox.createTextRange) {
+ var oRange = this.textbox.createTextRange();
+ oRange.moveStart("character", iStart);
+ oRange.moveEnd("character", iLength - this.textbox.value.length);
+ oRange.select();
+
+ //use setSelectionRange() for Mozilla
+ } else if (this.textbox.setSelectionRange) {
+ this.textbox.setSelectionRange(iStart, iLength);
+ }
+
+ //set focus back to the textbox
+ this.textbox.focus();
+};
+
+/**
+ * Builds the suggestion layer contents, moves it into position,
+ * and displays the layer.
+ * @scope private
+ * @param aSuggestions An array of suggestions for the control.
+ */
+AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/) {
+
+ var oDiv = null;
+ this.layer.innerHTML = ""; //clear contents of the layer
+
+ for (var i=0; i < aSuggestions.length; i++) {
+ oDiv = document.createElement("div");
+ oDiv.appendChild(document.createTextNode(aSuggestions[i]));
+ this.layer.appendChild(oDiv);
+ }
+
+ this.layer.style.left = this.getLeft() + "px";
+ this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
+ this.layer.style.width = this.textbox.offsetWidth + "px";
+ this.layer.style.visibility = "visible";
+
+};
+
+/**
+ * Inserts a suggestion into the textbox, highlighting the
+ * suggested part of the text.
+ * @scope private
+ * @param sSuggestion The suggestion for the textbox.
+ */
+AutoSuggestControl.prototype.typeAhead = function (sSuggestion /*:String*/) {
+
+ //check for support of typeahead functionality
+ if (this.textbox.createTextRange || this.textbox.setSelectionRange){
+ var iLen = this.textbox.value.length;
+ this.textbox.value = sSuggestion;
+ this.selectRange(iLen, sSuggestion.length);
+ }
+};
+
diff --git a/src/usr/local/www/javascript/firewall_nat_edit/disablekeys.js b/src/usr/local/www/javascript/firewall_nat_edit/disablekeys.js
new file mode 100644
index 0000000..5d6c87a
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_nat_edit/disablekeys.js
@@ -0,0 +1,6 @@
+function kH(e) {
+ var pK = document.all? window.event.keyCode:e.which;
+ return pK != 13;
+}
+document.onkeypress = kH;
+if (document.layers) document.captureEvents(Event.KEYPRESS); \ No newline at end of file
diff --git a/src/usr/local/www/javascript/firewall_nat_edit/firewall_nat_edit.js b/src/usr/local/www/javascript/firewall_nat_edit/firewall_nat_edit.js
new file mode 100644
index 0000000..7007b40
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_nat_edit/firewall_nat_edit.js
@@ -0,0 +1,203 @@
+//<![CDATA[
+var portsenabled = 1;
+var dstenabled = 1;
+var showsource = 0;
+
+function ext_change() {
+ if ((document.iform.srcbeginport.selectedIndex == 0) && portsenabled) {
+ document.iform.srcbeginport_cust.disabled = 0;
+ } else {
+ document.iform.srcbeginport_cust.value = "";
+ document.iform.srcbeginport_cust.disabled = 1;
+ }
+ if ((document.iform.srcendport.selectedIndex == 0) && portsenabled) {
+ document.iform.srcendport_cust.disabled = 0;
+ } else {
+ document.iform.srcendport_cust.value = "";
+ document.iform.srcendport_cust.disabled = 1;
+ }
+ if ((document.iform.dstbeginport.selectedIndex == 0) && portsenabled && dstenabled) {
+ document.iform.dstbeginport_cust.disabled = 0;
+ } else {
+ document.iform.dstbeginport_cust.value = "";
+ document.iform.dstbeginport_cust.disabled = 1;
+ }
+ if ((document.iform.dstendport.selectedIndex == 0) && portsenabled && dstenabled) {
+ document.iform.dstendport_cust.disabled = 0;
+ } else {
+ document.iform.dstendport_cust.value = "";
+ document.iform.dstendport_cust.disabled = 1;
+ }
+
+ if ((document.iform.localbeginport.selectedIndex == 0) && portsenabled) {
+ document.iform.localbeginport_cust.disabled = 0;
+ } else {
+ document.iform.localbeginport_cust.value = "";
+ document.iform.localbeginport_cust.disabled = 1;
+ }
+
+ if (!portsenabled) {
+ document.iform.srcbeginport.disabled = 1;
+ document.iform.srcendport.disabled = 1;
+ document.iform.dstbeginport.disabled = 1;
+ document.iform.dstendport.disabled = 1;
+ document.iform.localbeginport_cust.disabled = 1;
+ } else {
+ document.iform.srcbeginport.disabled = 0;
+ document.iform.srcendport.disabled = 0;
+ document.iform.localbeginport_cust.disabled = 0;
+ if( dstenabled ) {
+ document.iform.dstbeginport.disabled = 0;
+ document.iform.dstendport.disabled = 0;
+ }
+ }
+}
+
+function nordr_change() {
+ if (document.iform.nordr.checked) {
+ document.getElementById("localiptable").style.display = 'none';
+ document.getElementById("lprtr").style.display = 'none';
+ document.getElementById("assoctable").style.display = 'none';
+ } else {
+ document.getElementById("localiptable").style.display = '';
+ document.getElementById("lprtr").style.display = portsenabled ? '' : 'none';
+ document.getElementById("assoctable").style.display = '';
+ }
+}
+
+function show_source() {
+ if(portsenabled)
+ document.getElementById("sprtable").style.display = '';
+
+ document.getElementById("srctable").style.display = '';
+ document.getElementById("showadvancedboxsrc").style.display = 'none';
+ showsource = 1;
+}
+
+function check_for_aliases() {
+ /* if External port range is an alias, then disallow
+ * entry of Local port
+ */
+ for(i=0; i<customarray.length; i++) {
+ if(document.iform.dstbeginport_cust.value == customarray[i]) {
+ document.iform.dstendport_cust.value = customarray[i];
+ document.iform.localbeginport_cust.value = customarray[i];
+ document.iform.dstendport_cust.disabled = 1;
+ document.iform.localbeginport.disabled = 1;
+ document.iform.localbeginport_cust.disabled = 1;
+ document.iform.dstendport_cust.disabled = 0;
+ document.iform.localbeginport.disabled = 0;
+ document.iform.localbeginport_cust.disabled = 0;
+ }
+ if(document.iform.dstbeginport.value == customarray[i]) {
+ document.iform.dstendport_cust.value = customarray[i];
+ document.iform.localbeginport_cust.value = customarray[i];
+ document.iform.dstendport_cust.disabled = 1;
+ document.iform.localbeginport.disabled = 1;
+ document.iform.localbeginport_cust.disabled = 1;
+ document.iform.dstendport_cust.disabled = 0;
+ document.iform.localbeginport.disabled = 0;
+ document.iform.localbeginport_cust.disabled = 0;
+ }
+ if(document.iform.dstendport_cust.value == customarray[i]) {
+ document.iform.dstendport_cust.value = customarray[i];
+ document.iform.localbeginport_cust.value = customarray[i];
+ document.iform.dstendport_cust.disabled = 1;
+ document.iform.localbeginport.disabled = 1;
+ document.iform.localbeginport_cust.disabled = 1;
+ document.iform.dstendport_cust.disabled = 0;
+ document.iform.localbeginport.disabled = 0;
+ document.iform.localbeginport_cust.disabled = 0;
+ }
+ if(document.iform.dstendport.value == customarray[i]) {
+ document.iform.dstendport_cust.value = customarray[i];
+ document.iform.localbeginport_cust.value = customarray[i];
+ document.iform.dstendport_cust.disabled = 1;
+ document.iform.localbeginport.disabled = 1;
+ document.iform.localbeginport_cust.disabled = 1;
+ document.iform.dstendport_cust.disabled = 0;
+ document.iform.localbeginport.disabled = 0;
+ document.iform.localbeginport_cust.disabled = 0;
+ }
+
+ }
+}
+
+function proto_change() {
+ if (document.iform.proto.selectedIndex >= 0 && document.iform.proto.selectedIndex <= 2) {
+ portsenabled = 1;
+ } else {
+ portsenabled = 0;
+ }
+
+ if (portsenabled) {
+ document.getElementById("sprtable").style.display = showsource == 1 ? '':'none';
+ document.getElementById("dprtr").style.display = '';
+ document.getElementById("lprtr").style.display = document.iform.nordr.checked ? 'none' : '';
+ } else {
+ document.getElementById("sprtable").style.display = 'none';
+ document.getElementById("dprtr").style.display = 'none';
+ document.getElementById("lprtr").style.display = 'none';
+ document.getElementById("dstbeginport").selectedIndex = 0;
+ document.getElementById("dstbeginport_cust").value = "";
+ document.getElementById("dstendport").selectedIndex = 0;
+ document.getElementById("dstendport_cust").value = "";
+ document.getElementById("localbeginport").selectedIndex = 0;
+ document.getElementById("localbeginport_cust").value = "";
+ }
+}
+
+function typesel_change() {
+ switch (document.iform.srctype.selectedIndex) {
+ case 1: /* single */
+ document.iform.src.disabled = 0;
+ document.iform.srcmask.value = "";
+ document.iform.srcmask.disabled = 1;
+ break;
+ case 2: /* network */
+ document.iform.src.disabled = 0;
+ document.iform.srcmask.disabled = 0;
+ break;
+ default:
+ document.iform.src.value = "";
+ document.iform.src.disabled = 1;
+ document.iform.srcmask.value = "";
+ document.iform.srcmask.disabled = 1;
+ break;
+ }
+ if( dstenabled )
+ {
+ switch (document.iform.dsttype.selectedIndex) {
+ case 1: /* single */
+ document.iform.dst.disabled = 0;
+ document.iform.dstmask.value = "";
+ document.iform.dstmask.disabled = 1;
+ break;
+ case 2: /* network */
+ document.iform.dst.disabled = 0;
+ document.iform.dstmask.disabled = 0;
+ break;
+ default:
+ document.iform.dst.value = "";
+ document.iform.dst.disabled = 1;
+ document.iform.dstmask.value = "";
+ document.iform.dstmask.disabled = 1;
+ break;
+ }
+ }
+}
+
+function src_rep_change() {
+ document.iform.srcendport.selectedIndex = document.iform.srcbeginport.selectedIndex;
+}
+
+function dst_rep_change() {
+ document.iform.dstendport.selectedIndex = document.iform.dstbeginport.selectedIndex;
+}
+
+function dst_change( iface, old_iface, old_dst ) {
+ if ( ( old_dst == "" ) || ( old_iface.concat("ip") == old_dst ) ) {
+ document.iform.dsttype.value = iface.concat("ip");
+ }
+}
+//]]>
diff --git a/src/usr/local/www/javascript/firewall_nat_edit/suggestions.js b/src/usr/local/www/javascript/firewall_nat_edit/suggestions.js
new file mode 100644
index 0000000..4d1e127
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_nat_edit/suggestions.js
@@ -0,0 +1,33 @@
+
+/**
+ * Provides suggestions for state names (USA).
+ * @class
+ * @scope public
+ */
+function StateSuggestions(text) {
+ this.states = text;
+}
+
+/**
+ * Request suggestions for the given autosuggest control.
+ * @scope protected
+ * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
+ */
+StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
+ bTypeAhead /*:boolean*/) {
+ var aSuggestions = [];
+ var sTextboxValue = oAutoSuggestControl.textbox.value;
+
+ if (sTextboxValue.length > 0){
+
+ //search for matching states
+ for (var i=0; i < this.states.length; i++) {
+ if (this.states[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
+ aSuggestions.push(this.states[i]);
+ }
+ }
+ }
+
+ //provide suggestions to the control
+ oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead);
+};
diff --git a/src/usr/local/www/javascript/firewall_rules_edit/autosuggest.js b/src/usr/local/www/javascript/firewall_rules_edit/autosuggest.js
new file mode 100644
index 0000000..d9b5ac0
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_rules_edit/autosuggest.js
@@ -0,0 +1,337 @@
+
+/**
+ * An autosuggest textbox control.
+ * @class
+ * @scope public
+ */
+function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
+ oProvider /*:SuggestionProvider*/) {
+
+ /**
+ * The currently selected suggestions.
+ * @scope private
+ */
+ this.cur /*:int*/ = -1;
+
+ /**
+ * The dropdown list layer.
+ * @scope private
+ */
+ this.layer = null;
+
+ /**
+ * Suggestion provider for the autosuggest feature.
+ * @scope private.
+ */
+ this.provider /*:SuggestionProvider*/ = oProvider;
+
+ /**
+ * The textbox to capture.
+ * @scope private
+ */
+ this.textbox /*:HTMLInputElement*/ = oTextbox;
+
+ //initialize the control
+ this.init();
+
+}
+
+/**
+ * Autosuggests one or more suggestions for what the user has typed.
+ * If no suggestions are passed in, then no autosuggest occurs.
+ * @scope private
+ * @param aSuggestions An array of suggestion strings.
+ * @param bTypeAhead If the control should provide a type ahead suggestion.
+ */
+AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/,
+ bTypeAhead /*:boolean*/) {
+
+ //make sure there's at least one suggestion
+ if (aSuggestions.length > 0) {
+ if (bTypeAhead) {
+ this.typeAhead(aSuggestions[0]);
+ }
+
+ this.showSuggestions(aSuggestions);
+ } else {
+ this.hideSuggestions();
+ }
+};
+
+/**
+ * Creates the dropdown layer to display multiple suggestions.
+ * @scope private
+ */
+AutoSuggestControl.prototype.createDropDown = function () {
+
+ var oThis = this;
+
+ //create the layer and assign styles
+ this.layer = document.createElement("div");
+ this.layer.className = "suggestions";
+ this.layer.style.visibility = "hidden";
+ this.layer.style.width = this.textbox.offsetWidth;
+
+ //when the user clicks on the a suggestion, get the text (innerHTML)
+ //and place it into a textbox
+ this.layer.onmousedown =
+ this.layer.onmouseup =
+ this.layer.onmouseover = function (oEvent) {
+ oEvent = oEvent || window.event;
+ oTarget = oEvent.target || oEvent.srcElement;
+
+ if (oEvent.type == "mousedown") {
+ oThis.textbox.value = oTarget.firstChild.nodeValue;
+ oThis.hideSuggestions();
+ } else if (oEvent.type == "mouseover") {
+ oThis.highlightSuggestion(oTarget);
+ } else {
+ oThis.textbox.focus();
+ }
+ };
+
+
+ document.body.appendChild(this.layer);
+};
+
+/**
+ * Gets the left coordinate of the textbox.
+ * @scope private
+ * @return The left coordinate of the textbox in pixels.
+ */
+AutoSuggestControl.prototype.getLeft = function () /*:int*/ {
+
+ var oNode = this.textbox;
+ var iLeft = 0;
+
+ while(oNode.tagName != "BODY") {
+ iLeft += oNode.offsetLeft;
+ oNode = oNode.offsetParent;
+ }
+
+ return iLeft;
+};
+
+/**
+ * Gets the top coordinate of the textbox.
+ * @scope private
+ * @return The top coordinate of the textbox in pixels.
+ */
+AutoSuggestControl.prototype.getTop = function () /*:int*/ {
+
+ var oNode = this.textbox;
+ var iTop = 0;
+
+ while(oNode.tagName != "BODY") {
+ iTop += oNode.offsetTop;
+ oNode = oNode.offsetParent;
+ }
+
+ return iTop;
+};
+
+/**
+ * Handles three keydown events.
+ * @scope private
+ * @param oEvent The event object for the keydown event.
+ */
+AutoSuggestControl.prototype.handleKeyDown = function (oEvent /*:Event*/) {
+
+ switch(oEvent.keyCode) {
+ case 38: //up arrow
+ this.previousSuggestion();
+ break;
+ case 40: //down arrow
+ this.nextSuggestion();
+ break;
+ case 13: //enter
+ this.hideSuggestions();
+ break;
+ }
+
+};
+
+/**
+ * Handles keyup events.
+ * @scope private
+ * @param oEvent The event object for the keyup event.
+ */
+AutoSuggestControl.prototype.handleKeyUp = function (oEvent /*:Event*/) {
+
+ var iKeyCode = oEvent.keyCode;
+
+ //for backspace (8) and delete (46), shows suggestions without typeahead
+ if (iKeyCode == 8 || iKeyCode == 46) {
+ this.provider.requestSuggestions(this, false);
+
+ //make sure not to interfere with non-character keys
+ } else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode < 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {
+ //ignore
+ } else {
+ //request suggestions from the suggestion provider with typeahead
+ this.provider.requestSuggestions(this, true);
+ }
+};
+
+/**
+ * Hides the suggestion dropdown.
+ * @scope private
+ */
+AutoSuggestControl.prototype.hideSuggestions = function () {
+ this.layer.style.visibility = "hidden";
+};
+
+/**
+ * Highlights the given node in the suggestions dropdown.
+ * @scope private
+ * @param oSuggestionNode The node representing a suggestion in the dropdown.
+ */
+AutoSuggestControl.prototype.highlightSuggestion = function (oSuggestionNode) {
+
+ for (var i=0; i < this.layer.childNodes.length; i++) {
+ var oNode = this.layer.childNodes[i];
+ if (oNode == oSuggestionNode) {
+ oNode.className = "current";
+ } else if (oNode.className == "current") {
+ oNode.className = "";
+ }
+ }
+};
+
+/**
+ * Initializes the textbox with event handlers for
+ * auto suggest functionality.
+ * @scope private
+ */
+AutoSuggestControl.prototype.init = function () {
+
+ //save a reference to this object
+ var oThis = this;
+
+ //assign the onkeyup event handler
+ this.textbox.onkeyup = function (oEvent) {
+
+ //check for the proper location of the event object
+ if (!oEvent) {
+ oEvent = window.event;
+ }
+
+ //call the handleKeyUp() method with the event object
+ oThis.handleKeyUp(oEvent);
+ };
+
+ //assign onkeydown event handler
+ this.textbox.onkeydown = function (oEvent) {
+
+ //check for the proper location of the event object
+ if (!oEvent) {
+ oEvent = window.event;
+ }
+
+ //call the handleKeyDown() method with the event object
+ oThis.handleKeyDown(oEvent);
+ };
+
+ //assign onblur event handler (hides suggestions)
+ this.textbox.onblur = function () {
+ oThis.hideSuggestions();
+ };
+
+ //create the suggestions dropdown
+ this.createDropDown();
+};
+
+/**
+ * Highlights the next suggestion in the dropdown and
+ * places the suggestion into the textbox.
+ * @scope private
+ */
+AutoSuggestControl.prototype.nextSuggestion = function () {
+ var cSuggestionNodes = this.layer.childNodes;
+
+ if (cSuggestionNodes.length > 0 && this.cur < cSuggestionNodes.length-1) {
+ var oNode = cSuggestionNodes[++this.cur];
+ this.highlightSuggestion(oNode);
+ this.textbox.value = oNode.firstChild.nodeValue;
+ }
+};
+
+/**
+ * Highlights the previous suggestion in the dropdown and
+ * places the suggestion into the textbox.
+ * @scope private
+ */
+AutoSuggestControl.prototype.previousSuggestion = function () {
+ var cSuggestionNodes = this.layer.childNodes;
+
+ if (cSuggestionNodes.length > 0 && this.cur > 0) {
+ var oNode = cSuggestionNodes[--this.cur];
+ this.highlightSuggestion(oNode);
+ this.textbox.value = oNode.firstChild.nodeValue;
+ }
+};
+
+/**
+ * Selects a range of text in the textbox.
+ * @scope public
+ * @param iStart The start index (base 0) of the selection.
+ * @param iLength The number of characters to select.
+ */
+AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*:int*/) {
+
+ //use text ranges for Internet Explorer
+ if (this.textbox.createTextRange) {
+ var oRange = this.textbox.createTextRange();
+ oRange.moveStart("character", iStart);
+ oRange.moveEnd("character", iLength - this.textbox.value.length);
+ oRange.select();
+
+ //use setSelectionRange() for Mozilla
+ } else if (this.textbox.setSelectionRange) {
+ this.textbox.setSelectionRange(iStart, iLength);
+ }
+
+ //set focus back to the textbox
+ this.textbox.focus();
+};
+
+/**
+ * Builds the suggestion layer contents, moves it into position,
+ * and displays the layer.
+ * @scope private
+ * @param aSuggestions An array of suggestions for the control.
+ */
+AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/) {
+
+ var oDiv = null;
+ this.layer.innerHTML = ""; //clear contents of the layer
+
+ for (var i=0; i < aSuggestions.length; i++) {
+ oDiv = document.createElement("div");
+ oDiv.appendChild(document.createTextNode(aSuggestions[i]));
+ this.layer.appendChild(oDiv);
+ }
+
+ this.layer.style.left = this.getLeft() + "px";
+ this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
+ this.layer.style.width = this.textbox.offsetWidth + "px";
+ this.layer.style.visibility = "visible";
+
+};
+
+/**
+ * Inserts a suggestion into the textbox, highlighting the
+ * suggested part of the text.
+ * @scope private
+ * @param sSuggestion The suggestion for the textbox.
+ */
+AutoSuggestControl.prototype.typeAhead = function (sSuggestion /*:String*/) {
+
+ //check for support of typeahead functionality
+ if (this.textbox.createTextRange || this.textbox.setSelectionRange){
+ var iLen = this.textbox.value.length;
+ this.textbox.value = sSuggestion;
+ this.selectRange(iLen, sSuggestion.length);
+ }
+};
+
diff --git a/src/usr/local/www/javascript/firewall_rules_edit/disablekeys.js b/src/usr/local/www/javascript/firewall_rules_edit/disablekeys.js
new file mode 100644
index 0000000..5d6c87a
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_rules_edit/disablekeys.js
@@ -0,0 +1,6 @@
+function kH(e) {
+ var pK = document.all? window.event.keyCode:e.which;
+ return pK != 13;
+}
+document.onkeypress = kH;
+if (document.layers) document.captureEvents(Event.KEYPRESS); \ No newline at end of file
diff --git a/src/usr/local/www/javascript/firewall_rules_edit/firewall_rules_edit.js b/src/usr/local/www/javascript/firewall_rules_edit/firewall_rules_edit.js
new file mode 100644
index 0000000..de1ff0c
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_rules_edit/firewall_rules_edit.js
@@ -0,0 +1,237 @@
+//<![CDATA[
+var portsenabled = 1;
+var editenabled = 1;
+
+function ext_change() {
+ if ((document.iform.srcbeginport.selectedIndex == 0) && portsenabled && editenabled) {
+ document.iform.srcbeginport_cust.disabled = 0;
+ } else {
+ if (editenabled)
+ document.iform.srcbeginport_cust.value = "";
+ document.iform.srcbeginport_cust.disabled = 1;
+ }
+ if ((document.iform.srcendport.selectedIndex == 0) && portsenabled && editenabled) {
+ document.iform.srcendport_cust.disabled = 0;
+ } else {
+ if (editenabled)
+ document.iform.srcendport_cust.value = "";
+ document.iform.srcendport_cust.disabled = 1;
+ }
+ if ((document.iform.dstbeginport.selectedIndex == 0) && portsenabled && editenabled) {
+ document.iform.dstbeginport_cust.disabled = 0;
+ } else {
+ if (editenabled)
+ document.iform.dstbeginport_cust.value = "";
+ document.iform.dstbeginport_cust.disabled = 1;
+ }
+ if ((document.iform.dstendport.selectedIndex == 0) && portsenabled && editenabled) {
+ document.iform.dstendport_cust.disabled = 0;
+ } else {
+ if (editenabled)
+ document.iform.dstendport_cust.value = "";
+ document.iform.dstendport_cust.disabled = 1;
+ }
+
+ if (!portsenabled) {
+ document.iform.srcbeginport.disabled = 1;
+ document.iform.srcendport.disabled = 1;
+ document.iform.dstbeginport.disabled = 1;
+ document.iform.dstendport.disabled = 1;
+ } else {
+ if( editenabled ) {
+ document.iform.srcbeginport.disabled = 0;
+ document.iform.srcendport.disabled = 0;
+ document.iform.dstbeginport.disabled = 0;
+ document.iform.dstendport.disabled = 0;
+ }
+ }
+}
+
+function show_source_port_range() {
+ if (portsenabled) {
+ document.getElementById("sprtable").style.display = '';
+ document.getElementById("showadvancedboxspr").style.display = 'none';
+ }
+}
+
+function typesel_change() {
+ if( editenabled ) {
+ switch (document.iform.srctype.selectedIndex) {
+ case 1: /* single */
+ document.iform.src.disabled = 0;
+ document.iform.srcmask.value = "";
+ document.iform.srcmask.disabled = 1;
+ break;
+ case 2: /* network */
+ document.iform.src.disabled = 0;
+ document.iform.srcmask.disabled = 0;
+ break;
+ default:
+ document.iform.src.value = "";
+ document.iform.src.disabled = 1;
+ document.iform.srcmask.value = "";
+ document.iform.srcmask.disabled = 1;
+ break;
+ }
+ switch (document.iform.dsttype.selectedIndex) {
+ case 1: /* single */
+ document.iform.dst.disabled = 0;
+ document.iform.dstmask.value = "";
+ document.iform.dstmask.disabled = 1;
+ break;
+ case 2: /* network */
+ document.iform.dst.disabled = 0;
+ document.iform.dstmask.disabled = 0;
+ break;
+ default:
+ document.iform.dst.value = "";
+ document.iform.dst.disabled = 1;
+ document.iform.dstmask.value = "";
+ document.iform.dstmask.disabled = 1;
+ break;
+ }
+ }
+}
+
+function proto_change() {
+ if (document.iform.proto.selectedIndex < 3) {
+ portsenabled = 1;
+ document.getElementById("tcpflags").style.display = '';
+ } else {
+ portsenabled = 0;
+ document.getElementById("tcpflags").style.display = 'none';
+ }
+
+ /* Disable OS knob if the proto is not TCP. */
+ if (document.iform.proto.selectedIndex < 1) {
+ document.forms[0].os.disabled = 0;
+ } else {
+ document.forms[0].os.disabled = 1;
+ }
+
+ if (document.iform.proto.selectedIndex == 3) {
+ document.iform.icmptype.disabled = 0;
+ document.iform.icmp6type.disabled = 0;
+ } else {
+ document.iform.icmptype.disabled = 1;
+ document.iform.icmp6type.disabled = 1;
+ }
+
+ ext_change();
+
+ if(document.iform.proto.selectedIndex == 3 || document.iform.proto.selectedIndex == 4) {
+ if(document.iform.ipprotocol.selectedIndex == 0) { // IPv4
+ document.getElementById("icmpbox").style.display = '';
+ document.getElementById("icmp6box").style.display = 'none';
+ } else if(document.iform.ipprotocol.selectedIndex == 1) { // IPv6
+ document.getElementById("icmpbox").style.display = 'none';
+ document.getElementById("icmp6box").style.display = '';
+ } else { // IPv4 + IPv6
+ document.getElementById("icmpbox").style.display = 'none';
+ document.getElementById("icmp6box").style.display = 'none';
+ }
+ } else {
+ document.getElementById("icmpbox").style.display = 'none';
+ document.getElementById("icmp6box").style.display = 'none';
+ }
+
+ if(document.iform.proto.selectedIndex >= 0 && document.iform.proto.selectedIndex <= 2) {
+ document.getElementById("dprtr").style.display = '';
+ if (editenabled) {
+ document.getElementById("showadvancedboxspr").style.display = 'table-row';
+ }
+ } else {
+ document.getElementById("sprtable").style.display = 'none';
+ document.getElementById("dprtr").style.display = 'none';
+ document.getElementById("showadvancedboxspr").style.display = 'none';
+ }
+}
+
+function show_aodiv() {
+ document.getElementById("aoadv").innerHTML='';
+ aodiv = document.getElementById('aodivmain');
+ aodiv.style.display = "block";
+}
+
+function show_dsdiv() {
+ document.getElementById("dsadv").innerHTML='';
+ dsdiv = document.getElementById('dsdivmain');
+ dsdiv.style.display = "block";
+}
+
+function show_advanced_noxmlrpc() {
+ document.getElementById("showadvnoxmlrpcsyncbox").innerHTML='';
+ aodiv = document.getElementById('shownoxmlrpcadv');
+ aodiv.style.display = "block";
+}
+
+function show_advanced_vlanprio() {
+ document.getElementById("showadvvlanpriobox").innerHTML='';
+ aodiv = document.getElementById('showvlanprioadv');
+ aodiv.style.display = "block";
+}
+
+function show_advanced_schedule() {
+ document.getElementById("showadvschedulebox").innerHTML='';
+ aodiv = document.getElementById('showscheduleadv');
+ aodiv.style.display = "block";
+}
+
+function show_advanced_gateway() {
+ document.getElementById("showadvgatewaybox").innerHTML='';
+ aodiv = document.getElementById('showgatewayadv');
+ aodiv.style.display = "block";
+}
+
+function show_advanced_sourceos() {
+ document.getElementById("showadvsourceosbox").innerHTML='';
+ aodiv = document.getElementById('showsourceosadv');
+ aodiv.style.display = "block";
+}
+
+function show_advanced_ackqueue() {
+ document.getElementById("showadvackqueuebox").innerHTML='';
+ aodiv = document.getElementById('showackqueueadv');
+ aodiv.style.display = "block";
+}
+
+function show_advanced_inout() {
+ document.getElementById("showadvinoutbox").innerHTML='';
+ aodiv = document.getElementById('showinoutadv');
+ aodiv.style.display = "block";
+}
+
+function show_advanced_state() {
+ document.getElementById("showadvstatebox").innerHTML='';
+ aodiv = document.getElementById('showstateadv');
+ aodiv.style.display = "block";
+}
+
+function show_advanced_tcpflags() {
+ document.getElementById("showtcpflagsbox").innerHTML='';
+ aodiv = document.getElementById('showtcpflagsadv');
+ aodiv.style.display = "block";
+}
+
+function show_advanced_layer7() {
+ document.getElementById("showadvlayer7box").innerHTML='';
+ aodiv = document.getElementById('showlayer7adv');
+ aodiv.style.display = "block";
+}
+
+function src_rep_change() {
+ document.iform.srcendport.selectedIndex = document.iform.srcbeginport.selectedIndex;
+}
+
+function dst_rep_change() {
+ document.iform.dstendport.selectedIndex = document.iform.dstbeginport.selectedIndex;
+}
+
+function tcpflags_anyclick(obj) {
+ if (obj.checked) {
+ document.getElementById('tcpheader').style.display= 'none';
+ } else {
+ document.getElementById('tcpheader').style.display= "";
+ }
+}
+//]]>
diff --git a/src/usr/local/www/javascript/firewall_rules_edit/suggestions.js b/src/usr/local/www/javascript/firewall_rules_edit/suggestions.js
new file mode 100644
index 0000000..4d1e127
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_rules_edit/suggestions.js
@@ -0,0 +1,33 @@
+
+/**
+ * Provides suggestions for state names (USA).
+ * @class
+ * @scope public
+ */
+function StateSuggestions(text) {
+ this.states = text;
+}
+
+/**
+ * Request suggestions for the given autosuggest control.
+ * @scope protected
+ * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
+ */
+StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
+ bTypeAhead /*:boolean*/) {
+ var aSuggestions = [];
+ var sTextboxValue = oAutoSuggestControl.textbox.value;
+
+ if (sTextboxValue.length > 0){
+
+ //search for matching states
+ for (var i=0; i < this.states.length; i++) {
+ if (this.states[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
+ aSuggestions.push(this.states[i]);
+ }
+ }
+ }
+
+ //provide suggestions to the control
+ oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead);
+};
diff --git a/src/usr/local/www/javascript/firewall_shaper_edit/autosuggest.js b/src/usr/local/www/javascript/firewall_shaper_edit/autosuggest.js
new file mode 100644
index 0000000..d9b5ac0
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_shaper_edit/autosuggest.js
@@ -0,0 +1,337 @@
+
+/**
+ * An autosuggest textbox control.
+ * @class
+ * @scope public
+ */
+function AutoSuggestControl(oTextbox /*:HTMLInputElement*/,
+ oProvider /*:SuggestionProvider*/) {
+
+ /**
+ * The currently selected suggestions.
+ * @scope private
+ */
+ this.cur /*:int*/ = -1;
+
+ /**
+ * The dropdown list layer.
+ * @scope private
+ */
+ this.layer = null;
+
+ /**
+ * Suggestion provider for the autosuggest feature.
+ * @scope private.
+ */
+ this.provider /*:SuggestionProvider*/ = oProvider;
+
+ /**
+ * The textbox to capture.
+ * @scope private
+ */
+ this.textbox /*:HTMLInputElement*/ = oTextbox;
+
+ //initialize the control
+ this.init();
+
+}
+
+/**
+ * Autosuggests one or more suggestions for what the user has typed.
+ * If no suggestions are passed in, then no autosuggest occurs.
+ * @scope private
+ * @param aSuggestions An array of suggestion strings.
+ * @param bTypeAhead If the control should provide a type ahead suggestion.
+ */
+AutoSuggestControl.prototype.autosuggest = function (aSuggestions /*:Array*/,
+ bTypeAhead /*:boolean*/) {
+
+ //make sure there's at least one suggestion
+ if (aSuggestions.length > 0) {
+ if (bTypeAhead) {
+ this.typeAhead(aSuggestions[0]);
+ }
+
+ this.showSuggestions(aSuggestions);
+ } else {
+ this.hideSuggestions();
+ }
+};
+
+/**
+ * Creates the dropdown layer to display multiple suggestions.
+ * @scope private
+ */
+AutoSuggestControl.prototype.createDropDown = function () {
+
+ var oThis = this;
+
+ //create the layer and assign styles
+ this.layer = document.createElement("div");
+ this.layer.className = "suggestions";
+ this.layer.style.visibility = "hidden";
+ this.layer.style.width = this.textbox.offsetWidth;
+
+ //when the user clicks on the a suggestion, get the text (innerHTML)
+ //and place it into a textbox
+ this.layer.onmousedown =
+ this.layer.onmouseup =
+ this.layer.onmouseover = function (oEvent) {
+ oEvent = oEvent || window.event;
+ oTarget = oEvent.target || oEvent.srcElement;
+
+ if (oEvent.type == "mousedown") {
+ oThis.textbox.value = oTarget.firstChild.nodeValue;
+ oThis.hideSuggestions();
+ } else if (oEvent.type == "mouseover") {
+ oThis.highlightSuggestion(oTarget);
+ } else {
+ oThis.textbox.focus();
+ }
+ };
+
+
+ document.body.appendChild(this.layer);
+};
+
+/**
+ * Gets the left coordinate of the textbox.
+ * @scope private
+ * @return The left coordinate of the textbox in pixels.
+ */
+AutoSuggestControl.prototype.getLeft = function () /*:int*/ {
+
+ var oNode = this.textbox;
+ var iLeft = 0;
+
+ while(oNode.tagName != "BODY") {
+ iLeft += oNode.offsetLeft;
+ oNode = oNode.offsetParent;
+ }
+
+ return iLeft;
+};
+
+/**
+ * Gets the top coordinate of the textbox.
+ * @scope private
+ * @return The top coordinate of the textbox in pixels.
+ */
+AutoSuggestControl.prototype.getTop = function () /*:int*/ {
+
+ var oNode = this.textbox;
+ var iTop = 0;
+
+ while(oNode.tagName != "BODY") {
+ iTop += oNode.offsetTop;
+ oNode = oNode.offsetParent;
+ }
+
+ return iTop;
+};
+
+/**
+ * Handles three keydown events.
+ * @scope private
+ * @param oEvent The event object for the keydown event.
+ */
+AutoSuggestControl.prototype.handleKeyDown = function (oEvent /*:Event*/) {
+
+ switch(oEvent.keyCode) {
+ case 38: //up arrow
+ this.previousSuggestion();
+ break;
+ case 40: //down arrow
+ this.nextSuggestion();
+ break;
+ case 13: //enter
+ this.hideSuggestions();
+ break;
+ }
+
+};
+
+/**
+ * Handles keyup events.
+ * @scope private
+ * @param oEvent The event object for the keyup event.
+ */
+AutoSuggestControl.prototype.handleKeyUp = function (oEvent /*:Event*/) {
+
+ var iKeyCode = oEvent.keyCode;
+
+ //for backspace (8) and delete (46), shows suggestions without typeahead
+ if (iKeyCode == 8 || iKeyCode == 46) {
+ this.provider.requestSuggestions(this, false);
+
+ //make sure not to interfere with non-character keys
+ } else if (iKeyCode < 32 || (iKeyCode >= 33 && iKeyCode < 46) || (iKeyCode >= 112 && iKeyCode <= 123)) {
+ //ignore
+ } else {
+ //request suggestions from the suggestion provider with typeahead
+ this.provider.requestSuggestions(this, true);
+ }
+};
+
+/**
+ * Hides the suggestion dropdown.
+ * @scope private
+ */
+AutoSuggestControl.prototype.hideSuggestions = function () {
+ this.layer.style.visibility = "hidden";
+};
+
+/**
+ * Highlights the given node in the suggestions dropdown.
+ * @scope private
+ * @param oSuggestionNode The node representing a suggestion in the dropdown.
+ */
+AutoSuggestControl.prototype.highlightSuggestion = function (oSuggestionNode) {
+
+ for (var i=0; i < this.layer.childNodes.length; i++) {
+ var oNode = this.layer.childNodes[i];
+ if (oNode == oSuggestionNode) {
+ oNode.className = "current";
+ } else if (oNode.className == "current") {
+ oNode.className = "";
+ }
+ }
+};
+
+/**
+ * Initializes the textbox with event handlers for
+ * auto suggest functionality.
+ * @scope private
+ */
+AutoSuggestControl.prototype.init = function () {
+
+ //save a reference to this object
+ var oThis = this;
+
+ //assign the onkeyup event handler
+ this.textbox.onkeyup = function (oEvent) {
+
+ //check for the proper location of the event object
+ if (!oEvent) {
+ oEvent = window.event;
+ }
+
+ //call the handleKeyUp() method with the event object
+ oThis.handleKeyUp(oEvent);
+ };
+
+ //assign onkeydown event handler
+ this.textbox.onkeydown = function (oEvent) {
+
+ //check for the proper location of the event object
+ if (!oEvent) {
+ oEvent = window.event;
+ }
+
+ //call the handleKeyDown() method with the event object
+ oThis.handleKeyDown(oEvent);
+ };
+
+ //assign onblur event handler (hides suggestions)
+ this.textbox.onblur = function () {
+ oThis.hideSuggestions();
+ };
+
+ //create the suggestions dropdown
+ this.createDropDown();
+};
+
+/**
+ * Highlights the next suggestion in the dropdown and
+ * places the suggestion into the textbox.
+ * @scope private
+ */
+AutoSuggestControl.prototype.nextSuggestion = function () {
+ var cSuggestionNodes = this.layer.childNodes;
+
+ if (cSuggestionNodes.length > 0 && this.cur < cSuggestionNodes.length-1) {
+ var oNode = cSuggestionNodes[++this.cur];
+ this.highlightSuggestion(oNode);
+ this.textbox.value = oNode.firstChild.nodeValue;
+ }
+};
+
+/**
+ * Highlights the previous suggestion in the dropdown and
+ * places the suggestion into the textbox.
+ * @scope private
+ */
+AutoSuggestControl.prototype.previousSuggestion = function () {
+ var cSuggestionNodes = this.layer.childNodes;
+
+ if (cSuggestionNodes.length > 0 && this.cur > 0) {
+ var oNode = cSuggestionNodes[--this.cur];
+ this.highlightSuggestion(oNode);
+ this.textbox.value = oNode.firstChild.nodeValue;
+ }
+};
+
+/**
+ * Selects a range of text in the textbox.
+ * @scope public
+ * @param iStart The start index (base 0) of the selection.
+ * @param iLength The number of characters to select.
+ */
+AutoSuggestControl.prototype.selectRange = function (iStart /*:int*/, iLength /*:int*/) {
+
+ //use text ranges for Internet Explorer
+ if (this.textbox.createTextRange) {
+ var oRange = this.textbox.createTextRange();
+ oRange.moveStart("character", iStart);
+ oRange.moveEnd("character", iLength - this.textbox.value.length);
+ oRange.select();
+
+ //use setSelectionRange() for Mozilla
+ } else if (this.textbox.setSelectionRange) {
+ this.textbox.setSelectionRange(iStart, iLength);
+ }
+
+ //set focus back to the textbox
+ this.textbox.focus();
+};
+
+/**
+ * Builds the suggestion layer contents, moves it into position,
+ * and displays the layer.
+ * @scope private
+ * @param aSuggestions An array of suggestions for the control.
+ */
+AutoSuggestControl.prototype.showSuggestions = function (aSuggestions /*:Array*/) {
+
+ var oDiv = null;
+ this.layer.innerHTML = ""; //clear contents of the layer
+
+ for (var i=0; i < aSuggestions.length; i++) {
+ oDiv = document.createElement("div");
+ oDiv.appendChild(document.createTextNode(aSuggestions[i]));
+ this.layer.appendChild(oDiv);
+ }
+
+ this.layer.style.left = this.getLeft() + "px";
+ this.layer.style.top = (this.getTop()+this.textbox.offsetHeight) + "px";
+ this.layer.style.width = this.textbox.offsetWidth + "px";
+ this.layer.style.visibility = "visible";
+
+};
+
+/**
+ * Inserts a suggestion into the textbox, highlighting the
+ * suggested part of the text.
+ * @scope private
+ * @param sSuggestion The suggestion for the textbox.
+ */
+AutoSuggestControl.prototype.typeAhead = function (sSuggestion /*:String*/) {
+
+ //check for support of typeahead functionality
+ if (this.textbox.createTextRange || this.textbox.setSelectionRange){
+ var iLen = this.textbox.value.length;
+ this.textbox.value = sSuggestion;
+ this.selectRange(iLen, sSuggestion.length);
+ }
+};
+
diff --git a/src/usr/local/www/javascript/firewall_shaper_edit/disablekeys.js b/src/usr/local/www/javascript/firewall_shaper_edit/disablekeys.js
new file mode 100644
index 0000000..5d6c87a
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_shaper_edit/disablekeys.js
@@ -0,0 +1,6 @@
+function kH(e) {
+ var pK = document.all? window.event.keyCode:e.which;
+ return pK != 13;
+}
+document.onkeypress = kH;
+if (document.layers) document.captureEvents(Event.KEYPRESS); \ No newline at end of file
diff --git a/src/usr/local/www/javascript/firewall_shaper_edit/firewall_shaper_edit.js b/src/usr/local/www/javascript/firewall_shaper_edit/firewall_shaper_edit.js
new file mode 100644
index 0000000..b1b8df0
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_shaper_edit/firewall_shaper_edit.js
@@ -0,0 +1,37 @@
+//<![CDATA[
+function ext_change() {
+ if (document.iform.beginport.selectedIndex == 0) {
+ document.iform.beginport_cust.disabled = 0;
+ } else {
+ document.iform.beginport_cust.value = "";
+ document.iform.beginport_cust.disabled = 1;
+ }
+ if (document.iform.endport.selectedIndex == 0) {
+ document.iform.endport_cust.disabled = 0;
+ } else {
+ document.iform.endport_cust.value = "";
+ document.iform.endport_cust.disabled = 1;
+ }
+ if (document.iform.localbeginport.selectedIndex == 0) {
+ document.iform.localbeginport_cust.disabled = 0;
+ } else {
+ document.iform.localbeginport_cust.value = "";
+ document.iform.localbeginport_cust.disabled = 1;
+ }
+};
+function ext_rep_change() {
+ document.iform.endport.selectedIndex = document.iform.beginport.selectedIndex;
+ document.iform.localbeginport.selectedIndex = document.iform.beginport.selectedIndex;
+}
+
+
+window.onload = function () {
+ var oTextbox1 = new AutoSuggestControl(document.getElementById("src"), new StateSuggestions(addressarray));
+ var oTextbox2 = new AutoSuggestControl(document.getElementById("srcbeginport_cust"), new StateSuggestions(customarray));
+ var oTextbox3 = new AutoSuggestControl(document.getElementById("srcendport_cust"), new StateSuggestions(customarray));
+ var oTextbox1 = new AutoSuggestControl(document.getElementById("dst"), new StateSuggestions(addressarray));
+ var oTextbox2 = new AutoSuggestControl(document.getElementById("dstbeginport_cust"), new StateSuggestions(customarray));
+ var oTextbox3 = new AutoSuggestControl(document.getElementById("dstendport_cust"), new StateSuggestions(customarray));
+};
+
+//]]> \ No newline at end of file
diff --git a/src/usr/local/www/javascript/firewall_shaper_edit/suggestions.js b/src/usr/local/www/javascript/firewall_shaper_edit/suggestions.js
new file mode 100644
index 0000000..4d1e127
--- /dev/null
+++ b/src/usr/local/www/javascript/firewall_shaper_edit/suggestions.js
@@ -0,0 +1,33 @@
+
+/**
+ * Provides suggestions for state names (USA).
+ * @class
+ * @scope public
+ */
+function StateSuggestions(text) {
+ this.states = text;
+}
+
+/**
+ * Request suggestions for the given autosuggest control.
+ * @scope protected
+ * @param oAutoSuggestControl The autosuggest control to provide suggestions for.
+ */
+StateSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/,
+ bTypeAhead /*:boolean*/) {
+ var aSuggestions = [];
+ var sTextboxValue = oAutoSuggestControl.textbox.value;
+
+ if (sTextboxValue.length > 0){
+
+ //search for matching states
+ for (var i=0; i < this.states.length; i++) {
+ if (this.states[i].toLowerCase().indexOf(sTextboxValue.toLowerCase()) == 0) {
+ aSuggestions.push(this.states[i]);
+ }
+ }
+ }
+
+ //provide suggestions to the control
+ oAutoSuggestControl.autosuggest(aSuggestions, bTypeAhead);
+};
diff --git a/src/usr/local/www/javascript/global.js b/src/usr/local/www/javascript/global.js
new file mode 100644
index 0000000..0b67f58
--- /dev/null
+++ b/src/usr/local/www/javascript/global.js
@@ -0,0 +1,43 @@
+var AjaxQueue = {
+ batchSize: 1, //No.of simultaneous AJAX requests allowed, Default : 1
+ urlQueue: [], //Request URLs will be pushed into this array
+ elementsQueue: [], //Element IDs of elements to be updated on completion of a request
+ optionsQueue: [], //Request options will be pushed into this array
+ currentRequest: null,
+ setBatchSize: function(bSize){ //Method to set a different batch size. Recommended: Set batchSize before making requests
+ this.batchSize = bSize;
+ },
+ push: function(url, options, elementID){ //Push the request in the queue. elementID is optional and required only for Ajax requests that updates the element
+ this.urlQueue.push(url);
+ this.optionsQueue.push(options);
+ if(elementID!=null){
+ this.elementsQueue.push(elementID);
+ } else {
+ this.elementsQueue.push("NOTSPECIFIED");
+ }
+
+ this._processNext();
+ },
+ _processNext: function() { // Method for processing the requests in the queue. Private method. Don't call it explicitly
+ if(this.currentRequest == null && this.urlQueue.length > 0) // Check if the currently processing request count is less than batch size
+ {
+ // Call jQuery.ajax on the first item in the queue and remove it from the queue
+ AjaxQueue.currentRequest = jQuery.ajax(AjaxQueue.urlQueue.shift(), AjaxQueue.optionsQueue.shift());
+ AjaxQueue.currentRequest.complete( function() {
+ //Call AjaxQueue._processNext on completion ( success / failure) of this AJAX request.
+ AjaxQueue.currentRequest = null;
+ AjaxQueue._processNext();
+ });
+ if(this.elementsQueue[0]=="NOTSPECIFIED") { //Check if an elementID was specified
+ // If no ElementID was specified remove the first item from the queue
+ var junk = AjaxQueue.elementsQueue.shift();
+ } else {
+ // If ElementID was specified update the first item in the queue and remove it from the queue
+ AjaxQueue.currentRequest.success( function(data) {
+ jQuery(AjaxQueue.elementsQueue.shift()).html(data);
+ });
+ }
+ }
+ }
+};
+
diff --git a/src/usr/local/www/javascript/index/ajax.js b/src/usr/local/www/javascript/index/ajax.js
new file mode 100644
index 0000000..274b8c0
--- /dev/null
+++ b/src/usr/local/www/javascript/index/ajax.js
@@ -0,0 +1,196 @@
+/* Most widgets update their backend data every 10 seconds. 11 seconds
+ * will ensure that we update the GUI right after the stats are updated.
+ * Seconds * 1000 = value
+ */
+var Seconds = 11;
+var update_interval = (Math.abs(Math.ceil(Seconds))-1)*1000 + 990;
+
+function updateMeters() {
+ url = '/getstats.php';
+
+ jQuery.ajax(url, {
+ type: 'get',
+ success: function(data) {
+ response = data || "";
+ if (response != "")
+ stats(data);
+ }
+ });
+ setTimer();
+}
+
+function setTimer() {
+ timeout = window.setTimeout('updateMeters()', update_interval);
+}
+
+function stats(x) {
+ var values = x.split("|");
+ if (jQuery.each(values,function(key,value){
+ if (value == 'undefined' || value == null)
+ return true;
+ else
+ return false;
+ }))
+
+ updateUptime(values[2]);
+ updateDateTime(values[5]);
+ updateCPU(values[0]);
+ updateMemory(values[1]);
+ updateState(values[3]);
+ updateTemp(values[4]);
+ updateInterfaceStats(values[6]);
+ updateInterfaces(values[7]);
+ updateGatewayStats(values[8]);
+ updateCpuFreq(values[9]);
+ updateLoadAverage(values[10]);
+ updateMbuf(values[11]);
+ updateMbufMeter(values[12]);
+ updateStateMeter(values[13]);
+}
+
+function updateMemory(x) {
+ if(jQuery('#memusagemeter'))
+ jQuery("#memusagemeter").html(x + '%');
+ if(jQuery('#memUsagePB'))
+ jQuery('#memUsagePB').progressbar( { value: parseInt(x) } );
+}
+
+function updateMbuf(x) {
+ if(jQuery('#mbuf'))
+ jQuery("#mbuf").html(x);
+}
+
+function updateMbufMeter(x) {
+ if(jQuery('#mbufusagemeter'))
+ jQuery("#mbufusagemeter").html(x + '%');
+ if(jQuery('#mbufPB'))
+ jQuery('#mbufPB').progressbar( { value: parseInt(x) } );
+}
+
+function updateCPU(x) {
+ if(jQuery('#cpumeter'))
+ jQuery("#cpumeter").html(x + '%');
+ if(jQuery('#cpuPB'))
+ jQuery('#cpuPB').progressbar( { value: parseInt(x) } );
+ /* Load CPU Graph widget if enabled */
+ if(widgetActive('cpu_graphs')) {
+ GraphValue(graph[0], x);
+ }
+}
+
+function updateTemp(x) {
+ if(jQuery("#tempmeter"))
+ jQuery("#tempmeter").html(x + '\u00B0' + 'C');
+ if(jQuery('#tempPB'))
+ jQuery("#tempPB").progressbar( { value: parseInt(x) } );
+}
+
+function updateDateTime(x) {
+ if(jQuery('#datetime'))
+ jQuery("#datetime").html(x);
+}
+
+function updateUptime(x) {
+ if(jQuery('#uptime'))
+ jQuery("#uptime").html(x);
+}
+
+function updateState(x) {
+ if(jQuery('#pfstate'))
+ jQuery("#pfstate").html(x);
+}
+
+function updateStateMeter(x) {
+ if(jQuery('#pfstateusagemeter'))
+ jQuery("#pfstateusagemeter").html(x + '%');
+ if(jQuery('#statePB'))
+ jQuery('#statePB').progressbar( { value: parseInt(x) } );
+}
+
+function updateGatewayStats(x){
+ if (widgetActive("gateways")){
+ gateways_split = x.split(",");
+ for (var y=0; y<gateways_split.length; y++){
+ gateways_field_split = gateways_split[y].split("^");
+ if(jQuery('#gateway' + (y + 1))) {
+ jQuery('#gateway' + (y + 1)).html(gateways_field_split[0]);
+ if(gateways_field_split[1]) {
+ jQuery('#gateway' + (y + 1)).css('background-color',gateways_field_split[1]);
+ }
+ }
+ }
+ }
+}
+
+function updateCpuFreq(x) {
+ if(jQuery('#cpufreq'))
+ jQuery("#cpufreq").html(x);
+}
+
+function updateLoadAverage(x) {
+ if(jQuery('#load_average'))
+ jQuery("#load_average").html(x);
+}
+
+function updateInterfaceStats(x){
+ if (widgetActive("interface_statistics")){
+ statistics_split = x.split(",");
+ var counter = 1;
+ for (var y=0; y<statistics_split.length-1; y++){
+ if(jQuery('#stat' + counter)) {
+ jQuery('#stat' + counter).html(statistics_split[y]);
+ counter++;
+ }
+ }
+ }
+}
+
+function updateInterfaces(x){
+ if (widgetActive("interfaces")){
+ interfaces_split = x.split("~");
+ interfaces_split.each(function(iface){
+ details = iface.split("^");
+ if (details[2] == '')
+ ipv4_details = '';
+ else
+ ipv4_details = details[2] + '<br />';
+ switch(details[1]) {
+ case "up":
+ jQuery('#' + details[0] + '-up').css("display","inline");
+ jQuery('#' + details[0] + '-down').css("display","none");
+ jQuery('#' + details[0] + '-block').css("display","none");
+ jQuery('#' + details[0] + '-ip').html(ipv4_details);
+ jQuery('#' + details[0] + '-ipv6').html(details[3]);
+ jQuery('#' + details[0] + '-media').html(details[4]);
+ break;
+ case "down":
+ jQuery('#' + details[0] + '-down').css("display","inline");
+ jQuery('#' + details[0] + '-up').css("display","none");
+ jQuery('#' + details[0] + '-block').css("display","none");
+ jQuery('#' + details[0] + '-ip').html(ipv4_details);
+ jQuery('#' + details[0] + '-ipv6').html(details[3]);
+ jQuery('#' + details[0] + '-media').html(details[4]);
+ break;
+ case "block":
+ jQuery('#' + details[0] + '-block').css("display","inline");
+ jQuery('#' + details[0] + '-down').css("display","none");
+ jQuery('#' + details[0] + '-up').css("display","none");
+ break;
+ }
+ });
+ }
+}
+
+function widgetActive(x) {
+ var widget = jQuery('#' + x + '-container');
+ if ((widget != null) && (widget.css('display') != null) && (widget.css('display') != "none"))
+ return true;
+ else
+ return false;
+}
+
+/* start updater */
+jQuery(document).ready(function(){
+ setTimer();
+});
+
diff --git a/src/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js b/src/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js
new file mode 100644
index 0000000..45b529b
--- /dev/null
+++ b/src/usr/local/www/javascript/interfaces_ppps_edit/ppps_edit.js
@@ -0,0 +1,253 @@
+/*jslint white: true, sloppy: true, vars: true, eqeq: true */
+/*jslint browser: true, devel: true */
+/*global show_hide_linkfields, jQuery, country_list */
+
+function update_select_list(new_options, select_list){
+ var option_array = new_options.split("|");
+ var i = 0;
+ var j;
+ select_list.length = 0;
+ for(j=0; j < option_array.length-1; j++){
+ var option = option_array[j].split(",");
+ var selected = Boolean(parseInt(option[2], 10));
+ select_list[j] = new Option(option[0], option[1], false, selected);
+ //for testing and debugging
+ //select_list.options[option_array.length-1+j] = new Option(option[2].toString() +" "+ selected.toString());
+ //select_list.options[option_array.length-1+j] = new Option("Link Label: " + linklabel + " Label Text:" + label_text);
+ }
+ show_hide_linkfields(select_list);
+}
+
+function show_advanced(hide){
+ var select_list = document.iform["interfaces[]"].options;
+ var adv_rows = parseInt(jQuery('#adv_rows').html(), 10);
+ var adv_show = Boolean(parseInt(jQuery('#adv_show').html(), 10));
+ var status = Boolean(parseInt(hide, 10));
+ var j, advanced;
+ if (status){
+ jQuery('#advanced_').hide();
+ for(j=0; j < adv_rows; j++){
+ advanced = "#advanced_" + j.toString();
+ jQuery(advanced).show();
+ }
+ jQuery('#adv_show').html("1");
+ show_hide_linkfields(select_list);
+ } else {
+ jQuery('#advanced_').show();
+ for(j=0; j < adv_rows; j++){
+ advanced = "#advanced_" + j.toString();
+ jQuery(advanced).hide();
+ }
+ jQuery('#adv_show').html("0");
+ show_hide_linkfields(select_list);
+ }
+}
+
+function show_hide_linkfields(options){
+ var i = 0;
+ var port_count = parseInt(jQuery('#port_count').html(), 10);
+ var adv_show = Boolean(parseInt(jQuery('#adv_show').html(), 10));
+ var j, count, type, link, lnklabel, bw, bwlabel, mtu, mru, mrru, ipfields, gwfields, localip,
+ localiplabel, subnet, gateway, gatewaylabel;
+ for(j=0; j < port_count; j++){
+ count = j.toString();
+ type = jQuery('#type').val();
+ link = "#link" + count;
+ lnklabel = "#linklabel" + count;
+ bw = "#bandwidth" + count;
+ bwlabel = "#bwlabel" + count;
+ mtu = "#mtu" + count;
+ mru = "#mru" + count;
+ mrru = "#mrru" + count;
+ ipfields = "#ip_fields" + count;
+ gwfields = "#gw_fields" + count;
+ localip = "#localip" + count;
+ localiplabel = "#localiplabel" + count;
+ subnet = "#subnet" + count;
+ gateway = "#gateway" + count;
+ gatewaylabel = "#gatewaylabel" + count;
+
+ jQuery(ipfields + ',' + gwfields + ',' + link).hide();
+ jQuery(subnet).prop('disabled',true);
+
+ jQuery(bw).attr("name","bandwidth[]");
+ jQuery(mtu).attr("name","mtu[]");
+ jQuery(mru).attr("name","mru[]");
+ jQuery(mrru).attr("name","mrru[]");
+ jQuery(localip).attr("name","localip[]");
+ jQuery(subnet).attr("name","subnet[]");
+ jQuery(gateway).attr("name","gateway[]");
+
+ while(i < options.length){
+ if (options[i].selected ){
+ jQuery(lnklabel).html("Link Parameters (" + options[i].value + ")");
+ jQuery(bwlabel).html("Bandwidth (" + options[i].value + ")");
+ jQuery(bw).attr("name","bandwidth[" + options[i].value + "]");
+ jQuery(mtu).attr("name","mtu[" + options[i].value + "]");
+ jQuery(mru).attr("name","mru[" + options[i].value + "]");
+ jQuery(mrru).attr("name","mrru[" + options[i].value + "]");
+ jQuery(localiplabel).html("Local IP (" + options[i].value + ")");
+ jQuery(gatewaylabel).html("Gateway (" + options[i].value + ")");
+ jQuery(localip).attr("name","localip[" + options[i].value + "]");
+ jQuery(subnet).attr("name","subnet[" + options[i].value + "]");
+ jQuery(gateway).attr("name","gateway[" + options[i].value + "]");
+ if (type == 'ppp' && adv_show){
+ jQuery(ipfields + ',' + gwfields).show();
+ }
+ if (type == 'pptp' || type == 'l2tp'){
+ jQuery(subnet).prop("disabled",false);
+ jQuery(ipfields + ',' + gwfields).show();
+ }
+ if (adv_show){
+ jQuery(link).show();
+ }
+ i++;
+ break;
+ }
+ i++;
+ }
+ }
+}
+
+
+function updateType(t){
+ var serialports = jQuery('#serialports').html();
+ var ports = jQuery('#ports').html();
+ var select_list = document.iform["interfaces[]"].options;
+ jQuery('#adv_show').html("0");
+ show_advanced('0');
+ jQuery("#select").show();
+ switch(t) {
+ case "select":
+ jQuery('#ppp,#pppoe,#ppp_provider,#phone_num,#apn_').hide();
+ select_list.length = 0;
+ select_list[0] = new Option("Select Link Type First","");
+ break;
+ case "ppp":
+ update_select_list(serialports, select_list);
+ jQuery('#select,#pppoe').hide();
+ jQuery('#ppp_provider,#phone_num,#apn_').show();
+ country_list();
+ break;
+ case "pppoe":
+ update_select_list(ports, select_list);
+ jQuery('#select,#ppp,#ppp_provider,#phone_num,#apn_').hide();
+ break;
+ case "l2tp":
+ case "pptp":
+ update_select_list(ports, select_list);
+ jQuery('#select,#ppp,#pppoe,#ppp_provider,#phone_num,#apn_').hide();
+ break;
+ default:
+ select_list.length = 0;
+ select_list[0] = new Option("Select Link Type First","");
+ break;
+ }
+ if (t == "pppoe" || t == "ppp"){
+ jQuery("#" + t).show();
+ }
+}
+
+function show_reset_settings(reset_type) {
+ if (reset_type == 'preset') {
+ jQuery('#pppoepresetwrap').show(0);
+ jQuery('#pppoecustomwrap').hide(0);
+ }
+ else if (reset_type == 'custom') {
+ jQuery('#pppoecustomwrap').show(0);
+ jQuery('#pppoepresetwrap').hide(0);
+ } else {
+ jQuery('#pppoecustomwrap').hide(0);
+ jQuery('#pppoepresetwrap').hide(0);
+ }
+}
+
+function country_list() {
+ jQuery('#country option').remove();
+ jQuery('#provider option').remove();
+ jQuery('#providerplan option').remove();
+ jQuery('#country').append(new Option('', ''));
+ jQuery.ajax("getserviceproviders.php",{
+ success: function(responseText) {
+ var responseTextArr = responseText.split("\n");
+ var value, i, country;
+ responseTextArr.sort();
+ for (i = 0; i < responseTextArr.length; i += 1) {
+ value = responseTextArr[i];
+ if (/\S/.test(value)) {
+ country = value.split(":");
+ jQuery('#country').append(new Option(country[0],country[1]));
+ }
+ }
+ }
+ });
+ jQuery('#trcountry').css("display","table-row");
+}
+
+function providers_list() {
+ jQuery('#provider option').remove();
+ jQuery('#providerplan option').remove();
+ jQuery('#provider').append(new Option('', ''));
+ jQuery.ajax("getserviceproviders.php",{
+ type: 'POST',
+ data: {country : jQuery('#country').val()},
+ success: function(responseText) {
+ var responseTextArr = responseText.split("\n");
+ var value, i;
+ responseTextArr.sort();
+ for (i = 0; i < responseTextArr.length; i += 1) {
+ value = responseTextArr[i];
+ if (/\S/.test(value)) {
+ jQuery('#provider').append(new Option(value, value));
+ }
+ }
+ }
+ });
+ jQuery('#trprovider').css("display","table-row");
+ jQuery('#trproviderplan').css("display","none");
+}
+
+function providerplan_list() {
+ jQuery('#providerplan option').remove();
+ jQuery('#providerplan').append( new Option('','') );
+ jQuery.ajax("getserviceproviders.php",{
+ type: 'POST',
+ data: {country : jQuery('#country').val(), provider : jQuery('#provider').val()},
+ success: function(responseText) {
+ var responseTextArr = responseText.split("\n");
+ var value, providerplan, i;
+ responseTextArr.sort();
+ for (i = 0; i < responseTextArr.length; i += 1) {
+ value = responseTextArr[i];
+ if (/\S/.test(value)) {
+ providerplan = value.split(":");
+ jQuery('#providerplan').append(new Option(providerplan[0] + " - " + providerplan[1],
+ providerplan[1]));
+ }
+ }
+ }
+ });
+ jQuery('#trproviderplan').css("display","table-row");
+}
+
+function prefill_provider() {
+ jQuery.ajax("getserviceproviders.php",{
+ type: "POST",
+ data: {country : jQuery('#country').val(), provider : jQuery('#provider').val(), plan : jQuery('#providerplan').val()},
+ success: function(responseXML) {
+ var xmldoc = responseXML;
+ var provider = xmldoc.getElementsByTagName('connection')[0];
+ jQuery('#username').val('');
+ jQuery('#password').val('');
+ if(provider.getElementsByTagName('apn')[0].firstChild.data == "CDMA") {
+ jQuery('#phone').val('#777');
+ jQuery('#apn').val('');
+ } else {
+ jQuery('#phone').val('*99#');
+ jQuery('#apn').val(provider.getElementsByTagName('apn')[0].firstChild.data);
+ }
+ jQuery('#username').val(provider.getElementsByTagName('username')[0].firstChild.data);
+ jQuery('#password').val(provider.getElementsByTagName('password')[0].firstChild.data);
+ }
+ });
+}
diff --git a/src/usr/local/www/javascript/jquery-1.11.1.min.js b/src/usr/local/www/javascript/jquery-1.11.1.min.js
new file mode 100644
index 0000000..ab28a24
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery-1.11.1.min.js
@@ -0,0 +1,4 @@
+/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
+!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;
+if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")
+},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
diff --git a/src/usr/local/www/javascript/jquery-migrate-1.2.1.min.js b/src/usr/local/www/javascript/jquery-migrate-1.2.1.min.js
new file mode 100644
index 0000000..62149c2
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery-migrate-1.2.1.min.js
@@ -0,0 +1,2 @@
+/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */
+jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var o=e("<input/>",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i)for(c=function(e){return!e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window); \ No newline at end of file
diff --git a/src/usr/local/www/javascript/jquery-ui-timepicker-addon/css/jquery-ui-timepicker-addon.css b/src/usr/local/www/javascript/jquery-ui-timepicker-addon/css/jquery-ui-timepicker-addon.css
new file mode 100644
index 0000000..1af3008
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery-ui-timepicker-addon/css/jquery-ui-timepicker-addon.css
@@ -0,0 +1,7 @@
+/* css for timepicker */
+.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
+.ui-timepicker-div dl { text-align: left; }
+.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
+.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
+.ui-timepicker-div td { font-size: 90%; }
+.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
diff --git a/src/usr/local/www/javascript/jquery-ui-timepicker-addon/js/jquery-ui-timepicker-addon.js b/src/usr/local/www/javascript/jquery-ui-timepicker-addon/js/jquery-ui-timepicker-addon.js
new file mode 100644
index 0000000..33cd3ae
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery-ui-timepicker-addon/js/jquery-ui-timepicker-addon.js
@@ -0,0 +1,1326 @@
+/*
+* jQuery timepicker addon
+* By: Trent Richardson [http://trentrichardson.com]
+* Version 0.9.9
+* Last Modified: 02/05/2012
+*
+* Copyright 2012 Trent Richardson
+* Dual licensed under the MIT and GPL licenses.
+* http://trentrichardson.com/Impromptu/GPL-LICENSE.txt
+* http://trentrichardson.com/Impromptu/MIT-LICENSE.txt
+*
+* HERES THE CSS:
+* .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
+* .ui-timepicker-div dl { text-align: left; }
+* .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
+* .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
+* .ui-timepicker-div td { font-size: 90%; }
+* .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
+*/
+
+(function($) {
+
+$.extend($.ui, { timepicker: { version: "0.9.9" } });
+
+/* Time picker manager.
+ Use the singleton instance of this class, $.timepicker, to interact with the time picker.
+ Settings for (groups of) time pickers are maintained in an instance object,
+ allowing multiple different settings on the same page. */
+
+function Timepicker() {
+ this.regional = []; // Available regional settings, indexed by language code
+ this.regional[''] = { // Default regional settings
+ currentText: 'Now',
+ closeText: 'Done',
+ ampm: false,
+ amNames: ['AM', 'A'],
+ pmNames: ['PM', 'P'],
+ timeFormat: 'hh:mm tt',
+ timeSuffix: '',
+ timeOnlyTitle: 'Choose Time',
+ timeText: 'Time',
+ hourText: 'Hour',
+ minuteText: 'Minute',
+ secondText: 'Second',
+ millisecText: 'Millisecond',
+ timezoneText: 'Time Zone'
+ };
+ this._defaults = { // Global defaults for all the datetime picker instances
+ showButtonPanel: true,
+ timeOnly: false,
+ showHour: true,
+ showMinute: true,
+ showSecond: false,
+ showMillisec: false,
+ showTimezone: false,
+ showTime: true,
+ stepHour: 1,
+ stepMinute: 1,
+ stepSecond: 1,
+ stepMillisec: 1,
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ timezone: '+0000',
+ hourMin: 0,
+ minuteMin: 0,
+ secondMin: 0,
+ millisecMin: 0,
+ hourMax: 23,
+ minuteMax: 59,
+ secondMax: 59,
+ millisecMax: 999,
+ minDateTime: null,
+ maxDateTime: null,
+ onSelect: null,
+ hourGrid: 0,
+ minuteGrid: 0,
+ secondGrid: 0,
+ millisecGrid: 0,
+ alwaysSetTime: true,
+ separator: ' ',
+ altFieldTimeOnly: true,
+ showTimepicker: true,
+ timezoneIso8609: false,
+ timezoneList: null,
+ addSliderAccess: false,
+ sliderAccessArgs: null
+ };
+ $.extend(this._defaults, this.regional['']);
+};
+
+$.extend(Timepicker.prototype, {
+ $input: null,
+ $altInput: null,
+ $timeObj: null,
+ inst: null,
+ hour_slider: null,
+ minute_slider: null,
+ second_slider: null,
+ millisec_slider: null,
+ timezone_select: null,
+ hour: 0,
+ minute: 0,
+ second: 0,
+ millisec: 0,
+ timezone: '+0000',
+ hourMinOriginal: null,
+ minuteMinOriginal: null,
+ secondMinOriginal: null,
+ millisecMinOriginal: null,
+ hourMaxOriginal: null,
+ minuteMaxOriginal: null,
+ secondMaxOriginal: null,
+ millisecMaxOriginal: null,
+ ampm: '',
+ formattedDate: '',
+ formattedTime: '',
+ formattedDateTime: '',
+ timezoneList: null,
+
+ /* Override the default settings for all instances of the time picker.
+ @param settings object - the new settings to use as defaults (anonymous object)
+ @return the manager object */
+ setDefaults: function(settings) {
+ extendRemove(this._defaults, settings || {});
+ return this;
+ },
+
+ //########################################################################
+ // Create a new Timepicker instance
+ //########################################################################
+ _newInst: function($input, o) {
+ var tp_inst = new Timepicker(),
+ inlineSettings = {};
+
+ for (var attrName in this._defaults) {
+ var attrValue = $input.attr('time:' + attrName);
+ if (attrValue) {
+ try {
+ inlineSettings[attrName] = eval(attrValue);
+ } catch (err) {
+ inlineSettings[attrName] = attrValue;
+ }
+ }
+ }
+ tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, {
+ beforeShow: function(input, dp_inst) {
+ if ($.isFunction(o.beforeShow))
+ return o.beforeShow(input, dp_inst, tp_inst);
+ },
+ onChangeMonthYear: function(year, month, dp_inst) {
+ // Update the time as well : this prevents the time from disappearing from the $input field.
+ tp_inst._updateDateTime(dp_inst);
+ if ($.isFunction(o.onChangeMonthYear))
+ o.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst);
+ },
+ onClose: function(dateText, dp_inst) {
+ if (tp_inst.timeDefined === true && $input.val() != '')
+ tp_inst._updateDateTime(dp_inst);
+ if ($.isFunction(o.onClose))
+ o.onClose.call($input[0], dateText, dp_inst, tp_inst);
+ },
+ timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker');
+ });
+ tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) { return val.toUpperCase() ;});
+ tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) { return val.toUpperCase() ;});
+
+ if (tp_inst._defaults.timezoneList === null) {
+ var timezoneList = [];
+ for (var i = -11; i <= 12; i++)
+ timezoneList.push((i >= 0 ? '+' : '-') + ('0' + Math.abs(i).toString()).slice(-2) + '00');
+ if (tp_inst._defaults.timezoneIso8609)
+ timezoneList = $.map(timezoneList, function(val) {
+ return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3));
+ });
+ tp_inst._defaults.timezoneList = timezoneList;
+ }
+
+ tp_inst.hour = tp_inst._defaults.hour;
+ tp_inst.minute = tp_inst._defaults.minute;
+ tp_inst.second = tp_inst._defaults.second;
+ tp_inst.millisec = tp_inst._defaults.millisec;
+ tp_inst.ampm = '';
+ tp_inst.$input = $input;
+
+ if (o.altField)
+ tp_inst.$altInput = $(o.altField)
+ .css({ cursor: 'pointer' })
+ .focus(function(){ $input.trigger("focus"); });
+
+ if(tp_inst._defaults.minDate==0 || tp_inst._defaults.minDateTime==0)
+ {
+ tp_inst._defaults.minDate=new Date();
+ }
+ if(tp_inst._defaults.maxDate==0 || tp_inst._defaults.maxDateTime==0)
+ {
+ tp_inst._defaults.maxDate=new Date();
+ }
+
+ // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime..
+ if(tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date)
+ tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime());
+ if(tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date)
+ tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime());
+ if(tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date)
+ tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime());
+ if(tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date)
+ tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime());
+ return tp_inst;
+ },
+
+ //########################################################################
+ // add our sliders to the calendar
+ //########################################################################
+ _addTimePicker: function(dp_inst) {
+ var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ?
+ this.$input.val() + ' ' + this.$altInput.val() :
+ this.$input.val();
+
+ this.timeDefined = this._parseTime(currDT);
+ this._limitMinMaxDateTime(dp_inst, false);
+ this._injectTimePicker();
+ },
+
+ //########################################################################
+ // parse the time string from input value or _setTime
+ //########################################################################
+ _parseTime: function(timeString, withDate) {
+ var regstr = this._defaults.timeFormat.toString()
+ .replace(/h{1,2}/ig, '(\\d?\\d)')
+ .replace(/m{1,2}/ig, '(\\d?\\d)')
+ .replace(/s{1,2}/ig, '(\\d?\\d)')
+ .replace(/l{1}/ig, '(\\d?\\d?\\d)')
+ .replace(/t{1,2}/ig, this._getPatternAmpm())
+ .replace(/z{1}/ig, '(z|[-+]\\d\\d:?\\d\\d)?')
+ .replace(/\s/g, '\\s?') + this._defaults.timeSuffix + '$',
+ order = this._getFormatPositions(),
+ ampm = '',
+ treg;
+
+ if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
+
+ if (withDate || !this._defaults.timeOnly) {
+ // the time should come after x number of characters and a space.
+ // x = at least the length of text specified by the date format
+ var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat');
+ // escape special regex characters in the separator
+ var specials = new RegExp("[.*+?|()\\[\\]{}\\\\]", "g");
+ regstr = '^.{' + dp_dateFormat.length + ',}?' + this._defaults.separator.replace(specials, "\\$&") + regstr;
+ }
+
+ treg = timeString.match(new RegExp(regstr, 'i'));
+
+ if (treg) {
+ if (order.t !== -1) {
+ if (treg[order.t] === undefined || treg[order.t].length === 0) {
+ ampm = '';
+ this.ampm = '';
+ } else {
+ ampm = $.inArray(treg[order.t].toUpperCase(), this.amNames) !== -1 ? 'AM' : 'PM';
+ this.ampm = this._defaults[ampm == 'AM' ? 'amNames' : 'pmNames'][0];
+ }
+ }
+
+ if (order.h !== -1) {
+ if (ampm == 'AM' && treg[order.h] == '12')
+ this.hour = 0; // 12am = 0 hour
+ else if (ampm == 'PM' && treg[order.h] != '12')
+ this.hour = (parseFloat(treg[order.h]) + 12).toFixed(0); // 12pm = 12 hour, any other pm = hour + 12
+ else this.hour = Number(treg[order.h]);
+ }
+
+ if (order.m !== -1) this.minute = Number(treg[order.m]);
+ if (order.s !== -1) this.second = Number(treg[order.s]);
+ if (order.l !== -1) this.millisec = Number(treg[order.l]);
+ if (order.z !== -1 && treg[order.z] !== undefined) {
+ var tz = treg[order.z].toUpperCase();
+ switch (tz.length) {
+ case 1: // Z
+ tz = this._defaults.timezoneIso8609 ? 'Z' : '+0000';
+ break;
+ case 5: // +hhmm
+ if (this._defaults.timezoneIso8609)
+ tz = tz.substring(1) == '0000'
+ ? 'Z'
+ : tz.substring(0, 3) + ':' + tz.substring(3);
+ break;
+ case 6: // +hh:mm
+ if (!this._defaults.timezoneIso8609)
+ tz = tz == 'Z' || tz.substring(1) == '00:00'
+ ? '+0000'
+ : tz.replace(/:/, '');
+ else if (tz.substring(1) == '00:00')
+ tz = 'Z';
+ break;
+ }
+ this.timezone = tz;
+ }
+
+ return true;
+
+ }
+ return false;
+ },
+
+ //########################################################################
+ // pattern for standard and localized AM/PM markers
+ //########################################################################
+ _getPatternAmpm: function() {
+ var markers = [];
+ o = this._defaults;
+ if (o.amNames)
+ $.merge(markers, o.amNames);
+ if (o.pmNames)
+ $.merge(markers, o.pmNames);
+ markers = $.map(markers, function(val) { return val.replace(/[.*+?|()\[\]{}\\]/g, '\\$&') });
+ return '(' + markers.join('|') + ')?';
+ },
+
+ //########################################################################
+ // figure out position of time elements.. cause js cant do named captures
+ //########################################################################
+ _getFormatPositions: function() {
+ var finds = this._defaults.timeFormat.toLowerCase().match(/(h{1,2}|m{1,2}|s{1,2}|l{1}|t{1,2}|z)/g),
+ orders = { h: -1, m: -1, s: -1, l: -1, t: -1, z: -1 };
+
+ if (finds)
+ for (var i = 0; i < finds.length; i++)
+ if (orders[finds[i].toString().charAt(0)] == -1)
+ orders[finds[i].toString().charAt(0)] = i + 1;
+
+ return orders;
+ },
+
+ //########################################################################
+ // generate and inject html for timepicker into ui datepicker
+ //########################################################################
+ _injectTimePicker: function() {
+ var $dp = this.inst.dpDiv,
+ o = this._defaults,
+ tp_inst = this,
+ // Added by Peter Medeiros:
+ // - Figure out what the hour/minute/second max should be based on the step values.
+ // - Example: if stepMinute is 15, then minMax is 45.
+ hourMax = parseInt((o.hourMax - ((o.hourMax - o.hourMin) % o.stepHour)) ,10),
+ minMax = parseInt((o.minuteMax - ((o.minuteMax - o.minuteMin) % o.stepMinute)) ,10),
+ secMax = parseInt((o.secondMax - ((o.secondMax - o.secondMin) % o.stepSecond)) ,10),
+ millisecMax = parseInt((o.millisecMax - ((o.millisecMax - o.millisecMin) % o.stepMillisec)) ,10),
+ dp_id = this.inst.id.toString().replace(/([^A-Za-z0-9_])/g, '');
+
+ // Prevent displaying twice
+ //if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0) {
+ if ($dp.find("div#ui-timepicker-div-"+ dp_id).length === 0 && o.showTimepicker) {
+ var noDisplay = ' style="display:none;"',
+ html = '<div class="ui-timepicker-div" id="ui-timepicker-div-' + dp_id + '"><dl>' +
+ '<dt class="ui_tpicker_time_label" id="ui_tpicker_time_label_' + dp_id + '"' +
+ ((o.showTime) ? '' : noDisplay) + '>' + o.timeText + '</dt>' +
+ '<dd class="ui_tpicker_time" id="ui_tpicker_time_' + dp_id + '"' +
+ ((o.showTime) ? '' : noDisplay) + '></dd>' +
+ '<dt class="ui_tpicker_hour_label" id="ui_tpicker_hour_label_' + dp_id + '"' +
+ ((o.showHour) ? '' : noDisplay) + '>' + o.hourText + '</dt>',
+ hourGridSize = 0,
+ minuteGridSize = 0,
+ secondGridSize = 0,
+ millisecGridSize = 0,
+ size;
+
+ // Hours
+ html += '<dd class="ui_tpicker_hour"><div id="ui_tpicker_hour_' + dp_id + '"' +
+ ((o.showHour) ? '' : noDisplay) + '></div>';
+ if (o.showHour && o.hourGrid > 0) {
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
+
+ for (var h = o.hourMin; h <= hourMax; h += parseInt(o.hourGrid,10)) {
+ hourGridSize++;
+ var tmph = (o.ampm && h > 12) ? h-12 : h;
+ if (tmph < 10) tmph = '0' + tmph;
+ if (o.ampm) {
+ if (h == 0) tmph = 12 +'a';
+ else if (h < 12) tmph += 'a';
+ else tmph += 'p';
+ }
+ html += '<td>' + tmph + '</td>';
+ }
+
+ html += '</tr></table></div>';
+ }
+ html += '</dd>';
+
+ // Minutes
+ html += '<dt class="ui_tpicker_minute_label" id="ui_tpicker_minute_label_' + dp_id + '"' +
+ ((o.showMinute) ? '' : noDisplay) + '>' + o.minuteText + '</dt>'+
+ '<dd class="ui_tpicker_minute"><div id="ui_tpicker_minute_' + dp_id + '"' +
+ ((o.showMinute) ? '' : noDisplay) + '></div>';
+
+ if (o.showMinute && o.minuteGrid > 0) {
+ html += '<div style="padding-left: 1px"><table class="ui-tpicker-grid-label"><tr>';
+
+ for (var m = o.minuteMin; m <= minMax; m += parseInt(o.minuteGrid,10)) {
+ minuteGridSize++;
+ html += '<td>' + ((m < 10) ? '0' : '') + m + '</td>';
+ }
+
+ html += '</tr></table></div>';
+ }
+ html += '</dd>';
+
+ // Seconds
+ html += '<dt class="ui_tpicker_second_label" id="ui_tpicker_second_label_' + dp_id + '"' +
+ ((o.showSecond) ? '' : noDisplay) + '>' + o.secondText + '</dt>'+
+ '<dd class="ui_tpicker_second"><div id="ui_tpicker_second_' + dp_id + '"'+
+ ((o.showSecond) ? '' : noDisplay) + '></div>';
+
+ if (o.showSecond && o.secondGrid > 0) {
+ html += '<div style="padding-left: 1px"><table><tr>';
+
+ for (var s = o.secondMin; s <= secMax; s += parseInt(o.secondGrid,10)) {
+ secondGridSize++;
+ html += '<td>' + ((s < 10) ? '0' : '') + s + '</td>';
+ }
+
+ html += '</tr></table></div>';
+ }
+ html += '</dd>';
+
+ // Milliseconds
+ html += '<dt class="ui_tpicker_millisec_label" id="ui_tpicker_millisec_label_' + dp_id + '"' +
+ ((o.showMillisec) ? '' : noDisplay) + '>' + o.millisecText + '</dt>'+
+ '<dd class="ui_tpicker_millisec"><div id="ui_tpicker_millisec_' + dp_id + '"'+
+ ((o.showMillisec) ? '' : noDisplay) + '></div>';
+
+ if (o.showMillisec && o.millisecGrid > 0) {
+ html += '<div style="padding-left: 1px"><table><tr>';
+
+ for (var l = o.millisecMin; l <= millisecMax; l += parseInt(o.millisecGrid,10)) {
+ millisecGridSize++;
+ html += '<td>' + ((l < 10) ? '0' : '') + l + '</td>';
+ }
+
+ html += '</tr></table></div>';
+ }
+ html += '</dd>';
+
+ // Timezone
+ html += '<dt class="ui_tpicker_timezone_label" id="ui_tpicker_timezone_label_' + dp_id + '"' +
+ ((o.showTimezone) ? '' : noDisplay) + '>' + o.timezoneText + '</dt>';
+ html += '<dd class="ui_tpicker_timezone" id="ui_tpicker_timezone_' + dp_id + '"' +
+ ((o.showTimezone) ? '' : noDisplay) + '></dd>';
+
+ html += '</dl></div>';
+ $tp = $(html);
+
+ // if we only want time picker...
+ if (o.timeOnly === true) {
+ $tp.prepend(
+ '<div class="ui-widget-header ui-helper-clearfix ui-corner-all">' +
+ '<div class="ui-datepicker-title">' + o.timeOnlyTitle + '</div>' +
+ '</div>');
+ $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide();
+ }
+
+ this.hour_slider = $tp.find('#ui_tpicker_hour_'+ dp_id).slider({
+ orientation: "horizontal",
+ value: this.hour,
+ min: o.hourMin,
+ max: hourMax,
+ step: o.stepHour,
+ slide: function(event, ui) {
+ tp_inst.hour_slider.slider( "option", "value", ui.value);
+ tp_inst._onTimeChange();
+ }
+ });
+
+
+ // Updated by Peter Medeiros:
+ // - Pass in Event and UI instance into slide function
+ this.minute_slider = $tp.find('#ui_tpicker_minute_'+ dp_id).slider({
+ orientation: "horizontal",
+ value: this.minute,
+ min: o.minuteMin,
+ max: minMax,
+ step: o.stepMinute,
+ slide: function(event, ui) {
+ tp_inst.minute_slider.slider( "option", "value", ui.value);
+ tp_inst._onTimeChange();
+ }
+ });
+
+ this.second_slider = $tp.find('#ui_tpicker_second_'+ dp_id).slider({
+ orientation: "horizontal",
+ value: this.second,
+ min: o.secondMin,
+ max: secMax,
+ step: o.stepSecond,
+ slide: function(event, ui) {
+ tp_inst.second_slider.slider( "option", "value", ui.value);
+ tp_inst._onTimeChange();
+ }
+ });
+
+ this.millisec_slider = $tp.find('#ui_tpicker_millisec_'+ dp_id).slider({
+ orientation: "horizontal",
+ value: this.millisec,
+ min: o.millisecMin,
+ max: millisecMax,
+ step: o.stepMillisec,
+ slide: function(event, ui) {
+ tp_inst.millisec_slider.slider( "option", "value", ui.value);
+ tp_inst._onTimeChange();
+ }
+ });
+
+ this.timezone_select = $tp.find('#ui_tpicker_timezone_'+ dp_id).append('<select></select>').find("select");
+ $.fn.append.apply(this.timezone_select,
+ $.map(o.timezoneList, function(val, idx) {
+ return $("<option />")
+ .val(typeof val == "object" ? val.value : val)
+ .text(typeof val == "object" ? val.label : val);
+ })
+ );
+ this.timezone_select.val((typeof this.timezone != "undefined" && this.timezone != null && this.timezone != "") ? this.timezone : o.timezone);
+ this.timezone_select.change(function() {
+ tp_inst._onTimeChange();
+ });
+
+ // Add grid functionality
+ if (o.showHour && o.hourGrid > 0) {
+ size = 100 * hourGridSize * o.hourGrid / (hourMax - o.hourMin);
+
+ $tp.find(".ui_tpicker_hour table").css({
+ width: size + "%",
+ marginLeft: (size / (-2 * hourGridSize)) + "%",
+ borderCollapse: 'collapse'
+ }).find("td").each( function(index) {
+ $(this).click(function() {
+ var h = $(this).html();
+ if(o.ampm) {
+ var ap = h.substring(2).toLowerCase(),
+ aph = parseInt(h.substring(0,2), 10);
+ if (ap == 'a') {
+ if (aph == 12) h = 0;
+ else h = aph;
+ } else if (aph == 12) h = 12;
+ else h = aph + 12;
+ }
+ tp_inst.hour_slider.slider("option", "value", h);
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ }).css({
+ cursor: 'pointer',
+ width: (100 / hourGridSize) + '%',
+ textAlign: 'center',
+ overflow: 'hidden'
+ });
+ });
+ }
+
+ if (o.showMinute && o.minuteGrid > 0) {
+ size = 100 * minuteGridSize * o.minuteGrid / (minMax - o.minuteMin);
+ $tp.find(".ui_tpicker_minute table").css({
+ width: size + "%",
+ marginLeft: (size / (-2 * minuteGridSize)) + "%",
+ borderCollapse: 'collapse'
+ }).find("td").each(function(index) {
+ $(this).click(function() {
+ tp_inst.minute_slider.slider("option", "value", $(this).html());
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ }).css({
+ cursor: 'pointer',
+ width: (100 / minuteGridSize) + '%',
+ textAlign: 'center',
+ overflow: 'hidden'
+ });
+ });
+ }
+
+ if (o.showSecond && o.secondGrid > 0) {
+ $tp.find(".ui_tpicker_second table").css({
+ width: size + "%",
+ marginLeft: (size / (-2 * secondGridSize)) + "%",
+ borderCollapse: 'collapse'
+ }).find("td").each(function(index) {
+ $(this).click(function() {
+ tp_inst.second_slider.slider("option", "value", $(this).html());
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ }).css({
+ cursor: 'pointer',
+ width: (100 / secondGridSize) + '%',
+ textAlign: 'center',
+ overflow: 'hidden'
+ });
+ });
+ }
+
+ if (o.showMillisec && o.millisecGrid > 0) {
+ $tp.find(".ui_tpicker_millisec table").css({
+ width: size + "%",
+ marginLeft: (size / (-2 * millisecGridSize)) + "%",
+ borderCollapse: 'collapse'
+ }).find("td").each(function(index) {
+ $(this).click(function() {
+ tp_inst.millisec_slider.slider("option", "value", $(this).html());
+ tp_inst._onTimeChange();
+ tp_inst._onSelectHandler();
+ }).css({
+ cursor: 'pointer',
+ width: (100 / millisecGridSize) + '%',
+ textAlign: 'center',
+ overflow: 'hidden'
+ });
+ });
+ }
+
+ var $buttonPanel = $dp.find('.ui-datepicker-buttonpane');
+ if ($buttonPanel.length) $buttonPanel.before($tp);
+ else $dp.append($tp);
+
+ this.$timeObj = $tp.find('#ui_tpicker_time_'+ dp_id);
+
+ if (this.inst !== null) {
+ var timeDefined = this.timeDefined;
+ this._onTimeChange();
+ this.timeDefined = timeDefined;
+ }
+
+ //Emulate datepicker onSelect behavior. Call on slidestop.
+ var onSelectDelegate = function() {
+ tp_inst._onSelectHandler();
+ };
+ this.hour_slider.bind('slidestop',onSelectDelegate);
+ this.minute_slider.bind('slidestop',onSelectDelegate);
+ this.second_slider.bind('slidestop',onSelectDelegate);
+ this.millisec_slider.bind('slidestop',onSelectDelegate);
+
+ // slideAccess integration: http://trentrichardson.com/2011/11/11/jquery-ui-sliders-and-touch-accessibility/
+ if (this._defaults.addSliderAccess){
+ var sliderAccessArgs = this._defaults.sliderAccessArgs;
+ setTimeout(function(){ // fix for inline mode
+ if($tp.find('.ui-slider-access').length == 0){
+ $tp.find('.ui-slider:visible').sliderAccess(sliderAccessArgs);
+
+ // fix any grids since sliders are shorter
+ var sliderAccessWidth = $tp.find('.ui-slider-access:eq(0)').outerWidth(true);
+ if(sliderAccessWidth){
+ $tp.find('table:visible').each(function(){
+ var $g = $(this),
+ oldWidth = $g.outerWidth(),
+ oldMarginLeft = $g.css('marginLeft').toString().replace('%',''),
+ newWidth = oldWidth - sliderAccessWidth,
+ newMarginLeft = ((oldMarginLeft * newWidth)/oldWidth) + '%';
+
+ $g.css({ width: newWidth, marginLeft: newMarginLeft });
+ });
+ }
+ }
+ },0);
+ }
+ // end slideAccess integration
+
+ }
+ },
+
+ //########################################################################
+ // This function tries to limit the ability to go outside the
+ // min/max date range
+ //########################################################################
+ _limitMinMaxDateTime: function(dp_inst, adjustSliders){
+ var o = this._defaults,
+ dp_date = new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay);
+
+ if(!this._defaults.showTimepicker) return; // No time so nothing to check here
+
+ if($.datepicker._get(dp_inst, 'minDateTime') !== null && $.datepicker._get(dp_inst, 'minDateTime') !== undefined && dp_date){
+ var minDateTime = $.datepicker._get(dp_inst, 'minDateTime'),
+ minDateTimeDate = new Date(minDateTime.getFullYear(), minDateTime.getMonth(), minDateTime.getDate(), 0, 0, 0, 0);
+
+ if(this.hourMinOriginal === null || this.minuteMinOriginal === null || this.secondMinOriginal === null || this.millisecMinOriginal === null){
+ this.hourMinOriginal = o.hourMin;
+ this.minuteMinOriginal = o.minuteMin;
+ this.secondMinOriginal = o.secondMin;
+ this.millisecMinOriginal = o.millisecMin;
+ }
+
+ if(dp_inst.settings.timeOnly || minDateTimeDate.getTime() == dp_date.getTime()) {
+ this._defaults.hourMin = minDateTime.getHours();
+ if (this.hour <= this._defaults.hourMin) {
+ this.hour = this._defaults.hourMin;
+ this._defaults.minuteMin = minDateTime.getMinutes();
+ if (this.minute <= this._defaults.minuteMin) {
+ this.minute = this._defaults.minuteMin;
+ this._defaults.secondMin = minDateTime.getSeconds();
+ } else if (this.second <= this._defaults.secondMin){
+ this.second = this._defaults.secondMin;
+ this._defaults.millisecMin = minDateTime.getMilliseconds();
+ } else {
+ if(this.millisec < this._defaults.millisecMin)
+ this.millisec = this._defaults.millisecMin;
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ }
+ } else {
+ this._defaults.minuteMin = this.minuteMinOriginal;
+ this._defaults.secondMin = this.secondMinOriginal;
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ }
+ }else{
+ this._defaults.hourMin = this.hourMinOriginal;
+ this._defaults.minuteMin = this.minuteMinOriginal;
+ this._defaults.secondMin = this.secondMinOriginal;
+ this._defaults.millisecMin = this.millisecMinOriginal;
+ }
+ }
+
+ if($.datepicker._get(dp_inst, 'maxDateTime') !== null && $.datepicker._get(dp_inst, 'maxDateTime') !== undefined && dp_date){
+ var maxDateTime = $.datepicker._get(dp_inst, 'maxDateTime'),
+ maxDateTimeDate = new Date(maxDateTime.getFullYear(), maxDateTime.getMonth(), maxDateTime.getDate(), 0, 0, 0, 0);
+
+ if(this.hourMaxOriginal === null || this.minuteMaxOriginal === null || this.secondMaxOriginal === null){
+ this.hourMaxOriginal = o.hourMax;
+ this.minuteMaxOriginal = o.minuteMax;
+ this.secondMaxOriginal = o.secondMax;
+ this.millisecMaxOriginal = o.millisecMax;
+ }
+
+ if(dp_inst.settings.timeOnly || maxDateTimeDate.getTime() == dp_date.getTime()){
+ this._defaults.hourMax = maxDateTime.getHours();
+ if (this.hour >= this._defaults.hourMax) {
+ this.hour = this._defaults.hourMax;
+ this._defaults.minuteMax = maxDateTime.getMinutes();
+ if (this.minute >= this._defaults.minuteMax) {
+ this.minute = this._defaults.minuteMax;
+ this._defaults.secondMax = maxDateTime.getSeconds();
+ } else if (this.second >= this._defaults.secondMax) {
+ this.second = this._defaults.secondMax;
+ this._defaults.millisecMax = maxDateTime.getMilliseconds();
+ } else {
+ if(this.millisec > this._defaults.millisecMax) this.millisec = this._defaults.millisecMax;
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ }
+ } else {
+ this._defaults.minuteMax = this.minuteMaxOriginal;
+ this._defaults.secondMax = this.secondMaxOriginal;
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ }
+ }else{
+ this._defaults.hourMax = this.hourMaxOriginal;
+ this._defaults.minuteMax = this.minuteMaxOriginal;
+ this._defaults.secondMax = this.secondMaxOriginal;
+ this._defaults.millisecMax = this.millisecMaxOriginal;
+ }
+ }
+
+ if(adjustSliders !== undefined && adjustSliders === true){
+ var hourMax = parseInt((this._defaults.hourMax - ((this._defaults.hourMax - this._defaults.hourMin) % this._defaults.stepHour)) ,10),
+ minMax = parseInt((this._defaults.minuteMax - ((this._defaults.minuteMax - this._defaults.minuteMin) % this._defaults.stepMinute)) ,10),
+ secMax = parseInt((this._defaults.secondMax - ((this._defaults.secondMax - this._defaults.secondMin) % this._defaults.stepSecond)) ,10),
+ millisecMax = parseInt((this._defaults.millisecMax - ((this._defaults.millisecMax - this._defaults.millisecMin) % this._defaults.stepMillisec)) ,10);
+
+ if(this.hour_slider)
+ this.hour_slider.slider("option", { min: this._defaults.hourMin, max: hourMax }).slider('value', this.hour);
+ if(this.minute_slider)
+ this.minute_slider.slider("option", { min: this._defaults.minuteMin, max: minMax }).slider('value', this.minute);
+ if(this.second_slider)
+ this.second_slider.slider("option", { min: this._defaults.secondMin, max: secMax }).slider('value', this.second);
+ if(this.millisec_slider)
+ this.millisec_slider.slider("option", { min: this._defaults.millisecMin, max: millisecMax }).slider('value', this.millisec);
+ }
+
+ },
+
+
+ //########################################################################
+ // when a slider moves, set the internal time...
+ // on time change is also called when the time is updated in the text field
+ //########################################################################
+ _onTimeChange: function() {
+ var hour = (this.hour_slider) ? this.hour_slider.slider('value') : false,
+ minute = (this.minute_slider) ? this.minute_slider.slider('value') : false,
+ second = (this.second_slider) ? this.second_slider.slider('value') : false,
+ millisec = (this.millisec_slider) ? this.millisec_slider.slider('value') : false,
+ timezone = (this.timezone_select) ? this.timezone_select.val() : false,
+ o = this._defaults;
+
+ if (typeof(hour) == 'object') hour = false;
+ if (typeof(minute) == 'object') minute = false;
+ if (typeof(second) == 'object') second = false;
+ if (typeof(millisec) == 'object') millisec = false;
+ if (typeof(timezone) == 'object') timezone = false;
+
+ if (hour !== false) hour = parseInt(hour,10);
+ if (minute !== false) minute = parseInt(minute,10);
+ if (second !== false) second = parseInt(second,10);
+ if (millisec !== false) millisec = parseInt(millisec,10);
+
+ var ampm = o[hour < 12 ? 'amNames' : 'pmNames'][0];
+
+ // If the update was done in the input field, the input field should not be updated.
+ // If the update was done using the sliders, update the input field.
+ var hasChanged = (hour != this.hour || minute != this.minute
+ || second != this.second || millisec != this.millisec
+ || (this.ampm.length > 0
+ && (hour < 12) != ($.inArray(this.ampm.toUpperCase(), this.amNames) !== -1))
+ || timezone != this.timezone);
+
+ if (hasChanged) {
+
+ if (hour !== false)this.hour = hour;
+ if (minute !== false) this.minute = minute;
+ if (second !== false) this.second = second;
+ if (millisec !== false) this.millisec = millisec;
+ if (timezone !== false) this.timezone = timezone;
+
+ if (!this.inst) this.inst = $.datepicker._getInst(this.$input[0]);
+
+ this._limitMinMaxDateTime(this.inst, true);
+ }
+ if (o.ampm) this.ampm = ampm;
+
+ //this._formatTime();
+ this.formattedTime = $.datepicker.formatTime(this._defaults.timeFormat, this, this._defaults);
+ if (this.$timeObj) this.$timeObj.text(this.formattedTime + o.timeSuffix);
+ this.timeDefined = true;
+ if (hasChanged) this._updateDateTime();
+ },
+
+ //########################################################################
+ // call custom onSelect.
+ // bind to sliders slidestop, and grid click.
+ //########################################################################
+ _onSelectHandler: function() {
+ var onSelect = this._defaults.onSelect;
+ var inputEl = this.$input ? this.$input[0] : null;
+ if (onSelect && inputEl) {
+ onSelect.apply(inputEl, [this.formattedDateTime, this]);
+ }
+ },
+
+ //########################################################################
+ // left for any backwards compatibility
+ //########################################################################
+ _formatTime: function(time, format) {
+ time = time || { hour: this.hour, minute: this.minute, second: this.second, millisec: this.millisec, ampm: this.ampm, timezone: this.timezone };
+ var tmptime = (format || this._defaults.timeFormat).toString();
+
+ tmptime = $.datepicker.formatTime(tmptime, time, this._defaults);
+
+ if (arguments.length) return tmptime;
+ else this.formattedTime = tmptime;
+ },
+
+ //########################################################################
+ // update our input with the new date time..
+ //########################################################################
+ _updateDateTime: function(dp_inst) {
+ dp_inst = this.inst || dp_inst;
+ var dt = $.datepicker._daylightSavingAdjust(new Date(dp_inst.selectedYear, dp_inst.selectedMonth, dp_inst.selectedDay)),
+ dateFmt = $.datepicker._get(dp_inst, 'dateFormat'),
+ formatCfg = $.datepicker._getFormatConfig(dp_inst),
+ timeAvailable = dt !== null && this.timeDefined;
+ this.formattedDate = $.datepicker.formatDate(dateFmt, (dt === null ? new Date() : dt), formatCfg);
+ var formattedDateTime = this.formattedDate;
+ if (dp_inst.lastVal !== undefined && (dp_inst.lastVal.length > 0 && this.$input.val().length === 0))
+ return;
+
+ if (this._defaults.timeOnly === true) {
+ formattedDateTime = this.formattedTime;
+ } else if (this._defaults.timeOnly !== true && (this._defaults.alwaysSetTime || timeAvailable)) {
+ formattedDateTime += this._defaults.separator + this.formattedTime + this._defaults.timeSuffix;
+ }
+
+ this.formattedDateTime = formattedDateTime;
+
+ if(!this._defaults.showTimepicker) {
+ this.$input.val(this.formattedDate);
+ } else if (this.$altInput && this._defaults.altFieldTimeOnly === true) {
+ this.$altInput.val(this.formattedTime);
+ this.$input.val(this.formattedDate);
+ } else if(this.$altInput) {
+ this.$altInput.val(formattedDateTime);
+ this.$input.val(formattedDateTime);
+ } else {
+ this.$input.val(formattedDateTime);
+ }
+
+ this.$input.trigger("change");
+ }
+
+});
+
+$.fn.extend({
+ //########################################################################
+ // shorthand just to use timepicker..
+ //########################################################################
+ timepicker: function(o) {
+ o = o || {};
+ var tmp_args = arguments;
+
+ if (typeof o == 'object') tmp_args[0] = $.extend(o, { timeOnly: true });
+
+ return $(this).each(function() {
+ $.fn.datetimepicker.apply($(this), tmp_args);
+ });
+ },
+
+ //########################################################################
+ // extend timepicker to datepicker
+ //########################################################################
+ datetimepicker: function(o) {
+ o = o || {};
+ var $input = this,
+ tmp_args = arguments;
+
+ if (typeof(o) == 'string'){
+ if(o == 'getDate')
+ return $.fn.datepicker.apply($(this[0]), tmp_args);
+ else
+ return this.each(function() {
+ var $t = $(this);
+ $t.datepicker.apply($t, tmp_args);
+ });
+ }
+ else
+ return this.each(function() {
+ var $t = $(this);
+ $t.datepicker($.timepicker._newInst($t, o)._defaults);
+ });
+ }
+});
+
+//########################################################################
+// format the time all pretty...
+// format = string format of the time
+// time = a {}, not a Date() for timezones
+// options = essentially the regional[].. amNames, pmNames, ampm
+//########################################################################
+$.datepicker.formatTime = function(format, time, options) {
+ options = options || {};
+ options = $.extend($.timepicker._defaults, options);
+ time = $.extend({hour:0, minute:0, second:0, millisec:0, timezone:'+0000'}, time);
+
+ var tmptime = format;
+ var ampmName = options['amNames'][0];
+
+ var hour = parseInt(time.hour, 10);
+ if (options.ampm) {
+ if (hour > 11){
+ ampmName = options['pmNames'][0];
+ if(hour > 12)
+ hour = hour % 12;
+ }
+ if (hour === 0)
+ hour = 12;
+ }
+ tmptime = tmptime.replace(/(?:hh?|mm?|ss?|[tT]{1,2}|[lz])/g, function(match) {
+ switch (match.toLowerCase()) {
+ case 'hh': return ('0' + hour).slice(-2);
+ case 'h': return hour;
+ case 'mm': return ('0' + time.minute).slice(-2);
+ case 'm': return time.minute;
+ case 'ss': return ('0' + time.second).slice(-2);
+ case 's': return time.second;
+ case 'l': return ('00' + time.millisec).slice(-3);
+ case 'z': return time.timezone;
+ case 't': case 'tt':
+ if (options.ampm) {
+ if (match.length == 1)
+ ampmName = ampmName.charAt(0);
+ return match.charAt(0) == 'T' ? ampmName.toUpperCase() : ampmName.toLowerCase();
+ }
+ return '';
+ }
+ });
+
+ tmptime = $.trim(tmptime);
+ return tmptime;
+};
+
+//########################################################################
+// the bad hack :/ override datepicker so it doesnt close on select
+// inspired: http://stackoverflow.com/questions/1252512/jquery-datepicker-prevent-closing-picker-when-clicking-a-date/1762378#1762378
+//########################################################################
+$.datepicker._base_selectDate = $.datepicker._selectDate;
+$.datepicker._selectDate = function (id, dateStr) {
+ var inst = this._getInst($(id)[0]),
+ tp_inst = this._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ tp_inst._limitMinMaxDateTime(inst, true);
+ inst.inline = inst.stay_open = true;
+ //This way the onSelect handler called from calendarpicker get the full dateTime
+ this._base_selectDate(id, dateStr);
+ inst.inline = inst.stay_open = false;
+ this._notifyChange(inst);
+ this._updateDatepicker(inst);
+ }
+ else this._base_selectDate(id, dateStr);
+};
+
+//#############################################################################################
+// second bad hack :/ override datepicker so it triggers an event when changing the input field
+// and does not redraw the datepicker on every selectDate event
+//#############################################################################################
+$.datepicker._base_updateDatepicker = $.datepicker._updateDatepicker;
+$.datepicker._updateDatepicker = function(inst) {
+
+ // don't popup the datepicker if there is another instance already opened
+ var input = inst.input[0];
+ if($.datepicker._curInst &&
+ $.datepicker._curInst != inst &&
+ $.datepicker._datepickerShowing &&
+ $.datepicker._lastInput != input) {
+ return;
+ }
+
+ if (typeof(inst.stay_open) !== 'boolean' || inst.stay_open === false) {
+
+ this._base_updateDatepicker(inst);
+
+ // Reload the time control when changing something in the input text field.
+ var tp_inst = this._get(inst, 'timepicker');
+ if(tp_inst) tp_inst._addTimePicker(inst);
+ }
+};
+
+//#######################################################################################
+// third bad hack :/ override datepicker so it allows spaces and colon in the input field
+//#######################################################################################
+$.datepicker._base_doKeyPress = $.datepicker._doKeyPress;
+$.datepicker._doKeyPress = function(event) {
+ var inst = $.datepicker._getInst(event.target),
+ tp_inst = $.datepicker._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ if ($.datepicker._get(inst, 'constrainInput')) {
+ var ampm = tp_inst._defaults.ampm,
+ dateChars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat')),
+ datetimeChars = tp_inst._defaults.timeFormat.toString()
+ .replace(/[hms]/g, '')
+ .replace(/TT/g, ampm ? 'APM' : '')
+ .replace(/Tt/g, ampm ? 'AaPpMm' : '')
+ .replace(/tT/g, ampm ? 'AaPpMm' : '')
+ .replace(/T/g, ampm ? 'AP' : '')
+ .replace(/tt/g, ampm ? 'apm' : '')
+ .replace(/t/g, ampm ? 'ap' : '') +
+ " " +
+ tp_inst._defaults.separator +
+ tp_inst._defaults.timeSuffix +
+ (tp_inst._defaults.showTimezone ? tp_inst._defaults.timezoneList.join('') : '') +
+ (tp_inst._defaults.amNames.join('')) +
+ (tp_inst._defaults.pmNames.join('')) +
+ dateChars,
+ chr = String.fromCharCode(event.charCode === undefined ? event.keyCode : event.charCode);
+ return event.ctrlKey || (chr < ' ' || !dateChars || datetimeChars.indexOf(chr) > -1);
+ }
+ }
+
+ return $.datepicker._base_doKeyPress(event);
+};
+
+//#######################################################################################
+// Override key up event to sync manual input changes.
+//#######################################################################################
+$.datepicker._base_doKeyUp = $.datepicker._doKeyUp;
+$.datepicker._doKeyUp = function (event) {
+ var inst = $.datepicker._getInst(event.target),
+ tp_inst = $.datepicker._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ if (tp_inst._defaults.timeOnly && (inst.input.val() != inst.lastVal)) {
+ try {
+ $.datepicker._updateDatepicker(inst);
+ }
+ catch (err) {
+ $.datepicker.log(err);
+ }
+ }
+ }
+
+ return $.datepicker._base_doKeyUp(event);
+};
+
+//#######################################################################################
+// override "Today" button to also grab the time.
+//#######################################################################################
+$.datepicker._base_gotoToday = $.datepicker._gotoToday;
+$.datepicker._gotoToday = function(id) {
+ var inst = this._getInst($(id)[0]),
+ $dp = inst.dpDiv;
+ this._base_gotoToday(id);
+ var now = new Date();
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst && tp_inst._defaults.showTimezone && tp_inst.timezone_select) {
+ var tzoffset = now.getTimezoneOffset(); // If +0100, returns -60
+ var tzsign = tzoffset > 0 ? '-' : '+';
+ tzoffset = Math.abs(tzoffset);
+ var tzmin = tzoffset % 60;
+ tzoffset = tzsign + ('0' + (tzoffset - tzmin) / 60).slice(-2) + ('0' + tzmin).slice(-2);
+ if (tp_inst._defaults.timezoneIso8609)
+ tzoffset = tzoffset.substring(0, 3) + ':' + tzoffset.substring(3);
+ tp_inst.timezone_select.val(tzoffset);
+ }
+ this._setTime(inst, now);
+ $( '.ui-datepicker-today', $dp).click();
+};
+
+//#######################################################################################
+// Disable & enable the Time in the datetimepicker
+//#######################################################################################
+$.datepicker._disableTimepickerDatepicker = function(target, date, withDate) {
+ var inst = this._getInst(target),
+ tp_inst = this._get(inst, 'timepicker');
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+ if (tp_inst) {
+ tp_inst._defaults.showTimepicker = false;
+ tp_inst._updateDateTime(inst);
+ }
+};
+
+$.datepicker._enableTimepickerDatepicker = function(target, date, withDate) {
+ var inst = this._getInst(target),
+ tp_inst = this._get(inst, 'timepicker');
+ $(target).datepicker('getDate'); // Init selected[Year|Month|Day]
+ if (tp_inst) {
+ tp_inst._defaults.showTimepicker = true;
+ tp_inst._addTimePicker(inst); // Could be disabled on page load
+ tp_inst._updateDateTime(inst);
+ }
+};
+
+//#######################################################################################
+// Create our own set time function
+//#######################################################################################
+$.datepicker._setTime = function(inst, date) {
+ var tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ var defaults = tp_inst._defaults,
+ // calling _setTime with no date sets time to defaults
+ hour = date ? date.getHours() : defaults.hour,
+ minute = date ? date.getMinutes() : defaults.minute,
+ second = date ? date.getSeconds() : defaults.second,
+ millisec = date ? date.getMilliseconds() : defaults.millisec;
+
+ //check if within min/max times..
+ if ((hour < defaults.hourMin || hour > defaults.hourMax) || (minute < defaults.minuteMin || minute > defaults.minuteMax) || (second < defaults.secondMin || second > defaults.secondMax) || (millisec < defaults.millisecMin || millisec > defaults.millisecMax)) {
+ hour = defaults.hourMin;
+ minute = defaults.minuteMin;
+ second = defaults.secondMin;
+ millisec = defaults.millisecMin;
+ }
+
+ tp_inst.hour = hour;
+ tp_inst.minute = minute;
+ tp_inst.second = second;
+ tp_inst.millisec = millisec;
+
+ if (tp_inst.hour_slider) tp_inst.hour_slider.slider('value', hour);
+ if (tp_inst.minute_slider) tp_inst.minute_slider.slider('value', minute);
+ if (tp_inst.second_slider) tp_inst.second_slider.slider('value', second);
+ if (tp_inst.millisec_slider) tp_inst.millisec_slider.slider('value', millisec);
+
+ tp_inst._onTimeChange();
+ tp_inst._updateDateTime(inst);
+ }
+};
+
+//#######################################################################################
+// Create new public method to set only time, callable as $().datepicker('setTime', date)
+//#######################################################################################
+$.datepicker._setTimeDatepicker = function(target, date, withDate) {
+ var inst = this._getInst(target),
+ tp_inst = this._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ this._setDateFromField(inst);
+ var tp_date;
+ if (date) {
+ if (typeof date == "string") {
+ tp_inst._parseTime(date, withDate);
+ tp_date = new Date();
+ tp_date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+ }
+ else tp_date = new Date(date.getTime());
+ if (tp_date.toString() == 'Invalid Date') tp_date = undefined;
+ this._setTime(inst, tp_date);
+ }
+ }
+
+};
+
+//#######################################################################################
+// override setDate() to allow setting time too within Date object
+//#######################################################################################
+$.datepicker._base_setDateDatepicker = $.datepicker._setDateDatepicker;
+$.datepicker._setDateDatepicker = function(target, date) {
+ var inst = this._getInst(target),
+ tp_date = (date instanceof Date) ? new Date(date.getTime()) : date;
+
+ this._updateDatepicker(inst);
+ this._base_setDateDatepicker.apply(this, arguments);
+ this._setTimeDatepicker(target, tp_date, true);
+};
+
+//#######################################################################################
+// override getDate() to allow getting time too within Date object
+//#######################################################################################
+$.datepicker._base_getDateDatepicker = $.datepicker._getDateDatepicker;
+$.datepicker._getDateDatepicker = function(target, noDefault) {
+ var inst = this._getInst(target),
+ tp_inst = this._get(inst, 'timepicker');
+
+ if (tp_inst) {
+ this._setDateFromField(inst, noDefault);
+ var date = this._getDate(inst);
+ if (date && tp_inst._parseTime($(target).val(), tp_inst.timeOnly)) date.setHours(tp_inst.hour, tp_inst.minute, tp_inst.second, tp_inst.millisec);
+ return date;
+ }
+ return this._base_getDateDatepicker(target, noDefault);
+};
+
+//#######################################################################################
+// override parseDate() because UI 1.8.14 throws an error about "Extra characters"
+// An option in datapicker to ignore extra format characters would be nicer.
+//#######################################################################################
+$.datepicker._base_parseDate = $.datepicker.parseDate;
+$.datepicker.parseDate = function(format, value, settings) {
+ var date;
+ try {
+ date = this._base_parseDate(format, value, settings);
+ } catch (err) {
+ if (err.indexOf(":") >= 0) {
+ // Hack! The error message ends with a colon, a space, and
+ // the "extra" characters. We rely on that instead of
+ // attempting to perfectly reproduce the parsing algorithm.
+ date = this._base_parseDate(format, value.substring(0,value.length-(err.length-err.indexOf(':')-2)), settings);
+ } else {
+ // The underlying error was not related to the time
+ throw err;
+ }
+ }
+ return date;
+};
+
+//#######################################################################################
+// override formatDate to set date with time to the input
+//#######################################################################################
+$.datepicker._base_formatDate=$.datepicker._formatDate;
+$.datepicker._formatDate = function(inst, day, month, year){
+ var tp_inst = this._get(inst, 'timepicker');
+ if(tp_inst)
+ {
+ if(day)
+ var b = this._base_formatDate(inst, day, month, year);
+ tp_inst._updateDateTime(inst);
+ return tp_inst.$input.val();
+ }
+ return this._base_formatDate(inst);
+};
+
+//#######################################################################################
+// override options setter to add time to maxDate(Time) and minDate(Time). MaxDate
+//#######################################################################################
+$.datepicker._base_optionDatepicker = $.datepicker._optionDatepicker;
+$.datepicker._optionDatepicker = function(target, name, value) {
+ var inst = this._getInst(target),
+ tp_inst = this._get(inst, 'timepicker');
+ if (tp_inst) {
+ var min,max,onselect;
+ if (typeof name == 'string') { // if min/max was set with the string
+ if (name==='minDate' || name==='minDateTime' )
+ min = value;
+ else if (name==='maxDate' || name==='maxDateTime')
+ max = value;
+ else if (name==='onSelect')
+ onselect=value;
+ } else if (typeof name == 'object') { //if min/max was set with the JSON
+ if(name.minDate)
+ min = name.minDate;
+ else if (name.minDateTime)
+ min = name.minDateTime;
+ else if (name.maxDate)
+ max = name.maxDate;
+ else if (name.maxDateTime)
+ max = name.maxDateTime;
+ }
+ if(min){ //if min was set
+ if(min==0)
+ min=new Date();
+ else
+ min= new Date(min);
+
+ tp_inst._defaults.minDate = min;
+ tp_inst._defaults.minDateTime = min;
+ } else if (max){ //if max was set
+ if(max==0)
+ max=new Date();
+ else
+ max= new Date(max);
+ tp_inst._defaults.maxDate = max;
+ tp_inst._defaults.maxDateTime = max;
+ }
+ else if (onselect)
+ tp_inst._defaults.onSelect=onselect;
+ }
+ if (value === undefined)
+ return this._base_optionDatepicker(target, name);
+ return this._base_optionDatepicker(target, name, value);
+};
+
+//#######################################################################################
+// jQuery extend now ignores nulls!
+//#######################################################################################
+function extendRemove(target, props) {
+ $.extend(target, props);
+ for (var name in props)
+ if (props[name] === null || props[name] === undefined)
+ target[name] = props[name];
+ return target;
+};
+
+$.timepicker = new Timepicker(); // singleton instance
+$.timepicker.version = "0.9.9";
+
+})(jQuery);
+
diff --git a/src/usr/local/www/javascript/jquery.ipv4v6ify.js b/src/usr/local/www/javascript/jquery.ipv4v6ify.js
new file mode 100755
index 0000000..93a513a
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery.ipv4v6ify.js
@@ -0,0 +1,140 @@
+/*jslint browser: true, eqeqeq: true, undef: true */
+/*global jQuery */
+/******************************************************************************
+Lines above are for jslint, the JavaScript verifier. http://www.jslint.com/
+******************************************************************************/
+
+/* MIT-licensed code from https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some */
+/* (C) 2007 Mozilla Developer Network and/or Jeff Walden */
+if (!Array.prototype.some) {
+ Array.prototype.some = function(fun /*, thisp */) {
+ "use strict";
+ if (!this) {
+ throw new TypeError();
+ }
+ var t = Object(this);
+ var len = t.length >>> 0;
+ if (typeof fun !== "function") {
+ throw new TypeError();
+ }
+ var thisp = arguments[1];
+ for (var i = 0; i < len; i++) {
+ if (i in t && fun.call(thisp, t[i], i, t)) {
+ return true;
+ }
+ }
+ return false;
+ };
+}
+
+(function ($) {
+ // --------------------------------------------------------------------
+ // find pairs of <input class='ipv4v6'> (textbox for IPv4 or IPv6 addr)
+ // and <select class='ipv4v6'> (dropdown for # bits in CIDR) and
+ // activate behavior that restricts options in the <select> when an
+ // ipv4 address is typed in the <input>.
+ // --------------------------------------------------------------------
+ var _ipv4v6ify = function (input1, input2) {
+ var options = Array.prototype.slice.call(input2.options, 0);
+ var has_128 = options.some(function (x) { return parseInt(x.value, 10) === 128; });
+ var has_0 = options.some(function (x) { return parseInt(x.value, 10) === 0; });
+ var max_ipv6 = has_128 ? 128 : 127;
+ var min_ipv6 = has_0 ? 0 : 1;
+ var max_ipv4 = has_128 ? 32 : 31;
+ var min_ipv4 = has_0 ? 0 : 1;
+ var was_ipv4 = undefined;
+ var is_ipv4 = undefined;
+ var restrict_bits_to_ipv4 = function () {
+ input2.options.length = 0;
+ for (var i = 0; i < options.length; i += 1) {
+ var val = parseInt(options[i].value, 10);
+ if (val >= min_ipv4 && val <= max_ipv4) {
+ input2.options.add(options[i]);
+ }
+ }
+ };
+ var unrestrict_bits = function () {
+ input2.options.length = 0;
+ for (var i = 0; i < options.length; i += 1) {
+ input2.options.add(options[i]);
+ }
+ };
+ var onchange_handler = function () {
+ was_ipv4 = is_ipv4;
+ is_ipv4 = /\./.test(input1.value) && !/\:/.test(input1.value);
+ // handle state transitions to gracefully change the
+ // value in the dropdown.
+ var bits = parseInt($(input2).val(), 10);
+ if (was_ipv4 === false && is_ipv4 === true) {
+ restrict_bits_to_ipv4();
+ /* min_ipv4 -> min_ipv4 */
+ /* ... -> ... */
+ /* max_ipv4 -> max_ipv4 */
+ /* ... -> ... */
+ /* max_ipv6 -> max_ipv4 */
+ if (bits < min_ipv4) {
+ $(input2).val(min_ipv4);
+ }
+ else if (bits < max_ipv4) {
+ $(input2).val(bits);
+ }
+ else {
+ $(input2).val(max_ipv4);
+ }
+ }
+ else if (was_ipv4 === true && is_ipv4 === false) {
+ unrestrict_bits();
+ /* min_ipv4 -> min_ipv4 */
+ /* ... -> ... */
+ /* max_ipv4 -> max_ipv4 */
+ if (bits < min_ipv4) {
+ $(input2).val(min_ipv6);
+ }
+ else if (bits < max_ipv4) {
+ $(input2).val(bits);
+ }
+ else {
+ $(input2).val(max_ipv6);
+ }
+ }
+ else if (was_ipv4 === undefined && is_ipv4 === true) {
+ // initial value is an ipv4 address
+ restrict_bits_to_ipv4();
+ /* min_ipv4 -> min_ipv4 */
+ /* ... -> ... */
+ /* max_ipv4 -> max_ipv4 */
+ /* ... -> ... */
+ /* max_ipv6 -> max_ipv4 */
+ if (bits < min_ipv4) {
+ $(input2).val(min_ipv4);
+ }
+ else if (bits < max_ipv4) {
+ $(input2).val(bits);
+ }
+ else {
+ $(input2).val(max_ipv4);
+ }
+ }
+ };
+ $(input1).unbind("change").bind("change", onchange_handler).trigger("change");
+ };
+ $.fn.extend({
+ "ipv4v6ify": function () {
+ return this.each(function () {
+ var inputs, i, input1, input2;
+ inputs = $(this).find(":input.ipv4v6").toArray();
+ for (i = 0; i < inputs.length - 1; i += 1) {
+ input1 = inputs[i];
+ input2 = inputs[i + 1];
+ if (input1.type === "text" && input2.type === "select-one") {
+ _ipv4v6ify(input1, input2);
+ }
+ }
+ });
+ }
+ });
+ $(function () {
+ $(document).ipv4v6ify();
+ });
+})(jQuery);
+
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_diagonals-thick_18_b81900_40x40.png b/src/usr/local/www/javascript/jquery/images/ui-bg_diagonals-thick_18_b81900_40x40.png
new file mode 100755
index 0000000..954e22d
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_diagonals-thick_18_b81900_40x40.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_diagonals-thick_20_666666_40x40.png b/src/usr/local/www/javascript/jquery/images/ui-bg_diagonals-thick_20_666666_40x40.png
new file mode 100755
index 0000000..64ece57
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_diagonals-thick_20_666666_40x40.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png
new file mode 100755
index 0000000..5b5dab2
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_0_aaaaaa_40x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_flat_0_eeeeee_40x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_0_eeeeee_40x100.png
new file mode 100755
index 0000000..e44f861
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_0_eeeeee_40x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_flat_10_000000_40x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_10_000000_40x100.png
new file mode 100755
index 0000000..abdc010
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_10_000000_40x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_flat_55_c0402a_40x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_55_c0402a_40x100.png
new file mode 100755
index 0000000..b8c9bb1
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_55_c0402a_40x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_flat_55_eeeeee_40x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_55_eeeeee_40x100.png
new file mode 100755
index 0000000..e44f861
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_flat_55_eeeeee_40x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_glass_100_f6f6f6_1x400.png b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_100_f6f6f6_1x400.png
new file mode 100755
index 0000000..9b383f4
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_100_f6f6f6_1x400.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_glass_100_f8f8f8_1x400.png b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_100_f8f8f8_1x400.png
new file mode 100755
index 0000000..cd79e9f
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_100_f8f8f8_1x400.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_glass_100_fdf5ce_1x400.png b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_100_fdf5ce_1x400.png
new file mode 100755
index 0000000..a23baad
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_100_fdf5ce_1x400.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_glass_35_dddddd_1x400.png b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_35_dddddd_1x400.png
new file mode 100755
index 0000000..3550f06
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_35_dddddd_1x400.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_glass_60_eeeeee_1x400.png b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_60_eeeeee_1x400.png
new file mode 100755
index 0000000..8ad921a
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_60_eeeeee_1x400.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_glass_65_ffffff_1x400.png b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_65_ffffff_1x400.png
new file mode 100755
index 0000000..42ccba2
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_glass_65_ffffff_1x400.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_gloss-wave_35_f6a828_500x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_gloss-wave_35_f6a828_500x100.png
new file mode 100755
index 0000000..39d5824
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_gloss-wave_35_f6a828_500x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_highlight-soft_100_eeeeee_1x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
new file mode 100755
index 0000000..f127367
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_highlight-soft_100_eeeeee_1x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_highlight-soft_75_ffe45c_1x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
new file mode 100755
index 0000000..359397a
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_highlight-soft_75_ffe45c_1x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_inset-hard_75_999999_1x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_inset-hard_75_999999_1x100.png
new file mode 100755
index 0000000..89b88d8
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_inset-hard_75_999999_1x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-bg_inset-soft_50_c9c9c9_1x100.png b/src/usr/local/www/javascript/jquery/images/ui-bg_inset-soft_50_c9c9c9_1x100.png
new file mode 100755
index 0000000..a265c62
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-bg_inset-soft_50_c9c9c9_1x100.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_222222_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_222222_256x240.png
new file mode 100755
index 0000000..b273ff1
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_222222_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_228ef1_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_228ef1_256x240.png
new file mode 100755
index 0000000..a641a37
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_228ef1_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_3383bb_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_3383bb_256x240.png
new file mode 100755
index 0000000..905274f
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_3383bb_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_454545_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_454545_256x240.png
new file mode 100755
index 0000000..59bd45b
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_454545_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_70b2e1_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_70b2e1_256x240.png
new file mode 100755
index 0000000..ed8543e
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_70b2e1_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_999999_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_999999_256x240.png
new file mode 100755
index 0000000..50ff803
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_999999_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_ef8c08_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_ef8c08_256x240.png
new file mode 100755
index 0000000..85e63e9
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_ef8c08_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_fbc856_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_fbc856_256x240.png
new file mode 100755
index 0000000..18e65a1
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_fbc856_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_ffd27a_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_ffd27a_256x240.png
new file mode 100755
index 0000000..e117eff
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_ffd27a_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/images/ui-icons_ffffff_256x240.png b/src/usr/local/www/javascript/jquery/images/ui-icons_ffffff_256x240.png
new file mode 100755
index 0000000..42f8f99
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/images/ui-icons_ffffff_256x240.png
Binary files differ
diff --git a/src/usr/local/www/javascript/jquery/jquery-ui-1.11.1.min.js b/src/usr/local/www/javascript/jquery/jquery-ui-1.11.1.min.js
new file mode 100644
index 0000000..6a4e1d1
--- /dev/null
+++ b/src/usr/local/www/javascript/jquery/jquery-ui-1.11.1.min.js
@@ -0,0 +1,13 @@
+/*! jQuery UI - v1.11.1 - 2014-09-21
+* http://jqueryui.com
+* Includes: core.js, widget.js, mouse.js, position.js, draggable.js, droppable.js, resizable.js, selectable.js, sortable.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, menu.js, progressbar.js, selectmenu.js, slider.js, spinner.js, tabs.js, tooltip.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js
+* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
+
+(function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)})(function(e){function t(t,s){var n,a,o,r=t.nodeName.toLowerCase();return"area"===r?(n=t.parentNode,a=n.name,t.href&&a&&"map"===n.nodeName.toLowerCase()?(o=e("img[usemap='#"+a+"']")[0],!!o&&i(o)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||s:s)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}function s(e){for(var t,i;e.length&&e[0]!==document;){if(t=e.css("position"),("absolute"===t||"relative"===t||"fixed"===t)&&(i=parseInt(e.css("zIndex"),10),!isNaN(i)&&0!==i))return i;e=e.parent()}return 0}function n(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},e.extend(this._defaults,this.regional[""]),this.regional.en=e.extend(!0,{},this.regional[""]),this.regional["en-US"]=e.extend(!0,{},this.regional.en),this.dpDiv=a(e("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function a(t){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.delegate(i,"mouseout",function(){e(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",o)}function o(){e.datepicker._isDisabledDatepicker(v.inline?v.dpDiv.parent()[0]:v.input[0])||(e(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),e(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&e(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&e(this).addClass("ui-datepicker-next-hover"))}function r(t,i){e.extend(t,i);for(var s in i)null==i[s]&&(t[s]=i[s]);return t}function h(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}e.ui=e.ui||{},e.extend(e.ui,{version:"1.11.1",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({scrollParent:function(t){var i=this.css("position"),s="absolute"===i,n=t?/(auto|scroll|hidden)/:/(auto|scroll)/,a=this.parents().filter(function(){var t=e(this);return s&&"static"===t.css("position")?!1:n.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==i&&a.length?a:e(this[0].ownerDocument||document)},uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(i){return t(i,!isNaN(e.attr(i,"tabindex")))},tabbable:function(i){var s=e.attr(i,"tabindex"),n=isNaN(s);return(n||s>=0)&&t(i,!n)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(t,i){function s(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===i?["Left","Right"]:["Top","Bottom"],a=i.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(t){return void 0===t?o["inner"+i].call(this):this.each(function(){e(this).css(a,s(this,t)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?o["outer"+i].call(this,t):this.each(function(){e(this).css(a,s(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),disableSelection:function(){var e="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.bind(e+".ui-disableSelection",function(e){e.preventDefault()})}}(),enableSelection:function(){return this.unbind(".ui-disableSelection")},zIndex:function(t){if(void 0!==t)return this.css("zIndex",t);if(this.length)for(var i,s,n=e(this[0]);n.length&&n[0]!==document;){if(i=n.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(s=parseInt(n.css("zIndex"),10),!isNaN(s)&&0!==s))return s;n=n.parent()}return 0}}),e.ui.plugin={add:function(t,i,s){var n,a=e.ui[t].prototype;for(n in s)a.plugins[n]=a.plugins[n]||[],a.plugins[n].push([i,s[n]])},call:function(e,t,i,s){var n,a=e.plugins[t];if(a&&(s||e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType))for(n=0;a.length>n;n++)e.options[a[n][0]]&&a[n][1].apply(e.element,i)}};var l=0,u=Array.prototype.slice;e.cleanData=function(t){return function(i){var s,n,a;for(a=0;null!=(n=i[a]);a++)try{s=e._data(n,"events"),s&&s.remove&&e(n).triggerHandler("remove")}catch(o){}t(i)}}(e.cleanData),e.widget=function(t,i,s){var n,a,o,r,h={},l=t.split(".")[0];return t=t.split(".")[1],n=l+"-"+t,s||(s=i,i=e.Widget),e.expr[":"][n.toLowerCase()]=function(t){return!!e.data(t,n)},e[l]=e[l]||{},a=e[l][t],o=e[l][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new o(e,t)},e.extend(o,a,{version:s.version,_proto:e.extend({},s),_childConstructors:[]}),r=new i,r.options=e.widget.extend({},r.options),e.each(s,function(t,s){return e.isFunction(s)?(h[t]=function(){var e=function(){return i.prototype[t].apply(this,arguments)},n=function(e){return i.prototype[t].apply(this,e)};return function(){var t,i=this._super,a=this._superApply;return this._super=e,this._superApply=n,t=s.apply(this,arguments),this._super=i,this._superApply=a,t}}(),void 0):(h[t]=s,void 0)}),o.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix||t:t},h,{constructor:o,namespace:l,widgetName:t,widgetFullName:n}),a?(e.each(a._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete a._childConstructors):i._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,s,n=u.call(arguments,1),a=0,o=n.length;o>a;a++)for(i in n[a])s=n[a][i],n[a].hasOwnProperty(i)&&void 0!==s&&(t[i]=e.isPlainObject(s)?e.isPlainObject(t[i])?e.widget.extend({},t[i],s):e.widget.extend({},s):s);return t},e.widget.bridge=function(t,i){var s=i.prototype.widgetFullName||t;e.fn[t]=function(n){var a="string"==typeof n,o=u.call(arguments,1),r=this;return n=!a&&o.length?e.widget.extend.apply(null,[n].concat(o)):n,a?this.each(function(){var i,a=e.data(this,s);return"instance"===n?(r=a,!1):a?e.isFunction(a[n])&&"_"!==n.charAt(0)?(i=a[n].apply(a,o),i!==a&&void 0!==i?(r=i&&i.jquery?r.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+n+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; "+"attempted to call method '"+n+"'")}):this.each(function(){var t=e.data(this,s);t?(t.option(n||{}),t._init&&t._init()):e.data(this,s,new i(n,this))}),r}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=l++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(t,i){var s,n,a,o=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(o={},s=t.split("."),t=s.shift(),s.length){for(n=o[t]=e.widget.extend({},this.options[t]),a=0;s.length-1>a;a++)n[s[a]]=n[s[a]]||{},n=n[s[a]];if(t=s.pop(),1===arguments.length)return void 0===n[t]?null:n[t];n[t]=i}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=i}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled",!!t),t&&(this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"))),this},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_on:function(t,i,s){var n,a=this;"boolean"!=typeof t&&(s=i,i=t,t=!1),s?(i=n=e(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),e.each(s,function(s,o){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?a[o]:o).apply(a,arguments):void 0}"string"!=typeof o&&(r.guid=o.guid=o.guid||r.guid||e.guid++);var h=s.match(/^([\w:-]*)\s*(.*)$/),l=h[1]+a.eventNamespace,u=h[2];u?n.delegate(u,l,r):i.bind(l,r)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,o=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(o)&&o.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var o,r=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),o=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),o&&e.effects&&e.effects.effect[r]?s[t](n):r!==t&&s[r]?s[r](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}}),e.widget;var d=!1;e(document).mouseup(function(){d=!1}),e.widget("ui.mouse",{version:"1.11.1",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!d){this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var i=this,s=1===t.which,n="string"==typeof this.options.cancel&&t.target.nodeName?e(t.target).closest(this.options.cancel).length:!1;return s&&!n&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(t)!==!1,!this._mouseStarted)?(t.preventDefault(),!0):(!0===e.data(t.target,this.widgetName+".preventClickEvent")&&e.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},this.document.bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),d=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):t.which?this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted):this._mouseUp(t)},_mouseUp:function(t){return this.document.unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),d=!1,!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),function(){function t(e,t,i){return[parseFloat(e[0])*(p.test(e[0])?t/100:1),parseFloat(e[1])*(p.test(e[1])?i/100:1)]}function i(t,i){return parseInt(e.css(t,i),10)||0}function s(t){var i=t[0];return 9===i.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(i)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var n,a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,u=/top|center|bottom/,d=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==n)return n;var t,i,s=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),a=s.children()[0];return e("body").append(s),t=a.offsetWidth,s.css("overflow","scroll"),i=a.offsetWidth,t===i&&(i=s[0].clientWidth),s.remove(),n=t-i},getScrollInfo:function(t){var i=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),s=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),n="scroll"===i||"auto"===i&&t.width<t.element[0].scrollWidth,a="scroll"===s||"auto"===s&&t.height<t.element[0].scrollHeight;return{width:a?e.position.scrollbarWidth():0,height:n?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var i=e(t||window),s=e.isWindow(i[0]),n=!!i[0]&&9===i[0].nodeType;return{element:i,isWindow:s,isDocument:n,offset:i.offset()||{left:0,top:0},scrollLeft:i.scrollLeft(),scrollTop:i.scrollTop(),width:s||n?i.width():i.outerWidth(),height:s||n?i.height():i.outerHeight()}}},e.fn.position=function(n){if(!n||!n.of)return f.apply(this,arguments);n=e.extend({},n);var p,m,g,v,y,b,_=e(n.of),x=e.position.getWithinInfo(n.within),w=e.position.getScrollInfo(x),k=(n.collision||"flip").split(" "),T={};return b=s(_),_[0].preventDefault&&(n.at="left top"),m=b.width,g=b.height,v=b.offset,y=e.extend({},v),e.each(["my","at"],function(){var e,t,i=(n[this]||"").split(" ");1===i.length&&(i=l.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=l.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=d.exec(i[0]),t=d.exec(i[1]),T[this]=[e?e[0]:0,t?t[0]:0],n[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===k.length&&(k[1]=k[0]),"right"===n.at[0]?y.left+=m:"center"===n.at[0]&&(y.left+=m/2),"bottom"===n.at[1]?y.top+=g:"center"===n.at[1]&&(y.top+=g/2),p=t(T.at,m,g),y.left+=p[0],y.top+=p[1],this.each(function(){var s,l,u=e(this),d=u.outerWidth(),c=u.outerHeight(),f=i(this,"marginLeft"),b=i(this,"marginTop"),D=d+f+i(this,"marginRight")+w.width,S=c+b+i(this,"marginBottom")+w.height,M=e.extend({},y),N=t(T.my,u.outerWidth(),u.outerHeight());"right"===n.my[0]?M.left-=d:"center"===n.my[0]&&(M.left-=d/2),"bottom"===n.my[1]?M.top-=c:"center"===n.my[1]&&(M.top-=c/2),M.left+=N[0],M.top+=N[1],a||(M.left=h(M.left),M.top=h(M.top)),s={marginLeft:f,marginTop:b},e.each(["left","top"],function(t,i){e.ui.position[k[t]]&&e.ui.position[k[t]][i](M,{targetWidth:m,targetHeight:g,elemWidth:d,elemHeight:c,collisionPosition:s,collisionWidth:D,collisionHeight:S,offset:[p[0]+N[0],p[1]+N[1]],my:n.my,at:n.at,within:x,elem:u})}),n.using&&(l=function(e){var t=v.left-M.left,i=t+m-d,s=v.top-M.top,a=s+g-c,h={target:{element:_,left:v.left,top:v.top,width:m,height:g},element:{element:u,left:M.left,top:M.top,width:d,height:c},horizontal:0>i?"left":t>0?"right":"center",vertical:0>a?"top":s>0?"bottom":"middle"};d>m&&m>r(t+i)&&(h.horizontal="center"),c>g&&g>r(s+a)&&(h.vertical="middle"),h.important=o(r(t),r(i))>o(r(s),r(a))?"horizontal":"vertical",n.using.call(this,e,h)}),u.offset(e.extend(M,{using:l}))})},e.ui.position={fit:{left:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=e.left-t.collisionPosition.marginLeft,h=n-r,l=r+t.collisionWidth-a-n;t.collisionWidth>a?h>0&&0>=l?(i=e.left+h+t.collisionWidth-a-n,e.left+=h-i):e.left=l>0&&0>=h?n:h>l?n+a-t.collisionWidth:n:h>0?e.left+=h:l>0?e.left-=l:e.left=o(e.left-r,e.left)},top:function(e,t){var i,s=t.within,n=s.isWindow?s.scrollTop:s.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,h=n-r,l=r+t.collisionHeight-a-n;t.collisionHeight>a?h>0&&0>=l?(i=e.top+h+t.collisionHeight-a-n,e.top+=h-i):e.top=l>0&&0>=h?n:h>l?n+a-t.collisionHeight:n:h>0?e.top+=h:l>0?e.top-=l:e.top=o(e.top-r,e.top)}},flip:{left:function(e,t){var i,s,n=t.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=e.left-t.collisionPosition.marginLeft,u=l-h,d=l+t.collisionWidth-o-h,c="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(i=e.left+c+p+f+t.collisionWidth-o-a,(0>i||r(u)>i)&&(e.left+=c+p+f)):d>0&&(s=e.left-t.collisionPosition.marginLeft+c+p+f-h,(s>0||d>r(s))&&(e.left+=c+p+f))},top:function(e,t){var i,s,n=t.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=e.top-t.collisionPosition.marginTop,u=l-h,d=l+t.collisionHeight-o-h,c="top"===t.my[1],p=c?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];0>u?(s=e.top+p+f+m+t.collisionHeight-o-a,e.top+p+f+m>u&&(0>s||r(u)>s)&&(e.top+=p+f+m)):d>0&&(i=e.top-t.collisionPosition.marginTop+p+f+m-h,e.top+p+f+m>d&&(i>0||d>r(i))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,i,s,n,o,r=document.getElementsByTagName("body")[0],h=document.createElement("div");t=document.createElement(r?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},r&&e.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(o in s)t.style[o]=s[o];t.appendChild(h),i=r||document.documentElement,i.insertBefore(t,i.firstChild),h.style.cssText="position: absolute; left: 10.7432222px;",n=e(h).offset().left,a=n>10&&11>n,t.innerHTML="",i.removeChild(t)}()}(),e.ui.position,e.widget("ui.draggable",e.ui.mouse,{version:"1.11.1",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._setHandleClassName(),this._mouseInit()},_setOption:function(e,t){this._super(e,t),"handle"===e&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(t){var i=this.document[0],s=this.options;try{i.activeElement&&"body"!==i.activeElement.nodeName.toLowerCase()&&e(i.activeElement).blur()}catch(n){}return this.helper||s.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(s.iframeFix===!0?"iframe":s.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),this.element.focus(),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this.handleElement.addClass("ui-draggable-handle")},_removeHandleClassName:function(){this.handleElement.removeClass("ui-draggable-handle")},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(e){return/(html|body)/i.test(e.tagName)||e===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var e=this.element.position(),t=this._isRootNode(this.scrollParent[0]);return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+(t?0:this.scrollParent.scrollTop()),left:e.left-(parseInt(this.helper.css("left"),10)||0)+(t?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options,a=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,e(a).width()-this.helperProportions.width-this.margins.left,(e(a).height()||a.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(e,t){t||(t=this.position);var i="absolute"===e?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:t.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:t.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(e,t){var i,s,n,a,o=this.options,r=this._isRootNode(this.scrollParent[0]),h=e.pageX,l=e.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),t&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,e.pageX-this.offset.click.left<i[0]&&(h=i[0]+this.offset.click.left),e.pageY-this.offset.click.top<i[1]&&(l=i[1]+this.offset.click.top),e.pageX-this.offset.click.left>i[2]&&(h=i[2]+this.offset.click.left),e.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a),"y"===o.axis&&(h=this.originalPageX),"x"===o.axis&&(l=this.originalPageY)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}
+},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s,this],!0),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i,s){var n=s.options,a=e.extend({},i,{item:s.element});s.sortables=[],e(n.connectToSortable).each(function(){var i=e(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,a))})},stop:function(t,i,s){var n=e.extend({},i,{item:s.element});e.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,n))})},drag:function(t,i,s){var n=this;e.each(s.sortables,function(){var a=!1,o=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,e.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(o.instance.element[0],this.instance.element[0])&&(a=!1),a})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",t),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",t),s.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(t,i,s){var n=e("body"),a=s.options;n.css("cursor")&&(a._cursor=n.css("cursor")),n.css("cursor",a.cursor)},stop:function(t,i,s){var n=s.options;n._cursor&&e("body").css("cursor",n._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("opacity")&&(a._opacity=n.css("opacity")),n.css("opacity",a.opacity)},stop:function(t,i,s){var n=s.options;n._opacity&&e(i.helper).css("opacity",n._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(e,t,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,i,s){var n=s.options,a=!1,o=s.scrollParentNotHidden[0],r=s.document[0];o!==r&&"HTML"!==o.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+o.offsetHeight-t.pageY<n.scrollSensitivity?o.scrollTop=a=o.scrollTop+n.scrollSpeed:t.pageY-s.overflowOffset.top<n.scrollSensitivity&&(o.scrollTop=a=o.scrollTop-n.scrollSpeed)),n.axis&&"y"===n.axis||(s.overflowOffset.left+o.offsetWidth-t.pageX<n.scrollSensitivity?o.scrollLeft=a=o.scrollLeft+n.scrollSpeed:t.pageX-s.overflowOffset.left<n.scrollSensitivity&&(o.scrollLeft=a=o.scrollLeft-n.scrollSpeed))):(n.axis&&"x"===n.axis||(t.pageY-e(r).scrollTop()<n.scrollSensitivity?a=e(r).scrollTop(e(r).scrollTop()-n.scrollSpeed):e(window).height()-(t.pageY-e(r).scrollTop())<n.scrollSensitivity&&(a=e(r).scrollTop(e(r).scrollTop()+n.scrollSpeed))),n.axis&&"y"===n.axis||(t.pageX-e(r).scrollLeft()<n.scrollSensitivity?a=e(r).scrollLeft(e(r).scrollLeft()-n.scrollSpeed):e(window).width()-(t.pageX-e(r).scrollLeft())<n.scrollSensitivity&&(a=e(r).scrollLeft(e(r).scrollLeft()+n.scrollSpeed)))),a!==!1&&e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(s,t)}}),e.ui.plugin.add("draggable","snap",{start:function(t,i,s){var n=s.options;s.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var t=e(this),i=t.offset();this!==s.element[0]&&s.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:i.top,left:i.left})})},drag:function(t,i,s){var n,a,o,r,h,l,u,d,c,p,f=s.options,m=f.snapTolerance,g=i.offset.left,v=g+s.helperProportions.width,y=i.offset.top,b=y+s.helperProportions.height;for(c=s.snapElements.length-1;c>=0;c--)h=s.snapElements[c].left,l=h+s.snapElements[c].width,u=s.snapElements[c].top,d=u+s.snapElements[c].height,h-m>v||g>l+m||u-m>b||y>d+m||!e.contains(s.snapElements[c].item.ownerDocument,s.snapElements[c].item)?(s.snapElements[c].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(n=m>=Math.abs(u-b),a=m>=Math.abs(d-y),o=m>=Math.abs(h-v),r=m>=Math.abs(l-g),n&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top-s.margins.top),a&&(i.position.top=s._convertPositionTo("relative",{top:d,left:0}).top-s.margins.top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left-s.margins.left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left-s.margins.left)),p=n||a||o||r,"outer"!==f.snapMode&&(n=m>=Math.abs(u-y),a=m>=Math.abs(d-b),o=m>=Math.abs(h-g),r=m>=Math.abs(l-v),n&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top-s.margins.top),a&&(i.position.top=s._convertPositionTo("relative",{top:d-s.helperProportions.height,left:0}).top-s.margins.top),o&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left-s.margins.left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left-s.margins.left)),!s.snapElements[c].snapping&&(n||a||o||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,t,e.extend(s._uiHash(),{snapItem:s.snapElements[c].item})),s.snapElements[c].snapping=n||a||o||r||p)}}),e.ui.plugin.add("draggable","stack",{start:function(t,i,s){var n,a=s.options,o=e.makeArray(e(a.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});o.length&&(n=parseInt(e(o[0]).css("zIndex"),10)||0,e(o).each(function(t){e(this).css("zIndex",n+t)}),this.css("zIndex",n+o.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i,s){var n=e(i.helper),a=s.options;n.css("zIndex")&&(a._zIndex=n.css("zIndex")),n.css("zIndex",a.zIndex)},stop:function(t,i,s){var n=s.options;n._zIndex&&e(i.helper).css("zIndex",n._zIndex)}}),e.ui.draggable,e.widget("ui.droppable",{version:"1.11.1",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,i=this.options,s=i.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(s)?s:function(e){return e.is(s)},this.proportions=function(){return arguments.length?(t=arguments[0],void 0):t?t:t={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight}},this._addToManager(i.scope),i.addClasses&&this.element.addClass("ui-droppable")},_addToManager:function(t){e.ui.ddmanager.droppables[t]=e.ui.ddmanager.droppables[t]||[],e.ui.ddmanager.droppables[t].push(this)},_splice:function(e){for(var t=0;e.length>t;t++)e[t]===this&&e.splice(t,1)},_destroy:function(){var t=e.ui.ddmanager.droppables[this.options.scope];this._splice(t),this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){if("accept"===t)this.accept=e.isFunction(i)?i:function(e){return e.is(i)};else if("scope"===t){var s=e.ui.ddmanager.droppables[this.options.scope];this._splice(s),this._addToManager(i)}this._super(t,i)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var i=e(this).droppable("instance");return i.options.greedy&&!i.options.disabled&&i.options.scope===s.options.scope&&i.accept.call(i.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(i,{offset:i.element.offset()}),i.options.tolerance,t)?(n=!0,!1):void 0}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(){function e(e,t,i){return e>=t&&t+i>e}return function(t,i,s,n){if(!i.offset)return!1;var a=(t.positionAbs||t.position.absolute).left,o=(t.positionAbs||t.position.absolute).top,r=a+t.helperProportions.width,h=o+t.helperProportions.height,l=i.offset.left,u=i.offset.top,d=l+i.proportions().width,c=u+i.proportions().height;switch(s){case"fit":return a>=l&&d>=r&&o>=u&&c>=h;case"intersect":return a+t.helperProportions.width/2>l&&d>r-t.helperProportions.width/2&&o+t.helperProportions.height/2>u&&c>h-t.helperProportions.height/2;case"pointer":return e(n.pageY,u,i.proportions().height)&&e(n.pageX,l,i.proportions().width);case"touch":return(o>=u&&c>=o||h>=u&&c>=h||u>o&&h>c)&&(a>=l&&d>=a||r>=l&&d>=r||l>a&&r>d);default:return!1}}}(),e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions().height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions({width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight}))}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance,i)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance,i),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e(this).droppable("instance").options.scope===n}),a.length&&(s=e(a[0]).droppable("instance"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}},e.ui.droppable,e.widget("ui.resizable",e.ui.mouse,{version:"1.11.1",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(e){return parseInt(e,10)||0},_isNumber:function(e){return!isNaN(parseInt(e,10))},_hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return t[s]>0?!0:(t[s]=1,n=t[s]>0,t[s]=0,n)},_create:function(){var t,i,s,n,a,o=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{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"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},i=0;t.length>i;i++)s=e.trim(t[i]),a="ui-resizable-"+s,n=e("<div class='ui-resizable-handle "+a+"'></div>"),n.css({zIndex:r.zIndex}),"se"===s&&n.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[s]=".ui-resizable-"+s,this.element.append(n);this._renderAxis=function(t){var i,s,n,a;t=t||this.element;for(i in this.handles)this.handles[i].constructor===String&&(this.handles[i]=this.element.children(this.handles[i]).first().show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(s=e(this.handles[i],this.element),a=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),t.css(n,a),this._proportionallyResize()),e(this.handles[i]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){o.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),o.axis=n&&n[1]?n[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),o._handles.show())}).mouseleave(function(){r.disabled||o.resizing||(e(this).addClass("ui-resizable-autohide"),o._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,i=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_mouseCapture:function(t){var i,s,n=!1;for(i in this.handles)s=e(this.handles[i])[0],(s===t.target||e.contains(s,t.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(t){var i,s,n,a=this.options,o=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),a.containment&&(i+=e(a.containment).scrollLeft()||0,s+=e(a.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:o.width(),height:o.height()},this.originalSize=this._helper?{width:o.outerWidth(),height:o.outerHeight()}:{width:o.width(),height:o.height()},this.sizeDiff={width:o.outerWidth()-o.width(),height:o.outerHeight()-o.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof a.aspectRatio?a.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===n?this.axis+"-resize":n),o.addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var i,s,n=this.originalMousePosition,a=this.axis,o=t.pageX-n.left||0,r=t.pageY-n.top||0,h=this._change[a];return this._updatePrevProperties(),h?(i=h.apply(this,[t,o,r]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(i=this._updateRatio(i,t)),i=this._respectSize(i,t),this._updateCache(i),this._propagate("resize",t),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(t){this.resizing=!1;var i,s,n,a,o,r,h,l=this.options,u=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:u.sizeDiff.height,a=s?0:u.sizeDiff.width,o={width:u.helper.width()-a,height:u.helper.height()-n},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,h=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,l.animate||this.element.css(e.extend(o,{top:h,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!l.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var e={};return this.position.top!==this.prevPosition.top&&(e.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(e.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(e.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(e.height=this.size.height+"px"),this.helper.css(e),e},_updateVirtualBoundaries:function(e){var t,i,s,n,a,o=this.options;a={minWidth:this._isNumber(o.minWidth)?o.minWidth:0,maxWidth:this._isNumber(o.maxWidth)?o.maxWidth:1/0,minHeight:this._isNumber(o.minHeight)?o.minHeight:0,maxHeight:this._isNumber(o.maxHeight)?o.maxHeight:1/0},(this._aspectRatio||e)&&(t=a.minHeight*this.aspectRatio,s=a.minWidth/this.aspectRatio,i=a.maxHeight*this.aspectRatio,n=a.maxWidth/this.aspectRatio,t>a.minWidth&&(a.minWidth=t),s>a.minHeight&&(a.minHeight=s),a.maxWidth>i&&(a.maxWidth=i),a.maxHeight>n&&(a.maxHeight=n)),this._vBoundaries=a},_updateCache:function(e){this.offset=this.helper.offset(),this._isNumber(e.left)&&(this.position.left=e.left),this._isNumber(e.top)&&(this.position.top=e.top),this._isNumber(e.height)&&(this.size.height=e.height),this._isNumber(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,s=this.axis;return this._isNumber(e.height)?e.width=e.height*this.aspectRatio:this._isNumber(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===s&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===s&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,s=this._isNumber(e.width)&&t.maxWidth&&t.maxWidth<e.width,n=this._isNumber(e.height)&&t.maxHeight&&t.maxHeight<e.height,a=this._isNumber(e.width)&&t.minWidth&&t.minWidth>e.width,o=this._isNumber(e.height)&&t.minHeight&&t.minHeight>e.height,r=this.originalPosition.left+this.originalSize.width,h=this.position.top+this.size.height,l=/sw|nw|w/.test(i),u=/nw|ne|n/.test(i);return a&&(e.width=t.minWidth),o&&(e.height=t.minHeight),s&&(e.width=t.maxWidth),n&&(e.height=t.maxHeight),a&&l&&(e.left=r-t.minWidth),s&&l&&(e.left=r-t.maxWidth),o&&u&&(e.top=h-t.minHeight),n&&u&&(e.top=h-t.maxHeight),e.width||e.height||e.left||!e.top?e.width||e.height||e.top||!e.left||(e.left=null):e.top=null,e},_getPaddingPlusBorderDimensions:function(e){for(var t=0,i=[],s=[e.css("borderTopWidth"),e.css("borderRightWidth"),e.css("borderBottomWidth"),e.css("borderLeftWidth")],n=[e.css("paddingTop"),e.css("paddingRight"),e.css("paddingBottom"),e.css("paddingLeft")];4>t;t++)i[t]=parseInt(s[t],10)||0,i[t]+=parseInt(n[t],10)||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var e,t=0,i=this.helper||this.element;this._proportionallyResizeElements.length>t;t++)e=this._proportionallyResizeElements[t],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(e)),e.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,i=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var i=this.originalSize,s=this.originalPosition;return{left:s.left+t,width:i.width-t}},n:function(e,t,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(e,t,i){return{height:this.originalSize.height+i}},se:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},sw:function(t,i,s){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,i,s]))},ne:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,i,s]))},nw:function(t,i,s){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,i,s]))}},_propagate:function(t,i){e.ui.plugin.call(this,t,[i,this.ui()]),"resize"!==t&&this._trigger(t,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var i=e(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,a=n.length&&/textarea/i.test(n[0].nodeName),o=a&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=a?0:i.sizeDiff.width,h={width:i.size.width-r,height:i.size.height-o},l=parseInt(i.element.css("left"),10)+(i.position.left-i.originalPosition.left)||null,u=parseInt(i.element.css("top"),10)+(i.position.top-i.originalPosition.top)||null;i.element.animate(e.extend(h,u&&l?{top:u,left:l}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseInt(i.element.css("width"),10),height:parseInt(i.element.css("height"),10),top:parseInt(i.element.css("top"),10),left:parseInt(i.element.css("left"),10)};n&&n.length&&e(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var t,i,s,n,a,o,r,h=e(this).resizable("instance"),l=h.options,u=h.element,d=l.containment,c=d instanceof e?d.get(0):/parent/.test(d)?u.parent().get(0):d;c&&(h.containerElement=e(c),/document/.test(d)||d===document?(h.containerOffset={left:0,top:0},h.containerPosition={left:0,top:0},h.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(t=e(c),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,s){i[e]=h._num(t.css("padding"+s))}),h.containerOffset=t.offset(),h.containerPosition=t.position(),h.containerSize={height:t.innerHeight()-i[3],width:t.innerWidth()-i[1]},s=h.containerOffset,n=h.containerSize.height,a=h.containerSize.width,o=h._hasScroll(c,"left")?c.scrollWidth:a,r=h._hasScroll(c)?c.scrollHeight:n,h.parentData={element:c,left:s.left,top:s.top,width:o,height:r}))},resize:function(t){var i,s,n,a,o=e(this).resizable("instance"),r=o.options,h=o.containerOffset,l=o.position,u=o._aspectRatio||t.shiftKey,d={top:0,left:0},c=o.containerElement,p=!0;c[0]!==document&&/static/.test(c.css("position"))&&(d=h),l.left<(o._helper?h.left:0)&&(o.size.width=o.size.width+(o._helper?o.position.left-h.left:o.position.left-d.left),u&&(o.size.height=o.size.width/o.aspectRatio,p=!1),o.position.left=r.helper?h.left:0),l.top<(o._helper?h.top:0)&&(o.size.height=o.size.height+(o._helper?o.position.top-h.top:o.position.top),u&&(o.size.width=o.size.height*o.aspectRatio,p=!1),o.position.top=o._helper?h.top:0),n=o.containerElement.get(0)===o.element.parent().get(0),a=/relative|absolute/.test(o.containerElement.css("position")),n&&a?(o.offset.left=o.parentData.left+o.position.left,o.offset.top=o.parentData.top+o.position.top):(o.offset.left=o.element.offset().left,o.offset.top=o.element.offset().top),i=Math.abs(o.sizeDiff.width+(o._helper?o.offset.left-d.left:o.offset.left-h.left)),s=Math.abs(o.sizeDiff.height+(o._helper?o.offset.top-d.top:o.offset.top-h.top)),i+o.size.width>=o.parentData.width&&(o.size.width=o.parentData.width-i,u&&(o.size.height=o.size.width/o.aspectRatio,p=!1)),s+o.size.height>=o.parentData.height&&(o.size.height=o.parentData.height-s,u&&(o.size.width=o.size.height*o.aspectRatio,p=!1)),p||(o.position.left=o.prevPosition.left,o.position.top=o.prevPosition.top,o.size.width=o.prevSize.width,o.size.height=o.prevSize.height)},stop:function(){var t=e(this).resizable("instance"),i=t.options,s=t.containerOffset,n=t.containerPosition,a=t.containerElement,o=e(t.helper),r=o.offset(),h=o.outerWidth()-t.sizeDiff.width,l=o.outerHeight()-t.sizeDiff.height;t._helper&&!i.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l}),t._helper&&!i.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-n.left-s.left,width:h,height:l})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof i.alsoResize||i.alsoResize.parentNode?s(i.alsoResize):i.alsoResize.length?(i.alsoResize=i.alsoResize[0],s(i.alsoResize)):e.each(i.alsoResize,function(e){s(e)})},resize:function(t,i){var s=e(this).resizable("instance"),n=s.options,a=s.originalSize,o=s.originalPosition,r={height:s.size.height-a.height||0,width:s.size.width-a.width||0,top:s.position.top-o.top||0,left:s.position.left-o.left||0},h=function(t,s){e(t).each(function(){var t=e(this),n=e(this).data("ui-resizable-alsoresize"),a={},o=s&&s.length?s:t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(o,function(e,t){var i=(n[t]||0)+(r[t]||0);i&&i>=0&&(a[t]=i||null)}),t.css(a)})};"object"!=typeof n.alsoResize||n.alsoResize.nodeType?h(n.alsoResize):e.each(n.alsoResize,function(e,t){h(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).resizable("instance"),i=t.options,s=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:s.height,width:s.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof i.ghost?i.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t,i=e(this).resizable("instance"),s=i.options,n=i.size,a=i.originalSize,o=i.originalPosition,r=i.axis,h="number"==typeof s.grid?[s.grid,s.grid]:s.grid,l=h[0]||1,u=h[1]||1,d=Math.round((n.width-a.width)/l)*l,c=Math.round((n.height-a.height)/u)*u,p=a.width+d,f=a.height+c,m=s.maxWidth&&p>s.maxWidth,g=s.maxHeight&&f>s.maxHeight,v=s.minWidth&&s.minWidth>p,y=s.minHeight&&s.minHeight>f;s.grid=h,v&&(p+=l),y&&(f+=u),m&&(p-=l),g&&(f-=u),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=o.top-c):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=o.left-d):((0>=f-u||0>=p-l)&&(t=i._getPaddingPlusBorderDimensions(this)),f-u>0?(i.size.height=f,i.position.top=o.top-c):(f=u-t.height,i.size.height=f,i.position.top=o.top+a.height-f),p-l>0?(i.size.width=p,i.position.left=o.left-d):(p=u-t.height,i.size.width=p,i.position.left=o.left+a.width-p))}}),e.ui.resizable,e.widget("ui.selectable",e.ui.mouse,{version:"1.11.1",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,i=this;
+this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(i.options.filter,i.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),i=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:i.left,top:i.top,right:i.left+t.outerWidth(),bottom:i.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var i=this,s=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(s.filter,this.element[0]),this._trigger("start",t),e(s.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),s.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var s=e.data(this,"selectable-item");s.startselected=!0,t.metaKey||t.ctrlKey||(s.$element.removeClass("ui-selected"),s.selected=!1,s.$element.addClass("ui-unselecting"),s.unselecting=!0,i._trigger("unselecting",t,{unselecting:s.element}))}),e(t.target).parents().addBack().each(function(){var s,n=e.data(this,"selectable-item");return n?(s=!t.metaKey&&!t.ctrlKey||!n.$element.hasClass("ui-selected"),n.$element.removeClass(s?"ui-unselecting":"ui-selected").addClass(s?"ui-selecting":"ui-unselecting"),n.unselecting=!s,n.selecting=s,n.selected=s,s?i._trigger("selecting",t,{selecting:n.element}):i._trigger("unselecting",t,{unselecting:n.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var i,s=this,n=this.options,a=this.opos[0],o=this.opos[1],r=t.pageX,h=t.pageY;return a>r&&(i=r,r=a,a=i),o>h&&(i=h,h=o,o=i),this.helper.css({left:a,top:o,width:r-a,height:h-o}),this.selectees.each(function(){var i=e.data(this,"selectable-item"),l=!1;i&&i.element!==s.element[0]&&("touch"===n.tolerance?l=!(i.left>r||a>i.right||i.top>h||o>i.bottom):"fit"===n.tolerance&&(l=i.left>a&&r>i.right&&i.top>o&&h>i.bottom),l?(i.selected&&(i.$element.removeClass("ui-selected"),i.selected=!1),i.unselecting&&(i.$element.removeClass("ui-unselecting"),i.unselecting=!1),i.selecting||(i.$element.addClass("ui-selecting"),i.selecting=!0,s._trigger("selecting",t,{selecting:i.element}))):(i.selecting&&((t.metaKey||t.ctrlKey)&&i.startselected?(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.$element.addClass("ui-selected"),i.selected=!0):(i.$element.removeClass("ui-selecting"),i.selecting=!1,i.startselected&&(i.$element.addClass("ui-unselecting"),i.unselecting=!0),s._trigger("unselecting",t,{unselecting:i.element}))),i.selected&&(t.metaKey||t.ctrlKey||i.startselected||(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,s._trigger("unselecting",t,{unselecting:i.element})))))}),!1}},_mouseStop:function(t){var i=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-unselecting"),s.unselecting=!1,s.startselected=!1,i._trigger("unselected",t,{unselected:s.element})}),e(".ui-selecting",this.element[0]).each(function(){var s=e.data(this,"selectable-item");s.$element.removeClass("ui-selecting").addClass("ui-selected"),s.selecting=!1,s.selected=!0,s.startselected=!0,i._trigger("selected",t,{selected:s.element})}),this._trigger("stop",t),this.helper.remove(),!1}}),e.widget("ui.sortable",e.ui.mouse,{version:"1.11.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(e,t,i){return e>=t&&t+i>e},_isFloating:function(e){return/left|right/.test(e.css("float"))||/inline|table-cell/.test(e.css("display"))},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||this._isFloating(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(e,t){this._super(e,t),"handle"===e&&this._setHandleClassName()},_setHandleClassName:function(){this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"),e.each(this.items,function(){(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item).addClass("ui-sortable-handle")})},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(s=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(s=e(t.target)),s?!this.options.handle||i||(e(this.options.handle,s).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=e("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<o.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+o.scrollSpeed:t.pageY-this.overflowOffset.top<o.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-o.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<o.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+o.scrollSpeed:t.pageX-this.overflowOffset.left<o.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-o.scrollSpeed)):(t.pageY-e(document).scrollTop()<o.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-o.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<o.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+o.scrollSpeed)),t.pageX-e(document).scrollLeft()<o.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-o.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<o.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+o.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!o.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),i=this.items.length-1;i>=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!e.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(t,s),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,i){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,e(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(t)})}else this._clear(t,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},e(i).each(function(){var i=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);i&&s.push((t.key||i[1]+"[]")+"="+(t.key&&t.expression?i[1]:i[2]))}),!s.length&&t.key&&s.push(t.key+"="),s.join("&")},toArray:function(t){var i=this._getItemsAsjQuery(t&&t.connected),s=[];return t=t||{},i.each(function(){s.push(e(t.item||this).attr(t.attribute||"id")||"")}),s},_intersectsWith:function(e){var t=this.positionAbs.left,i=t+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=e.left,o=a+e.width,r=e.top,h=r+e.height,l=this.offset.click.top,u=this.offset.click.left,d="x"===this.options.axis||s+l>r&&h>s+l,c="y"===this.options.axis||t+u>a&&o>t+u,p=d&&c;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?p:t+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(e){var t="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left,e.width),s=t&&i,n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return s?this.floating?a&&"right"===a||"down"===n?2:1:n&&("down"===n?2:1):!1},_intersectsWithSides:function(e){var t=this._isOverAxis(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&t||"up"===s&&!t)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){function i(){r.push(this)}var s,n,a,o,r=[],h=[],l=this._connectWith();if(l&&t)for(s=l.length-1;s>=0;s--)for(a=e(l[s]),n=a.length-1;n>=0;n--)o=e.data(a[n],this.widgetFullName),o&&o!==this&&!o.options.disabled&&h.push([e.isFunction(o.options.items)?o.options.items.call(o.element):e(o.options.items,o.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),o]);for(h.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=h.length-1;s>=0;s--)h[s][0].each(i);return e(r)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var i=0;t.length>i;i++)if(t[i]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,u=this.items,d=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],c=this._connectWith();if(c&&this.ready)for(i=c.length-1;i>=0;i--)for(n=e(c[i]),s=n.length-1;s>=0;s--)a=e.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(d.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(i=d.length-1;i>=0;i--)for(o=d[i][1],r=d[i][0],s=0,l=r.length;l>s;s++)h=e(r[s]),h.data(this.widgetName+"-item",o),u.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?e(this.options.toleranceElement,s.item):s.item,t||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var i,s=t.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=t.currentItem[0].nodeName.toLowerCase(),n=e("<"+s+">",t.document[0]).addClass(i||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?t.currentItem.children().each(function(){e("<td>&#160;</td>",t.document[0]).attr("colspan",e(this).attr("colspan")||1).appendTo(n)}):"img"===s&&n.attr("src",t.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(e,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(s.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),s.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var i,s,n,a,o,r,h,l,u,d,c=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!e.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(c&&e.contains(this.containers[i].element[0],c.element[0]))continue;c=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",t,this._uiHash(this)),this.containers[i].containerCache.over=0);if(c)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,a=null,u=c.floating||this._isFloating(this.currentItem),o=u?"left":"top",r=u?"width":"height",d=u?"clientX":"clientY",s=this.items.length-1;s>=0;s--)e.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(h=this.items[s].item.offset()[o],l=!1,t[d]-h>this.items[s][r]/2&&(l=!0),n>Math.abs(t[d]-h)&&(n=Math.abs(t[d]-h),a=this.items[s],this.direction=l?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return;a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[p].element,!0),this._trigger("change",t,this._uiHash()),this.containers[p]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",t,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||e("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(t=e(n.containment)[0],i=e(n.containment).offset(),s="hidden"!==e(t).css("overflow"),this.containment=[i.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(t){var i,s,n=this.options,a=t.pageX,o=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(o=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(e,t,i,s){i?i[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(e,t){function i(e,t,i){return function(s){i._trigger(e,s,t._uiHash(t))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!t&&n.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||t||n.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(t||(n.push(function(e){this._trigger("remove",e,this._uiHash())}),n.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)t||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!t){for(this._trigger("beforeStop",e,this._uiHash()),s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!1}if(t||this._trigger("beforeStop",e,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!t){for(s=0;n.length>s;s++)n[s].call(this,e);this._trigger("stop",e,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var i=t||this;return{helper:i.helper,placeholder:i.placeholder||e([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:t?t.element:null}}}),e.widget("ui.accordion",{version:"1.11.1",options:{active:0,animate:{},collapsible:!1,event:"click",header:"> li > :first-child,> :not(li):even",heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=e(),this.element.addClass("ui-accordion ui-widget ui-helper-reset").attr("role","tablist"),t.collapsible||t.active!==!1&&null!=t.active||(t.active=0),this._processPanels(),0>t.active&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():e()}},_createIcons:function(){var t=this.options.icons;t&&(e("<span>").addClass("ui-accordion-header-icon ui-icon "+t.header).prependTo(this.headers),this.active.children(".ui-accordion-header-icon").removeClass(t.header).addClass(t.activeHeader),this.headers.addClass("ui-accordion-icons"))},_destroyIcons:function(){this.headers.removeClass("ui-accordion-icons").children(".ui-accordion-header-icon").remove()},_destroy:function(){var e;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role"),this.headers.removeClass("ui-accordion-header ui-accordion-header-active ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("aria-controls").removeAttr("tabIndex").removeUniqueId(),this._destroyIcons(),e=this.headers.next().removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled").css("display","").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&e.css("height","")},_setOption:function(e,t){return"active"===e?(this._activate(t),void 0):("event"===e&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(t)),this._super(e,t),"collapsible"!==e||t||this.options.active!==!1||this._activate(0),"icons"===e&&(this._destroyIcons(),t&&this._createIcons()),"disabled"===e&&(this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this.headers.add(this.headers.next()).toggleClass("ui-state-disabled",!!t)),void 0)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var i=e.ui.keyCode,s=this.headers.length,n=this.headers.index(t.target),a=!1;switch(t.keyCode){case i.RIGHT:case i.DOWN:a=this.headers[(n+1)%s];break;case i.LEFT:case i.UP:a=this.headers[(n-1+s)%s];break;case i.SPACE:case i.ENTER:this._eventHandler(t);break;case i.HOME:a=this.headers[0];break;case i.END:a=this.headers[s-1]}a&&(e(t.target).attr("tabIndex",-1),e(a).attr("tabIndex",0),a.focus(),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===e.ui.keyCode.UP&&t.ctrlKey&&e(t.currentTarget).prev().focus()},refresh:function(){var t=this.options;this._processPanels(),t.active===!1&&t.collapsible===!0||!this.headers.length?(t.active=!1,this.active=e()):t.active===!1?this._activate(0):this.active.length&&!e.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=e()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){this.headers=this.element.find(this.options.header).addClass("ui-accordion-header ui-state-default ui-corner-all"),this.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").filter(":not(.ui-accordion-content-active)").hide()},_refresh:function(){var t,i=this.options,s=i.heightStyle,n=this.element.parent();this.active=this._findActive(i.active).addClass("ui-accordion-header-active ui-state-active ui-corner-top").removeClass("ui-corner-all"),this.active.next().addClass("ui-accordion-content-active").show(),this.headers.attr("role","tab").each(function(){var t=e(this),i=t.uniqueId().attr("id"),s=t.next(),n=s.uniqueId().attr("id");
+t.attr("aria-controls",n),s.attr("aria-labelledby",i)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(i.event),"fill"===s?(t=n.height(),this.element.siblings(":visible").each(function(){var i=e(this),s=i.css("position");"absolute"!==s&&"fixed"!==s&&(t-=i.outerHeight(!0))}),this.headers.each(function(){t-=e(this).outerHeight(!0)}),this.headers.next().each(function(){e(this).height(Math.max(0,t-e(this).innerHeight()+e(this).height()))}).css("overflow","auto")):"auto"===s&&(t=0,this.headers.next().each(function(){t=Math.max(t,e(this).css("height","").height())}).height(t))},_activate:function(t){var i=this._findActive(t)[0];i!==this.active[0]&&(i=i||this.active[0],this._eventHandler({target:i,currentTarget:i,preventDefault:e.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):e()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&e.each(t.split(" "),function(e,t){i[t]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var i=this.options,s=this.active,n=e(t.currentTarget),a=n[0]===s[0],o=a&&i.collapsible,r=o?e():n.next(),h=s.next(),l={oldHeader:s,oldPanel:h,newHeader:o?e():n,newPanel:r};t.preventDefault(),a&&!i.collapsible||this._trigger("beforeActivate",t,l)===!1||(i.active=o?!1:this.headers.index(n),this.active=a?e():n,this._toggle(l),s.removeClass("ui-accordion-header-active ui-state-active"),i.icons&&s.children(".ui-accordion-header-icon").removeClass(i.icons.activeHeader).addClass(i.icons.header),a||(n.removeClass("ui-corner-all").addClass("ui-accordion-header-active ui-state-active ui-corner-top"),i.icons&&n.children(".ui-accordion-header-icon").removeClass(i.icons.header).addClass(i.icons.activeHeader),n.next().addClass("ui-accordion-content-active")))},_toggle:function(t){var i=t.newPanel,s=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=i,this.prevHide=s,this.options.animate?this._animate(i,s,t):(s.hide(),i.show(),this._toggleComplete(t)),s.attr({"aria-hidden":"true"}),s.prev().attr("aria-selected","false"),i.length&&s.length?s.prev().attr({tabIndex:-1,"aria-expanded":"false"}):i.length&&this.headers.filter(function(){return 0===e(this).attr("tabIndex")}).attr("tabIndex",-1),i.attr("aria-hidden","false").prev().attr({"aria-selected":"true",tabIndex:0,"aria-expanded":"true"})},_animate:function(e,t,i){var s,n,a,o=this,r=0,h=e.length&&(!t.length||e.index()<t.index()),l=this.options.animate||{},u=h&&l.down||l,d=function(){o._toggleComplete(i)};return"number"==typeof u&&(a=u),"string"==typeof u&&(n=u),n=n||u.easing||l.easing,a=a||u.duration||l.duration,t.length?e.length?(s=e.show().outerHeight(),t.animate(this.hideProps,{duration:a,easing:n,step:function(e,t){t.now=Math.round(e)}}),e.hide().animate(this.showProps,{duration:a,easing:n,complete:d,step:function(e,i){i.now=Math.round(e),"height"!==i.prop?r+=i.now:"content"!==o.options.heightStyle&&(i.now=Math.round(s-t.outerHeight()-r),r=0)}}),void 0):t.animate(this.hideProps,a,n,d):e.animate(this.showProps,a,n,d)},_toggleComplete:function(e){var t=e.oldPanel;t.removeClass("ui-accordion-content-active").prev().removeClass("ui-corner-top").addClass("ui-corner-all"),t.length&&(t.parent()[0].className=t.parent()[0].className),this._trigger("activate",null,e)}}),e.widget("ui.menu",{version:"1.11.1",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},items:"> *",menus:"ul",position:{my:"left-1 top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.element.uniqueId().addClass("ui-menu ui-widget ui-widget-content").toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabIndex:0}),this.options.disabled&&this.element.addClass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item":function(e){e.preventDefault()},"click .ui-menu-item":function(t){var i=e(t.target);!this.mouseHandled&&i.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),i.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&e(this.document[0].activeElement).closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var i=e(t.currentTarget);i.siblings(".ui-state-active").removeClass("ui-state-active"),this.focus(t,i)},mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(e,t){var i=this.active||this.element.find(this.options.items).eq(0);t||this.focus(e,i)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeElement)||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(e){this._closeOnDocumentClick(e)&&this.collapseAll(e),this.mouseHandled=!1}})},_destroy:function(){this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeClass("ui-menu ui-widget ui-widget-content ui-menu-icons ui-front").removeAttr("role").removeAttr("tabIndex").removeAttr("aria-labelledby").removeAttr("aria-expanded").removeAttr("aria-hidden").removeAttr("aria-disabled").removeUniqueId().show(),this.element.find(".ui-menu-item").removeClass("ui-menu-item").removeAttr("role").removeAttr("aria-disabled").removeUniqueId().removeClass("ui-state-hover").removeAttr("tabIndex").removeAttr("role").removeAttr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeClass("ui-menu-divider ui-widget-content")},_keydown:function(t){function i(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var s,n,a,o,r,h=!0;switch(t.keyCode){case e.ui.keyCode.PAGE_UP:this.previousPage(t);break;case e.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case e.ui.keyCode.HOME:this._move("first","first",t);break;case e.ui.keyCode.END:this._move("last","last",t);break;case e.ui.keyCode.UP:this.previous(t);break;case e.ui.keyCode.DOWN:this.next(t);break;case e.ui.keyCode.LEFT:this.collapse(t);break;case e.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keyCode.ENTER:case e.ui.keyCode.SPACE:this._activate(t);break;case e.ui.keyCode.ESCAPE:this.collapse(t);break;default:h=!1,n=this.previousFilter||"",a=String.fromCharCode(t.keyCode),o=!1,clearTimeout(this.filterTimer),a===n?o=!0:a=n+a,r=RegExp("^"+i(a),"i"),s=this.activeMenu.find(this.options.items).filter(function(){return r.test(e(this).text())}),s=o&&-1!==s.index(this.active.next())?this.active.nextAll(".ui-menu-item"):s,s.length||(a=String.fromCharCode(t.keyCode),r=RegExp("^"+i(a),"i"),s=this.activeMenu.find(this.options.items).filter(function(){return r.test(e(this).text())})),s.length?(this.focus(t,s),s.length>1?(this.previousFilter=a,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter):delete this.previousFilter}h&&t.preventDefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.is("[aria-haspopup='true']")?this.expand(e):this.select(e))},refresh:function(){var t,i,s=this,n=this.options.icons.submenu,a=this.element.find(this.options.menus);this.element.toggleClass("ui-menu-icons",!!this.element.find(".ui-icon").length),a.filter(":not(.ui-menu)").addClass("ui-menu ui-widget ui-widget-content ui-front").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),i=t.parent(),s=e("<span>").addClass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);i.attr("aria-haspopup","true").prepend(s),t.attr("aria-labelledby",i.attr("id"))}),t=a.add(this.element),i=t.find(this.options.items),i.not(".ui-menu-item").each(function(){var t=e(this);s._isDivider(t)&&t.addClass("ui-widget-content ui-menu-divider")}),i.not(".ui-menu-item, .ui-menu-divider").addClass("ui-menu-item").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),i.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(e,t){"icons"===e&&this.element.find(".ui-menu-icon").removeClass(this.options.icons.submenu).addClass(t.submenu),"disabled"===e&&this.element.toggleClass("ui-state-disabled",!!t).attr("aria-disabled",t),this._super(e,t)},focus:function(e,t){var i,s;this.blur(e,e&&"focus"===e.type),this._scrollIntoView(t),this.active=t.first(),s=this.active.addClass("ui-state-focus").removeClass("ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",s.attr("id")),this.active.parent().closest(".ui-menu-item").addClass("ui-state-active"),e&&"keydown"===e.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),i=t.children(".ui-menu"),i.length&&e&&/^mouse/.test(e.type)&&this._startOpening(i),this.activeMenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollIntoView:function(t){var i,s,n,a,o,r;this._hasScroll()&&(i=parseFloat(e.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(e.css(this.activeMenu[0],"paddingTop"))||0,n=t.offset().top-this.activeMenu.off